diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 26 | ||||
-rw-r--r-- | src/map/battle.c | 6 | ||||
-rw-r--r-- | src/map/chrif.c | 20 | ||||
-rw-r--r-- | src/map/chrif.h | 2 | ||||
-rw-r--r-- | src/map/clif.c | 17 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/itemdb.c | 161 | ||||
-rw-r--r-- | src/map/itemdb.h | 4 | ||||
-rw-r--r-- | src/map/packets.h | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 28 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.HookingPoints.inc | 7 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Hooks.inc | 81 | ||||
-rw-r--r-- | src/plugins/db2sql.c | 6 |
13 files changed, 234 insertions, 127 deletions
diff --git a/src/char/char.c b/src/char/char.c index ce05f32f4..f1b95474e 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1004,7 +1004,7 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) struct mmo_charstatus p; int j = 0, i; char last_map[MAP_NAME_LENGTH_EXT]; - size_t unban_time; + time_t unban_time; stmt = SQL->StmtMalloc(sql_handle); if( stmt == NULL ) { @@ -1949,9 +1949,9 @@ void mmo_char_send099d(int fd, struct char_session_data *sd) { void mmo_char_send020d(int fd, struct char_session_data *sd) { int i; time_t now = time(NULL); - - ARR_FIND(0, MAX_CHARS, i, sd->unban_time[i] > now); - + + ARR_FIND(0, MAX_CHARS, i, sd->unban_time[i]); + if( i != MAX_CHARS ) { int c; @@ -1960,9 +1960,19 @@ void mmo_char_send020d(int fd, struct char_session_data *sd) { WFIFOW(fd, 0) = 0x20d; for(i = 0, c = 0; i < MAX_CHARS; i++) { - if( sd->unban_time[i] > now ) { - WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + if( sd->unban_time[i] ) { timestamp2string((char*)WFIFOP(fd,8 + (28*c)), 20, sd->unban_time[i], "%Y-%m-%d %H:%M:%S"); + + if( sd->unban_time[i] > now ) + WFIFOL(fd, 4 + (24*c)) = sd->found_char[i]; + else { + /* reset -- client keeps this information even if you logout so we need to clear */ + WFIFOL(fd, 4 + (24*c)) = 0; + /* also update on mysql */ + sd->unban_time[i] = 0; + if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `unban_time`='0' WHERE `char_id`='%d' LIMIT 1", char_db, sd->found_char[i]) ) + Sql_ShowDebug(sql_handle); + } c++; } } @@ -2338,7 +2348,7 @@ int parse_fromlogin(int fd) { #else mmo_char_send006b(i, sd); #endif - #if PACKETVER >= 20080000 + #if PACKETVER >= 20060819 mmo_char_send020d(i, sd); #endif #if PACKETVER >= 20110309 @@ -3301,7 +3311,7 @@ int parse_frommap(int fd) unsigned char buf[11]; WBUFW(buf,0) = 0x2b14; - WBUFL(buf,2) = account_id; + WBUFL(buf,2) = char_id; WBUFB(buf,6) = 2; WBUFL(buf,7) = (unsigned int)timestamp; mapif_sendall(buf, 11); diff --git a/src/map/battle.c b/src/map/battle.c index 32e450bc0..cd8c36b69 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4696,11 +4696,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( (i = battle->adjust_skill_damage(src->m,skill_id)) ) ATK_RATE(i); - #ifdef RENEWAL - if( skill_id && (wd.damage+wd.damage2) ){ - RE_SKILL_REDUCTION(); - } - #endif + if( sd ) { if (skill_id && (i = pc->skillatk_bonus(sd, skill_id))) ATK_ADDRATE(i); diff --git a/src/map/chrif.c b/src/map/chrif.c index 56572d492..5927e31bf 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -966,21 +966,21 @@ int chrif_deadopt(int father_id, int mother_id, int child_id) { } /*========================================== - * Disconnection of a player (account has been banned of has a status, from login-server) by [Yor] + * Disconnection of a player (account or char has been banned of has a status, from login or char server) by [Yor] *------------------------------------------*/ -int chrif_accountban(int fd) { - int acc; +int chrif_idbanned(int fd) { + int id; struct map_session_data *sd; - acc = RFIFOL(fd,2); + id = RFIFOL(fd,2); if ( battle_config.etc_log ) - ShowNotice("chrif_accountban %d.\n", acc); + ShowNotice("chrif_idbanned %d.\n", id); - sd = map->id2sd(acc); + sd = ( RFIFOB(fd,6) == 2 ) ? map->charid2sd(id) : map->id2sd(id); - if ( acc < 0 || sd == NULL ) { - ShowError("chrif_accountban failed - player not online.\n"); + if ( id < 0 || sd == NULL ) { + /* player not online or unknown id, either way no error is necessary (since if you try to ban a offline char it still works) */ return 0; } @@ -1453,7 +1453,7 @@ int chrif_parse(int fd) { case 0x2b0d: chrif->changedsex(fd); break; case 0x2b0f: chrif->char_ask_name_answer(RFIFOL(fd,2), (char*)RFIFOP(fd,6), RFIFOW(fd,30), RFIFOW(fd,32)); break; case 0x2b12: chrif->divorceack(RFIFOL(fd,2), RFIFOL(fd,6)); break; - case 0x2b14: chrif->accountban(fd); break; + case 0x2b14: chrif->idbanned(fd); break; case 0x2b1b: chrif->recvfamelist(fd); break; case 0x2b1d: chrif->load_scdata(fd); break; case 0x2b1e: chrif->update_ip(fd); break; @@ -1748,7 +1748,7 @@ void chrif_defaults(void) { chrif->changemapserverack = chrif_changemapserverack; chrif->changedsex = chrif_changedsex; chrif->divorceack = chrif_divorceack; - chrif->accountban = chrif_accountban; + chrif->idbanned = chrif_idbanned; chrif->recvfamelist = chrif_recvfamelist; chrif->load_scdata = chrif_load_scdata; chrif->update_ip = chrif_update_ip; diff --git a/src/map/chrif.h b/src/map/chrif.h index 56aa569a3..b69d34210 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -127,7 +127,7 @@ struct chrif_interface { int (*changemapserverack) (int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port); int (*changedsex) (int fd); int (*divorceack) (int char_id, int partner_id); - int (*accountban) (int fd); + int (*idbanned) (int fd); int (*recvfamelist) (int fd); int (*load_scdata) (int fd); void (*update_ip) (int fd); diff --git a/src/map/clif.c b/src/map/clif.c index dc3b00e6a..84976d67c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17966,6 +17966,22 @@ void clif_notify_bounditem(struct map_session_data *sd, unsigned short index) { clif->send(&p,sizeof(p), &sd->bl, SELF); } + +/* (GM) right click -> 'remove all equipment' */ +void clif_parse_GMFullStrip(int fd, struct map_session_data *sd) { + struct map_session_data *tsd = map->id2sd(RFIFOL(fd,2)); + int i; + + /* TODO maybe this could be a new permission? using gm level in the meantime */ + if( !tsd || pc->get_group_level(tsd) >= pc->get_group_level(sd) ) + return; + + for( i = 0; i < EQI_MAX; i++ ) { + if( tsd->equip_index[ i ] >= 0 ) + pc->unequipitem( tsd , tsd->equip_index[ i ] , 2 ); + } +} + /* */ unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { if( sd ) { @@ -18914,6 +18930,7 @@ void clif_defaults(void) { clif->pGMRc = clif_parse_GMRc; clif->pGMReqAccountName = clif_parse_GMReqAccountName; clif->pGMChangeMapType = clif_parse_GMChangeMapType; + clif->pGMFullStrip = clif_parse_GMFullStrip; clif->pPMIgnore = clif_parse_PMIgnore; clif->pPMIgnoreAll = clif_parse_PMIgnoreAll; clif->pPMIgnoreList = clif_parse_PMIgnoreList; diff --git a/src/map/clif.h b/src/map/clif.h index 043f7dd3a..88f3383d1 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1162,6 +1162,7 @@ struct clif_interface { void (*pGMRc) (int fd, struct map_session_data* sd); void (*pGMReqAccountName) (int fd, struct map_session_data *sd); void (*pGMChangeMapType) (int fd, struct map_session_data *sd); + void (*pGMFullStrip) (int fd, struct map_session_data *sd); void (*pPMIgnore) (int fd, struct map_session_data* sd); void (*pPMIgnoreAll) (int fd, struct map_session_data *sd); void (*pPMIgnoreList) (int fd,struct map_session_data *sd); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 51986fcf6..9c3ff4138 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1532,6 +1532,24 @@ int itemdb_gendercheck(struct item_data *id) return (battle_config.ignore_items_gender) ? 2 : id->sex; } + +/** + * Validates an item DB entry and inserts it into the database. + * This function is called after preparing the item entry data, and it takes + * care of inserting it and cleaning up any remainders of the previous one. + * + * @param *entry Pointer to the new item_data entry. Ownership is NOT taken, + * but the content is modified to reflect the validation. + * @param n Ordinal number of the entry, to be displayed in case of + * validation errors. + * @param *source Source of the entry (table or file name), to be displayed in + * case of validation errors. + * @return Nameid of the validated entry, or 0 in case of failure. + * + * Note: This is safe to call if the new entry is a copy of the old one (i.e. + * item_db2 inheritance), as it will make sure not to free any scripts still in + * use in the new entry. + */ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { struct item_data *item; @@ -1594,7 +1612,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { if( !entry->elvmax ) entry->elvmax = MAX_LEVEL; - else if( entry->elvmax > entry->elv ) + else if( entry->elvmax < entry->elv ) entry->elvmax = entry->elv; if( entry->type != IT_ARMOR && entry->type != IT_WEAPON && !entry->flag.no_refine ) @@ -1607,15 +1625,15 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { // Validated. Finally insert it item = itemdb->load(entry->nameid); - if (item->script) { + if (item->script && item->script != entry->script) { // Don't free if it's inheriting the same script script->free_code(item->script); item->script = NULL; } - if (item->equip_script) { + if (item->equip_script && item->equip_script != entry->equip_script) { // Don't free if it's inheriting the same script script->free_code(item->equip_script); item->equip_script = NULL; } - if (item->unequip_script) { + if (item->unequip_script && item->unequip_script != entry->unequip_script) { // Don't free if it's inheriting the same script script->free_code(item->unequip_script); item->unequip_script = NULL; } @@ -1623,9 +1641,20 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { *item = *entry; return item->nameid; } -/*========================================== - * processes one itemdb entry - *------------------------------------------*/ + +/** + * 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; @@ -1686,6 +1715,19 @@ int itemdb_readdb_sql_sub(Sql *handle, int n, const char *source) { return itemdb->validate_entry(&id, n, source); } +/** + * Processes one itemdb entry from the sql 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 + * necessary) + * @param n Ordinal number of the entry, to be displayed in case of + * validation errors. + * @param *source Source of the entry (file name), to be displayed in case of + * validation errors. + * @return Nameid of the validated entry, or 0 in case of failure. + */ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) { struct item_data id = { 0 }; config_setting_t *t = NULL; @@ -1845,11 +1887,14 @@ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source) return itemdb->validate_entry(&id, n, source); } -/*========================================== - * Reading item from item db - * item_db2 overwriting item_db - *------------------------------------------*/ -int itemdb_readdb(const char *filename) { +/** + * Reads from a libconfig-formatted itemdb file and inserts the found entries into the + * item database, overwriting duplicate ones (i.e. item_db2 overriding item_db.) + * + * @param *filename File name, relative to the database path. + * @return The number of found entries. + */ +int itemdb_readdb_libconfig(const char *filename) { bool duplicate[MAX_ITEMDB]; config_t item_db_conf; config_setting_t *itdb, *it; @@ -1880,44 +1925,43 @@ int itemdb_readdb(const char *filename) { config_destroy(&item_db_conf); ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename); - return 0; + return count; } -/*====================================== - * item_db table reading - *======================================*/ -int itemdb_read_sqldb(void) { - const char* item_db_name[] = { -#ifdef RENEWAL - map->item_db_re_db, -#else // not RENEWAL - map->item_db_db, -#endif // RENEWAL - map->item_db2_db }; - int fi; - - for( fi = 0; fi < ARRAYLENGTH(item_db_name); ++fi ) { - int i = 0; - uint32 count = 0; + +/** + * 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 * FROM `%s`", item_db_name[fi]) ) { - Sql_ShowDebug(map->mysql_handle); - continue; - } + // 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`, `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++, item_db_name[fi]) ) - count++; - } + // 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); + // free the query result + SQL->FreeResult(map->mysql_handle); - ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, item_db_name[fi]); - } + ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, tablename); - return 0; + return count; } /*========================================== @@ -1963,23 +2007,32 @@ int itemdb_uid_load() { return 0; } -/*==================================== - * read all item-related databases - *------------------------------------*/ +/** + * Reads all item-related databases. + */ void itemdb_read(bool minimal) { int i; DBData prev; - if (map->db_use_sql_item_db) - itemdb->read_sqldb(); - else { + if (map->db_use_sql_item_db) { + const char* item_db_name[] = { +#ifdef RENEWAL + map->item_db_re_db, +#else // not RENEWAL + map->item_db_db, +#endif // RENEWAL + 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(filename[i]); + itemdb->readdb_libconfig(filename[i]); } for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) { @@ -2001,7 +2054,7 @@ void itemdb_read(bool minimal) { sv->readdb(map->db_path, "item_avail.txt", ',', 2, 2, -1, itemdb->read_itemavail); sv->readdb(map->db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, itemdb->read_itemtrade); - sv->readdb(map->db_path, DBPATH"item_delay.txt", ',', 2, 2, -1, itemdb->read_itemdelay); + sv->readdb(map->db_path, DBPATH"item_delay.txt", ',', 2, 2, -1, itemdb->read_itemdelay); sv->readdb(map->db_path, "item_stack.txt", ',', 3, 3, -1, itemdb->read_stack); sv->readdb(map->db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, itemdb->read_buyingstore); sv->readdb(map->db_path, "item_nouse.txt", ',', 3, 3, -1, itemdb->read_nouse); @@ -2285,8 +2338,8 @@ void itemdb_defaults(void) { itemdb->validate_entry = itemdb_validate_entry; itemdb->readdb_sql_sub = itemdb_readdb_sql_sub; itemdb->readdb_libconfig_sub = itemdb_readdb_libconfig_sub; - itemdb->readdb = itemdb_readdb; - itemdb->read_sqldb = itemdb_read_sqldb; + itemdb->readdb_libconfig = itemdb_readdb_libconfig; + itemdb->readdb_sql = itemdb_readdb_sql; itemdb->unique_id = itemdb_unique_id; itemdb->uid_load = itemdb_uid_load; itemdb->read = itemdb_read; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 092db52d7..3f31c79d4 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -350,8 +350,8 @@ struct itemdb_interface { int (*validate_entry) (struct item_data *entry, 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) (const char *filename); - int (*read_sqldb) (void); + int (*readdb_libconfig) (const char *filename); + int (*readdb_sql) (const char *tablename); uint64 (*unique_id) (int8 flag, int64 value); int (*uid_load) (); void (*read) (bool minimal); diff --git a/src/map/packets.h b/src/map/packets.h index 55a85e182..08c73fdb0 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1613,7 +1613,7 @@ packet(0x020d,-1); //2009-10-27aRagexeRE #if PACKETVER >= 20091027 - packet(0x07f5,6,clif->pGMReqAccountName,2); + packet(0x07f5,6,clif->pGMFullStrip,2); packet(0x07f6,14); #endif diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index b77505fbb..42a881a49 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -369,8 +369,8 @@ struct { struct HPMHookPoint *HP_chrif_changedsex_post; struct HPMHookPoint *HP_chrif_divorceack_pre; struct HPMHookPoint *HP_chrif_divorceack_post; - struct HPMHookPoint *HP_chrif_accountban_pre; - struct HPMHookPoint *HP_chrif_accountban_post; + struct HPMHookPoint *HP_chrif_idbanned_pre; + struct HPMHookPoint *HP_chrif_idbanned_post; struct HPMHookPoint *HP_chrif_recvfamelist_pre; struct HPMHookPoint *HP_chrif_recvfamelist_post; struct HPMHookPoint *HP_chrif_load_scdata_pre; @@ -1561,6 +1561,8 @@ struct { struct HPMHookPoint *HP_clif_pGMReqAccountName_post; struct HPMHookPoint *HP_clif_pGMChangeMapType_pre; struct HPMHookPoint *HP_clif_pGMChangeMapType_post; + struct HPMHookPoint *HP_clif_pGMFullStrip_pre; + struct HPMHookPoint *HP_clif_pGMFullStrip_post; struct HPMHookPoint *HP_clif_pPMIgnore_pre; struct HPMHookPoint *HP_clif_pPMIgnore_post; struct HPMHookPoint *HP_clif_pPMIgnoreAll_pre; @@ -2541,10 +2543,10 @@ struct { 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_pre; - struct HPMHookPoint *HP_itemdb_readdb_post; - struct HPMHookPoint *HP_itemdb_read_sqldb_pre; - struct HPMHookPoint *HP_itemdb_read_sqldb_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_uid_load_pre; @@ -5328,8 +5330,8 @@ struct { int HP_chrif_changedsex_post; int HP_chrif_divorceack_pre; int HP_chrif_divorceack_post; - int HP_chrif_accountban_pre; - int HP_chrif_accountban_post; + int HP_chrif_idbanned_pre; + int HP_chrif_idbanned_post; int HP_chrif_recvfamelist_pre; int HP_chrif_recvfamelist_post; int HP_chrif_load_scdata_pre; @@ -6520,6 +6522,8 @@ struct { int HP_clif_pGMReqAccountName_post; int HP_clif_pGMChangeMapType_pre; int HP_clif_pGMChangeMapType_post; + int HP_clif_pGMFullStrip_pre; + int HP_clif_pGMFullStrip_post; int HP_clif_pPMIgnore_pre; int HP_clif_pPMIgnore_post; int HP_clif_pPMIgnoreAll_pre; @@ -7500,10 +7504,10 @@ struct { 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_pre; - int HP_itemdb_readdb_post; - int HP_itemdb_read_sqldb_pre; - int HP_itemdb_read_sqldb_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_uid_load_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 57c243913..2dead85db 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -193,7 +193,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(chrif->changemapserverack, HP_chrif_changemapserverack) }, { HP_POP(chrif->changedsex, HP_chrif_changedsex) }, { HP_POP(chrif->divorceack, HP_chrif_divorceack) }, - { HP_POP(chrif->accountban, HP_chrif_accountban) }, + { HP_POP(chrif->idbanned, HP_chrif_idbanned) }, { HP_POP(chrif->recvfamelist, HP_chrif_recvfamelist) }, { HP_POP(chrif->load_scdata, HP_chrif_load_scdata) }, { HP_POP(chrif->update_ip, HP_chrif_update_ip) }, @@ -790,6 +790,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->pGMRc, HP_clif_pGMRc) }, { HP_POP(clif->pGMReqAccountName, HP_clif_pGMReqAccountName) }, { HP_POP(clif->pGMChangeMapType, HP_clif_pGMChangeMapType) }, + { HP_POP(clif->pGMFullStrip, HP_clif_pGMFullStrip) }, { HP_POP(clif->pPMIgnore, HP_clif_pPMIgnore) }, { HP_POP(clif->pPMIgnoreAll, HP_clif_pPMIgnoreAll) }, { HP_POP(clif->pPMIgnoreList, HP_clif_pPMIgnoreList) }, @@ -1289,8 +1290,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->validate_entry, HP_itemdb_validate_entry) }, { 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, HP_itemdb_readdb) }, - { HP_POP(itemdb->read_sqldb, HP_itemdb_read_sqldb) }, + { 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->uid_load, HP_itemdb_uid_load) }, { HP_POP(itemdb->read, HP_itemdb_read) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 5511959e9..836e4e124 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -4793,13 +4793,13 @@ int HP_chrif_divorceack(int char_id, int partner_id) { } return retVal___; } -int HP_chrif_accountban(int fd) { +int HP_chrif_idbanned(int fd) { int hIndex = 0; int retVal___ = 0; - if( HPMHooks.count.HP_chrif_accountban_pre ) { + if( HPMHooks.count.HP_chrif_idbanned_pre ) { int (*preHookFunc) (int *fd); - for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_accountban_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_chrif_accountban_pre[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_idbanned_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_chrif_idbanned_pre[hIndex].func; retVal___ = preHookFunc(&fd); } if( *HPMforce_return ) { @@ -4808,12 +4808,12 @@ int HP_chrif_accountban(int fd) { } } { - retVal___ = HPMHooks.source.chrif.accountban(fd); + retVal___ = HPMHooks.source.chrif.idbanned(fd); } - if( HPMHooks.count.HP_chrif_accountban_post ) { + if( HPMHooks.count.HP_chrif_idbanned_post ) { int (*postHookFunc) (int retVal___, int *fd); - for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_accountban_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_chrif_accountban_post[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_chrif_idbanned_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_chrif_idbanned_post[hIndex].func; retVal___ = postHookFunc(retVal___, &fd); } } @@ -19773,6 +19773,31 @@ void HP_clif_pGMChangeMapType(int fd, struct map_session_data *sd) { } return; } +void HP_clif_pGMFullStrip(int fd, struct map_session_data *sd) { + int hIndex = 0; + if( HPMHooks.count.HP_clif_pGMFullStrip_pre ) { + void (*preHookFunc) (int *fd, struct map_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_pGMFullStrip_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_clif_pGMFullStrip_pre[hIndex].func; + preHookFunc(&fd, sd); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pGMFullStrip(fd, sd); + } + if( HPMHooks.count.HP_clif_pGMFullStrip_post ) { + void (*postHookFunc) (int *fd, struct map_session_data *sd); + for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_pGMFullStrip_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_clif_pGMFullStrip_post[hIndex].func; + postHookFunc(&fd, sd); + } + } + return; +} void HP_clif_pPMIgnore(int fd, struct map_session_data *sd) { int hIndex = 0; if( HPMHooks.count.HP_clif_pPMIgnore_pre ) { @@ -32402,13 +32427,13 @@ int HP_itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *sour } return retVal___; } -int HP_itemdb_readdb(const char *filename) { +int HP_itemdb_readdb_libconfig(const char *filename) { int hIndex = 0; int retVal___ = 0; - if( HPMHooks.count.HP_itemdb_readdb_pre ) { + if( HPMHooks.count.HP_itemdb_readdb_libconfig_pre ) { int (*preHookFunc) (const char *filename); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_itemdb_readdb_pre[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_libconfig_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_itemdb_readdb_libconfig_pre[hIndex].func; retVal___ = preHookFunc(filename); } if( *HPMforce_return ) { @@ -32417,25 +32442,25 @@ int HP_itemdb_readdb(const char *filename) { } } { - retVal___ = HPMHooks.source.itemdb.readdb(filename); + retVal___ = HPMHooks.source.itemdb.readdb_libconfig(filename); } - if( HPMHooks.count.HP_itemdb_readdb_post ) { + if( HPMHooks.count.HP_itemdb_readdb_libconfig_post ) { int (*postHookFunc) (int retVal___, const char *filename); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_itemdb_readdb_post[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_readdb_libconfig_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_itemdb_readdb_libconfig_post[hIndex].func; retVal___ = postHookFunc(retVal___, filename); } } return retVal___; } -int HP_itemdb_read_sqldb(void) { +int HP_itemdb_readdb_sql(const char *tablename) { int hIndex = 0; int retVal___ = 0; - if( HPMHooks.count.HP_itemdb_read_sqldb_pre ) { - int (*preHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_sqldb_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_itemdb_read_sqldb_pre[hIndex].func; - retVal___ = preHookFunc(); + if( HPMHooks.count.HP_itemdb_readdb_sql_pre ) { + int (*preHookFunc) (const char *tablename); + 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; @@ -32443,13 +32468,13 @@ int HP_itemdb_read_sqldb(void) { } } { - retVal___ = HPMHooks.source.itemdb.read_sqldb(); + retVal___ = HPMHooks.source.itemdb.readdb_sql(tablename); } - if( HPMHooks.count.HP_itemdb_read_sqldb_post ) { - int (*postHookFunc) (int retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_sqldb_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_itemdb_read_sqldb_post[hIndex].func; - retVal___ = postHookFunc(retVal___); + 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___; diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index b3d389527..3c3981bdd 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -139,7 +139,7 @@ void do_db2sql(void) { memset(&tosql.buf, 0, sizeof(tosql.buf) ); itemdb->clear(false); - itemdb->readdb("re/item_db.conf"); + itemdb->readdb_libconfig("re/item_db.conf"); fclose(tosql.fp); @@ -152,7 +152,7 @@ void do_db2sql(void) { totable(); itemdb->clear(false); - itemdb->readdb("pre-re/item_db.conf"); + itemdb->readdb_libconfig("pre-re/item_db.conf"); fclose(tosql.fp); @@ -165,7 +165,7 @@ void do_db2sql(void) { totable(); itemdb->clear(false); - itemdb->readdb("item_db2.conf"); + itemdb->readdb_libconfig("item_db2.conf"); fclose(tosql.fp); |