summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-12-04 20:11:10 +0100
committerHaru <haru@dotalux.com>2013-12-04 21:00:48 +0100
commit43462caf9441a041755806a889cb6d5104dcf438 (patch)
treecf1e86d12b4c788238a7c3290a50cea76642f21c
parent48fdd76b45f6c37cc02a5f981d3591c951ddfb94 (diff)
downloadhercules-43462caf9441a041755806a889cb6d5104dcf438.tar.gz
hercules-43462caf9441a041755806a889cb6d5104dcf438.tar.bz2
hercules-43462caf9441a041755806a889cb6d5104dcf438.tar.xz
hercules-43462caf9441a041755806a889cb6d5104dcf438.zip
Follow-up to 6e9c385b8fa2fbca97ca23e35f0b8e5dabd13526
- Case-sensitive AegisName and Sprite ID lookups are now optional, controlled by the case_sensitive_aegisnames battle config flag (you can set it to "no" to restore the case insensitive behavior.) - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--conf/battle/misc.conf15
-rw-r--r--src/map/battle.c19
-rw-r--r--src/map/battle.h4
-rw-r--r--src/map/clif.c14
-rw-r--r--src/map/itemdb.c29
-rw-r--r--src/map/mob.c22
6 files changed, 76 insertions, 27 deletions
diff --git a/conf/battle/misc.conf b/conf/battle/misc.conf
index 41866056a..dd3d57aaa 100644
--- a/conf/battle/misc.conf
+++ b/conf/battle/misc.conf
@@ -120,3 +120,18 @@ mail_show_status: 0
// Is monster transformation disabled during Guild Wars?
// If set to yes, monster transforming is automatically removed/disabled when entering castles during WoE times
mon_trans_disable_in_gvg: no
+
+// Whether AegisName and SpriteName lookups are case sensitive
+// Default: yes (as in official servers)
+// When this is set to yes, item and monster lookups through atcommands and
+// script commands will match AegisNames and SpriteNames only when the case
+// matches. Display name lookups are not affected by this setting.
+// Example: Given the two items:
+// - { Id: 553, AegisName: "Bun", Name: "Bao" }
+// - { Id: 6115, AegisName: "Bun_", Name: "Bun" }
+// query when 'yes' when 'no'
+// @item bun # 6115 # 553
+// @item Bun # 553 # 553
+// @item Bao # 553 # 553
+// @item Bun_ # 6115 # 6115
+case_sensitive_aegisnames: yes
diff --git a/src/map/battle.c b/src/map/battle.c
index 38b516bd9..648e75bb3 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6458,7 +6458,7 @@ static const struct _battle_data {
{ "duel_time_interval", &battle_config.duel_time_interval, 60, 0, INT_MAX, },
{ "duel_only_on_same_map", &battle_config.duel_only_on_same_map, 0, 0, 1, },
{ "skip_teleport_lv1_menu", &battle_config.skip_teleport_lv1_menu, 0, 0, 1, },
- { "mob_max_skilllvl", &battle_config.mob_max_skilllvl, 100, 1, INT_MAX, },
+ { "mob_max_skilllvl", &battle_config.mob_max_skilllvl, 100, 1, INT_MAX, },
{ "allow_skill_without_day", &battle_config.allow_skill_without_day, 0, 0, 1, },
{ "allow_es_magic_player", &battle_config.allow_es_magic_pc, 0, 0, 1, },
{ "skill_caster_check", &battle_config.skill_caster_check, 1, 0, 1, },
@@ -6527,24 +6527,25 @@ static const struct _battle_data {
{ "atcommand_mobinfo_type", &battle_config.atcommand_mobinfo_type, 0, 0, 1 },
{ "homunculus_max_level", &battle_config.hom_max_level, 99, 0, MAX_LEVEL, },
{ "homunculus_S_max_level", &battle_config.hom_S_max_level, 150, 0, MAX_LEVEL, },
- { "mob_size_influence", &battle_config.mob_size_influence, 0, 0, 1, },
+ { "mob_size_influence", &battle_config.mob_size_influence, 0, 0, 1, },
/**
* Hercules
**/
{ "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, },
{ "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, },
- { "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, },
- { "item_enabled_npc", &battle_config.item_enabled_npc, 1, 0, 1, },
- { "gm_ignore_warpable_area", &battle_config.gm_ignore_warpable_area, 0, 2, 100, },
- { "packet_obfuscation", &battle_config.packet_obfuscation, 1, 0, 3, },
- { "client_accept_chatdori", &battle_config.client_accept_chatdori, 0, 0, INT_MAX, },
- { "snovice_call_type", &battle_config.snovice_call_type, 0, 0, 1, },
- { "guild_notice_changemap", &battle_config.guild_notice_changemap, 2, 0, 2, },
+ { "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, },
+ { "item_enabled_npc", &battle_config.item_enabled_npc, 1, 0, 1, },
+ { "gm_ignore_warpable_area", &battle_config.gm_ignore_warpable_area, 0, 2, 100, },
+ { "packet_obfuscation", &battle_config.packet_obfuscation, 1, 0, 3, },
+ { "client_accept_chatdori", &battle_config.client_accept_chatdori, 0, 0, INT_MAX, },
+ { "snovice_call_type", &battle_config.snovice_call_type, 0, 0, 1, },
+ { "guild_notice_changemap", &battle_config.guild_notice_changemap, 2, 0, 2, },
{ "feature.banking", &battle_config.feature_banking, 1, 0, 1, },
{ "feature.auction", &battle_config.feature_auction, 0, 0, 2, },
{ "idletime_criteria", &battle_config.idletime_criteria, 0x25, 1, INT_MAX, },
{ "mon_trans_disable_in_gvg", &battle_config.mon_trans_disable_in_gvg, 0, 0, 1, },
+ { "case_sensitive_aegisnames", &battle_config.case_sensitive_aegisnames, 1, 0, 1, },
};
#ifndef STATS_OPT_OUT
/**
diff --git a/src/map/battle.h b/src/map/battle.h
index 4d4508742..ed5e40988 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -444,7 +444,7 @@ struct Battle_Config {
int mvp_tomb_enabled;
int atcommand_suggestions_enabled;
- int min_npc_vendchat_distance;
+ int min_npc_vendchat_distance;
int atcommand_mobinfo_type;
int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95]
@@ -466,6 +466,8 @@ struct Battle_Config {
int feature_auction;
int mon_trans_disable_in_gvg;
+
+ int case_sensitive_aegisnames;
} battle_config;
/* criteria for battle_config.idletime_critera */
diff --git a/src/map/clif.c b/src/map/clif.c
index 1fcbb77bc..d8a3274a0 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -13524,7 +13524,12 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
if ( (count=itemdb->search_name_array(item_array, 10, item_monster_name, 1)) > 0 ){
for(i = 0; i < count; i++){
- if( item_array[i] && strcmp(item_array[i]->name, item_monster_name) == 0 )// It only accepts aegis name
+ if( !item_array[i] )
+ continue;
+ // It only accepts aegis name
+ if( battle_config.case_sensitive_aegisnames && strcmp(item_array[i]->name, item_monster_name) == 0 )
+ break;
+ if( !battle_config.case_sensitive_aegisnames && strcasecmp(item_array[i]->name, item_monster_name) == 0 )
break;
}
@@ -13546,7 +13551,12 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
if( (count=mob->db_searchname_array(mob_array, 10, item_monster_name, 1)) > 0){
for(i = 0; i < count; i++){
- if( mob_array[i] && strcmp(mob_array[i]->sprite, item_monster_name) == 0 ) // It only accepts sprite name
+ if( !mob_array[i] )
+ continue;
+ // It only accepts sprite name
+ if( battle_config.case_sensitive_aegisnames && strcmp(mob_array[i]->sprite, item_monster_name) == 0 )
+ break;
+ if( !battle_config.case_sensitive_aegisnames && strcasecmp(mob_array[i]->sprite, item_monster_name) == 0 )
break;
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 1f9e2c889..30f81c354 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -33,11 +33,13 @@ int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap)
str=va_arg(ap,char *);
dst=va_arg(ap,struct item_data **);
dst2=va_arg(ap,struct item_data **);
- if(item == &itemdb->dummy) return 0;
+ if (item == &itemdb->dummy) return 0;
//Absolute priority to Aegis code name.
if (*dst != NULL) return 0;
- if( strcmp(item->name,str)==0 ) // Case sensitive
+ if ( battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0 )
+ *dst=item;
+ else if ( !battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0 )
*dst=item;
//Second priority to Client displayed name.
@@ -61,7 +63,9 @@ struct item_data* itemdb_searchname(const char *str) {
continue;
// Absolute priority to Aegis code name.
- if( strcmp(item->name,str) == 0 ) // Case sensitive
+ if ( battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0 )
+ return item;
+ else if ( !battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0 )
return item;
//Second priority to Client displayed name.
@@ -90,7 +94,9 @@ int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap)
return 1; //Invalid item.
if(stristr(item->jname,str))
return 0;
- if(stristr(item->name,str))
+ if(battle_config.case_sensitive_aegisnames && strstr(item->name,str))
+ return 0;
+ if(!battle_config.case_sensitive_aegisnames && stristr(item->name,str))
return 0;
return strcmpi(item->jname,str);
}
@@ -113,9 +119,18 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str,
if( item == NULL )
continue;
- if( (!flag && (stristr(item->jname,str) || stristr(item->name,str))) ||
- (flag && (strcmp(item->jname,str) == 0 || strcmp(item->name,str) == 0)) )
- {
+ if(
+ (!flag
+ && (stristr(item->jname,str)
+ || (battle_config.case_sensitive_aegisnames && strstr(item->name,str))
+ || (!battle_config.case_sensitive_aegisnames && stristr(item->name,str))
+ ))
+ || (flag
+ && (strcmp(item->jname,str) == 0
+ || (battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0)
+ || (!battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0)
+ ))
+ ) {
if( count < size )
data[count] = item;
++count;
diff --git a/src/map/mob.c b/src/map/mob.c
index 92fa98885..8bb0ebe65 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -95,7 +95,11 @@ int mobdb_searchname(const char *str)
monster = mob->db(i);
if(monster == mob->dummy) //Skip dummy mobs.
continue;
- if(strcmpi(monster->name,str)==0 || strcmpi(monster->jname,str)==0 || strcmp(monster->sprite,str)==0) // Sprite name case sensitive
+ if(strcmpi(monster->name,str)==0 || strcmpi(monster->jname,str)==0)
+ return i;
+ if(battle_config.case_sensitive_aegisnames && strcmp(monster->sprite,str)==0)
+ return i;
+ if(!battle_config.case_sensitive_aegisnames && strcasecmp(monster->sprite,str)==0)
return i;
}
@@ -106,18 +110,20 @@ int mobdb_searchname_array_sub(struct mob_db* monster, const char *str, int flag
return 1;
if(!monster->base_exp && !monster->job_exp && monster->spawn[0].qty < 1)
return 1; // Monsters with no base/job exp and no spawn point are, by this criteria, considered "slave mobs" and excluded from search results
- if( !flag ){
+ if( !flag ) {
if(stristr(monster->jname,str))
return 0;
if(stristr(monster->name,str))
return 0;
- return strcmpi(monster->jname,str);
+ } else {
+ if(strcmpi(monster->jname,str) == 0)
+ return 0;
+ if(strcmpi(monster->name,str) == 0)
+ return 0;
}
- if(strcmpi(monster->jname,str) == 0)
- return 0;
- if(strcmpi(monster->name,str) == 0)
- return 0;
- return strcmp(monster->sprite,str);
+ if (battle_config.case_sensitive_aegisnames)
+ return strcmp(monster->sprite,str);
+ return strcasecmp(monster->sprite,str);
}
/*==========================================