Jump to content
  • 0

Modify Change Race (bonus_bRace)


Louis T Steinhil

Question


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  95
  • Reputation:   12
  • Joined:  06/22/13
  • Last Seen:  

Good day I would like to ask on how to add this 

* Monster Race (mr)
	RC2_Goblin, RC2_Kobold, RC2_Orc, RC2_Golem, RC2_Guardian, RC2_Ninja, RC2_GVG, RC2_Battlefield,
	RC2_Treasure, RC2_BioLab, RC2_Manuk, RC2_Splendide, RC2_Scaraba, RC2_OGH_ATK_DEF, RC2_OGH_Hidden,
	RC2_Bio5_Swordman_Thief, RC2_Bio5_Acolyte_Merchant, RC2_Bio5_Mage_Archer, RC2_Bio5_MVP,
	RC2_Clocktower, RC2_Thanatos, RC2_Faceworm, RC2_Hearthunter, RC2_Rockridge, RC2_Werner_Lab,
	RC2_Temple_Demon, RC2_Illusion_Vampire, RC2_Malangdo, RC2_EP172ALPHA, RC2_EP172BETA, RC2_EP172BATH,
	RC2_Illusion_Turtle, RC2_Rachel_Sanctuary, RC2_Illusion_Luanda

into this patch that was available and made Cydh public.

doc/item_bonus.txt           | 1 +
 src/map/map.hpp              | 1 +
 src/map/pc.cpp               | 4 ++++
 src/map/pc.hpp               | 1 +
 src/map/script_constants.hpp | 1 +
 src/map/status.cpp           | 5 +++++
 6 files changed, 13 insertions(+)

diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt
index 7ffe172b5..08ef4a571 100644
--- a/doc/item_bonus.txt
+++ b/doc/item_bonus.txt
@@ -260,6 +260,7 @@ Atk/Def
 -------
 bonus bAtkEle,e;          		Gives the player's attacks element e
 bonus bDefEle,e;          		Gives the player's defense element e
+bonus bRace,r;          		Set the player's race to race r
 
 bonus2 bMagicAtkEle,e,x;  		Increases damage of e element magic by x%
 
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 5200ff6b4..44073fbb2 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -429,6 +429,7 @@ enum _sp {
 
 	// Mercenaries
 	SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,
+	SP_RACE,
 
 	// original 1000-
 	SP_ATTACKRANGE=1000,	SP_ATKELE,SP_DEFELE,	// 1000-1002
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index ab1040eca..be3d1cdee 100755
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -3217,6 +3217,10 @@ void pc_bonus(struct map_session_data *sd,int type,int val)
 			if (sd->state.lr_flag != 2)
 				sd->special_state.no_mado_fuel = 1;
 			break;
+		case SP_RACE:
+			PC_BONUS_CHK_RACE(val, SP_RACE);
+			sd->bonus.change_race = (enum e_race)val;
+			break;
 		default:
 			if (running_npc_stat_calc_event) {
 				ShowWarning("pc_bonus: unknown bonus type %d %d in OnPCStatCalcEvent!\n", type, val);
diff --git a/src/map/pc.hpp b/src/map/pc.hpp
index 05e861c64..dfebca1d9 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -497,6 +497,7 @@ struct map_session_data {
 		int ematk; // matk bonus from equipment
 		int eatk; // atk bonus from equipment
 		uint8 absorb_dmg_maxhp; // [Cydh]
+		enum e_race change_race;
 		short critical_rangeatk;
 		short weapon_atk_rate, weapon_matk_rate;
 	} bonus;
diff --git a/src/map/script_constants.hpp b/src/map/script_constants.hpp
index 5d5066a4e..2c8a2f0e9 100644
--- a/src/map/script_constants.hpp
+++ b/src/map/script_constants.hpp
@@ -731,6 +731,7 @@
 	export_constant2("bRegenPercentHP", SP_REGEN_PERCENT_HP);
 	export_constant2("bRegenPercentSP", SP_REGEN_PERCENT_SP);
 	export_constant2("bSkillDelay",SP_SKILL_DELAY);
+	export_constant2("bRace", SP_RACE);
 
 	/* equip indices */
 	export_constant(EQI_COMPOUND_ON);
diff --git a/src/map/status.cpp b/src/map/status.cpp
index d08be8e81..67546d1c2 100644
--- a/src/map/status.cpp
+++ b/src/map/status.cpp
@@ -3495,6 +3495,7 @@ int status_calc_pc_sub(struct map_session_data* sd, enum e_status_calc_opt opt)
 	);
 
 	memset (&sd->bonus, 0, sizeof(sd->bonus));
+	sd->bonus.change_race = RC_NONE_;
 
 	// Autobonus
 	pc_delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true);
@@ -4208,6 +4209,10 @@ int status_calc_pc_sub(struct map_session_data* sd, enum e_status_calc_opt opt)
 		if (sc->data[SC_LAUDARAMUS])
 			sd->bonus.crit_atk_rate += 5 * sc->data[SC_LAUDARAMUS]->val1;
 	}
+
+	if (sd->bonus.change_race != RC_NONE_)
+		base_status->race = sd->bonus.change_race;
+
 	status_cpy(&sd->battle_status, base_status);
 
 // ----- CLIENT-SIDE REFRESH -----


This code is working and I would just like to add it from these choices:
 

* Race (r)
	RC_Angel, RC_Brute, RC_DemiHuman, RC_Demon, RC_Dragon, RC_Fish, RC_Formless,
	RC_Insect, RC_Plant, RC_Player_Human (RC_Player deprecated), RC_Player_Doram, RC_Undead, RC_All


Thanks in advance!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  95
  • Reputation:   12
  • Joined:  06/22/13
  • Last Seen:  

SOLVED

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...