diff options
30 files changed, 106 insertions, 110 deletions
diff --git a/sql-files/main.sql b/sql-files/main.sql index e69279710..fbdf40dde 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -618,6 +618,7 @@ CREATE TABLE IF NOT EXISTS `skill` ( `char_id` int(11) unsigned NOT NULL default '0', `id` smallint(11) unsigned NOT NULL default '0', `lv` tinyint(4) unsigned NOT NULL default '0', + `flag` TINYINT(1) UNSIGNED NOT NULL default 0, PRIMARY KEY (`char_id`,`id`) ) ENGINE=MyISAM; @@ -633,6 +634,18 @@ CREATE TABLE IF NOT EXISTS `skill_homunculus` ( ) ENGINE=MyISAM; -- +-- Table structure for table `sql_updates` +-- + +CREATE TABLE IF NOT EXISTS `sql_updates` ( + `timestamp` int(11) unsigned NOT NULL, + `ignored` enum('Yes','No') NOT NULL DEFAULT 'No' +) ENGINE=MyISAM; + +-- Existent updates to enter +INSERT INTO `sql_updates` (`timestamp`) VALUES (1360858500); + +-- -- Table structure for table `sstatus` -- diff --git a/sql-files/upgrades/2013-02-14--16-15.sql b/sql-files/upgrades/2013-02-14--16-15.sql new file mode 100644 index 000000000..9afd034b1 --- /dev/null +++ b/sql-files/upgrades/2013-02-14--16-15.sql @@ -0,0 +1,7 @@ +#1360858500 +CREATE TABLE IF NOT EXISTS `sql_updates` ( + `timestamp` int(11) unsigned NOT NULL, + `ignored` enum('Yes','No') NOT NULL DEFAULT 'No' +) ENGINE=MyISAM; +ALTER TABLE `skill` ADD COLUMN `flag` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0; +INSERT INTO `sql_updates` (`timestamp`) VALUES (1360858500);
\ No newline at end of file diff --git a/sql-files/upgrades/index.txt b/sql-files/upgrades/index.txt new file mode 100644 index 000000000..e0c49cbce --- /dev/null +++ b/sql-files/upgrades/index.txt @@ -0,0 +1 @@ +2013-02-14--16-15.sql
\ No newline at end of file diff --git a/sql-files/upgrades/upgrade_svn15003.sql b/sql-files/upgrades/upgrade_svn15003.sql deleted file mode 100644 index e30a3b0fd..000000000 --- a/sql-files/upgrades/upgrade_svn15003.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `global_reg_value` MODIFY `type` TINYINT(1) UNSIGNED NOT NULL DEFAULT '3'; diff --git a/sql-files/upgrades/upgrade_svn15420_log.sql b/sql-files/upgrades/upgrade_svn15420_log.sql deleted file mode 100644 index 580dce9a2..000000000 --- a/sql-files/upgrades/upgrade_svn15420_log.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Adds 'I' and 'X' to `type` in `picklog` table - -ALTER TABLE `picklog` MODIFY `type` ENUM('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X') NOT NULL DEFAULT 'P'; diff --git a/sql-files/upgrades/upgrade_svn15519_log.sql b/sql-files/upgrades/upgrade_svn15519_log.sql deleted file mode 100644 index 623b022b8..000000000 --- a/sql-files/upgrades/upgrade_svn15519_log.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Adds 'D' and 'U' to `type` in `picklog` table - -ALTER TABLE `picklog` MODIFY `type` ENUM('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U') NOT NULL DEFAULT 'P'; diff --git a/sql-files/upgrades/upgrade_svn15531_db.sql b/sql-files/upgrades/upgrade_svn15531_db.sql deleted file mode 100644 index ce0e56302..000000000 --- a/sql-files/upgrades/upgrade_svn15531_db.sql +++ /dev/null @@ -1,4 +0,0 @@ --- `ExpPer` column removed from `mob_db` and `mob_db2` tables - -ALTER TABLE `mob_db` DROP COLUMN `ExpPer`; -ALTER TABLE `mob_db2` DROP COLUMN `ExpPer`; diff --git a/sql-files/upgrades/upgrade_svn15572.sql b/sql-files/upgrades/upgrade_svn15572.sql deleted file mode 100644 index 821bb79d6..000000000 --- a/sql-files/upgrades/upgrade_svn15572.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Rename `level` column to `group_id` in `login` table - -ALTER TABLE `login` CHANGE COLUMN `level` `group_id` TINYINT(3) NOT NULL DEFAULT '0';
\ No newline at end of file diff --git a/sql-files/upgrades/upgrade_svn15818_log.sql b/sql-files/upgrades/upgrade_svn15818_log.sql deleted file mode 100644 index b61f71f53..000000000 --- a/sql-files/upgrades/upgrade_svn15818_log.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Adds 'I' to `type` in `zenylog` - -ALTER TABLE `zenylog` MODIFY `type` ENUM('M','T','V','S','N','A','E','B','I') NOT NULL DEFAULT 'S'; diff --git a/sql-files/upgrades/upgrade_svn15885.sql b/sql-files/upgrades/upgrade_svn15885.sql deleted file mode 100644 index 48b25b5a7..000000000 --- a/sql-files/upgrades/upgrade_svn15885.sql +++ /dev/null @@ -1,24 +0,0 @@ -ALTER TABLE `char` ADD COLUMN `elemental_id` int(11) unsigned NOT NULL default '0'; - --- --- Table structure for table `elemental` --- - -CREATE TABLE IF NOT EXISTS `elemental` ( - `ele_id` int(11) unsigned NOT NULL auto_increment, - `char_id` int(11) NOT NULL, - `class` mediumint(9) unsigned NOT NULL default '0', - `mode` int(11) unsigned NOT NULL default '1', - `hp` int(12) NOT NULL default '1', - `sp` int(12) NOT NULL default '1', - `max_hp` mediumint(8) unsigned NOT NULL default '0', - `max_sp` mediumint(6) unsigned NOT NULL default '0', - `str` smallint(4) unsigned NOT NULL default '0', - `agi` smallint(4) unsigned NOT NULL default '0', - `vit` smallint(4) unsigned NOT NULL default '0', - `int` smallint(4) unsigned NOT NULL default '0', - `dex` smallint(4) unsigned NOT NULL default '0', - `luk` smallint(4) unsigned NOT NULL default '0', - `life_time` int(11) NOT NULL default '0', - PRIMARY KEY (`ele_id`) -) ENGINE=MyISAM; diff --git a/sql-files/upgrades/upgrade_svn15926_log.sql b/sql-files/upgrades/upgrade_svn15926_log.sql deleted file mode 100644 index 099ee6faa..000000000 --- a/sql-files/upgrades/upgrade_svn15926_log.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Adds 'D' to `type` in `zenylog` - -ALTER TABLE `zenylog` MODIFY `type` ENUM('M','T','V','S','N','A','E','B','I','D') NOT NULL DEFAULT 'S'; diff --git a/sql-files/upgrades/upgrade_svn16490.sql b/sql-files/upgrades/upgrade_svn16490.sql deleted file mode 100644 index b38445c46..000000000 --- a/sql-files/upgrades/upgrade_svn16490.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `char` ADD CONSTRAINT `name_key` UNIQUE (`name`); diff --git a/sql-files/upgrades/upgrade_svn16518.sql b/sql-files/upgrades/upgrade_svn16518.sql deleted file mode 100644 index 1c142c65f..000000000 --- a/sql-files/upgrades/upgrade_svn16518.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `inventory` ADD COLUMN `favorite` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `expire_time`; diff --git a/sql-files/upgrades/upgrade_svn16639.sql b/sql-files/upgrades/upgrade_svn16639.sql deleted file mode 100644 index 0da4b91d1..000000000 --- a/sql-files/upgrades/upgrade_svn16639.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `item_db_re` CHANGE `equip_level` `equip_level` VARCHAR(10) DEFAULT ''; diff --git a/sql-files/upgrades/upgrade_svn16645.sql b/sql-files/upgrades/upgrade_svn16645.sql deleted file mode 100644 index 9a3237ad8..000000000 --- a/sql-files/upgrades/upgrade_svn16645.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `item_db_re` MODIFY COLUMN `atk:matk` VARCHAR(11) DEFAULT ''; -ALTER TABLE `item_db_re` MODIFY COLUMN `defence` SMALLINT(5) UNSIGNED DEFAULT NULL;
\ No newline at end of file diff --git a/sql-files/upgrades/upgrade_svn16663.sql b/sql-files/upgrades/upgrade_svn16663.sql deleted file mode 100644 index 8883a108b..000000000 --- a/sql-files/upgrades/upgrade_svn16663.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `homunculus` ADD `prev_class` MEDIUMINT( 9 ) NOT NULL AFTER `class` diff --git a/sql-files/upgrades/upgrade_svn16823.sql b/sql-files/upgrades/upgrade_svn16823.sql deleted file mode 100644 index f4b211912..000000000 --- a/sql-files/upgrades/upgrade_svn16823.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `item_db_re` MODIFY `defence` SMALLINT(5) DEFAULT NULL; -ALTER TABLE `item_db` MODIFY `defence` SMALLINT(5) DEFAULT NULL; diff --git a/sql-files/upgrades/upgrade_svn16914.sql b/sql-files/upgrades/upgrade_svn16914.sql deleted file mode 100644 index 2352077ac..000000000 --- a/sql-files/upgrades/upgrade_svn16914.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `zenylog` MODIFY `type` ENUM('T','V','P','M','S','N','D','C','A','E','I','B') NOT NULL DEFAULT 'S'; diff --git a/sql-files/upgrades/upgrade_svn17014.sql b/sql-files/upgrades/upgrade_svn17014.sql deleted file mode 100644 index 68a279aa7..000000000 --- a/sql-files/upgrades/upgrade_svn17014.sql +++ /dev/null @@ -1,9 +0,0 @@ -ALTER TABLE `elemental` CHANGE COLUMN `str` `atk1` MEDIUMINT(6) UNSIGNED NOT NULL DEFAULT 0, - CHANGE COLUMN `agi` `atk2` MEDIUMINT(6) UNSIGNED NOT NULL DEFAULT 0, - CHANGE COLUMN `vit` `matk` MEDIUMINT(6) UNSIGNED NOT NULL DEFAULT 0, - CHANGE COLUMN `int` `aspd` SMALLINT(4) UNSIGNED NOT NULL DEFAULT 0, - CHANGE COLUMN `dex` `def` SMALLINT(4) UNSIGNED NOT NULL DEFAULT 0, - CHANGE COLUMN `luk` `mdef` SMALLINT(4) UNSIGNED NOT NULL DEFAULT 0, - CHANGE COLUMN `life_time` `flee` SMALLINT(4) UNSIGNED NOT NULL DEFAULT 0, - ADD COLUMN `hit` SMALLINT(4) UNSIGNED NOT NULL DEFAULT 0 AFTER `flee`, - ADD COLUMN `life_time` INT(11) NOT NULL DEFAULT 0 AFTER `hit`;
\ No newline at end of file diff --git a/sql-files/upgrades/upgrade_svn17080.sql b/sql-files/upgrades/upgrade_svn17080.sql deleted file mode 100644 index cfbe5dfe0..000000000 --- a/sql-files/upgrades/upgrade_svn17080.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE IF NOT EXISTS `interreg` ( - `varname` varchar(11) NOT NULL, - `value` varchar(20) NOT NULL, - PRIMARY KEY (`varname`) -) ENGINE=InnoDB; -INSERT INTO `interreg` (`varname`, `value`) VALUES -('nsiuid', '0'); - -ALTER TABLE `auction` ADD `nsiuid` BIGINT NOT NULL DEFAULT '0'; -ALTER TABLE `cart_inventory` ADD `nsiuid` BIGINT NOT NULL DEFAULT '0'; -ALTER TABLE `guild_storage` ADD `nsiuid` BIGINT NOT NULL DEFAULT '0'; -ALTER TABLE `inventory` ADD `nsiuid` BIGINT NOT NULL DEFAULT '0'; -ALTER TABLE `mail` ADD `nsiuid` BIGINT NOT NULL DEFAULT '0'; -ALTER TABLE `storage` ADD `nsiuid` BIGINT NOT NULL DEFAULT '0'; - -ALTER TABLE `picklog` ADD `nsiuid` BIGINT NOT NULL DEFAULT '0' AFTER `card3`; diff --git a/sql-files/upgrades/upgrade_svn17086.sql b/sql-files/upgrades/upgrade_svn17086.sql deleted file mode 100644 index 3ba53e9ba..000000000 --- a/sql-files/upgrades/upgrade_svn17086.sql +++ /dev/null @@ -1,11 +0,0 @@ -UPDATE `interreg` SET `varname` = 'unique_id' WHERE `interreg`.`varname` = 'nsiuid'; - - -ALTER TABLE `auction` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; -ALTER TABLE `cart_inventory` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; -ALTER TABLE `guild_storage` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; -ALTER TABLE `inventory` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; -ALTER TABLE `mail` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; -ALTER TABLE `storage` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; - -ALTER TABLE `picklog` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
\ No newline at end of file diff --git a/src/char/char.c b/src/char/char.c index 1b5c7898d..8be0134ba 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -595,19 +595,20 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p) } StringBuf_Clear(&buf); - StringBuf_Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`) VALUES ", skill_db); + StringBuf_Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); //insert here. - for( i = 0, count = 0; i < MAX_SKILL; ++i ) - { - if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) - { - if( p->skill[i].flag == SKILL_FLAG_PERMANENT && p->skill[i].lv == 0 ) + for( i = 0, count = 0; i < MAX_SKILL; ++i ) { + if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { + + if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) continue; - if( p->skill[i].flag != SKILL_FLAG_PERMANENT && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) + if( p->skill[i].flag != SKILL_FLAG_PERMANENT && p->skill[i].flag != SKILL_FLAG_PERM_GRANTED && (p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0) == 0 ) continue; if( count ) StringBuf_AppendStr(&buf, ","); - StringBuf_Printf(&buf, "('%d','%d','%d')", char_id, p->skill[i].id, (p->skill[i].flag == SKILL_FLAG_PERMANENT ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0)); + StringBuf_Printf(&buf, "('%d','%d','%d','%d')", char_id, p->skill[i].id, + ( (p->skill[i].flag == SKILL_FLAG_PERMANENT || p->skill[i].flag == SKILL_FLAG_PERM_GRANTED) ? p->skill[i].lv : p->skill[i].flag - SKILL_FLAG_REPLACED_LV_0), + p->skill[i].flag == SKILL_FLAG_PERM_GRANTED ? p->skill[i].flag : 0);/* other flags do not need to be saved */ ++count; } } @@ -1274,13 +1275,16 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything //read skill //`skill` (`char_id`, `id`, `lv`) - if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `id`, `lv` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL) + if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT, &tmp_skill.lv, 0, NULL, NULL) ) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT, &tmp_skill.lv, 0, NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_USHORT, &tmp_skill.flag, 0, NULL, NULL) ) SqlStmt_ShowDebug(stmt); - tmp_skill.flag = SKILL_FLAG_PERMANENT; + + if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) + tmp_skill.flag = SKILL_FLAG_PERMANENT; for( i = 0; i < MAX_SKILL && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i ) { @@ -4820,6 +4824,7 @@ int do_init(int argc, char **argv) char_fd = make_listen_bind(bind_ip, char_port); ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port); + Sql_HerculesUpdateCheck(sql_handle); if( runflag != CORE_ST_STOP ) { shutdown_callback = do_shutdown; diff --git a/src/common/sql.c b/src/common/sql.c index b842db46d..fdb6e0114 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -1016,6 +1016,53 @@ void Sql_inter_server_read(const char* cfgName, bool first) { return; } +void Sql_HerculesUpdateCheck(Sql* self) { + char line[22];// "yyyy-mm-dd--hh-mm" (17) + ".sql" (4) + 1 + FILE* ifp;/* index fp */ + unsigned int performed = 0; + + if( !( ifp = fopen("sql-files/upgrades/index.txt", "r") ) ) { + ShowError("SQL upgrade index was not found!\n"); + return; + } + + while(fgets(line, sizeof(line), ifp)) { + char path[41];// "sql-files/upgrades/" (19) + "yyyy-mm-dd--hh-mm" (17) + ".sql" (4) + 1 + char timestamp[11];// "1360186680" (10) + 1 + FILE* ufp;/* upgrade fp */ + + sprintf(path,"sql-files/upgrades/%s",line); + + if( !( ufp = fopen(path, "r") ) ) { + ShowError("SQL upgrade file %s was not found!\n",path); + continue; + } + + if( fgetc(ufp) != '#' ) + continue; + + fseek (ufp,1,SEEK_SET);/* woo. skip the # */ + + if( fgets(timestamp,sizeof(timestamp),ufp) ) { + unsigned int timestampui = atol(timestamp); + if( SQL_ERROR == Sql_Query(self, "SELECT 1 FROM `sql_updates` WHERE `timestamp` = '%u' LIMIT 1", timestampui) ) + Sql_ShowDebug(self); + if( Sql_NumRows(self) != 1 ) { + ShowSQL("'"CL_WHITE"%s"CL_RESET"' wasn't applied to the database\n",path); + performed++; + } + } + + fclose(ufp); + } + + fclose(ifp); + + if( performed ) { + ShowSQL("If you did apply these updates or would like to be skip, insert a new entry in your sql_updates table with the timestamp of each file\n"); + } +} + void Sql_Init(void) { Sql_inter_server_read("conf/inter-server.conf",true); } diff --git a/src/common/sql.h b/src/common/sql.h index b7159ec90..ebbd1711f 100644 --- a/src/common/sql.h +++ b/src/common/sql.h @@ -325,7 +325,7 @@ int SqlStmt_NextRow(SqlStmt* self); /// Frees the result of the statement execution. void SqlStmt_FreeResult(SqlStmt* self); - +void Sql_HerculesUpdateCheck(Sql* self); #if defined(SQL_REMOVE_SHOWDEBUG) #define SqlStmt_ShowDebug(self) (void)0 diff --git a/src/login/account.h b/src/login/account.h index 1b567be70..adbcb7102 100644 --- a/src/login/account.h +++ b/src/login/account.h @@ -152,5 +152,6 @@ struct AccountDB AccountDBIterator* (*iterator)(AccountDB* self); }; +void account_db_sql_up(AccountDB* self); #endif // __ACCOUNT_H_INCLUDED__ diff --git a/src/login/account_sql.c b/src/login/account_sql.c index 5073941e2..ae80163af 100644 --- a/src/login/account_sql.c +++ b/src/login/account_sql.c @@ -678,3 +678,7 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo return result; } +void account_db_sql_up(AccountDB* self) { + AccountDB_SQL* db = (AccountDB_SQL*)self; + Sql_HerculesUpdateCheck(db->accounts); +}
\ No newline at end of file diff --git a/src/login/login.c b/src/login/login.c index 7f272e2a4..c7e250040 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1879,6 +1879,8 @@ int do_init(int argc, char** argv) ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %u).\n\n", login_config.login_port); login_log(0, "login server", 100, "login server started"); - + + account_db_sql_up(accounts); + return 0; } diff --git a/src/map/map.c b/src/map/map.c index 6f9401dad..a42d7abca 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3939,6 +3939,8 @@ int do_init(int argc, char *argv[]) ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port); + Sql_HerculesUpdateCheck(mmysql_handle); + if( runflag != CORE_ST_STOP ) { shutdown_callback = do_shutdown; diff --git a/src/map/pc.c b/src/map/pc.c index 0dd210394..1bc37040e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1253,7 +1253,7 @@ static int pc_calc_skillpoint(struct map_session_data* sd) if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) skill_point += skill; else - if(sd->status.skill[i].flag >= SKILL_FLAG_REPLACED_LV_0) + if(sd->status.skill[i].flag == SKILL_FLAG_REPLACED_LV_0) skill_point += (sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0); } } @@ -1283,13 +1283,13 @@ int pc_calc_skilltree(struct map_session_data *sd) for( i = 0; i < MAX_SKILL; i++ ) { - if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) //Don't touch plagiarized skills + if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED ) //Don't touch these sd->status.skill[i].id = 0; //First clear skills. } for( i = 0; i < MAX_SKILL; i++ ) { - if( sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) + if( sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) { // Restore original level of skills after deleting earned skills. sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; sd->status.skill[i].flag = SKILL_FLAG_PERMANENT; @@ -1509,7 +1509,7 @@ int pc_clean_skilltree(struct map_session_data *sd) sd->status.skill[i].flag = 0; } else - if (sd->status.skill[i].flag >= SKILL_FLAG_REPLACED_LV_0){ + if (sd->status.skill[i].flag == SKILL_FLAG_REPLACED_LV_0){ sd->status.skill[i].lv = sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; sd->status.skill[i].flag = 0; } @@ -3442,7 +3442,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) case 0: //Set skill data overwriting whatever was there before. sd->status.skill[id].id = id; sd->status.skill[id].lv = level; - sd->status.skill[id].flag = SKILL_FLAG_PERMANENT; + sd->status.skill[id].flag = SKILL_FLAG_PERM_GRANTED; if( level == 0 ) //Remove skill. { sd->status.skill[id].id = 0; @@ -6056,7 +6056,7 @@ int pc_allskillup(struct map_session_data *sd) nullpo_ret(sd); for(i=0;i<MAX_SKILL;i++){ - if (sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED) { + if (sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED) { sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; sd->status.skill[i].flag = SKILL_FLAG_PERMANENT; if (sd->status.skill[i].lv == 0) @@ -6329,6 +6329,9 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( i == NV_BASIC && (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE ) continue; + if( sd->status.skill[i].flag == SKILL_FLAG_PERM_GRANTED ) + continue; + if( flag&4 && !skill_ischangesex(i) ) continue; @@ -6344,7 +6347,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( sd->status.skill[i].flag == SKILL_FLAG_PERMANENT ) skill_point += lv; else - if( sd->status.skill[i].flag >= SKILL_FLAG_REPLACED_LV_0 ) + if( sd->status.skill[i].flag == SKILL_FLAG_REPLACED_LV_0 ) skill_point += (sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0); if( !(flag&2) ) diff --git a/src/map/script.c b/src/map/script.c index b89121ee4..83b6c1a68 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7347,7 +7347,7 @@ BUILDIN_FUNC(strnpcinfo) // aegis->athena slot position conversion table -static unsigned int equip[] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW}; +static unsigned int equip[] = {EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_GARMENT,EQP_SHOES,EQP_ACC_L,EQP_ACC_R,EQP_HEAD_MID,EQP_HEAD_LOW,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_TOP}; /*========================================== * GetEquipID(Pos); Pos: 1-10 |