Przeglądaj źródła

- Applied multiple fixes which should take care of making homun save/load work on TXT now.
- Added Gatling Fever's batk bonus.
- Some cleaning in status_damage which should prevent trying to free already free'd pointers when unit_remove_map invokes unit_free (when status_damage was going to invoke unit_free anyway)


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

skotlex 19 lat temu
rodzic
commit
5c44979d67

+ 6 - 0
Changelog-Trunk.txt

@@ -4,6 +4,12 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/08/15
+	* Applied multiple fixes which should take care of making homun save/load
+	  work on TXT now. [Skotlex]
+	* Added Gatling Fever's batk bonus. [Skotlex]
+	* Some cleaning in status_damage which should prevent trying to free
+	  already free'd pointers when unit_remove_map invokes unit_free (when
+	  status_damage was going to invoke unit_free anyway) [Skotlex]
 	* Delete homunc's skills from sql when the homunc is destroyed [Toms]
 	* Homunc Timers should be disabled when the homunc is vaporized or dead an re-enabled on call/resu [Toms]
 	* Updated vc-project files to compile with the new int_homun files.

+ 9 - 9
src/char/int_homun.c

@@ -92,13 +92,13 @@ int inter_homun_fromstr(char *str,struct s_homunculus *p)
 	p->luk = tmp_int[17];
 
 	//Read skills.
-	while(str[next]) {
+	while(str[next] && str[next] != '\n') {
 		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;
+			i = tmp_int[0] - HM_SKILLBASE -1;
 			p->hskill[i].id = tmp_int[0];
 			p->hskill[i].lv = tmp_int[1];
 		} else
@@ -327,7 +327,7 @@ int mapif_save_homun(int fd,int account_id,struct s_homunculus *data)
 	hom_id = data->hom_id;
 	p= idb_ensure(homun_db,hom_id,create_homun);
 	memcpy(p,data,sizeof(struct s_homunculus));
-	mapif_save_homun_ack(fd,account_id,0);
+	mapif_save_homun_ack(fd,account_id,1);
 	return 0;
 }
 
@@ -382,11 +382,11 @@ int inter_homun_parse_frommap(int fd)
 {
 	RFIFOHEAD(fd);
 	switch(RFIFOW(fd,0)){
-	case 0x3080: mapif_create_homun(fd); break;
-	case 0x3081: mapif_load_homun(fd); break;
-	case 0x3082: mapif_parse_SaveHomun(fd); break;
-	case 0x3083: mapif_parse_DeleteHomun(fd); break;
-	case 0x3084: mapif_parse_RenameHomun(fd); break;
+	case 0x3090: mapif_create_homun(fd); break;
+	case 0x3091: mapif_load_homun(fd); break;
+	case 0x3092: mapif_parse_SaveHomun(fd); break;
+	case 0x3093: mapif_parse_DeleteHomun(fd); break;
+	case 0x3094: mapif_parse_RenameHomun(fd); break;
 	default:
 		return 0;
 	}

+ 8 - 3
src/char/inter.c

@@ -39,8 +39,9 @@ struct accreg {
 
 unsigned int party_share_level = 10;
 
-// ‘—�MƒpƒPƒbƒg’·ƒŠƒXƒg
-int inter_send_packet_length[] = {
+// sending packet list
+// NOTE: This variable ain't used at all! And it's confusing.. where do I add that the length of packet 0x2b07 is 10? x.x [Skotlex]
+int inter_send_packet_length[]={
 	-1,-1,27,-1, -1, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0, //0x3000-0x300f
 	-1, 7, 0, 0,  0, 0, 0, 0, -1,11, 0, 0,  0, 0,  0, 0,
 	35,-1,11,15, 34,29, 7,-1,  0, 0, 0, 0,  0, 0,  0, 0,
@@ -52,7 +53,7 @@ int inter_send_packet_length[] = {
 	11,-1, 7, 3, 36, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,
 };
 // recv. packet list
-int inter_recv_packet_length[] = {
+int inter_recv_packet_length[]={
 	-1,-1, 7,-1, -1,13, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0, //0x3000-0x300f
 	 6,-1, 0, 0,  0, 0, 0, 0, 10,-1, 0, 0,  0, 0,  0, 0, //0x3010-0x301f
 	-1, 6,-1,14, 14,19, 6,-1, 14,14, 0, 0,  0, 0,  0, 0, //0x3020-0x302f
@@ -62,6 +63,7 @@ int inter_recv_packet_length[] = {
 	 0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,
 	 0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,
 	48,14,-1, 6, 35, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0, //0x3080-0x308f
+	68,10,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x3090 - 0x309f  Homunculus packets [albator]
 };
 
 struct WisData {
@@ -251,6 +253,7 @@ int inter_save(void) {
 	inter_storage_save();
 	inter_guild_storage_save();
 	inter_pet_save();
+	inter_homun_save();
 	inter_accreg_save();
 
 	return 0;
@@ -632,6 +635,8 @@ int inter_parse_frommap(int fd) {
 			break;
 		if (inter_pet_parse_frommap(fd))
 			break;
+		if (inter_homun_parse_frommap(fd))
+			break;
 		return 0;
 	}
 	RFIFOSKIP(fd, len);

+ 1 - 1
src/char_sql/int_homun.c

@@ -321,7 +321,7 @@ int inter_homunculus_parse_frommap(int fd){
 	switch(RFIFOW(fd, 0)){
 	case 0x3090: mapif_parse_CreateHomunculus(fd); break;
 	case 0x3091: mapif_load_homunculus(fd); break;
-	case 0x3092: mapif_save_homunculus(fd, RFIFOL(fd,6), (struct s_homunculus*) RFIFOP(fd, 10)); break;
+	case 0x3092: mapif_save_homunculus(fd, RFIFOW(fd,4), (struct s_homunculus*) RFIFOP(fd, 8)); break;
 	case 0x3093: mapif_delete_homunculus(fd); break;  // doesn't need to be parse, very simple packet...
 	case 0x3094: mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOP(fd, 10)); break;
 	default:

+ 5 - 5
src/map/intif.c

@@ -821,12 +821,12 @@ int intif_homunculus_requestsave(int account_id, struct s_homunculus* sh)
 {
 	if (CheckForCharServer())
 		return 0;
-	WFIFOHEAD(inter_fd, sizeof(struct s_homunculus)+10);
+	WFIFOHEAD(inter_fd, sizeof(struct s_homunculus)+8);
 	WFIFOW(inter_fd,0) = 0x3092;
-	WFIFOL(inter_fd,2) =  sizeof(struct s_homunculus)+10;
-	WFIFOL(inter_fd,6) = account_id;
-	memcpy(WFIFOP(inter_fd,10),sh,sizeof(struct s_homunculus));
-	WFIFOSET(inter_fd, sizeof(struct s_homunculus)+10);
+	WFIFOW(inter_fd,2) = sizeof(struct s_homunculus)+8;
+	WFIFOL(inter_fd,4) = account_id;
+	memcpy(WFIFOP(inter_fd,8),sh,sizeof(struct s_homunculus));
+	WFIFOSET(inter_fd, WFIFOW(inter_fd,2));
 	return 0;
 
 }

+ 0 - 7
src/map/mercenary.c

@@ -521,7 +521,6 @@ int merc_natural_heal(int tid,unsigned int tick,int id,int data)
 	return 0;
 }
 
-#ifndef TXT_ONLY
 void merc_save(struct homun_data *hd)
 {
 	// copy data that must be saved in homunculus struct ( hp / sp )
@@ -532,12 +531,6 @@ void merc_save(struct homun_data *hd)
 		sd->homunculus.sp = sd->homunculus.max_sp;
 	intif_homunculus_requestsave(sd->status.account_id, &sd->homunculus) ;
 }
-#else
-void merc_save(struct homun_data *hd)
-{
-	//Not implemented...
-}
-#endif
 
 static int merc_calc_pos(struct homun_data *hd,int tx,int ty,int dir)	//[orn]
 {

+ 12 - 10
src/map/status.c

@@ -351,7 +351,7 @@ void initChangeTables(void) {
 	set_sc(GS_MADNESSCANCEL, SC_MADNESSCANCEL, SI_MADNESSCANCEL, SCB_BATK|SCB_ASPD);
 	set_sc(GS_ADJUSTMENT, SC_ADJUSTMENT, SI_ADJUSTMENT, SCB_HIT|SCB_FLEE);
 	set_sc(GS_INCREASING, SC_INCREASING, SI_ACCURACY, SCB_AGI|SCB_DEX|SCB_HIT);
-	set_sc(GS_GATLINGFEVER, SC_GATLINGFEVER, SI_GATLINGFEVER, SCB_FLEE|SCB_SPEED|SCB_ASPD);
+	set_sc(GS_GATLINGFEVER, SC_GATLINGFEVER, SI_GATLINGFEVER, SCB_BATK|SCB_FLEE|SCB_SPEED|SCB_ASPD);
 	set_sc(NJ_TATAMIGAESHI, SC_TATAMIGAESHI, SI_BLANK, SCB_NONE);
 	set_sc(NJ_SUITON, SC_SUITON, SI_BLANK, SCB_AGI|SCB_SPEED);
 	add_sc(NJ_HYOUSYOURAKU, SC_FREEZE);
@@ -698,9 +698,13 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
 		skill_clear_unitgroup(target);
 	status_change_clear(target,0);
 
-	if(flag&2) //remove the unit from the map.
+	if(flag&4) //Delete from memory. (also invokes map removal code)
+		unit_free(target);
+	else
+	if(flag&2) //remove from map
 		unit_remove_map(target,1);
-	else { //These are handled by unit_remove_map.
+	else
+	{ //Some death states that would normally be handled by unit_remove_map
 		unit_stop_attack(target);
 		unit_stop_walking(target,0);
 		unit_skillcastcancel(target,0);
@@ -708,11 +712,6 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
 		skill_unit_move(target,gettick(),4);
 		skill_cleartimerskill(target);
 	}
-
-	if(flag&4) { //Delete from memory.
-		map_delblock(target);
-		unit_free(target);
-	}
 		
 	return hp+sp;
 }
@@ -3137,6 +3136,8 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan
 //Curse shouldn't effect on this?  <- Curse OR Bleeding??
 //	if(sc->data[SC_BLEEDING].timer != -1)
 //		batk -= batk * 25/100;
+	if(sc->data[SC_GATLINGFEVER].timer!=-1)
+		batk += sc->data[SC_GATLINGFEVER].val3;
 	if(sc->data[SC_MADNESSCANCEL].timer!=-1)
 		batk += 100;
 	return cap_value(batk,0,USHRT_MAX);
@@ -3280,7 +3281,7 @@ static signed short status_calc_flee(struct block_list *bl, struct status_change
 	if(sc->data[SC_ADJUSTMENT].timer!=-1)
 		flee += 30;
 	if(sc->data[SC_GATLINGFEVER].timer!=-1)
-		flee -= sc->data[SC_GATLINGFEVER].val1*5;
+		flee -= sc->data[SC_GATLINGFEVER].val4;
 	if(sc->data[SC_SPEED].timer!=-1)
 		flee += 10 + sc->data[SC_SPEED].val1 * 10 ;
 
@@ -5342,7 +5343,8 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 		// gs_something1 [Vicious]
 		case SC_GATLINGFEVER:
 			val2 = 20*val1; //Aspd increase
-			val3 = 5*val1; //Flee decrease
+			val3 = 20+10*val1; //Batk increase
+			val4 = 5*val1; //Flee decrease
 			break;
 
 		case SC_FLING: