diff options
-rw-r--r-- | conf/inter-server.conf | 26 | ||||
-rw-r--r-- | conf/messages.conf | 4 | ||||
-rw-r--r-- | doc/script_commands.txt | 52 | ||||
-rw-r--r-- | src/char/char.c | 4 | ||||
-rw-r--r-- | src/char/char.h | 4 | ||||
-rw-r--r-- | src/common/console.c | 25 | ||||
-rw-r--r-- | src/map/battle.c | 13 | ||||
-rw-r--r-- | src/map/clif.c | 3 | ||||
-rw-r--r-- | src/map/instance.c | 4 | ||||
-rw-r--r-- | src/map/itemdb.c | 171 | ||||
-rw-r--r-- | src/map/itemdb.h | 3 | ||||
-rw-r--r-- | src/map/map.c | 62 | ||||
-rw-r--r-- | src/map/map.h | 10 | ||||
-rw-r--r-- | src/map/mob.c | 61 | ||||
-rw-r--r-- | src/map/mob.h | 1 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 3 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 81 | ||||
-rw-r--r-- | src/plugins/db2sql.c | 11 |
20 files changed, 79 insertions, 473 deletions
diff --git a/conf/inter-server.conf b/conf/inter-server.conf index c3ad8d676..704d5fc12 100644 --- a/conf/inter-server.conf +++ b/conf/inter-server.conf @@ -117,35 +117,9 @@ char_reg_str_db: char_reg_str_db char_reg_num_db: char_reg_num_db // Map Database Tables -item_db_db: item_db -item_db2_db: item_db2 -mob_db_db: mob_db -mob_db2_db: mob_db2 -mob_skill_db_db: mob_skill_db -mob_skill_db2_db: mob_skill_db2 mapreg_db: mapreg autotrade_merchants_db: autotrade_merchants autotrade_data_db: autotrade_data npc_market_data_db: npc_market_data -// == SQL item, mob, mob skill databases -// ===================================== -// Note: the following databases may get out of date at times, or not be -// thoroughly tested (if at all, since they're auto-generated). As such it is -// not advisable to rely on them other than for informative reasons (Control -// Panels, websites, etc.) -// Unless you know what you're doing, please consider using their txt version. -// Note2: It is perfectly legit (and recommended) to use txt databases in -// Hercules, while still loading the SQL tables we provide to be used -// exclusively by your Control Panel or Website. - -// Use SQL for item_db? (deprecated) -//use_sql_item_db: no - -// Use SQL for mob_db? (deprecated) -//use_sql_mob_db: no - -// Use SQL for mob_skill_db? (deprecated) -//use_sql_mob_skill_db: no - import: conf/import/inter_conf.txt diff --git a/conf/messages.conf b/conf/messages.conf index 2b5f8eb63..f4098ae30 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -1235,7 +1235,8 @@ // @mobinfo ... 1291: ATK:%d~%d MATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Element: %s (Lv:%d) -//1292-1294 FREE +//1292-1293 FREE +//1294 used by hercules chat feature // @version 1295: %s revision '%s' (src) / '%s' (scripts) @@ -1416,6 +1417,7 @@ 1402: You're not in that channel, type '@join <#channel_name>' 1435: You're now in the '#%s' channel for '%s' 1436: You're already in the '%s' channel +1294: You're not allowed to talk on this channel // @channel 1404: %s failed diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 146e58a45..546122475 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4457,6 +4457,14 @@ they will also have their skills reset upon 'changesex'. --------------------------------------- +*changecharsex; + +This command is exactly same as changesex, with an exception that, +character sex will be changed instead of account sex. +Requires client 2014-10-22 or greater. + +--------------------------------------- + *getexp <base xp>,<job xp>; This command will give the invoking character a specified number of base @@ -4985,8 +4993,8 @@ Returns the item_id of a random item picked from the item container specified. T are different item containers and they are specified in 'db/(pre-)re/item_group.conf'. Example: - getitem groupranditem 603,1; - getitem groupranditem Old_Blue_Box,1; + getitem groupranditem(603),1; + getitem groupranditem(Old_Blue_Box),1; --------------------------------------- @@ -6499,8 +6507,8 @@ Example 4: --------------------------------------- -*sleep {<milliseconds>}; -*sleep2 {<milliseconds>}; +*sleep <milliseconds>; +*sleep2 <milliseconds>; *awake "<NPC name>"; These commands are used to control the pause of a NPC. @@ -8793,18 +8801,48 @@ following: ---------------------------------------- -*bg_getareausers(<battle group>,<map name>,<x0>,<y0>,<x1>,<y1>); +*bg_getareausers(<battle group>,"<map_name>",<x0>,<y0>,<x1>,<y1>); Retrieves amount of players belonging to given battle group on given map within an specified rectangular area. ---------------------------------------- -*bg_updatescore "<mapname>",<Guillaume Score>,<Croix Score>; +*bg_updatescore "<map_name>",<Guillaume Score>,<Croix Score>; This command will force the update of the displayed scoreboard. It is only usable when the map is defined as a Type 2 Battleground: -mapflag%TAB%<mapname>%TAB%battleground%TAB%2 +mapflag%TAB%<map_name>%TAB%battleground%TAB%2 + +---------------------------------------- + +*bg_create_team "<map_name>",<Respawn X>,<Respawn Y>; + +This command will create a new BG Team. +When player dies, they will be respawned map_name,X,Y as mentioned. + +Command will return -1 if BG Creation is failed, +else it will return the BG ID(Also known as TeamID). + +---------------------------------------- + +*bg_join_team <Team_ID>{,<account_id>}; + +This command will make the attached player join to Team with ID as mentioned. +If account_id is provided, command will look for that player, instead of the attached player. + +Command will return -1 if Player is not found, 0 if join is failed, 1 upon successful. + +---------------------------------------- + +*bg_match_over "<Arena Name>"{,<Cancelled>}; + +This command will end the battleground Arena +(Arena Name as referred to, in conf/battlegrounds.conf) +If Cancelled is not provided, it will set the join delay, as mentioned in conf/battlegrounds.conf +else, it will just destroy the Teams and queue's. + +Command will return 0 when successful, else it will return 1. --------------------------------------- //===================================== diff --git a/src/char/char.c b/src/char/char.c index 7cc6aa91a..41b13b3db 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -94,10 +94,6 @@ int save_log = 1; char db_path[1024] = "db"; -int db_use_sql_item_db; -int db_use_sql_mob_db; -int db_use_sql_mob_skill_db; - char wisp_server_name[NAME_LENGTH] = "Server"; char login_ip_str[128]; uint32 login_ip = 0; diff --git a/src/char/char.h b/src/char/char.h index fe6c0b9da..7576b00ce 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -298,10 +298,6 @@ extern char acc_reg_str_db[32]; extern char char_reg_str_db[32]; extern char char_reg_num_db[32]; -extern int db_use_sql_item_db; -extern int db_use_sql_mob_db; -extern int db_use_sql_mob_skill_db; - extern int guild_exp_rate; extern int log_inter; diff --git a/src/common/console.c b/src/common/console.c index f4f18b799..477141b48 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -362,7 +362,6 @@ void console_parse_sub(char *line) char *tok; char sublist[CP_CMD_LENGTH * 5]; int i; - unsigned int len = 0; memcpy(bline, line, 200); tok = strtok(line, " "); @@ -375,19 +374,15 @@ void console_parse_sub(char *line) cmd = VECTOR_INDEX(console->input->command_list, i); - len += snprintf(sublist,CP_CMD_LENGTH * 5,"%s", cmd->cmd); + snprintf(sublist, sizeof(sublist), "%s", cmd->cmd); if (cmd->type == CPET_FUNCTION) { - char *r = NULL; - if( (tok = strtok(NULL, " ")) ) { - r = bline; - r += len + 1; - } - cmd->u.func(r); + tok = strtok(NULL, ""); + cmd->u.func(tok); return; } - while (( tok = strtok(NULL, " ") ) != NULL) { + while ((tok = strtok(NULL, " ")) != NULL) { struct CParseEntry *entry = NULL; Assert_retv(cmd->type == CPET_CATEGORY); @@ -409,17 +404,15 @@ void console_parse_sub(char *line) } entry = VECTOR_INDEX(cmd->u.children, i); if (entry->type == CPET_FUNCTION) { - char *r = NULL; - if ((tok = strtok(NULL, " "))) { - r = bline; - r += len + strlen(entry->cmd) + 1; - } - entry->u.func(r); + tok = strtok(NULL, ""); + entry->u.func(tok); return; } cmd = entry; - len += snprintf(sublist + len,(CP_CMD_LENGTH * 5) - len," %s", cmd->cmd); + + if (strlen(sublist) < sizeof(sublist)-1) + snprintf(sublist+strlen(sublist), sizeof(sublist), " %s", cmd->cmd); } ShowError("Is only a category, type '"CL_WHITE"%s help"CL_RESET"' to list its subcommands\n",sublist); } diff --git a/src/map/battle.c b/src/map/battle.c index 1f9d75a64..be508dae0 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7157,14 +7157,14 @@ void Hercules_report(char* date, char *time_c) { C_RENEWAL_EDP = 0x0400, C_RENEWAL_ASPD = 0x0800, C_SECURE_NPCTIMEOUT = 0x1000, - C_SQL_DB_ITEM = 0x2000, + //C_SQL_DB_ITEM = 0x2000, C_SQL_LOGS = 0x4000, C_MEMWATCH = 0x8000, C_DMALLOC = 0x10000, C_GCOLLECT = 0x20000, C_SEND_SHORTLIST = 0x40000, - C_SQL_DB_MOB = 0x80000, - C_SQL_DB_MOBSKILL = 0x100000, + //C_SQL_DB_MOB = 0x80000, + //C_SQL_DB_MOBSKILL = 0x100000, C_PACKETVER_RE = 0x200000, }; @@ -7229,13 +7229,6 @@ void Hercules_report(char* date, char *time_c) { #endif /* non-define part */ - if( map->db_use_sql_item_db ) - config |= C_SQL_DB_ITEM; - if( map->db_use_sql_mob_db ) - config |= C_SQL_DB_MOB; - if( map->db_use_sql_mob_skill_db ) - config |= C_SQL_DB_MOBSKILL; - if( logs->config.sql_logs ) config |= C_SQL_LOGS; diff --git a/src/map/clif.c b/src/map/clif.c index 124288635..95ad088e5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10130,6 +10130,9 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) clif->message(fd, msg_fd(fd,1402)); } return; + } else if (strcmpi(&chname[1], channel->config->ally_name) == 0) { + clif->message(fd, msg_fd(fd,1294)); // You're not allowed to talk on this channel + return; } } diff --git a/src/map/instance.c b/src/map/instance.c index 545ffe1e7..45e407dfc 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -94,9 +94,9 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ } if( type != IOT_NONE && *icptr ) { - ARR_FIND(0, *icptr, i, strcmp(instance->list[iptr[i]].name,name) == 0 ); + ARR_FIND(0, *icptr, i, iptr[i] != -1 && strcmp(instance->list[iptr[i]].name, name) == 0 ); if( i != *icptr ) - return -4;/* already got this instance */ + return -4; /* already got this instance */ } ARR_FIND(0, instance->instances, i, instance->list[i].state == INSTANCE_FREE); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 3afb10bec..efa9b18e5 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1502,112 +1502,8 @@ void itemdb_readdb_additional_fields(int itemid, config_setting_t *it, int n, co } /** - * Processes one itemdb entry from the sql backend, loading and inserting it - * into the item database. - * - * @param *handle MySQL connection handle. It is expected to have data - * available (i.e. already queried) and it won't be freed (it - * is care of the caller to do so) - * @param n Ordinal number of the entry, to be displayed in case of - * validation errors. - * @param *source Source of the entry (table name), to be displayed in case of - * validation errors. - * @return Nameid of the validated entry, or 0 in case of failure. - */ -int itemdb_readdb_sql_sub(Sql *handle, int n, const char *source) { - struct item_data id = { 0 }; - char *data = NULL; - - /* - * `id` smallint(5) unsigned NOT NULL DEFAULT '0' - * `name_english` varchar(50) NOT NULL DEFAULT '' - * `name_japanese` varchar(50) NOT NULL DEFAULT '' - * `type` tinyint(2) unsigned NOT NULL DEFAULT '0' - * `price_buy` mediumint(10) DEFAULT NULL - * `price_sell` mediumint(10) DEFAULT NULL - * `weight` smallint(5) unsigned DEFAULT NULL - * `atk` smallint(5) unsigned DEFAULT NULL - * `matk` smallint(5) unsigned DEFAULT NULL - * `defence` smallint(5) unsigned DEFAULT NULL - * `range` tinyint(2) unsigned DEFAULT NULL - * `slots` tinyint(2) unsigned DEFAULT NULL - * `equip_jobs` int(12) unsigned DEFAULT NULL - * `equip_upper` tinyint(8) unsigned DEFAULT NULL - * `equip_genders` tinyint(2) unsigned DEFAULT NULL - * `equip_locations` smallint(4) unsigned DEFAULT NULL - * `weapon_level` tinyint(2) unsigned DEFAULT NULL - * `equip_level_min` smallint(5) unsigned DEFAULT NULL - * `equip_level_max` smallint(5) unsigned DEFAULT NULL - * `refineable` tinyint(1) unsigned DEFAULT NULL - * `view` smallint(3) unsigned DEFAULT NULL - * `bindonequip` tinyint(1) unsigned DEFAULT NULL - * `buyingstore` tinyint(1) NOT NULL DEFAULT NULL - * `delay` mediumint(9) NOT NULL DEFAULT NULL - * `trade_flag` smallint(4) NOT NULL DEFAULT NULL - * `trade_group` smallint(4) NOT NULL DEFAULT NULL - * `nouse_flag` smallint(4) NOT NULL DEFAULT NULL - * `nouse_group` smallint(4) NOT NULL DEFAULT NULL - * `stack_amount` mediumint(6) NOT NULL DEFAULT NULL - * `stack_flag` smallint(2) NOT NULL DEFAULT NULL - * `sprite` mediumint(6) NOT NULL DEFAULT NULL - * `script` text - * `equip_script` text - * `unequip_script` text - */ - SQL->GetData(handle, 0, &data, NULL); id.nameid = (uint16)atoi(data); - SQL->GetData(handle, 1, &data, NULL); safestrncpy(id.name, data, sizeof(id.name)); - SQL->GetData(handle, 2, &data, NULL); safestrncpy(id.jname, data, sizeof(id.jname)); - SQL->GetData(handle, 3, &data, NULL); id.type = atoi(data); - SQL->GetData(handle, 4, &data, NULL); id.value_buy = data ? atoi(data) : -1; // Using invalid price -1 when missing, it'll be validated later - SQL->GetData(handle, 5, &data, NULL); id.value_sell = data ? atoi(data) : -1; - SQL->GetData(handle, 6, &data, NULL); id.weight = data ? atoi(data) : 0; - SQL->GetData(handle, 7, &data, NULL); id.atk = data ? atoi(data) : 0; - SQL->GetData(handle, 8, &data, NULL); id.matk = data ? atoi(data) : 0; - SQL->GetData(handle, 9, &data, NULL); id.def = data ? atoi(data) : 0; - SQL->GetData(handle, 10, &data, NULL); id.range = data ? atoi(data) : 0; - SQL->GetData(handle, 11, &data, NULL); id.slot = data ? atoi(data) : 0; - SQL->GetData(handle, 12, &data, NULL); itemdb->jobid2mapid(id.class_base, data ? (unsigned int)strtoul(data,NULL,0) : UINT_MAX); - SQL->GetData(handle, 13, &data, NULL); id.class_upper = data ? (unsigned int)atoi(data) : ITEMUPPER_ALL; - SQL->GetData(handle, 14, &data, NULL); id.sex = data ? atoi(data) : 2; - SQL->GetData(handle, 15, &data, NULL); id.equip = data ? atoi(data) : 0; - SQL->GetData(handle, 16, &data, NULL); id.wlv = data ? atoi(data) : 0; - SQL->GetData(handle, 17, &data, NULL); id.elv = data ? atoi(data) : 0; - SQL->GetData(handle, 18, &data, NULL); id.elvmax = data ? atoi(data) : 0; - SQL->GetData(handle, 19, &data, NULL); id.flag.no_refine = data && atoi(data) ? 0 : 1; - SQL->GetData(handle, 20, &data, NULL); id.look = data ? atoi(data) : 0; - SQL->GetData(handle, 21, &data, NULL); id.flag.bindonequip = data && atoi(data) ? 1 : 0; - SQL->GetData(handle, 22, &data, NULL); id.flag.force_serial = data && atoi(data) ? 1 : 0; - SQL->GetData(handle, 23, &data, NULL); id.flag.buyingstore = data && atoi(data) ? 1 : 0; - SQL->GetData(handle, 24, &data, NULL); id.delay = data ? atoi(data) : 0; - SQL->GetData(handle, 25, &data, NULL); id.flag.trade_restriction = data ? atoi(data) : ITR_NONE; - SQL->GetData(handle, 26, &data, NULL); id.gm_lv_trade_override = data ? atoi(data) : 0; - SQL->GetData(handle, 27, &data, NULL); id.item_usage.flag = data ? atoi(data) : INR_NONE; - SQL->GetData(handle, 28, &data, NULL); id.item_usage.override = data ? atoi(data) : 0; - SQL->GetData(handle, 29, &data, NULL); id.stack.amount = data ? atoi(data) : 0; - SQL->GetData(handle, 30, &data, NULL); - if (data) { - int stack_flag = atoi(data); - id.stack.inventory = (stack_flag&1)!=0; - id.stack.cart = (stack_flag&2)!=0; - id.stack.storage = (stack_flag&4)!=0; - id.stack.guildstorage = (stack_flag&8)!=0; - } - SQL->GetData(handle, 31, &data, NULL); - if (data) { - id.view_id = atoi(data); - if (id.view_id) - id.flag.available = 1; - } - SQL->GetData(handle, 32, &data, NULL); id.script = data && *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL; - SQL->GetData(handle, 33, &data, NULL); id.equip_script = data && *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL; - SQL->GetData(handle, 34, &data, NULL); id.unequip_script = data && *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL; - - return itemdb->validate_entry(&id, n, source); -} - -/** - * Processes one itemdb entry from the sql backend, loading and inserting it - * into the item database. + * Processes one itemdb entry from the libconfig backend, loading and inserting + * it into the item database. * * @param *it Libconfig setting entry. It is expected to be valid and it * won't be freed (it is care of the caller to do so if @@ -1974,45 +1870,6 @@ int itemdb_readdb_libconfig(const char *filename) { return count; } -/** - * Reads from a sql itemdb table and inserts the found entries into the item - * database, overwriting duplicate ones (i.e. item_db2 overriding item_db.) - * - * @param *tablename Table name to query. - * @return The number of found entries. - */ -int itemdb_readdb_sql(const char *tablename) { - int i = 0, count = 0; - - // retrieve all rows from the item database - if( SQL_ERROR == SQL->Query(map->mysql_handle, "SELECT `id`, `name_english`, `name_japanese`, `type`," - " `price_buy`, `price_sell`, `weight`, `atk`," - " `matk`, `defence`, `range`, `slots`," - " `equip_jobs`, `equip_upper`, `equip_genders`, `equip_locations`," - " `weapon_level`, `equip_level_min`, `equip_level_max`, `refineable`," - " `view`, `bindonequip`, `forceserial`, `buyingstore`, `delay`," - " `trade_flag`, `trade_group`, `nouse_flag`, `nouse_group`," - " `stack_amount`, `stack_flag`, `sprite`, `script`," - " `equip_script`, `unequip_script`" - "FROM `%s`", tablename) ) { - Sql_ShowDebug(map->mysql_handle); - return 0; - } - - // process rows one by one - while( SQL_SUCCESS == SQL->NextRow(map->mysql_handle) ) { - if( itemdb->readdb_sql_sub(map->mysql_handle, i++, tablename) ) - count++; - } - - // free the query result - SQL->FreeResult(map->mysql_handle); - - ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, tablename); - - return count; -} - /*========================================== * Unique item ID function * Only one operation by once @@ -2029,22 +1886,12 @@ void itemdb_read(bool minimal) { int i; DBData prev; - if (map->db_use_sql_item_db) { - const char* item_db_name[] = { - map->item_db_db, - map->item_db2_db - }; - for(i = 0; i < ARRAYLENGTH(item_db_name); i++) - itemdb->readdb_sql(item_db_name[i]); - } else { - const char* filename[] = { - DBPATH"item_db.conf", - "item_db2.conf", - }; - - for(i = 0; i < ARRAYLENGTH(filename); i++) - itemdb->readdb_libconfig(filename[i]); - } + const char *filename[] = { + DBPATH"item_db.conf", + "item_db2.conf", + }; + for (i = 0; i < ARRAYLENGTH(filename); i++) + itemdb->readdb_libconfig(filename[i]); for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) { if( itemdb->array[i] ) { @@ -2359,10 +2206,8 @@ void itemdb_defaults(void) { itemdb->gendercheck = itemdb_gendercheck; itemdb->validate_entry = itemdb_validate_entry; itemdb->readdb_additional_fields = itemdb_readdb_additional_fields; - itemdb->readdb_sql_sub = itemdb_readdb_sql_sub; itemdb->readdb_libconfig_sub = itemdb_readdb_libconfig_sub; itemdb->readdb_libconfig = itemdb_readdb_libconfig; - itemdb->readdb_sql = itemdb_readdb_sql; itemdb->unique_id = itemdb_unique_id; itemdb->read = itemdb_read; itemdb->destroy_item_data = destroy_item_data; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 64b800b87..7b35e1ae1 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -10,7 +10,6 @@ #include "common/conf.h" #include "common/db.h" #include "common/mmo.h" // ITEM_NAME_LENGTH -#include "common/sql.h" struct script_code; struct hplugin_data_store; @@ -602,10 +601,8 @@ struct itemdb_interface { int (*gendercheck) (struct item_data *id); int (*validate_entry) (struct item_data *entry, int n, const char *source); void (*readdb_additional_fields) (int itemid, config_setting_t *it, int n, const char *source); - int (*readdb_sql_sub) (Sql *handle, int n, const char *source); int (*readdb_libconfig_sub) (config_setting_t *it, int n, const char *source); int (*readdb_libconfig) (const char *filename); - int (*readdb_sql) (const char *tablename); uint64 (*unique_id) (struct map_session_data *sd); void (*read) (bool minimal); void (*destroy_item_data) (struct item_data *self, int free_self); diff --git a/src/map/map.c b/src/map/map.c index 9a7cbe163..cd2ba17c2 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3702,21 +3702,8 @@ int inter_config_read(char *cfgName) { if (sscanf(line,"%1023[^:]: %1023[^\r\n]", w1, w2) < 2) continue; - /* table names */ - if(strcmpi(w1,"item_db_db")==0) - safestrncpy(map->item_db_db, w2, sizeof(map->item_db_db)); - else if(strcmpi(w1,"mob_db_db")==0) - safestrncpy(map->mob_db_db, w2, sizeof(map->mob_db_db)); - else if(strcmpi(w1,"item_db2_db")==0) - safestrncpy(map->item_db2_db, w2, sizeof(map->item_db2_db)); - else if(strcmpi(w1,"mob_db2_db")==0) - safestrncpy(map->mob_db2_db, w2, sizeof(map->mob_db2_db)); - else if(strcmpi(w1, "mob_skill_db_db") == 0) - safestrncpy(map->mob_skill_db_db, w2, sizeof(map->mob_skill_db_db)); - else if(strcmpi(w1,"mob_skill_db2_db")==0) - safestrncpy(map->mob_skill_db2_db, w2, sizeof(map->mob_skill_db2_db)); /* map sql stuff */ - else if(strcmpi(w1,"map_server_ip")==0) + if(strcmpi(w1,"map_server_ip")==0) safestrncpy(map->server_ip, w2, sizeof(map->server_ip)); else if(strcmpi(w1,"map_server_port")==0) map->server_port=atoi(w2); @@ -3728,42 +3715,6 @@ int inter_config_read(char *cfgName) { safestrncpy(map->server_db, w2, sizeof(map->server_db)); else if(strcmpi(w1,"default_codepage")==0) safestrncpy(map->default_codepage, w2, sizeof(map->default_codepage)); - else if(strcmpi(w1,"use_sql_item_db")==0) { - map->db_use_sql_item_db = config_switch(w2); - ShowStatus ("Using item database as SQL: '%s'\n", w2); - if (map->db_use_sql_item_db) { - // Deprecated 2015-08-09 [Haru] - ShowWarning("Support for the SQL item database is deprecated and it will removed in future versions. " - "Please upgrade to the non-sql version as soon as possible. " - "Bug reports or pull requests concerning the SQL item database are no longer accepted.\n"); - ShowInfo("Resuming in 10 seconds...\n"); - HSleep(10); - } - } - else if(strcmpi(w1,"use_sql_mob_db")==0) { - map->db_use_sql_mob_db = config_switch(w2); - ShowStatus ("Using monster database as SQL: '%s'\n", w2); - if (map->db_use_sql_mob_db) { - // Deprecated 2015-08-09 [Haru] - ShowWarning("Support for the SQL monster database is deprecated and it will removed in future versions. " - "Please upgrade to the non-sql version as soon as possible. " - "Bug reports or pull requests concerning the SQL monster database are no longer accepted.\n"); - ShowInfo("Resuming in 10 seconds...\n"); - HSleep(10); - } - } - else if(strcmpi(w1,"use_sql_mob_skill_db")==0) { - map->db_use_sql_mob_skill_db = config_switch(w2); - ShowStatus ("Using monster skill database as SQL: '%s'\n", w2); - if (map->db_use_sql_mob_skill_db) { - // Deprecated 2015-08-09 [Haru] - ShowWarning("Support for the SQL monster skill database is deprecated and it will removed in future versions. " - "Please upgrade to the non-sql version as soon as possible. " - "Bug reports or pull requests concerning the SQL monster skill database are no longer accepted.\n"); - ShowInfo("Resuming in 10 seconds...\n"); - HSleep(10); - } - } else if(strcmpi(w1,"autotrade_merchants_db")==0) safestrncpy(map->autotrade_merchants_db, w2, sizeof(map->autotrade_merchants_db)); else if(strcmpi(w1,"autotrade_data_db")==0) @@ -6019,17 +5970,6 @@ void map_defaults(void) { map->night_flag = 0; // 0=day, 1=night [Yor] map->enable_spy = 0; //To enable/disable @spy commands, which consume too much cpu time when sending packets. [Skotlex] - map->db_use_sql_item_db = 0; - map->db_use_sql_mob_db = 0; - map->db_use_sql_mob_skill_db = 0; - - sprintf(map->item_db_db, "item_db"); - sprintf(map->item_db2_db, "item_db2"); - sprintf(map->mob_db_db, "mob_db"); - sprintf(map->mob_db2_db, "mob_db2"); - sprintf(map->mob_skill_db_db, "mob_skill_db"); - sprintf(map->mob_skill_db2_db, "mob_skill_db2"); - map->INTER_CONF_NAME="conf/inter-server.conf"; map->LOG_CONF_NAME="conf/logs.conf"; map->MAP_CONF_NAME = "conf/map-server.conf"; diff --git a/src/map/map.h b/src/map/map.h index 961a45793..974fbc4ba 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -858,16 +858,6 @@ struct map_interface { char *MSG_CONF_NAME; char *GRF_PATH_FILENAME; - int db_use_sql_item_db; - int db_use_sql_mob_db; - int db_use_sql_mob_skill_db; - - char item_db_db[32]; - char item_db2_db[32]; - char mob_db_db[32]; - char mob_db2_db[32]; - char mob_skill_db_db[32]; - char mob_skill_db2_db[32]; char autotrade_merchants_db[32]; char autotrade_data_db[32]; char npc_market_data_db[32]; diff --git a/src/map/mob.c b/src/map/mob.c index 94d68df88..2b519462d 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4261,7 +4261,6 @@ void mob_readdb(void) { mob->name_constants(); } - int mob_read_libconfig(const char *filename, bool ignore_missing) { config_t mob_db_conf; @@ -4809,59 +4808,6 @@ void mob_readskilldb(void) { } } -/** - * mob_skill_db table reading [CalciumKid] - * not overly sure if this is all correct - * seems to work though... - */ -int mob_read_sqlskilldb(void) { - const char* mob_skill_db_name[] = { - map->mob_skill_db_db, - map->mob_skill_db2_db - }; - int fi; - - if( battle_config.mob_skill_rate == 0 ) { - ShowStatus("Mob skill use disabled. Not reading mob skills.\n"); - return 0; - } - - for( fi = 0; fi < ARRAYLENGTH(mob_skill_db_name); ++fi ) { - uint32 lines = 0, count = 0; - - // retrieve all rows from the mob skill database - if( SQL_ERROR == SQL->Query(map->mysql_handle, "SELECT * FROM `%s`", mob_skill_db_name[fi]) ) { - Sql_ShowDebug(map->mysql_handle); - continue; - } - - // process rows one by one - while( SQL_SUCCESS == SQL->NextRow(map->mysql_handle) ) { - // wrap the result into a TXT-compatible format - char* str[19]; - char* dummy = ""; - int i; - ++lines; - for( i = 0; i < 19; ++i ) - { - SQL->GetData(map->mysql_handle, i, &str[i], NULL); - if( str[i] == NULL ) str[i] = dummy; // get rid of NULL columns - } - - if (!mob->parse_row_mobskilldb(str, 19, count)) - continue; - - count++; - } - - // free the query result - SQL->FreeResult(map->mysql_handle); - - ShowStatus("Done reading '"CL_WHITE"%"PRIu32""CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mob_skill_db_name[fi]); - } - return 0; -} - /*========================================== * mob_race2_db.txt reading *------------------------------------------*/ @@ -4925,11 +4871,7 @@ void mob_load(bool minimal) { sv->readdb(map->db_path, "mob_item_ratio.txt", ',', 2, 2+MAX_ITEMRATIO_MOBS, -1, mob->readdb_itemratio); // must be read before mobdb mob->readchatdb(); mob->readdb(); - if (map->db_use_sql_mob_skill_db) { - mob->read_sqlskilldb(); - } else { - mob->readskilldb(); - } + mob->readskilldb(); sv->readdb(map->db_path, "mob_avail.txt", ',', 2, 12, -1, mob->readdb_mobavail); mob->read_randommonster(); sv->readdb(map->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, mob->readdb_race2); @@ -5155,7 +5097,6 @@ void mob_defaults(void) { mob->readchatdb = mob_readchatdb; mob->parse_row_mobskilldb = mob_parse_row_mobskilldb; mob->readskilldb = mob_readskilldb; - mob->read_sqlskilldb = mob_read_sqlskilldb; mob->readdb_race2 = mob_readdb_race2; mob->readdb_itemratio = mob_readdb_itemratio; mob->load = mob_load; diff --git a/src/map/mob.h b/src/map/mob.h index cc81c2fc3..f7e071261 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -380,7 +380,6 @@ struct mob_interface { void (*readchatdb) (void); bool (*parse_row_mobskilldb) (char **str, int columns, int current); void (*readskilldb) (void); - int (*read_sqlskilldb) (void); bool (*readdb_race2) (char *fields[], int columns, int current); bool (*readdb_itemratio) (char *str[], int columns, int current); void (*load) (bool minimal); diff --git a/src/map/script.c b/src/map/script.c index 006daf7b9..54d8d338d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -19208,7 +19208,7 @@ BUILDIN(bg_join_team) { sd = script->rid2sd(st); if( !sd ) - script_pushint(st, 1); + script_pushint(st, -1); else script_pushint(st,bg->team_join(team_id, sd)?0:1); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b7973cd59..258fc0512 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2689,14 +2689,10 @@ struct { struct HPMHookPoint *HP_itemdb_validate_entry_post; struct HPMHookPoint *HP_itemdb_readdb_additional_fields_pre; struct HPMHookPoint *HP_itemdb_readdb_additional_fields_post; - struct HPMHookPoint *HP_itemdb_readdb_sql_sub_pre; - struct HPMHookPoint *HP_itemdb_readdb_sql_sub_post; struct HPMHookPoint *HP_itemdb_readdb_libconfig_sub_pre; struct HPMHookPoint *HP_itemdb_readdb_libconfig_sub_post; struct HPMHookPoint *HP_itemdb_readdb_libconfig_pre; struct HPMHookPoint *HP_itemdb_readdb_libconfig_post; - struct HPMHookPoint *HP_itemdb_readdb_sql_pre; - struct HPMHookPoint *HP_itemdb_readdb_sql_post; struct HPMHookPoint *HP_itemdb_unique_id_pre; struct HPMHookPoint *HP_itemdb_unique_id_post; struct HPMHookPoint *HP_itemdb_read_pre; @@ -3473,8 +3469,6 @@ struct { struct HPMHookPoint *HP_mob_parse_row_mobskilldb_post; struct HPMHookPoint *HP_mob_readskilldb_pre; struct HPMHookPoint *HP_mob_readskilldb_post; - struct HPMHookPoint *HP_mob_read_sqlskilldb_pre; - struct HPMHookPoint *HP_mob_read_sqlskilldb_post; struct HPMHookPoint *HP_mob_readdb_race2_pre; struct HPMHookPoint *HP_mob_readdb_race2_post; struct HPMHookPoint *HP_mob_readdb_itemratio_pre; @@ -8460,14 +8454,10 @@ struct { int HP_itemdb_validate_entry_post; int HP_itemdb_readdb_additional_fields_pre; int HP_itemdb_readdb_additional_fields_post; - int HP_itemdb_readdb_sql_sub_pre; - int HP_itemdb_readdb_sql_sub_post; int HP_itemdb_readdb_libconfig_sub_pre; int HP_itemdb_readdb_libconfig_sub_post; int HP_itemdb_readdb_libconfig_pre; int HP_itemdb_readdb_libconfig_post; - int HP_itemdb_readdb_sql_pre; - int HP_itemdb_readdb_sql_post; int HP_itemdb_unique_id_pre; int HP_itemdb_unique_id_post; int HP_itemdb_read_pre; @@ -9244,8 +9234,6 @@ struct { int HP_mob_parse_row_mobskilldb_post; int HP_mob_readskilldb_pre; int HP_mob_readskilldb_post; - int HP_mob_read_sqlskilldb_pre; - int HP_mob_read_sqlskilldb_post; int HP_mob_readdb_race2_pre; int HP_mob_readdb_race2_post; int HP_mob_readdb_itemratio_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3ecb82965..f793c9505 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1369,10 +1369,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->gendercheck, HP_itemdb_gendercheck) }, { HP_POP(itemdb->validate_entry, HP_itemdb_validate_entry) }, { HP_POP(itemdb->readdb_additional_fields, HP_itemdb_readdb_additional_fields) }, - { HP_POP(itemdb->readdb_sql_sub, HP_itemdb_readdb_sql_sub) }, { HP_POP(itemdb->readdb_libconfig_sub, HP_itemdb_readdb_libconfig_sub) }, { HP_POP(itemdb->readdb_libconfig, HP_itemdb_readdb_libconfig) }, - { HP_POP(itemdb->readdb_sql, HP_itemdb_readdb_sql) }, { HP_POP(itemdb->unique_id, HP_itemdb_unique_id) }, { HP_POP(itemdb->read, HP_itemdb_read) }, { HP_POP(itemdb->destroy_item_data, HP_itemdb_destroy_item_data) }, @@ -1771,7 +1769,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mob->readchatdb, HP_mob_readchatdb) }, { HP_POP(mob->parse_row_mobskilldb, HP_mob_parse_row_mobskilldb) }, { HP_POP(mob->readskilldb, HP_mob_readskilldb) }, - { HP_POP(mob->read_sqlskilldb, HP_mob_read_sqlskilldb) }, { HP_POP(mob->readdb_race2, HP_mob_readdb_race2) }, { HP_POP(mob->readdb_itemratio, HP_mob_readdb_itemratio) }, { HP_POP(mob->load, HP_mob_load) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 645873e13..b0bc853b3 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -35631,33 +35631,6 @@ void HP_itemdb_readdb_additional_fields(int itemid, config_setting_t *it, int n, } return; } -int HP_itemdb_readdb_sql_sub(Sql *handle, int n, const char *source) { - int hIndex = 0; - int retVal___ = 0; - if( HPMHooks.count.HP_itemdb_readdb_sql_sub_pre ) { - int (*preHookFunc) (Sql *handle, int *n, const char *source); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_sql_sub_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_itemdb_readdb_sql_sub_pre[hIndex].func; - retVal___ = preHookFunc(handle, &n, source); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.itemdb.readdb_sql_sub(handle, n, source); - } - if( HPMHooks.count.HP_itemdb_readdb_sql_sub_post ) { - int (*postHookFunc) (int retVal___, Sql *handle, int *n, const char *source); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_sql_sub_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_itemdb_readdb_sql_sub_post[hIndex].func; - retVal___ = postHookFunc(retVal___, handle, &n, source); - } - } - return retVal___; -} int HP_itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) { int hIndex = 0; int retVal___ = 0; @@ -35712,33 +35685,6 @@ int HP_itemdb_readdb_libconfig(const char *filename) { } return retVal___; } -int HP_itemdb_readdb_sql(const char *tablename) { - int hIndex = 0; - int retVal___ = 0; - if( HPMHooks.count.HP_itemdb_readdb_sql_pre ) { - int (*preHookFunc) (const char *tablename); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_sql_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_itemdb_readdb_sql_pre[hIndex].func; - retVal___ = preHookFunc(tablename); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.itemdb.readdb_sql(tablename); - } - if( HPMHooks.count.HP_itemdb_readdb_sql_post ) { - int (*postHookFunc) (int retVal___, const char *tablename); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_sql_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_itemdb_readdb_sql_post[hIndex].func; - retVal___ = postHookFunc(retVal___, tablename); - } - } - return retVal___; -} uint64 HP_itemdb_unique_id(struct map_session_data *sd) { int hIndex = 0; uint64 retVal___ = 0; @@ -46372,33 +46318,6 @@ void HP_mob_readskilldb(void) { } return; } -int HP_mob_read_sqlskilldb(void) { - int hIndex = 0; - int retVal___ = 0; - if( HPMHooks.count.HP_mob_read_sqlskilldb_pre ) { - int (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_sqlskilldb_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_mob_read_sqlskilldb_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.mob.read_sqlskilldb(); - } - if( HPMHooks.count.HP_mob_read_sqlskilldb_post ) { - int (*postHookFunc) (int retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_sqlskilldb_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_mob_read_sqlskilldb_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} bool HP_mob_readdb_race2(char *fields[], int columns, int current) { int hIndex = 0; bool retVal___ = false; diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index 50781f319..6d4a7789c 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -290,11 +290,6 @@ void totable(void) { "\n",tosql.db_name,tosql.db_name,tosql.db_name); } void do_db2sql(void) { - if( map->db_use_sql_item_db ) { - ShowInfo("db2sql: this should not be used with 'db_use_sql_item_db' enabled, skipping...\n"); - return; - } - /* link */ itemdb_readdb_libconfig_sub = itemdb->readdb_libconfig_sub; itemdb->readdb_libconfig_sub = db2sql; @@ -305,7 +300,7 @@ void do_db2sql(void) { return; } - tosql.db_name = map->item_db_db; + tosql.db_name = "item_db"; totable(); memset(&tosql.buf, 0, sizeof(tosql.buf) ); @@ -320,7 +315,7 @@ void do_db2sql(void) { return; } - tosql.db_name = map->item_db_db; + tosql.db_name = "item_db"; totable(); itemdb->clear(false); @@ -333,7 +328,7 @@ void do_db2sql(void) { return; } - tosql.db_name = map->item_db2_db; + tosql.db_name = "item_db2"; totable(); itemdb->clear(false); |