Преглед на файлове

Fixed some homunculus skill offset calculation mistakes (bugreport:363)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11731 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage преди 17 години
родител
ревизия
b5cf6976a2
променени са 8 файла, в които са добавени 16 реда и са изтрити 14 реда
  1. 2 0
      Changelog-Trunk.txt
  2. 2 2
      src/char/int_homun.c
  3. 1 1
      src/char_sql/int_homun.c
  4. 1 1
      src/common/mmo.h
  5. 1 1
      src/map/atcommand.c
  6. 3 3
      src/map/clif.c
  7. 4 4
      src/map/mercenary.c
  8. 2 2
      src/map/pc.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/11/15
+	* Fixed some homunculus skill offset calculation mistakes (bugreport:363)
 2007/11/14
 	* Fixed skill_castnodex_db.txt not being parsed correctly
 	* Fixed a search&replace typo in skill_db.txt

+ 2 - 2
src/char/int_homun.c

@@ -97,9 +97,9 @@ int inter_homun_fromstr(char *str,struct s_homunculus *p)
 		if (sscanf(str+next, "%d,%d,%n", &tmp_int[0], &tmp_int[1], &len) != 2)
 			return 2;
 
-		if (tmp_int[0] > HM_SKILLBASE && tmp_int[0] <= HM_SKILLBASE+MAX_HOMUNSKILL)
+		if (tmp_int[0] > HM_SKILLBASE && tmp_int[0] < HM_SKILLBASE+MAX_HOMUNSKILL)
 		{
-			i = tmp_int[0] - HM_SKILLBASE -1;
+			i = tmp_int[0] - HM_SKILLBASE;
 			p->hskill[i].id = tmp_int[0];
 			p->hskill[i].lv = tmp_int[1];
 		} else

+ 1 - 1
src/char_sql/int_homun.c

@@ -199,7 +199,7 @@ int mapif_load_homunculus(int fd)
 		i = atoi(data);
 		if( i < HM_SKILLBASE || i >= HM_SKILLBASE + MAX_HOMUNSKILL )
 			continue;// invalid guild skill
-		i = i - HM_SKILLBASE - 1;
+		i = i - HM_SKILLBASE;
 		homun_pt->hskill[i].id = (unsigned short)atoi(data);
 		// lv
 		Sql_GetData(sql_handle, 1, &data, NULL);

+ 1 - 1
src/common/mmo.h

@@ -96,7 +96,7 @@
 #define DEFAULT_MAX_CHAR_ID 250000
 
 //Base Homun skill.
-#define HM_SKILLBASE 8000
+#define HM_SKILLBASE 8001
 #define MAX_HOMUNSKILL 16
 #define MAX_HOMUNCULUS_CLASS	16	//[orn]
 #define HM_CLASS_BASE 6001

+ 1 - 1
src/map/atcommand.c

@@ -5666,7 +5666,7 @@ int atcommand_useskill(const int fd, struct map_session_data* sd, const char* co
 		return -1;
 	}
 
-	if (skillnum >= HM_SKILLBASE && skillnum <= HM_SKILLBASE+MAX_HOMUNSKILL
+	if (skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE+MAX_HOMUNSKILL
 		&& sd->hd && merc_is_hom_active(sd->hd)) // (If used with @useskill, put the homunc as dest)
 		bl = &sd->hd->bl;
 	else

+ 3 - 3
src/map/clif.c

@@ -1426,7 +1426,7 @@ int clif_homskillinfoblock(struct map_session_data *sd)
 	WFIFOW(fd,0)=0x235;
 	for ( i = 0; i < MAX_HOMUNSKILL; i++){
 		if( (id = hd->homunculus.hskill[i].id) != 0 ){
-			j = id - HM_SKILLBASE - 1 ;
+			j = id - HM_SKILLBASE ;
 			WFIFOW(fd,len  ) = id ;
 			WFIFOW(fd,len+2) = skill_get_inf(id) ;
 			WFIFOW(fd,len+4) = 0 ;
@@ -1450,7 +1450,7 @@ void clif_homskillup(struct map_session_data *sd, int skill_num)
 	int fd=sd->fd, skillid;
 	WFIFOHEAD(fd, packet_len(0x239));
 	nullpo_retv(sd);
-	skillid = skill_num - HM_SKILLBASE - 1;
+	skillid = skill_num - HM_SKILLBASE;
 
 	hd=sd->hd;
 
@@ -9275,7 +9275,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
 	if (tmp&INF_GROUND_SKILL || !tmp)
 		return; //Using a ground/passive skill on a target? WRONG.
 
-	if (skillnum >= HM_SKILLBASE && skillnum <= HM_SKILLBASE+MAX_HOMUNSKILL) {
+	if (skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE+MAX_HOMUNSKILL) {
 		clif_parse_UseSkillToId_homun(sd->hd, sd, tick, skillnum, skilllv, target_id);
 		return;
 	}

+ 4 - 4
src/map/mercenary.c

@@ -143,7 +143,7 @@ int merc_hom_calc_skilltree(struct homun_data *hd)
 	
 	for(i=0;i < MAX_SKILL_TREE && (id = hskill_tree[c][i].id) > 0;i++)
 	{
-		if(hd->homunculus.hskill[id-HM_SKILLBASE-1].id)
+		if(hd->homunculus.hskill[id-HM_SKILLBASE].id)
 			continue; //Skill already known.
 		if(!battle_config.skillfree)
 		{
@@ -158,14 +158,14 @@ int merc_hom_calc_skilltree(struct homun_data *hd)
 			}
 		}
 		if (f)
-			hd->homunculus.hskill[id-HM_SKILLBASE-1].id = id ;
+			hd->homunculus.hskill[id-HM_SKILLBASE].id = id ;
 	}
 	return 0;
 }
 
 int merc_hom_checkskill(struct homun_data *hd,int skill_id)
 {
-	int i = skill_id - HM_SKILLBASE - 1;
+	int i = skill_id - HM_SKILLBASE;
 	if(!hd)
 		return 0;
 
@@ -192,7 +192,7 @@ void merc_hom_skillup(struct homun_data *hd,int skillnum)
 	if(hd->homunculus.vaporize)
 		return;
 	
-	i = skillnum - HM_SKILLBASE - 1;
+	i = skillnum - HM_SKILLBASE;
 	if(hd->homunculus.skillpts > 0 &&
 		hd->homunculus.hskill[i].id &&
 		hd->homunculus.hskill[i].flag == 0 && //Don't allow raising while you have granted skills. [Skotlex]

+ 2 - 2
src/map/pc.c

@@ -4544,12 +4544,12 @@ int pc_skillup(struct map_session_data *sd,int skill_num)
 {
 	nullpo_retr(0, sd);
 
-	if(skill_num >= GD_SKILLBASE){
+	if(skill_num >= GD_SKILLBASE && skill_num < GD_SKILLBASE+MAX_GUILDSKILL){
 		guild_skillup(sd, skill_num);
 		return 0;
 	}
 
-	if(skill_num >= HM_SKILLBASE && sd->hd){
+	if(skill_num >= HM_SKILLBASE && skill_num < HM_SKILLBASE+MAX_HOMUNSKILL && sd->hd){
 		merc_hom_skillup(sd->hd, skill_num);
 		return 0;
 	}