Explorar o código

- Fixed some Homunc issues with HR servers (capping some values)
- Added @hominfo command to obtain real values (not capped ones)

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

toms %!s(int64=19) %!d(string=hai) anos
pai
achega
96c1fe1903
Modificáronse 5 ficheiros con 44 adicións e 12 borrados
  1. 3 1
      Changelog-Trunk.txt
  2. 30 0
      src/map/atcommand.c
  3. 1 0
      src/map/atcommand.h
  4. 2 2
      src/map/clif.c
  5. 8 9
      src/map/status.c

+ 3 - 1
Changelog-Trunk.txt

@@ -2,7 +2,9 @@ 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.
-
+2006/08/20
+	* Fixed some Homunc issues with HR servers (capping some values) [Toms]
+	* Added @hominfo command to obtain real values (not capped ones) [Toms]
 2006/08/19
 	* Fixed @homlvup bug [Toms]
 	* Fixed AM_REST & AM_RESU consumming SP if they fail [Toms]

+ 30 - 0
src/map/atcommand.c

@@ -309,6 +309,7 @@ ACMD_FUNC(makehomun);	//[orn]
 ACMD_FUNC(homfriendly);	//[orn]
 ACMD_FUNC(homhungry);	//[orn]
 ACMD_FUNC(homtalk);	//[orn]
+ACMD_FUNC(hominfo);	//[Toms]
 
 /*==========================================
  *AtCommandInfo atcommand_info[]�\‘¢‘̂̒è‹`
@@ -638,6 +639,7 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_HomFriendly,			"@homfriendly",		60, atcommand_homfriendly },
 	{ AtCommand_HomHungry,			"@homhungry",		60, atcommand_homhungry },
 	{ AtCommand_HomTalk,			"@homtalk",		0, atcommand_homtalk },
+	{ AtCommand_HomInfo,			"@hominfo",		0, atcommand_hominfo },
 
 // add new commands before this line
 	{ AtCommand_Unknown,			NULL,				 1, NULL }
@@ -9922,6 +9924,34 @@ int atcommand_homtalk(
 	return 0;
 }
 
+/*==========================================
+ * Show homunculus stats
+ *------------------------------------------
+ */
+int atcommand_hominfo(
+	const int fd, struct map_session_data* sd,
+	const char* command, const char* message)
+{
+
+	nullpo_retr(-1, sd);
+
+	if(!merc_is_hom_active(sd->hd))
+		return -1;
+
+	clif_displaymessage(fd, "Homunculus stats :");
+
+	snprintf(atcmd_output, sizeof(atcmd_output) ,"HP : %d/%d - SP : %d/%d", sd->hd->battle_status.hp, sd->hd->battle_status.max_hp, sd->hd->battle_status.sp, sd->hd->battle_status.max_sp);
+	clif_displaymessage(fd, atcmd_output);
+
+	snprintf(atcmd_output, sizeof(atcmd_output) ,"ATK : %d - MATK : %d~%d", sd->hd->battle_status.rhw.atk2+sd->hd->battle_status.batk, sd->hd->battle_status.matk_min, sd->hd->battle_status.matk_max);
+	clif_displaymessage(fd, atcmd_output);
+
+	snprintf(atcmd_output, sizeof(atcmd_output) ,"Hungry : %d - Intimacy : %d", sd->homunculus.hunger, sd->homunculus.intimacy);
+	clif_displaymessage(fd, atcmd_output);
+
+	return 0;
+}
+
 /*==========================================
  * Show Items DB Info   v 1.0
  * originally by [Lupus] eAthena

+ 1 - 0
src/map/atcommand.h

@@ -281,6 +281,7 @@ enum AtCommandType {
 	AtCommand_HomFriendly, //[orn]
 	AtCommand_HomHungry, //[orn]
 	AtCommand_HomTalk, //[orn]
+	AtCommand_HomInfo, //[Toms]
 	// end <- Ahem, guys, don't place AtCommands after AtCommand_Unknown! [Skotlex]
 	AtCommand_Unknown,
 	AtCommand_MAX

+ 2 - 2
src/map/clif.c

@@ -1473,8 +1473,8 @@ int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
 	WBUFW(buf,29)=sd->homunculus.hunger;
 	WBUFW(buf,31)=(unsigned short) (sd->homunculus.intimacy / 100) ;
 	WBUFW(buf,33)=0; // equip id
-	WBUFW(buf,35)=status->rhw.atk2+status->batk;
-	WBUFW(buf,37)=status->matk_max;
+	WBUFW(buf,35)=cap_value(status->rhw.atk2+status->batk, 0, SHRT_MAX);
+	WBUFW(buf,37)=cap_value(status->matk_max, 0, SHRT_MAX);
 	WBUFW(buf,39)=status->hit;
 	WBUFW(buf,41)=status->cri/10;	//crit is a +1 decimal value!
 	WBUFW(buf,43)=status->def + status->vit ;

+ 8 - 9
src/map/status.c

@@ -2206,12 +2206,12 @@ int status_calc_homunculus(struct homun_data *hd, int first)
 
 	status = &hd->base_status;
 	
-	status->str = (int) (hom->str / 10);
-	status->agi = (int) (hom->agi / 10);
-	status->vit = (int) (hom->vit / 10);
-	status->dex = (int) (hom->dex / 10);
-	status->int_ = (int) (hom->int_ / 10);
-	status->luk = (int) (hom->luk / 10);
+	status->str = hom->str / 10;
+	status->agi = hom->agi / 10;
+	status->vit = hom->vit / 10;
+	status->dex = hom->dex / 10;
+	status->int_ = hom->int_ / 10;
+	status->luk = hom->luk / 10;
 
 	status->def_ele =  hd->homunculusDB->element ;	//[orn]
 	status->ele_lv = 1;
@@ -2220,9 +2220,8 @@ int status_calc_homunculus(struct homun_data *hd, int first)
 	status->rhw.range = 1 + status->size;	//[orn]
 	status->mode = MD_CANMOVE|MD_CANATTACK|MD_ASSIST|MD_AGGRESSIVE|MD_CASTSENSOR;	//[orn]
 	status->speed = DEFAULT_WALK_SPEED;
-	status->aspd_rate = 1000;
-	status->def =	hom->level/10 + status->vit/5;
-	status->mdef =	hom->level/10 + status->int_/5;
+	status->def = cap_value(hom->level/10 + status->vit/5, 0, SCHAR_MAX);
+	status->mdef = cap_value(hom->level/10 + status->int_/5, 0, SCHAR_MAX);
 
 	status->hp = 1;
 	status->sp = 1;