Browse Source

- Fixed Clown/Gypsy/Minstrel/Wanderer not receiving skill points upon change-sex
- Fixed missing casts from void* to struct online_char_data* in char.c

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15735 54d463be-8e91-2dee-dedb-b68131a5f0ec

epoque11 13 năm trước cách đây
mục cha
commit
7bcfb36e0e
5 tập tin đã thay đổi với 19 bổ sung12 xóa
  1. 4 12
      src/char/char.c
  2. 1 0
      src/map/atcommand.c
  3. 8 0
      src/map/pc.c
  4. 1 0
      src/map/script.c
  5. 5 0
      src/map/skill.h

+ 4 - 12
src/char/char.c

@@ -214,7 +214,7 @@ void set_char_charselect(int account_id)
 {
 	struct online_char_data* character;
 
-	character = idb_ensure(online_char_db, account_id, create_online_char_data);
+	character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
 
 	if( character->server > -1 )
 		if( server[character->server].users > 0 ) // Prevent this value from going negative.
@@ -248,7 +248,7 @@ void set_char_online(int map_id, int char_id, int account_id)
 		Sql_ShowDebug(sql_handle);
 
 	//Check to see for online conflicts
-	character = idb_ensure(online_char_db, account_id, create_online_char_data);
+	character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
 	if( character->char_id != -1 && character->server > -1 && character->server != map_id )
 	{
 		ShowNotice("set_char_online: Character %d:%d marked in map server %d, but map server %d claims to have (%d:%d) online!\n",
@@ -338,7 +338,7 @@ void set_char_offline(int char_id, int account_id)
  */
 static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
 {
-	struct online_char_data* character = db_data2ptr(data);
+	struct online_char_data* character = (struct online_char_data*)db_data2ptr(data);
 	int server = va_arg(ap, int);
 	if (server == -1) {
 		character->char_id = -1;
@@ -357,7 +357,7 @@ static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
  */
 static int char_db_kickoffline(DBKey key, DBData *data, va_list ap)
 {
-	struct online_char_data* character = db_data2ptr(data);
+	struct online_char_data* character = (struct online_char_data*)db_data2ptr(data);
 	int server_id = va_arg(ap, int);
 
 	if (server_id > -1 && character->server != server_id)
@@ -2081,14 +2081,6 @@ int parse_fromlogin(int fd)
 							class_[i] = (sex ? JOB_MINSTREL : JOB_WANDERER);
 						else if( class_[i] == JOB_MINSTREL_T || class_[i] == JOB_WANDERER_T )
 							class_[i] = (sex ? JOB_MINSTREL_T : JOB_WANDERER_T);
-						// remove specifical skills of classes 19,20 4020,4021 and 4042,4043
-						if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `skill_point` = `skill_point` +"
-							" (SELECT SUM(lv) FROM `%s` WHERE `char_id` = '%d' AND `id` >= '315' AND `id` <= '330' AND `lv` > '0')"
-							" WHERE `char_id` = '%d'",
-							char_db, skill_db, char_id[i], char_id[i]) )
-							Sql_ShowDebug(sql_handle);
-						if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d' AND `id` >= '315' AND `id` <= '330'", skill_db, char_id[i]) )
-							Sql_ShowDebug(sql_handle);
 					}
 					// to avoid any problem with equipment and invalid sex, equipment is unequiped.
 					if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `equip` = '0' WHERE `char_id` = '%d'", inventory_db, char_id[i]) )

+ 1 - 0
src/map/atcommand.c

@@ -6396,6 +6396,7 @@ ACMD_FUNC(uptime)
 ACMD_FUNC(changesex)
 {
 	nullpo_retr(-1, sd);
+	pc_resetskill(sd,4);
 	chrif_changesex(sd);
 	return 0;
 }

+ 8 - 0
src/map/pc.c

@@ -5804,11 +5804,16 @@ int pc_resetstate(struct map_session_data* sd)
  * /resetskill
  * if flag&1, perform block resync and status_calc call.
  * if flag&2, just count total amount of skill points used by player, do not really reset.
+ * if flag&4, just reset the skills if the player class is a bard/dancer type (for changesex.)
  *------------------------------------------*/
 int pc_resetskill(struct map_session_data* sd, int flag)
 {
 	int i, lv, inf2, skill_point=0;
 	nullpo_ret(sd);
+
+	if( flag&4 && (sd->class_&MAPID_UPPERMASK) != MAPID_BARDDANCER )
+		return 0;
+
 	if( !(flag&2) ) { //Remove stuff lost when resetting skills.
 		
 		/**
@@ -5865,6 +5870,9 @@ int pc_resetskill(struct map_session_data* sd, int flag)
 		if( i == NV_BASIC && (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE )
 			continue;
 
+		if( flag&4 && !skill_ischangesex(i) )
+			continue;
+
 		if( inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn )
 		{ //Only handle quest skills in a special way when you can't learn them manually
 			if( battle_config.quest_skill_reset && !(flag&2) )

+ 1 - 0
src/map/script.c

@@ -9326,6 +9326,7 @@ BUILDIN_FUNC(changesex)
 	TBL_PC *sd = NULL;
 	sd = script_rid2sd(st);
 
+	pc_resetskill(sd,4);
 	chrif_changesex(sd);
 	return 0;
 }

+ 5 - 0
src/map/skill.h

@@ -353,6 +353,11 @@ int skill_blockmerc_start (struct mercenary_data*,int,int);
 
 #define skill_blockpc_start(sd, skillid, tick) skill_blockpc_start_( sd, skillid, tick, false )
 
+// (Epoque:) To-do: replace this macro with some sort of skill tree check (rather than hard-coded skill names)
+#define skill_ischangesex(id) ( \
+	((id) >= BD_ADAPTATION     && (id) <= DC_SERVICEFORYOU) || ((id) >= CG_ARROWVULCAN && (id) <= CG_MARIONETTE) || \
+	((id) >= CG_LONGINGFREEDOM && (id) <= CG_TAROTCARD)     || ((id) >= WA_SWING_DANCE && (id) <= WM_UNLIMITED_HUMMING_VOICE))
+
 // ƒXƒLƒ‹�U?ˆêЇ?—�
 int skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag );