summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/login/account_sql.c47
-rw-r--r--src/login/ipban_sql.c13
-rw-r--r--src/login/login.c36
-rw-r--r--src/login/loginlog_sql.c5
-rw-r--r--src/map/pc.c312
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/skill.c4
-rw-r--r--src/map/status.c399
-rw-r--r--src/map/status.h13
-rw-r--r--src/map/unit.c9
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc32
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc138
13 files changed, 599 insertions, 419 deletions
diff --git a/src/login/account_sql.c b/src/login/account_sql.c
index f745d3d13..8975250b8 100644
--- a/src/login/account_sql.c
+++ b/src/login/account_sql.c
@@ -13,6 +13,7 @@
#include "../common/console.h"
#include "../common/malloc.h"
#include "../common/mmo.h"
+#include "../common/nullpo.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/sql.h"
@@ -136,6 +137,7 @@ static bool account_db_sql_init(AccountDB* self)
const char* database;
const char* codepage;
+ nullpo_ret(db);
db->accounts = SQL->Malloc();
sql_handle = db->accounts;
@@ -181,6 +183,7 @@ static void account_db_sql_destroy(AccountDB* self)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
+ nullpo_retv(db);
SQL->Free(db->accounts);
db->accounts = NULL;
aFree(db);
@@ -192,6 +195,9 @@ static bool account_db_sql_get_property(AccountDB* self, const char* key, char*
AccountDB_SQL* db = (AccountDB_SQL*)self;
const char* signature;
+ nullpo_ret(db);
+ nullpo_ret(key);
+ nullpo_ret(buf);
signature = "engine.";
if( strncmpi(key, signature, strlen(signature)) == 0 )
{
@@ -282,7 +288,9 @@ static bool account_db_sql_set_property(AccountDB* self, const char* key, const
AccountDB_SQL* db = (AccountDB_SQL*)self;
const char* signature;
-
+ nullpo_ret(db);
+ nullpo_ret(key);
+ nullpo_ret(value);
signature = "sql.";
if( strncmp(key, signature, strlen(signature)) == 0 )
{
@@ -360,6 +368,8 @@ static bool account_db_sql_create(AccountDB* self, struct mmo_account* acc)
// decide on the account id to assign
int account_id;
+ nullpo_ret(db);
+ nullpo_ret(acc);
if( acc->account_id != -1 )
{// caller specifies it manually
account_id = acc->account_id;
@@ -410,6 +420,7 @@ static bool account_db_sql_remove(AccountDB* self, const int account_id)
Sql* sql_handle = db->accounts;
bool result = false;
+ nullpo_ret(db);
if( SQL_SUCCESS != SQL->QueryStr(sql_handle, "START TRANSACTION")
|| SQL_SUCCESS != SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = %d", db->account_db, account_id)
|| SQL_SUCCESS != SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = %d", db->global_acc_reg_num_db, account_id)
@@ -442,11 +453,13 @@ static bool account_db_sql_load_num(AccountDB* self, struct mmo_account* acc, co
static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, const char* userid)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- Sql* sql_handle = db->accounts;
+ Sql* sql_handle;
char esc_userid[2*NAME_LENGTH+1];
int account_id;
char* data;
+ nullpo_ret(db);
+ sql_handle = db->accounts;
SQL->EscapeString(sql_handle, esc_userid, userid);
// get the list of account IDs for this user ID
@@ -481,8 +494,10 @@ static bool account_db_sql_load_str(AccountDB* self, struct mmo_account* acc, co
static AccountDBIterator* account_db_sql_iterator(AccountDB* self)
{
AccountDB_SQL* db = (AccountDB_SQL*)self;
- AccountDBIterator_SQL* iter = (AccountDBIterator_SQL*)aCalloc(1, sizeof(AccountDBIterator_SQL));
+ AccountDBIterator_SQL* iter;
+ nullpo_retr(NULL, db);
+ iter = (AccountDBIterator_SQL*)aCalloc(1, sizeof(AccountDBIterator_SQL));
// set up the vtable
iter->vtable.destroy = &account_db_sql_iter_destroy;
iter->vtable.next = &account_db_sql_iter_next;
@@ -507,10 +522,14 @@ static void account_db_sql_iter_destroy(AccountDBIterator* self)
static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account* acc)
{
AccountDBIterator_SQL* iter = (AccountDBIterator_SQL*)self;
- AccountDB_SQL* db = (AccountDB_SQL*)iter->db;
- Sql* sql_handle = db->accounts;
+ AccountDB_SQL* db;
+ Sql* sql_handle;
char* data;
+ nullpo_ret(iter);
+ db = (AccountDB_SQL*)iter->db;
+ nullpo_ret(db);
+ sql_handle = db->accounts;
// get next account ID
if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id` FROM `%s` WHERE `account_id` > '%d' ORDER BY `account_id` ASC LIMIT 1",
db->account_db, iter->last_account_id) )
@@ -539,9 +558,12 @@ static bool account_db_sql_iter_next(AccountDBIterator* self, struct mmo_account
static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int account_id)
{
- Sql* sql_handle = db->accounts;
+ Sql* sql_handle;
char* data;
+ nullpo_ret(db);
+ nullpo_ret(acc);
+ sql_handle = db->accounts;
// retrieve login entry for the specified account
if( SQL_ERROR == SQL->Query(sql_handle,
"SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`group_id`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`character_slots`,`pincode`,`pincode_change` FROM `%s` WHERE `account_id` = %d",
@@ -581,10 +603,14 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, bool is_new)
{
- Sql* sql_handle = db->accounts;
- SqlStmt* stmt = SQL->StmtMalloc(sql_handle);
+ Sql* sql_handle;
+ SqlStmt* stmt;
bool result = false;
+ nullpo_ret(db);
+ sql_handle = db->accounts;
+ stmt = SQL->StmtMalloc(sql_handle);
+
// try
do
{
@@ -666,6 +692,7 @@ void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id) {
AccountDB_SQL* db = (AccountDB_SQL*)self;
int count = RFIFOW(fd, 12);
+ nullpo_retv(db);
if (count) {
int cursor = 14, i;
char key[32], sval[254];
@@ -709,12 +736,14 @@ void mmo_save_accreg2(AccountDB* self, int fd, int account_id, int char_id) {
}
void mmo_send_accreg2(AccountDB* self, int fd, int account_id, int char_id) {
- Sql* sql_handle = ((AccountDB_SQL*)self)->accounts;
+ Sql* sql_handle;
AccountDB_SQL* db = (AccountDB_SQL*)self;
char* data;
int plen = 0;
size_t len;
+ nullpo_retv(db);
+ sql_handle = ((AccountDB_SQL*)self)->accounts;
if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `key`, `index`, `value` FROM `%s` WHERE `account_id`='%d'", db->global_acc_reg_str_db, account_id) )
Sql_ShowDebug(sql_handle);
diff --git a/src/login/ipban_sql.c b/src/login/ipban_sql.c
index bfc90ad11..f995450ce 100644
--- a/src/login/ipban_sql.c
+++ b/src/login/ipban_sql.c
@@ -14,6 +14,7 @@
#include "../common/cbasetypes.h"
#include "../common/db.h"
#include "../common/malloc.h"
+#include "../common/nullpo.h"
#include "../common/sql.h"
#include "../common/socket.h"
#include "../common/strlib.h"
@@ -118,6 +119,8 @@ bool ipban_config_read(const char* key, const char* value)
{
const char* signature;
+ nullpo_ret(key);
+ nullpo_ret(value);
if( ipban_inited )
return false;// settings can only be changed before init
@@ -220,8 +223,8 @@ bool ipban_check(uint32 ip)
return true;
}
- if( SQL_ERROR == SQL->NextRow(sql_handle) )
- return true;// Shouldn't happen, but just in case...
+ if( SQL_SUCCESS != SQL->NextRow(sql_handle) )
+ return false;
SQL->GetData(sql_handle, 0, &data, NULL);
matches = atoi(data);
@@ -244,9 +247,11 @@ void ipban_log(uint32 ip)
if( failures >= login_config.dynamic_pass_failure_ban_limit )
{
uint8* p = (uint8*)&ip;
- if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s`(`list`,`btime`,`rtime`,`reason`) VALUES ('%u.%u.%u.*', NOW() , NOW() + INTERVAL %d MINUTE ,'Password error ban')",
- ipban_table, p[3], p[2], p[1], login_config.dynamic_pass_failure_ban_duration) )
+ if (SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s`(`list`,`btime`,`rtime`,`reason`) VALUES ('%u.%u.%u.*', NOW() , NOW() + INTERVAL %d MINUTE ,'Password error ban')",
+ ipban_table, p[3], p[2], p[1], login_config.dynamic_pass_failure_ban_duration))
+ {
Sql_ShowDebug(sql_handle);
+ }
}
}
diff --git a/src/login/login.c b/src/login/login.c
index 846f24027..95cbab70d 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -19,6 +19,7 @@
#include "../common/db.h"
#include "../common/malloc.h"
#include "../common/md5calc.h"
+#include "../common/nullpo.h"
#include "../common/random.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
@@ -98,6 +99,7 @@ static int login_online_db_setoffline(DBKey key, DBData *data, va_list ap)
{
struct online_login_data* p = DB->data2ptr(data);
int server_id = va_arg(ap, int);
+ nullpo_ret(p);
if( server_id == -1 )
{
p->char_server = -1;
@@ -118,6 +120,7 @@ static int login_online_db_setoffline(DBKey key, DBData *data, va_list ap)
static int login_online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
struct online_login_data *character= DB->data2ptr(data);
+ nullpo_ret(character);
if (character->char_server == -2) //Unknown server.. set them offline
login->remove_online_user(character->account_id);
return 0;
@@ -136,6 +139,7 @@ int charif_sendallwos(int sfd, uint8* buf, size_t len)
{
int i, c;
+ nullpo_ret(buf);
for( i = 0, c = 0; i < ARRAYLENGTH(server); ++i )
{
int fd = server[i].fd;
@@ -155,6 +159,7 @@ int charif_sendallwos(int sfd, uint8* buf, size_t len)
/// Initializes a server structure.
void chrif_server_init(int id)
{
+ Assert_retv(id >= 0 && id < MAX_SERVERS);
memset(&server[id], 0, sizeof(server[id]));
server[id].fd = -1;
}
@@ -163,7 +168,8 @@ void chrif_server_init(int id)
/// Destroys a server structure.
void chrif_server_destroy(int id)
{
- if( server[id].fd != -1 )
+ Assert_retv(id >= 0 && id < MAX_SERVERS);
+ if (server[id].fd != -1)
{
do_close(server[id].fd);
server[id].fd = -1;
@@ -183,6 +189,7 @@ void chrif_server_reset(int id)
/// Called when the connection to Char Server is disconnected.
void chrif_on_disconnect(int id)
{
+ Assert_retv(id >= 0 && id < MAX_SERVERS);
ShowStatus("Char-server '%s' has disconnected.\n", server[id].name);
chrif_server_reset(id);
}
@@ -207,6 +214,9 @@ bool login_check_encrypted(const char* str1, const char* str2, const char* passw
{
char tmpstr[64+1], md5str[32+1];
+ nullpo_ret(str1);
+ nullpo_ret(str2);
+ nullpo_ret(passwd);
safesnprintf(tmpstr, sizeof(tmpstr), "%s%s", str1, str2);
MD5_String(tmpstr, md5str);
@@ -215,6 +225,8 @@ bool login_check_encrypted(const char* str1, const char* str2, const char* passw
bool login_check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass)
{
+ nullpo_ret(passwd);
+ nullpo_ret(refpass);
if(passwdenc == 0)
{
return (0==strcmp(passwd, refpass));
@@ -248,6 +260,7 @@ int login_lan_config_read(const char *lancfgName)
int line_num = 0;
char line[1024], w1[64], w2[64], w3[64], w4[64];
+ nullpo_ret(lancfgName);
if((fp = fopen(lancfgName, "r")) == NULL) {
ShowWarning("LAN Support configuration file is not found: %s\n", lancfgName);
return 1;
@@ -348,6 +361,7 @@ void login_fromchar_parse_auth(int fd, int id, const char *const ip)
}
else
{// authentication not found
+ nullpo_retv(ip);
ShowStatus("Char-server '%s': authentication of the account %d REFUSED (ip: %s).\n", server[id].name, account_id, ip);
login->fromchar_auth_ack(fd, account_id, login_id1, login_id2, sex, request_id, NULL);
}
@@ -1008,6 +1022,9 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con
int64 tick = timer->gettick();
struct mmo_account acc;
+ nullpo_retr(3, userid);
+ nullpo_retr(3, pass);
+ nullpo_retr(3, last_ip);
//Account Registration Flood Protection by [Kevin]
if( new_reg_tick == 0 )
new_reg_tick = timer->gettick();
@@ -1065,6 +1082,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
size_t len;
char ip[16];
+ nullpo_ret(sd);
ip2str(session[sd->fd]->client_addr, ip);
// DNS Blacklist check
@@ -1206,6 +1224,7 @@ void login_connection_problem(int fd, uint8 status)
void login_kick(struct login_session_data* sd)
{
uint8 buf[6];
+ nullpo_retv(sd);
WBUFW(buf,0) = 0x2734;
WBUFL(buf,2) = sd->account_id;
charif_sendallwos(-1, buf, 6);
@@ -1214,13 +1233,15 @@ void login_kick(struct login_session_data* sd)
void login_auth_ok(struct login_session_data* sd)
{
int fd = sd->fd;
- uint32 ip = session[fd]->client_addr;
+ uint32 ip;
uint8 server_num, n;
uint32 subnet_char_ip;
struct login_auth_node* node;
int i;
+ nullpo_retv(sd);
+ ip = session[fd]->client_addr;
if( runflag != LOGINSERVER_ST_RUNNING )
{
// players can only login while running
@@ -1336,9 +1357,12 @@ void login_auth_ok(struct login_session_data* sd)
void login_auth_failed(struct login_session_data* sd, int result)
{
- int fd = sd->fd;
- uint32 ip = session[fd]->client_addr;
+ int fd;
+ uint32 ip;
+ nullpo_retv(sd);
+ fd = sd->fd;
+ ip = session[fd]->client_addr;
if (login_config.log_login)
{
const char* error;
@@ -1738,7 +1762,9 @@ void login_set_defaults()
int login_config_read(const char* cfgName)
{
char line[1024], w1[1024], w2[1024];
- FILE* fp = fopen(cfgName, "r");
+ FILE* fp;
+ nullpo_retr(1, cfgName);
+ fp = fopen(cfgName, "r");
if (fp == NULL) {
ShowError("Configuration file (%s) not found.\n", cfgName);
return 1;
diff --git a/src/login/loginlog_sql.c b/src/login/loginlog_sql.c
index 5654b4c5b..8ed6e395a 100644
--- a/src/login/loginlog_sql.c
+++ b/src/login/loginlog_sql.c
@@ -11,6 +11,7 @@
#include "../common/cbasetypes.h"
#include "../common/mmo.h"
+#include "../common/nullpo.h"
#include "../common/socket.h"
#include "../common/sql.h"
#include "../common/strlib.h"
@@ -67,6 +68,8 @@ void login_log(uint32 ip, const char* username, int rcode, const char* message)
char esc_message[255*2+1];
int retcode;
+ nullpo_retv(username);
+ nullpo_retv(message);
if( !enabled )
return;
@@ -137,6 +140,8 @@ bool loginlog_config_read(const char* key, const char* value)
{
const char* signature;
+ nullpo_ret(key);
+ nullpo_ret(value);
signature = "sql.";
if( strncmpi(key, signature, strlen(signature)) == 0 )
{
diff --git a/src/map/pc.c b/src/map/pc.c
index 29baf0c84..0905df61b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5869,6 +5869,138 @@ const char* job_name(int class_)
}
}
+int pc_check_job_name(const char *name) {
+ int i, len;
+ struct {
+ const char *name;
+ int id;
+ } names[] = {
+ { "Novice", JOB_NOVICE },
+ { "Swordsman", JOB_SWORDMAN },
+ { "Magician", JOB_MAGE },
+ { "Archer", JOB_ARCHER },
+ { "Acolyte", JOB_ACOLYTE },
+ { "Merchant", JOB_MERCHANT },
+ { "Thief", JOB_THIEF },
+ { "Knight", JOB_KNIGHT },
+ { "Priest", JOB_PRIEST },
+ { "Wizard", JOB_WIZARD },
+ { "Blacksmith", JOB_BLACKSMITH },
+ { "Hunter", JOB_HUNTER },
+ { "Assassin", JOB_ASSASSIN },
+ { "Crusader", JOB_CRUSADER },
+ { "Monk", JOB_MONK },
+ { "Sage", JOB_SAGE },
+ { "Rogue", JOB_ROGUE },
+ { "Alchemist", JOB_ALCHEMIST },
+ { "Bard", JOB_BARD },
+ { "Dancer", JOB_DANCER },
+ { "Super_Novice", JOB_SUPER_NOVICE },
+ { "Gunslinger", JOB_GUNSLINGER },
+ { "Ninja", JOB_NINJA },
+ { "Novice_High", JOB_NOVICE_HIGH },
+ { "Swordsman_High", JOB_SWORDMAN_HIGH },
+ { "Magician_High", JOB_MAGE_HIGH },
+ { "Archer_High", JOB_ARCHER_HIGH },
+ { "Acolyte_High", JOB_ACOLYTE_HIGH },
+ { "Merchant_High", JOB_MERCHANT_HIGH },
+ { "Thief_High", JOB_THIEF_HIGH },
+ { "Lord_Knight", JOB_LORD_KNIGHT },
+ { "High_Priest", JOB_HIGH_PRIEST },
+ { "High_Wizard", JOB_HIGH_WIZARD },
+ { "Whitesmith", JOB_WHITESMITH },
+ { "Sniper", JOB_SNIPER },
+ { "Assassin_Cross", JOB_ASSASSIN_CROSS },
+ { "Paladin", JOB_PALADIN },
+ { "Champion", JOB_CHAMPION },
+ { "Professor", JOB_PROFESSOR },
+ { "Stalker", JOB_STALKER },
+ { "Creator", JOB_CREATOR },
+ { "Clown", JOB_CLOWN },
+ { "Gypsy", JOB_GYPSY },
+ { "Baby_Novice", JOB_BABY },
+ { "Baby_Swordsman", JOB_BABY_SWORDMAN },
+ { "Baby_Magician", JOB_BABY_MAGE },
+ { "Baby_Archer", JOB_BABY_ARCHER },
+ { "Baby_Acolyte", JOB_BABY_ACOLYTE },
+ { "Baby_Merchant", JOB_BABY_MERCHANT },
+ { "Baby_Thief", JOB_BABY_THIEF },
+ { "Baby_Knight", JOB_BABY_KNIGHT },
+ { "Baby_Priest", JOB_BABY_PRIEST },
+ { "Baby_Wizard", JOB_BABY_WIZARD },
+ { "Baby_Blacksmith", JOB_BABY_BLACKSMITH },
+ { "Baby_Hunter", JOB_BABY_HUNTER },
+ { "Baby_Assassin", JOB_BABY_ASSASSIN },
+ { "Baby_Crusader", JOB_BABY_CRUSADER },
+ { "Baby_Monk", JOB_BABY_MONK },
+ { "Baby_Sage", JOB_BABY_SAGE },
+ { "Baby_Rogue", JOB_BABY_ROGUE },
+ { "Baby_Alchemist", JOB_BABY_ALCHEMIST },
+ { "Baby_Bard", JOB_BABY_BARD },
+ { "Baby_Dancer", JOB_BABY_DANCER },
+ { "Super_Baby", JOB_SUPER_BABY },
+ { "Taekwon", JOB_TAEKWON },
+ { "Star_Gladiator", JOB_STAR_GLADIATOR },
+ { "Soul_Linker", JOB_SOUL_LINKER },
+ { "Gangsi", JOB_GANGSI },
+ { "Death_Knight", JOB_DEATH_KNIGHT },
+ { "Dark_Collector", JOB_DARK_COLLECTOR },
+ { "Rune_Knight", JOB_RUNE_KNIGHT },
+ { "Warlock", JOB_WARLOCK },
+ { "Ranger", JOB_RANGER },
+ { "Arch_Bishop", JOB_ARCH_BISHOP },
+ { "Mechanic", JOB_MECHANIC },
+ { "Guillotine_Cross", JOB_GUILLOTINE_CROSS },
+ { "Rune_Knight_Trans", JOB_RUNE_KNIGHT_T },
+ { "Warlock_Trans", JOB_WARLOCK_T },
+ { "Ranger_Trans", JOB_RANGER_T },
+ { "Arch_Bishop_Trans", JOB_ARCH_BISHOP_T },
+ { "Mechanic_Trans", JOB_MECHANIC_T },
+ { "Guillotine_Cross_Trans", JOB_GUILLOTINE_CROSS_T },
+ { "Royal_Guard", JOB_ROYAL_GUARD },
+ { "Sorcerer", JOB_SORCERER },
+ { "Minstrel", JOB_MINSTREL },
+ { "Wanderer", JOB_WANDERER },
+ { "Sura", JOB_SURA },
+ { "Genetic", JOB_GENETIC },
+ { "Shadow_Chaser", JOB_SHADOW_CHASER },
+ { "Royal_Guard_Trans", JOB_ROYAL_GUARD_T },
+ { "Sorcerer_Trans", JOB_SORCERER_T },
+ { "Minstrel_Trans", JOB_MINSTREL_T },
+ { "Wanderer_Trans", JOB_WANDERER_T },
+ { "Sura_Trans", JOB_SURA_T },
+ { "Genetic_Trans", JOB_GENETIC_T },
+ { "Shadow_Chaser_Trans", JOB_SHADOW_CHASER_T },
+ { "Baby_Rune_Knight", JOB_BABY_RUNE },
+ { "Baby_Warlock", JOB_BABY_WARLOCK },
+ { "Baby_Ranger", JOB_BABY_RANGER },
+ { "Baby_Arch_Bishop", JOB_BABY_BISHOP },
+ { "Baby_Mechanic", JOB_BABY_MECHANIC },
+ { "Baby_Guillotine_Cross", JOB_BABY_CROSS },
+ { "Baby_Royal_Guard", JOB_BABY_GUARD },
+ { "Baby_Sorcerer", JOB_BABY_SORCERER },
+ { "Baby_Minstrel", JOB_BABY_MINSTREL },
+ { "Baby_Wanderer", JOB_BABY_WANDERER },
+ { "Baby_Sura", JOB_BABY_SURA },
+ { "Baby_Genetic", JOB_BABY_GENETIC },
+ { "Baby_Shadow_Chaser", JOB_BABY_CHASER },
+ { "Expanded_Super_Novice", JOB_SUPER_NOVICE_E },
+ { "Expanded_Super_Baby", JOB_SUPER_BABY_E },
+ { "Kagerou", JOB_KAGEROU },
+ { "Oboro", JOB_OBORO },
+ { "Rebellion", JOB_REBELLION },
+ };
+
+ len = ARRAYLENGTH(names);
+
+ ARR_FIND(0, len, i, strcmpi(names[i].name, name) == 0);
+
+ if ( i == len )
+ return -1;
+
+ return names[i].id;
+}
+
int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data *sd;
struct block_list *tbl;
@@ -10048,151 +10180,27 @@ void pc_read_skill_tree(void) {
#else
const char *config_filename = "db/pre-re/skill_tree.conf"; // FIXME hardcoded name
#endif
- int i = 0, jnamelen = 0;
+ int i = 0;
struct s_mapiterator *iter;
struct map_session_data *sd;
- struct {
- const char *name;
- int id;
- } jnames[] = {
- { "Novice", JOB_NOVICE },
- { "Swordsman", JOB_SWORDMAN },
- { "Magician", JOB_MAGE },
- { "Archer", JOB_ARCHER },
- { "Acolyte", JOB_ACOLYTE },
- { "Merchant", JOB_MERCHANT },
- { "Thief", JOB_THIEF },
- { "Knight", JOB_KNIGHT },
- { "Priest", JOB_PRIEST },
- { "Wizard", JOB_WIZARD },
- { "Blacksmith", JOB_BLACKSMITH },
- { "Hunter", JOB_HUNTER },
- { "Assassin", JOB_ASSASSIN },
- { "Crusader", JOB_CRUSADER },
- { "Monk", JOB_MONK },
- { "Sage", JOB_SAGE },
- { "Rogue", JOB_ROGUE },
- { "Alchemist", JOB_ALCHEMIST },
- { "Bard", JOB_BARD },
- { "Dancer", JOB_DANCER },
- { "Super_Novice", JOB_SUPER_NOVICE },
- { "Gunslinger", JOB_GUNSLINGER },
- { "Ninja", JOB_NINJA },
- { "Novice_High", JOB_NOVICE_HIGH },
- { "Swordsman_High", JOB_SWORDMAN_HIGH },
- { "Magician_High", JOB_MAGE_HIGH },
- { "Archer_High", JOB_ARCHER_HIGH },
- { "Acolyte_High", JOB_ACOLYTE_HIGH },
- { "Merchant_High", JOB_MERCHANT_HIGH },
- { "Thief_High", JOB_THIEF_HIGH },
- { "Lord_Knight", JOB_LORD_KNIGHT },
- { "High_Priest", JOB_HIGH_PRIEST },
- { "High_Wizard", JOB_HIGH_WIZARD },
- { "Whitesmith", JOB_WHITESMITH },
- { "Sniper", JOB_SNIPER },
- { "Assassin_Cross", JOB_ASSASSIN_CROSS },
- { "Paladin", JOB_PALADIN },
- { "Champion", JOB_CHAMPION },
- { "Professor", JOB_PROFESSOR },
- { "Stalker", JOB_STALKER },
- { "Creator", JOB_CREATOR },
- { "Clown", JOB_CLOWN },
- { "Gypsy", JOB_GYPSY },
- { "Baby_Novice", JOB_BABY },
- { "Baby_Swordsman", JOB_BABY_SWORDMAN },
- { "Baby_Magician", JOB_BABY_MAGE },
- { "Baby_Archer", JOB_BABY_ARCHER },
- { "Baby_Acolyte", JOB_BABY_ACOLYTE },
- { "Baby_Merchant", JOB_BABY_MERCHANT },
- { "Baby_Thief", JOB_BABY_THIEF },
- { "Baby_Knight", JOB_BABY_KNIGHT },
- { "Baby_Priest", JOB_BABY_PRIEST },
- { "Baby_Wizard", JOB_BABY_WIZARD },
- { "Baby_Blacksmith", JOB_BABY_BLACKSMITH },
- { "Baby_Hunter", JOB_BABY_HUNTER },
- { "Baby_Assassin", JOB_BABY_ASSASSIN },
- { "Baby_Crusader", JOB_BABY_CRUSADER },
- { "Baby_Monk", JOB_BABY_MONK },
- { "Baby_Sage", JOB_BABY_SAGE },
- { "Baby_Rogue", JOB_BABY_ROGUE },
- { "Baby_Alchemist", JOB_BABY_ALCHEMIST },
- { "Baby_Bard", JOB_BABY_BARD },
- { "Baby_Dancer", JOB_BABY_DANCER },
- { "Super_Baby", JOB_SUPER_BABY },
- { "Taekwon", JOB_TAEKWON },
- { "Star_Gladiator", JOB_STAR_GLADIATOR },
- { "Soul_Linker", JOB_SOUL_LINKER },
- { "Gangsi", JOB_GANGSI },
- { "Death_Knight", JOB_DEATH_KNIGHT },
- { "Dark_Collector", JOB_DARK_COLLECTOR },
- { "Rune_Knight", JOB_RUNE_KNIGHT },
- { "Warlock", JOB_WARLOCK },
- { "Ranger", JOB_RANGER },
- { "Arch_Bishop", JOB_ARCH_BISHOP },
- { "Mechanic", JOB_MECHANIC },
- { "Guillotine_Cross", JOB_GUILLOTINE_CROSS },
- { "Rune_Knight_Trans", JOB_RUNE_KNIGHT_T },
- { "Warlock_Trans", JOB_WARLOCK_T },
- { "Ranger_Trans", JOB_RANGER_T },
- { "Arch_Bishop_Trans", JOB_ARCH_BISHOP_T },
- { "Mechanic_Trans", JOB_MECHANIC_T },
- { "Guillotine_Cross_Trans", JOB_GUILLOTINE_CROSS_T },
- { "Royal_Guard", JOB_ROYAL_GUARD },
- { "Sorcerer", JOB_SORCERER },
- { "Minstrel", JOB_MINSTREL },
- { "Wanderer", JOB_WANDERER },
- { "Sura", JOB_SURA },
- { "Genetic", JOB_GENETIC },
- { "Shadow_Chaser", JOB_SHADOW_CHASER },
- { "Royal_Guard_Trans", JOB_ROYAL_GUARD_T },
- { "Sorcerer_Trans", JOB_SORCERER_T },
- { "Minstrel_Trans", JOB_MINSTREL_T },
- { "Wanderer_Trans", JOB_WANDERER_T },
- { "Sura_Trans", JOB_SURA_T },
- { "Genetic_Trans", JOB_GENETIC_T },
- { "Shadow_Chaser_Trans", JOB_SHADOW_CHASER_T },
- { "Baby_Rune_Knight", JOB_BABY_RUNE },
- { "Baby_Warlock", JOB_BABY_WARLOCK },
- { "Baby_Ranger", JOB_BABY_RANGER },
- { "Baby_Arch_Bishop", JOB_BABY_BISHOP },
- { "Baby_Mechanic", JOB_BABY_MECHANIC },
- { "Baby_Guillotine_Cross", JOB_BABY_CROSS },
- { "Baby_Royal_Guard", JOB_BABY_GUARD },
- { "Baby_Sorcerer", JOB_BABY_SORCERER },
- { "Baby_Minstrel", JOB_BABY_MINSTREL },
- { "Baby_Wanderer", JOB_BABY_WANDERER },
- { "Baby_Sura", JOB_BABY_SURA },
- { "Baby_Genetic", JOB_BABY_GENETIC },
- { "Baby_Shadow_Chaser", JOB_BABY_CHASER },
- { "Expanded_Super_Novice", JOB_SUPER_NOVICE_E },
- { "Expanded_Super_Baby", JOB_SUPER_BABY_E },
- { "Kagerou", JOB_KAGEROU },
- { "Oboro", JOB_OBORO },
- { "Rebellion", JOB_REBELLION },
- };
if (libconfig->read_file(&skill_tree_conf, config_filename)) {
ShowError("can't read %s\n", config_filename);
return;
}
-
- jnamelen = ARRAYLENGTH(jnames);
-
+
while ((skt = libconfig->setting_get_elem(skill_tree_conf.root,i++))) {
int k;
const char *name = config_setting_name(skt);
- ARR_FIND(0, jnamelen, k, strcmpi(jnames[k].name,name) == 0 );
-
- if( k == jnamelen ) {
- ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n",name);
+ if ( (k = pc->check_job_name(name)) == -1 ) {
+ ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n", name);
continue;
}
-
-
+
if( ( skills = libconfig->setting_get_member(skt,"skills") ) ) {
int c = 0;
- int idx = pc->class2idx(jnames[k].id);
+ int idx = pc->class2idx(k);
while ((sk = libconfig->setting_get_elem(skills,c++))) {
const char *sk_name = config_setting_name(sk);
@@ -10206,7 +10214,7 @@ void pc_read_skill_tree(void) {
ShowWarning("pc_read_skill_tree: Unable to load skill %d (%s) into '%s's tree. Maximum number of skills per class has been reached.\n", skill_id, sk_name, name);
continue;
} else if (pc->skill_tree[idx][skidx].id) {
- ShowNotice("pc_read_skill_tree: Overwriting %d for '%s' (%d)\n", skill_id, name, jnames[k].id);
+ ShowNotice("pc_read_skill_tree: Overwriting %d for '%s' (%d)\n", skill_id, name, k);
}
pc->skill_tree[idx][skidx].id = skill_id;
@@ -10250,46 +10258,42 @@ void pc_read_skill_tree(void) {
while( (skt = libconfig->setting_get_elem(skill_tree_conf.root,i++)) ) {
int k, idx;
const char *name = config_setting_name(skt);
-
-
- ARR_FIND(0, jnamelen, k, strcmpi(jnames[k].name,name) == 0 );
- if( k == jnamelen ) {
- ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n",name);
+ if ( (k = pc->check_job_name(name)) == -1 ) {
+ ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n", name);
continue;
}
- idx = pc->class2idx(jnames[k].id);
+
+ idx = pc->class2idx(k);
if( ( inherit = libconfig->setting_get_member(skt,"inherit") ) ) {
const char *iname;
int v = 0;
- while ((iname = libconfig->setting_get_string_elem(inherit, v++))) {
+ while ( (iname = libconfig->setting_get_string_elem(inherit, v++)) ) {
int b = 0, a, d, f, fidx;
- ARR_FIND(0, jnamelen, b, strcmpi(jnames[b].name,iname) == 0 );
-
- if( b == jnamelen ) {
- ShowWarning("pc_read_skill_tree: '%s' trying to inherit unknown '%s'!\n",name,iname);
+ if ( (b = pc->check_job_name(iname)) == -1 ) {
+ ShowWarning("pc_read_skill_tree: '%s' trying to inherit unknown '%s'!\n", name, iname);
continue;
}
-
- fidx = pc->class2idx(jnames[b].id);
-
- ARR_FIND( 0, MAX_SKILL_TREE, d, pc->skill_tree[fidx][d].id == 0 );
- for( f = 0; f < d; f++ ) {
-
- ARR_FIND( 0, MAX_SKILL_TREE, a, pc->skill_tree[idx][a].id == 0 || pc->skill_tree[idx][a].id == pc->skill_tree[fidx][f].id );
+ fidx = pc->class2idx(b);
+
+ ARR_FIND(0, MAX_SKILL_TREE, d, pc->skill_tree[fidx][d].id == 0);
+
+ for ( f = 0; f < d; f++ ) {
- if( a == MAX_SKILL_TREE ) {
- ShowWarning("pc_read_skill_tree: '%s' can't inherit '%s', skill tree is full!\n", name,iname);
+ ARR_FIND(0, MAX_SKILL_TREE, a, pc->skill_tree[idx][a].id == 0 || pc->skill_tree[idx][a].id == pc->skill_tree[fidx][f].id);
+
+ if ( a == MAX_SKILL_TREE ) {
+ ShowWarning("pc_read_skill_tree: '%s' can't inherit '%s', skill tree is full!\n", name, iname);
break;
- } else if ( pc->skill_tree[idx][a].id || ( pc->skill_tree[idx][a].id == NV_TRICKDEAD && ((pc->jobid2mapid(jnames[k].id)&(MAPID_BASEMASK|JOBL_2))!=MAPID_NOVICE) ) ) /* we skip trickdead for non-novices */
+ } else if ( pc->skill_tree[idx][a].id || (pc->skill_tree[idx][a].id == NV_TRICKDEAD && ((pc->jobid2mapid(k)&(MAPID_BASEMASK | JOBL_2)) != MAPID_NOVICE)) ) /* we skip trickdead for non-novices */
continue;/* skip */
memcpy(&pc->skill_tree[idx][a], &pc->skill_tree[fidx][f], sizeof(pc->skill_tree[fidx][f]));
pc->skill_tree[idx][a].inherited = 1;
}
-
+
}
}
@@ -11294,4 +11298,6 @@ void pc_defaults(void) {
pc->autotrade_start = pc_autotrade_start;
pc->autotrade_prepare = pc_autotrade_prepare;
pc->autotrade_populate = pc_autotrade_populate;
+
+ pc->check_job_name = pc_check_job_name;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 9e9aa4673..39b705b8f 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1035,6 +1035,8 @@ struct pc_interface {
void (*autotrade_start) (struct map_session_data *sd);
void (*autotrade_prepare) (struct map_session_data *sd);
void (*autotrade_populate) (struct map_session_data *sd);
+
+ int (*check_job_name) (const char *name);
};
struct pc_interface *pc;
diff --git a/src/map/skill.c b/src/map/skill.c
index 3140b720c..4c8ecb40f 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4866,7 +4866,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
if( sd && ud->skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
- status_calc_bl(&sd->bl, SCB_SPEED);
+ status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD);
}
ud->skilltimer = INVALID_TIMER;
@@ -9878,7 +9878,7 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data)
if( sd && ud->skilltimer != INVALID_TIMER && ( pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
- status_calc_bl(&sd->bl, SCB_SPEED);
+ status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD);
}
ud->skilltimer = INVALID_TIMER;
diff --git a/src/map/status.c b/src/map/status.c
index a7c809c6d..4e4398c49 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2081,64 +2081,42 @@ int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt)
return 1;
}
-/// Helper function for status_base_pc_maxhp(), used to pre-calculate the hp_sigma_val[] array
-void status_calc_sigma(void)
-{
- int i,j;
+unsigned int status_get_base_maxsp(struct map_session_data* sd, struct status_data *st) {
+ uint64 val = pc->class2idx(sd->status.class_);
- for(i = 0; i < CLASS_COUNT; i++)
- {
- unsigned int k = 0;
- status->hp_sigma_val[i][0] = status->hp_sigma_val[i][1] = 0;
- for(j = 2; j <= MAX_LEVEL; j++)
- {
- k += (status->hp_coefficient[i]*j + 50) / 100;
- status->hp_sigma_val[i][j] = k;
- if (k >= INT_MAX)
- break; //Overflow protection. [Skotlex]
- }
- for(; j <= MAX_LEVEL; j++)
- status->hp_sigma_val[i][j] = INT_MAX;
- }
+ val = status->SP_table[val][sd->status.base_level];
+
+ if ( sd->class_&JOBL_UPPER )
+ val += val * 25 / 100;
+ else if ( sd->class_&JOBL_BABY )
+ val = val * 70 / 100;
+ if ( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )
+ val *= 3; //Triple max SP for top ranking Taekwons over level 90.
+
+ val += val * st->int_ / 100;
+
+ return (unsigned int)cap_value(val, 0, UINT_MAX);
}
-/// Calculates base MaxHP value according to class and base level
-/// The recursive equation used to calculate level bonus is (using integer operations)
-/// f(0) = 35 | f(x+1) = f(x) + A + (x + B)*C/D
-/// which reduces to something close to
-/// f(x) = 35 + x*(A + B*C/D) + sum(i=2..x){ i*C/D }
-unsigned int status_base_pc_maxhp(struct map_session_data *sd, struct status_data *st) {
+unsigned int status_get_base_maxhp(struct map_session_data *sd, struct status_data *st) {
uint64 val = pc->class2idx(sd->status.class_);
- val = 35 + sd->status.base_level*(int64)status->hp_coefficient2[val]/100 + status->hp_sigma_val[val][sd->status.base_level];
-
- if((sd->class_&MAPID_UPPERMASK) == MAPID_NINJA || (sd->class_&MAPID_UPPERMASK) == MAPID_GUNSLINGER || (sd->class_&MAPID_UPPERMASK) == MAPID_REBELLION)
- val += 100; //Since their HP can't be approximated well enough without this.
- if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
- val *= 3; //Triple max HP for top ranking Taekwons over level 90.
- if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99)
- val += 2000; //Supernovice lvl99 hp bonus.
- val += val * st->vit/100; // +1% per each point of VIT
+ val = status->HP_table[val][sd->status.base_level];
- if (sd->class_&JOBL_UPPER)
- val += val * 25/100; //Trans classes get a 25% hp bonus
- else if (sd->class_&JOBL_BABY)
- val -= val * 30/100; //Baby classes get a 30% hp penalty
- return (unsigned int)cap_value(val,0,UINT_MAX);
-}
+ if ( (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99 )
+ val += 2000; //Supernovice lvl99 hp bonus.
+ if ( (sd->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E && sd->status.base_level >= 150 )
+ val += 2000; //Extented Supernovice lvl150 hp bonus.
-unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct status_data *st) {
- uint64 val;
+ if ( sd->class_&JOBL_UPPER )
+ val += val * 25 / 100; //Trans classes get a 25% hp bonus
+ else if ( sd->class_&JOBL_BABY )
+ val = val * 70 / 100; //Baby classes get a 30% hp penalty
- val = 10 + sd->status.base_level*(int64)status->sp_coefficient[pc->class2idx(sd->status.class_)]/100;
- val += val * st->int_/100;
+ if ( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )
+ val *= 3; //Triple max HP for top ranking Taekwons over level 90.
- if (sd->class_&JOBL_UPPER)
- val += val * 25/100;
- else if (sd->class_&JOBL_BABY)
- val -= val * 30/100;
- if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
- val *= 3; //Triple max SP for top ranking Taekwons over level 90.
+ val += val * st->vit / 100; // +1% per each point of VIT
return (unsigned int)cap_value(val,0,UINT_MAX);
}
@@ -2630,7 +2608,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
// Basic MaxHP value
//We hold the standard Max HP here to make it faster to recalculate on vit changes.
- sd->status.max_hp = status->base_pc_maxhp(sd,bstatus);
+ sd->status.max_hp = status->get_base_maxhp(sd,bstatus);
//This is done to handle underflows from negative Max HP bonuses
i64 = sd->status.max_hp + (int)bstatus->max_hp;
bstatus->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX);
@@ -2655,7 +2633,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
// ----- SP MAX CALCULATION -----
// Basic MaxSP value
- sd->status.max_sp = status->base_pc_maxsp(sd,bstatus);
+ sd->status.max_sp = status->get_base_maxsp(sd,bstatus);
//This is done to handle underflows from negative Max SP bonuses
i64 = sd->status.max_sp + (int)bstatus->max_sp;
bstatus->max_sp = (unsigned int)cap_value(i64, 0, INT_MAX);
@@ -2842,17 +2820,12 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) {
else if (pc_isridingdragon(sd))
bstatus->aspd_rate += 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
#else // needs more info
- if((skill_lv=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
- bstatus->aspd_rate += 5*skill_lv;
- if((skill_lv = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd))
- bstatus->aspd_rate += 30*skill_lv;
- if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 &&
- (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
- bstatus->aspd_rate += ((skill_lv+1)/2) * 10;
- if (pc_isridingpeco(sd))
- bstatus->aspd_rate -= 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY);
- else if (pc_isridingdragon(sd))
- bstatus->aspd_rate -= 250-50*pc->checkskill(sd,RK_DRAGONTRAINING);
+ if ( (skill_lv = pc->checkskill(sd, SG_DEVIL)) > 0 && !pc->nextjobexp(sd) )
+ bstatus->aspd_rate += 30 * skill_lv;
+ if ( pc_isridingpeco(sd) )
+ bstatus->aspd_rate -= 500 - 100 * pc->checkskill(sd, KN_CAVALIERMASTERY);
+ else if ( pc_isridingdragon(sd) )
+ bstatus->aspd_rate -= 250 - 50 * pc->checkskill(sd, RK_DRAGONTRAINING);
#endif
bstatus->adelay = 2*bstatus->amotion;
@@ -3656,7 +3629,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if(flag&SCB_MAXHP) {
if( bl->type&BL_PC ) {
- st->max_hp = status->base_pc_maxhp(sd,st);
+ st->max_hp = status->get_base_maxhp(sd,st);
if (sd)
st->max_hp += bst->max_hp - sd->status.max_hp;
@@ -3677,7 +3650,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
if(flag&SCB_MAXSP) {
if( bl->type&BL_PC ) {
- st->max_sp = status->base_pc_maxsp(sd,st);
+ st->max_sp = status->get_base_maxsp(sd,st);
if (sd)
st->max_sp += bst->max_sp - sd->status.max_sp;
@@ -3744,19 +3717,14 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
amotion = status->base_amotion_pc(sd, st);
#ifndef RENEWAL_ASPD
st->aspd_rate = status->calc_aspd_rate(bl, sc, bst->aspd_rate);
-
- if(st->aspd_rate != 1000)
- amotion = amotion*st->aspd_rate/1000;
-#else
- // aspd = baseaspd + floor(sqrt((agi^2/2) + (dex^2/5))/4 + (potskillbonus*agi/200))
- amotion -= (int)(sqrt((pow(st->agi, 2) / 2) + (pow(st->dex, 2) / 5)) / 4 + ((float)status->calc_aspd(bl, sc, 1) * st->agi / 200)) * 10;
-
- if ( (status->calc_aspd(bl, sc, 2) + st->aspd_rate2) != 0 ) // RE ASPD percertage modifier
- amotion -= ((amotion - ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd))
- * (status->calc_aspd(bl, sc, 2) + st->aspd_rate2) / 10 + 5) / 10;
-
+#endif
if ( st->aspd_rate != 1000 ) // absolute percentage modifier
- amotion = (200 - (200 - amotion / 10) * st->aspd_rate / 1000) * 10;
+ amotion = amotion * st->aspd_rate / 1000;
+ if ( sd && sd->ud.skilltimer != INVALID_TIMER && pc->checkskill(sd, SA_FREECAST) > 0 )
+ amotion = amotion * 5 * (pc->checkskill(sd, SA_FREECAST) + 10) / 100;
+#ifdef RENEWAL_ASPD
+ amotion += (max(0xc3 - amotion, 2) * (st->aspd_rate2 + status->calc_aspd(bl, sc, 2))) / 100;
+ amotion = 10 * (200 - amotion) + sd->bonus.aspd_add;
#endif
amotion = status->calc_fix_aspd(bl, sc, amotion);
st->amotion = cap_value(amotion, ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd), 2000);
@@ -4011,31 +3979,30 @@ int status_check_visibility(struct block_list *src, struct block_list *target) {
// Basic ASPD value
int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) {
int amotion;
-#ifdef RENEWAL_ASPD
- short mod = -1;
-
- switch ( sd->weapontype2 ) { // adjustment for dual wielding
- case W_DAGGER:
- mod = 0;
- break; // 0, 1, 1
- case W_1HSWORD:
- case W_1HAXE:
- mod = 1;
- if ( (sd->class_&MAPID_THIRDMASK) == MAPID_GUILLOTINE_CROSS ) // 0, 2, 3
- mod = sd->weapontype2 / W_1HSWORD + W_1HSWORD / sd->weapontype2;
- }
-
- amotion = (sd->status.weapon < MAX_WEAPON_TYPE && mod < 0)
- ? (status->aspd_base[pc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
- : ((status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] // dual-wield
- + status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]) * 6 / 10 + 10 * mod
- - status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]
- + status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1]);
-
+#ifdef RENEWAL_ASPD /* [malufett/Hercules] */
+ float temp;
+ int skill_lv, val = 0;
+ amotion = status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1];
+ if ( sd->status.weapon > MAX_WEAPON_TYPE )
+ amotion += status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] / 4;
if ( sd->status.shield )
- amotion += (2000 - status->aspd_base[pc->class2idx(sd->status.class_)][W_FIST]) +
- (status->aspd_base[pc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE] - 2000);
-
+ amotion += status->aspd_base[pc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE];
+ switch ( sd->status.weapon ) {
+ case W_BOW: case W_MUSICAL:
+ case W_WHIP: case W_REVOLVER:
+ case W_RIFLE: case W_GATLING:
+ case W_SHOTGUN: case W_GRENADE:
+ temp = st->dex * st->dex / 7.0f + st->agi * st->agi * 0.5f;
+ break;
+ default:
+ temp = st->dex * st->dex / 5.0f + st->agi * st->agi * 0.5f;
+ }
+ temp = (float)(sqrt(temp) * 0.25f) + 0xc4;
+ if ( (skill_lv = pc->checkskill(sd, SA_ADVANCEDBOOK)) > 0 && sd->status.weapon == W_BOOK )
+ val += (skill_lv - 1) / 2 + 1;
+ if ( (skill_lv = pc->checkskill(sd, GS_SINGLEACTION)) > 0 )
+ val += ((skill_lv + 1) / 2);
+ amotion = ((int)(temp + ((float)(status->calc_aspd(&sd->bl, &sd->sc, 1) + val) * st->agi / 200)) - min(amotion, 200));
#else
// base weapon delay
amotion = (sd->status.weapon < MAX_WEAPON_TYPE)
@@ -4044,9 +4011,10 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st)
// percentual delay reduction from stats
amotion -= amotion * (4 * st->agi + st->dex) / 1000;
-#endif
+
// raw delay adjustment from bAspd bonus
amotion += sd->bonus.aspd_add;
+#endif
/* angra manyu disregards aspd_base and similar */
if ( sd->equip_index[EQI_HAND_R] >= 0 && sd->status.inventory[sd->equip_index[EQI_HAND_R]].nameid == ITEMID_ANGRA_MANYU )
@@ -12086,33 +12054,178 @@ int status_get_sc_type(sc_type type) {
* size_fix.txt - size adjustment table for weapons
* refine_db.txt - refining data table
*------------------------------------------*/
-bool status_readdb_job1(char* fields[], int columns, int current)
-{// Job-specific values (weight, HP, SP, ASPD)
- int idx, class_;
- unsigned int i;
-
- class_ = atoi(fields[0]);
+void status_read_job_db(void) { /* [malufett/Hercules] */
+ int i = 0;
+ config_t job_db_conf;
+ config_setting_t *jdb = NULL;
+ const char *config_filename = "db/"DBPATH"job_db.conf";
+ struct {
+ const char *name;
+ int id;
+ } wnames[] = {
+ { "Fist", W_FIST },
+ { "Dagger", W_DAGGER },
+ { "Sword", W_1HSWORD },
+ { "TwoHandSword", W_2HSWORD },
+ { "Spear", W_1HSPEAR },
+ { "TwoHandSpear", W_2HSPEAR },
+ { "Axe", W_1HAXE },
+ { "TwoHandAxe", W_2HAXE },
+ { "Mace", W_MACE },
+ { "TwoHandMace", W_2HMACE },
+ { "Rod", W_STAFF },
+ { "Bow", W_BOW },
+ { "Knuckle", W_KNUCKLE },
+ { "Instrument", W_MUSICAL },
+ { "Whip", W_WHIP },
+ { "Book", W_BOOK },
+ { "Katar", W_KATAR },
+ { "Revolver", W_REVOLVER },
+ { "Rifle", W_RIFLE },
+ { "GatlingGun", W_GATLING },
+ { "Shotgun", W_SHOTGUN },
+ { "GrenadeLauncher", W_GRENADE },
+ { "FuumaShuriken", W_HUUMA },
+ { "TwoHandRod", W_2HSTAFF },
+#ifdef RENEWAL_ASPD
+ { "Shield", MAX_WEAPON_TYPE }
+#endif
+ };
- if(!pc->db_checkid(class_))
- {
- ShowWarning("status_readdb_job1: Invalid job class %d specified.\n", class_);
- return false;
+ if ( libconfig->read_file(&job_db_conf, config_filename) ) {
+ ShowError("can't read %s\n", config_filename);
+ return;
}
- idx = pc->class2idx(class_);
+ while ( (jdb = libconfig->setting_get_elem(job_db_conf.root, i++)) ) {
+ int class_, idx, i32 = 0;
+ config_setting_t *temp = NULL;
+ const char *name = config_setting_name(jdb);
- status->max_weight_base[idx] = atoi(fields[1]);
- status->hp_coefficient[idx] = atoi(fields[2]);
- status->hp_coefficient2[idx] = atoi(fields[3]);
- status->sp_coefficient[idx] = atoi(fields[4]);
-#ifdef RENEWAL_ASPD
- for(i = 0; i <= MAX_WEAPON_TYPE; i++)
-#else
- for(i = 0; i < MAX_WEAPON_TYPE; i++)
-#endif
- {
- status->aspd_base[idx][i] = atoi(fields[i+5]);
+ if ( (class_ = pc->check_job_name(name)) == -1 ) {
+ ShowWarning("pc_read_job_db: '%s' unknown job name!\n", name);
+ continue;
+ }
+
+ idx = pc->class2idx(class_);
+ if ( (temp = libconfig->setting_get_member(jdb, "Inherit")) ) {
+ int nidx = 0, iidx, w;
+ const char *iname;
+ while ( (iname = libconfig->setting_get_string_elem(temp, nidx++)) ) {
+ int iclass, ave, total = 0;
+ if ( (iclass = pc->check_job_name(iname)) == -1 ) {
+ ShowWarning("status_read_job_db: '%s' trying to inherit unknown '%s'!\n", name, iname);
+ continue;
+ }
+ iidx = pc->class2idx(iclass);
+ status->max_weight_base[idx] = status->max_weight_base[iidx];
+ memcpy(&status->aspd_base[idx], &status->aspd_base[iidx], sizeof(status->aspd_base[iidx]));
+ for ( w = 1; w <= MAX_LEVEL && status->HP_table[iidx][w]; w++ ) {
+ status->HP_table[idx][w] = status->HP_table[iidx][w];
+ total += status->HP_table[idx][w];
+ }
+ ave = total / (w - 1);
+ for ( ; w <= pc->max_level[idx][0]; w++ ) {
+ status->HP_table[idx][w] = min(ave * w, battle_config.max_hp);
+ }
+ for ( w = 1; w <= MAX_LEVEL && status->SP_table[iidx][w]; w++ ) {
+ status->SP_table[idx][w] = status->SP_table[iidx][w];
+ total += status->SP_table[idx][w];
+ }
+ ave = total / (w - 1);
+ for ( ; w <= pc->max_level[idx][0]; w++ ) {
+ status->SP_table[idx][w] = min(ave * w, battle_config.max_sp);
+ }
+ }
+ }
+ if ( (temp = libconfig->setting_get_member(jdb, "InheritHP")) ) {
+ int nidx = 0, iidx;
+ const char *iname;
+ while ( (iname = libconfig->setting_get_string_elem(temp, nidx++)) ) {
+ int iclass, w, ave, total = 0;
+ if ( (iclass = pc->check_job_name(iname)) == -1 ) {
+ ShowWarning("status_read_job_db: '%s' trying to inherit unknown '%s' HP!\n", name, iname);
+ continue;
+ }
+ iidx = pc->class2idx(iclass);
+ for ( w = 1; w <= MAX_LEVEL && status->HP_table[iidx][w]; w++ ) {
+ status->HP_table[idx][w] = status->HP_table[iidx][w];
+ total += status->HP_table[idx][w];
+ }
+ ave = total / (w - 1);
+ for ( ; w <= pc->max_level[idx][0]; w++ ) {
+ status->HP_table[idx][w] = min(ave * w, battle_config.max_hp);
+ }
+ }
+ }
+ if ( (temp = libconfig->setting_get_member(jdb, "InheritSP")) ) {
+ int nidx = 0, iidx, ave, total = 0;
+ const char *iname;
+ while ( (iname = libconfig->setting_get_string_elem(temp, nidx++)) ) {
+ int iclass, w;
+ if ( (iclass = pc->check_job_name(iname)) == -1 ) {
+ ShowWarning("status_read_job_db: '%s' trying to inherit unknown '%s' SP!\n", name, iname);
+ continue;
+ }
+ iidx = pc->class2idx(iclass);
+ for ( w = 1; w <= MAX_LEVEL && status->SP_table[iidx][w]; w++ ) {
+ status->SP_table[idx][w] = status->SP_table[iidx][w];
+ total += status->SP_table[idx][w];
+ }
+ ave = total / (w - 1);
+ for ( ; w <= pc->max_level[idx][0]; w++ ) {
+ status->SP_table[idx][w] = min(ave * w, battle_config.max_sp);
+ }
+ }
+ }
+
+ if ( libconfig->setting_lookup_int(jdb, "Weight", &i32) )
+ status->max_weight_base[idx] = i32;
+ else if ( !status->max_weight_base[idx] )
+ status->max_weight_base[idx] = 20000;
+
+ if ( (temp = libconfig->setting_get_member(jdb, "BaseASPD")) ) {
+ int widx = 0;
+ config_setting_t *wpn = NULL;
+ while ( (wpn = libconfig->setting_get_elem(temp, widx++)) ) {
+ int w, wlen = ARRAYLENGTH(wnames);
+ const char *wname = config_setting_name(wpn);
+
+ ARR_FIND(0, wlen, w, strcmp(wnames[w].name, wname) == 0);
+ if ( w != wlen ) {
+ status->aspd_base[idx][wnames[w].id] = libconfig->setting_get_int(wpn);
+ } else {
+ ShowWarning("status_read_job_db: unknown weapon type '%s'!\n", wname);
+ }
+ }
+ }
+
+ if ( (temp = libconfig->setting_get_member(jdb, "HPTable")) ) {
+ int level = 0, ave, total = 0;
+ config_setting_t *hp = NULL;
+ while ( (hp = libconfig->setting_get_elem(temp, level++)) ) {
+ status->HP_table[idx][level] = i32 = min(libconfig->setting_get_int(hp), battle_config.max_hp);
+ total += i32 - status->HP_table[idx][level - 1];
+ }
+ ave = total / (level - 1);
+ for ( ; level <= pc->max_level[idx][0]; level++ ) { /* limit only to possible maximum level of the given class */
+ status->HP_table[idx][level] = min(ave * level, battle_config.max_hp); /* some are still empty? then let's use the average increase */
+ }
+ }
+
+ if ( (temp = libconfig->setting_get_member(jdb, "SPTable")) ) {
+ int level = 0, ave, total = 0;
+ config_setting_t *sp = NULL;
+ while ( (sp = libconfig->setting_get_elem(temp, level++)) ) {
+ status->SP_table[idx][level] = i32 = min(libconfig->setting_get_int(sp), battle_config.max_sp);
+ total += i32 - status->SP_table[idx][level - 1];
+ }
+ ave = total / (level - 1);
+ for ( ; level <= pc->max_level[idx][0]; level++ ) {
+ status->SP_table[idx][level] = min(ave * level, battle_config.max_sp);
+ }
+ }
}
- return true;
+ libconfig->destroy(&job_db_conf);
}
bool status_readdb_job2(char* fields[], int columns, int current)
@@ -12207,15 +12320,21 @@ int status_readdb(void)
// initialize databases to default
//
if( runflag == MAPSERVER_ST_RUNNING ) {//not necessary during boot
- // reset job_db1.txt data
+ // reset job_db.conf data
memset(status->max_weight_base, 0, sizeof(status->max_weight_base));
- memset(status->hp_coefficient, 0, sizeof(status->hp_coefficient));
- memset(status->hp_coefficient2, 0, sizeof(status->hp_coefficient2));
- memset(status->sp_coefficient, 0, sizeof(status->sp_coefficient));
- memset(status->aspd_base, 0, sizeof(status->aspd_base));
+ memset(status->HP_table, 0, sizeof(status->HP_table));
+ memset(status->SP_table, 0, sizeof(status->SP_table));
// reset job_db2.txt data
memset(status->job_bonus,0,sizeof(status->job_bonus)); // Job-specific stats bonus
}
+ for ( i = 0; i < CLASS_COUNT; i++ ) {
+ for ( j = 0; j < MAX_WEAPON_TYPE; j++ )
+ status->aspd_base[i][j] = 2000;
+#ifdef RENEWAL_ASPD
+ status->aspd_base[i][MAX_WEAPON_TYPE] = 0;
+#endif
+ }
+
// size_fix.txt
for(i = 0; i < ARRAYLENGTH(status->atkmods); i++)
for(j = 0; j < MAX_WEAPON_TYPE; j++)
@@ -12232,17 +12351,11 @@ int status_readdb(void)
// read databases
//
-
-
-#ifdef RENEWAL_ASPD
- sv->readdb(map->db_path, "re/job_db1.txt", ',', 6+MAX_WEAPON_TYPE, 6+MAX_WEAPON_TYPE, -1, status->readdb_job1);
-#else
- sv->readdb(map->db_path, "pre-re/job_db1.txt", ',', 5+MAX_WEAPON_TYPE, 5+MAX_WEAPON_TYPE, -1, status->readdb_job1);
-#endif
sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, status->readdb_job2);
sv->readdb(map->db_path, DBPATH"size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(status->atkmods), status->readdb_sizefix);
sv->readdb(map->db_path, DBPATH"refine_db.txt", ',', 4+MAX_REFINE, 4+MAX_REFINE, ARRAYLENGTH(status->refine_info), status->readdb_refine);
sv->readdb(map->db_path, "sc_config.txt", ',', 2, 2, SC_MAX, status->readdb_scconfig);
+ status->read_job_db();
return 0;
}
@@ -12260,7 +12373,6 @@ int do_init_status(bool minimal) {
status->initChangeTables();
status->initDummyData();
status->readdb();
- status->calc_sigma();
status->natural_heal_prev_tick = timer->gettick();
status->data_ers = ers_new(sizeof(struct status_change_entry),"status.c::data_ers",ERS_OPT_NONE);
timer->add_interval(status->natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, status->natural_heal_timer, 0, 0, NATURAL_HEAL_INTERVAL);
@@ -12285,10 +12397,8 @@ void status_defaults(void) {
status->current_equip_card_id = 0; //To prevent card-stacking (from jA) [Skotlex]
memset(status->max_weight_base,0,sizeof(status->max_weight_base)
- + sizeof(status->hp_coefficient)
- + sizeof(status->hp_coefficient2)
- + sizeof(status->hp_sigma_val)
- + sizeof(status->sp_coefficient)
+ + sizeof(status->HP_table)
+ + sizeof(status->SP_table)
+ sizeof(status->aspd_base)
+ sizeof(status->Skill2SCTable)
+ sizeof(status->IconChangeTable)
@@ -12396,9 +12506,8 @@ void status_defaults(void) {
status->initDummyData = initDummyData;
status->base_amotion_pc = status_base_amotion_pc;
status->base_atk = status_base_atk;
- status->calc_sigma = status_calc_sigma;
- status->base_pc_maxhp = status_base_pc_maxhp;
- status->base_pc_maxsp = status_base_pc_maxsp;
+ status->get_base_maxhp = status_get_base_maxhp;
+ status->get_base_maxsp = status_get_base_maxsp;
status->calc_npc_ = status_calc_npc_;
status->calc_str = status_calc_str;
status->calc_agi = status_calc_agi;
@@ -12428,9 +12537,9 @@ void status_defaults(void) {
status->display_remove = status_display_remove;
status->natural_heal = status_natural_heal;
status->natural_heal_timer = status_natural_heal_timer;
- status->readdb_job1 = status_readdb_job1;
status->readdb_job2 = status_readdb_job2;
status->readdb_sizefix = status_readdb_sizefix;
status->readdb_refine = status_readdb_refine;
status->readdb_scconfig = status_readdb_scconfig;
+ status->read_job_db = status_read_job_db;
}
diff --git a/src/map/status.h b/src/map/status.h
index f0624587e..98d5d415c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -1982,10 +1982,8 @@ struct status_interface {
int current_equip_card_id;
/* */
int max_weight_base[CLASS_COUNT];
- int hp_coefficient[CLASS_COUNT];
- int hp_coefficient2[CLASS_COUNT];
- int hp_sigma_val[CLASS_COUNT][MAX_LEVEL+1];
- int sp_coefficient[CLASS_COUNT];
+ int HP_table[CLASS_COUNT][MAX_LEVEL + 1];
+ int SP_table[CLASS_COUNT][MAX_LEVEL + 1];
int aspd_base[CLASS_COUNT][MAX_WEAPON_TYPE+1]; // +1 for RENEWAL_ASPD
sc_type Skill2SCTable[MAX_SKILL]; // skill -> status
int IconChangeTable[SC_MAX]; // status -> "icon" (icon is a bit of a misnomer, since there exist values with no icon associated)
@@ -2082,9 +2080,8 @@ struct status_interface {
void (*initDummyData) (void);
int (*base_amotion_pc) (struct map_session_data *sd, struct status_data *st);
unsigned short (*base_atk) (const struct block_list *bl, const struct status_data *st);
- void (*calc_sigma) (void);
- unsigned int (*base_pc_maxhp) (struct map_session_data *sd, struct status_data *st);
- unsigned int (*base_pc_maxsp) (struct map_session_data *sd, struct status_data *st);
+ unsigned int (*get_base_maxhp) (struct map_session_data *sd, struct status_data *st);
+ unsigned int (*get_base_maxsp) (struct map_session_data *sd, struct status_data *st);
int (*calc_npc_) (struct npc_data *nd, enum e_status_calc_opt opt);
unsigned short (*calc_str) (struct block_list *bl, struct status_change *sc, int str);
unsigned short (*calc_agi) (struct block_list *bl, struct status_change *sc, int agi);
@@ -2114,11 +2111,11 @@ struct status_interface {
void (*display_remove) (struct map_session_data *sd, enum sc_type type);
int (*natural_heal) (struct block_list *bl, va_list args);
int (*natural_heal_timer) (int tid, int64 tick, int id, intptr_t data);
- bool (*readdb_job1) (char *fields[], int columns, int current);
bool (*readdb_job2) (char *fields[], int columns, int current);
bool (*readdb_sizefix) (char *fields[], int columns, int current);
bool (*readdb_refine) (char *fields[], int columns, int current);
bool (*readdb_scconfig) (char *fields[], int columns, int current);
+ void (*read_job_db) (void);
};
struct status_interface *status;
diff --git a/src/map/unit.c b/src/map/unit.c
index 2e96e9c20..2dba10aeb 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1604,7 +1604,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
unit->setdir(src, map->calc_dir(src, target->x, target->y));
ud->skilltimer = timer->add( tick+casttime, skill->castend_id, src->id, 0 );
if( sd && (pc->checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) )
- status_calc_bl(&sd->bl, SCB_SPEED);
+ status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD);
} else
skill->castend_id(ud->skilltimer,tick,src->id,0);
@@ -1747,8 +1747,9 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
if( casttime > 0 ) {
unit->setdir(src, map->calc_dir(src, skill_x, skill_y));
ud->skilltimer = timer->add( tick+casttime, skill->castend_pos, src->id, 0 );
- if( (sd && pc->checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK)
- status_calc_bl(&sd->bl, SCB_SPEED);
+ if ( (sd && pc->checkskill(sd, SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK ) {
+ status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD);
+ }
} else {
ud->skilltimer = INVALID_TIMER;
skill->castend_pos(ud->skilltimer,tick,src->id,0);
@@ -2231,7 +2232,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
ud->skilltimer = INVALID_TIMER;
if( sd && pc->checkskill(sd,SA_FREECAST) > 0 )
- status_calc_bl(&sd->bl, SCB_SPEED);
+ status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD);
if( sd ) {
switch( skill_id ) {
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 651b8efc3..d7a6cf672 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -3989,6 +3989,8 @@ struct {
struct HPMHookPoint *HP_pc_autotrade_prepare_post;
struct HPMHookPoint *HP_pc_autotrade_populate_pre;
struct HPMHookPoint *HP_pc_autotrade_populate_post;
+ struct HPMHookPoint *HP_pc_check_job_name_pre;
+ struct HPMHookPoint *HP_pc_check_job_name_post;
struct HPMHookPoint *HP_pet_init_pre;
struct HPMHookPoint *HP_pet_init_post;
struct HPMHookPoint *HP_pet_final_pre;
@@ -4979,12 +4981,10 @@ struct {
struct HPMHookPoint *HP_status_base_amotion_pc_post;
struct HPMHookPoint *HP_status_base_atk_pre;
struct HPMHookPoint *HP_status_base_atk_post;
- struct HPMHookPoint *HP_status_calc_sigma_pre;
- struct HPMHookPoint *HP_status_calc_sigma_post;
- struct HPMHookPoint *HP_status_base_pc_maxhp_pre;
- struct HPMHookPoint *HP_status_base_pc_maxhp_post;
- struct HPMHookPoint *HP_status_base_pc_maxsp_pre;
- struct HPMHookPoint *HP_status_base_pc_maxsp_post;
+ struct HPMHookPoint *HP_status_get_base_maxhp_pre;
+ struct HPMHookPoint *HP_status_get_base_maxhp_post;
+ struct HPMHookPoint *HP_status_get_base_maxsp_pre;
+ struct HPMHookPoint *HP_status_get_base_maxsp_post;
struct HPMHookPoint *HP_status_calc_npc__pre;
struct HPMHookPoint *HP_status_calc_npc__post;
struct HPMHookPoint *HP_status_calc_str_pre;
@@ -5043,8 +5043,6 @@ struct {
struct HPMHookPoint *HP_status_natural_heal_post;
struct HPMHookPoint *HP_status_natural_heal_timer_pre;
struct HPMHookPoint *HP_status_natural_heal_timer_post;
- struct HPMHookPoint *HP_status_readdb_job1_pre;
- struct HPMHookPoint *HP_status_readdb_job1_post;
struct HPMHookPoint *HP_status_readdb_job2_pre;
struct HPMHookPoint *HP_status_readdb_job2_post;
struct HPMHookPoint *HP_status_readdb_sizefix_pre;
@@ -5053,6 +5051,8 @@ struct {
struct HPMHookPoint *HP_status_readdb_refine_post;
struct HPMHookPoint *HP_status_readdb_scconfig_pre;
struct HPMHookPoint *HP_status_readdb_scconfig_post;
+ struct HPMHookPoint *HP_status_read_job_db_pre;
+ struct HPMHookPoint *HP_status_read_job_db_post;
struct HPMHookPoint *HP_storage_reconnect_pre;
struct HPMHookPoint *HP_storage_reconnect_post;
struct HPMHookPoint *HP_storage_delitem_pre;
@@ -9196,6 +9196,8 @@ struct {
int HP_pc_autotrade_prepare_post;
int HP_pc_autotrade_populate_pre;
int HP_pc_autotrade_populate_post;
+ int HP_pc_check_job_name_pre;
+ int HP_pc_check_job_name_post;
int HP_pet_init_pre;
int HP_pet_init_post;
int HP_pet_final_pre;
@@ -10186,12 +10188,10 @@ struct {
int HP_status_base_amotion_pc_post;
int HP_status_base_atk_pre;
int HP_status_base_atk_post;
- int HP_status_calc_sigma_pre;
- int HP_status_calc_sigma_post;
- int HP_status_base_pc_maxhp_pre;
- int HP_status_base_pc_maxhp_post;
- int HP_status_base_pc_maxsp_pre;
- int HP_status_base_pc_maxsp_post;
+ int HP_status_get_base_maxhp_pre;
+ int HP_status_get_base_maxhp_post;
+ int HP_status_get_base_maxsp_pre;
+ int HP_status_get_base_maxsp_post;
int HP_status_calc_npc__pre;
int HP_status_calc_npc__post;
int HP_status_calc_str_pre;
@@ -10250,8 +10250,6 @@ struct {
int HP_status_natural_heal_post;
int HP_status_natural_heal_timer_pre;
int HP_status_natural_heal_timer_post;
- int HP_status_readdb_job1_pre;
- int HP_status_readdb_job1_post;
int HP_status_readdb_job2_pre;
int HP_status_readdb_job2_post;
int HP_status_readdb_sizefix_pre;
@@ -10260,6 +10258,8 @@ struct {
int HP_status_readdb_refine_post;
int HP_status_readdb_scconfig_pre;
int HP_status_readdb_scconfig_post;
+ int HP_status_read_job_db_pre;
+ int HP_status_read_job_db_post;
int HP_storage_reconnect_pre;
int HP_storage_reconnect_post;
int HP_storage_delitem_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index 5cbc20541..05ceb4ab1 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2026,6 +2026,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(pc->autotrade_start, HP_pc_autotrade_start) },
{ HP_POP(pc->autotrade_prepare, HP_pc_autotrade_prepare) },
{ HP_POP(pc->autotrade_populate, HP_pc_autotrade_populate) },
+ { HP_POP(pc->check_job_name, HP_pc_check_job_name) },
/* pet */
{ HP_POP(pet->init, HP_pet_init) },
{ HP_POP(pet->final, HP_pet_final) },
@@ -2527,9 +2528,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(status->initDummyData, HP_status_initDummyData) },
{ HP_POP(status->base_amotion_pc, HP_status_base_amotion_pc) },
{ HP_POP(status->base_atk, HP_status_base_atk) },
- { HP_POP(status->calc_sigma, HP_status_calc_sigma) },
- { HP_POP(status->base_pc_maxhp, HP_status_base_pc_maxhp) },
- { HP_POP(status->base_pc_maxsp, HP_status_base_pc_maxsp) },
+ { HP_POP(status->get_base_maxhp, HP_status_get_base_maxhp) },
+ { HP_POP(status->get_base_maxsp, HP_status_get_base_maxsp) },
{ HP_POP(status->calc_npc_, HP_status_calc_npc_) },
{ HP_POP(status->calc_str, HP_status_calc_str) },
{ HP_POP(status->calc_agi, HP_status_calc_agi) },
@@ -2559,11 +2559,11 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(status->display_remove, HP_status_display_remove) },
{ HP_POP(status->natural_heal, HP_status_natural_heal) },
{ HP_POP(status->natural_heal_timer, HP_status_natural_heal_timer) },
- { HP_POP(status->readdb_job1, HP_status_readdb_job1) },
{ HP_POP(status->readdb_job2, HP_status_readdb_job2) },
{ HP_POP(status->readdb_sizefix, HP_status_readdb_sizefix) },
{ HP_POP(status->readdb_refine, HP_status_readdb_refine) },
{ HP_POP(status->readdb_scconfig, HP_status_readdb_scconfig) },
+ { HP_POP(status->read_job_db, HP_status_read_job_db) },
/* storage */
{ HP_POP(storage->reconnect, HP_storage_reconnect) },
{ HP_POP(storage->delitem, HP_storage_delitem) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 3b2c3f08f..8f7c4f0b4 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -53389,6 +53389,33 @@ void HP_pc_autotrade_populate(struct map_session_data *sd) {
}
return;
}
+int HP_pc_check_job_name(const char *name) {
+ int hIndex = 0;
+ int retVal___ = 0;
+ if( HPMHooks.count.HP_pc_check_job_name_pre ) {
+ int (*preHookFunc) (const char *name);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_job_name_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_pc_check_job_name_pre[hIndex].func;
+ retVal___ = preHookFunc(name);
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.pc.check_job_name(name);
+ }
+ if( HPMHooks.count.HP_pc_check_job_name_post ) {
+ int (*postHookFunc) (int retVal___, const char *name);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_job_name_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_pc_check_job_name_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, name);
+ }
+ }
+ return retVal___;
+}
/* pet */
int HP_pet_init(bool minimal) {
int hIndex = 0;
@@ -66962,40 +66989,14 @@ unsigned short HP_status_base_atk(const struct block_list *bl, const struct stat
}
return retVal___;
}
-void HP_status_calc_sigma(void) {
- int hIndex = 0;
- if( HPMHooks.count.HP_status_calc_sigma_pre ) {
- void (*preHookFunc) (void);
- *HPMforce_return = false;
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_sigma_pre; hIndex++ ) {
- preHookFunc = HPMHooks.list.HP_status_calc_sigma_pre[hIndex].func;
- preHookFunc();
- }
- if( *HPMforce_return ) {
- *HPMforce_return = false;
- return;
- }
- }
- {
- HPMHooks.source.status.calc_sigma();
- }
- if( HPMHooks.count.HP_status_calc_sigma_post ) {
- void (*postHookFunc) (void);
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_sigma_post; hIndex++ ) {
- postHookFunc = HPMHooks.list.HP_status_calc_sigma_post[hIndex].func;
- postHookFunc();
- }
- }
- return;
-}
-unsigned int HP_status_base_pc_maxhp(struct map_session_data *sd, struct status_data *st) {
+unsigned int HP_status_get_base_maxhp(struct map_session_data *sd, struct status_data *st) {
int hIndex = 0;
unsigned int retVal___ = 0;
- if( HPMHooks.count.HP_status_base_pc_maxhp_pre ) {
+ if( HPMHooks.count.HP_status_get_base_maxhp_pre ) {
unsigned int (*preHookFunc) (struct map_session_data *sd, struct status_data *st);
*HPMforce_return = false;
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxhp_pre; hIndex++ ) {
- preHookFunc = HPMHooks.list.HP_status_base_pc_maxhp_pre[hIndex].func;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxhp_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_status_get_base_maxhp_pre[hIndex].func;
retVal___ = preHookFunc(sd, st);
}
if( *HPMforce_return ) {
@@ -67004,25 +67005,25 @@ unsigned int HP_status_base_pc_maxhp(struct map_session_data *sd, struct status_
}
}
{
- retVal___ = HPMHooks.source.status.base_pc_maxhp(sd, st);
+ retVal___ = HPMHooks.source.status.get_base_maxhp(sd, st);
}
- if( HPMHooks.count.HP_status_base_pc_maxhp_post ) {
+ if( HPMHooks.count.HP_status_get_base_maxhp_post ) {
unsigned int (*postHookFunc) (unsigned int retVal___, struct map_session_data *sd, struct status_data *st);
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxhp_post; hIndex++ ) {
- postHookFunc = HPMHooks.list.HP_status_base_pc_maxhp_post[hIndex].func;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxhp_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_status_get_base_maxhp_post[hIndex].func;
retVal___ = postHookFunc(retVal___, sd, st);
}
}
return retVal___;
}
-unsigned int HP_status_base_pc_maxsp(struct map_session_data *sd, struct status_data *st) {
+unsigned int HP_status_get_base_maxsp(struct map_session_data *sd, struct status_data *st) {
int hIndex = 0;
unsigned int retVal___ = 0;
- if( HPMHooks.count.HP_status_base_pc_maxsp_pre ) {
+ if( HPMHooks.count.HP_status_get_base_maxsp_pre ) {
unsigned int (*preHookFunc) (struct map_session_data *sd, struct status_data *st);
*HPMforce_return = false;
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxsp_pre; hIndex++ ) {
- preHookFunc = HPMHooks.list.HP_status_base_pc_maxsp_pre[hIndex].func;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxsp_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_status_get_base_maxsp_pre[hIndex].func;
retVal___ = preHookFunc(sd, st);
}
if( *HPMforce_return ) {
@@ -67031,12 +67032,12 @@ unsigned int HP_status_base_pc_maxsp(struct map_session_data *sd, struct status_
}
}
{
- retVal___ = HPMHooks.source.status.base_pc_maxsp(sd, st);
+ retVal___ = HPMHooks.source.status.get_base_maxsp(sd, st);
}
- if( HPMHooks.count.HP_status_base_pc_maxsp_post ) {
+ if( HPMHooks.count.HP_status_get_base_maxsp_post ) {
unsigned int (*postHookFunc) (unsigned int retVal___, struct map_session_data *sd, struct status_data *st);
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxsp_post; hIndex++ ) {
- postHookFunc = HPMHooks.list.HP_status_base_pc_maxsp_post[hIndex].func;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxsp_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_status_get_base_maxsp_post[hIndex].func;
retVal___ = postHookFunc(retVal___, sd, st);
}
}
@@ -67828,33 +67829,6 @@ int HP_status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) {
}
return retVal___;
}
-bool HP_status_readdb_job1(char *fields[], int columns, int current) {
- int hIndex = 0;
- bool retVal___ = false;
- if( HPMHooks.count.HP_status_readdb_job1_pre ) {
- bool (*preHookFunc) (char *fields[], int *columns, int *current);
- *HPMforce_return = false;
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_job1_pre; hIndex++ ) {
- preHookFunc = HPMHooks.list.HP_status_readdb_job1_pre[hIndex].func;
- retVal___ = preHookFunc(fields, &columns, &current);
- }
- if( *HPMforce_return ) {
- *HPMforce_return = false;
- return retVal___;
- }
- }
- {
- retVal___ = HPMHooks.source.status.readdb_job1(fields, columns, current);
- }
- if( HPMHooks.count.HP_status_readdb_job1_post ) {
- bool (*postHookFunc) (bool retVal___, char *fields[], int *columns, int *current);
- for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_job1_post; hIndex++ ) {
- postHookFunc = HPMHooks.list.HP_status_readdb_job1_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, fields, &columns, &current);
- }
- }
- return retVal___;
-}
bool HP_status_readdb_job2(char *fields[], int columns, int current) {
int hIndex = 0;
bool retVal___ = false;
@@ -67963,6 +67937,32 @@ bool HP_status_readdb_scconfig(char *fields[], int columns, int current) {
}
return retVal___;
}
+void HP_status_read_job_db(void) {
+ int hIndex = 0;
+ if( HPMHooks.count.HP_status_read_job_db_pre ) {
+ void (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_read_job_db_pre; hIndex++ ) {
+ preHookFunc = HPMHooks.list.HP_status_read_job_db_pre[hIndex].func;
+ preHookFunc();
+ }
+ if( *HPMforce_return ) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.status.read_job_db();
+ }
+ if( HPMHooks.count.HP_status_read_job_db_post ) {
+ void (*postHookFunc) (void);
+ for(hIndex = 0; hIndex < HPMHooks.count.HP_status_read_job_db_post; hIndex++ ) {
+ postHookFunc = HPMHooks.list.HP_status_read_job_db_post[hIndex].func;
+ postHookFunc();
+ }
+ }
+ return;
+}
/* storage */
void HP_storage_reconnect(void) {
int hIndex = 0;