Browse Source

fix mobs not setting their start hp/power, oops

Emagi 6 months ago
parent
commit
4278a968c9

+ 2 - 0
EQ2/source/WorldServer/Bots/BotCommands.cpp

@@ -438,10 +438,12 @@ void Commands::Command_Bot_Create(Client* client, Seperator* sep) {
 			bot->size = 32;
 			if (bot->GetTotalHP() == 0) {
 				bot->SetTotalHP(25 * bot->GetLevel() + 1);
+				bot->SetTotalHPBaseInstance(bot->GetTotalHP());
 				bot->SetHP(25 * bot->GetLevel() + 1);
 			}
 			if (bot->GetTotalPower() == 0) {
 				bot->SetTotalPower(25 * bot->GetLevel() + 1);
+				bot->SetTotalPowerBaseInstance(bot->GetTotalPower());
 				bot->SetPower(25 * bot->GetLevel() + 1);
 			}
 			bot->SetOwner(client->GetPlayer());

+ 3 - 1
EQ2/source/WorldServer/NPC.cpp

@@ -78,7 +78,9 @@ NPC::NPC(NPC* old_npc){
 			SetLevel(appearance.min_level + rand()%((appearance.max_level - appearance.min_level)+1));
 		target = 0;
 		SetTotalHPBase(old_npc->GetTotalHPBase());
-		SetTotalPowerBase(old_npc->GetTotalPowerBase());		
+		SetTotalHPBaseInstance(old_npc->GetTotalHPBase());
+		SetTotalPowerBase(old_npc->GetTotalPowerBase());	
+		SetTotalPowerBaseInstance(old_npc->GetTotalPowerBase());	
 		faction_id = old_npc->faction_id;
 		movement_interrupted = false;
 		old_npc->SetQuestsRequired(this);

+ 6 - 2
EQ2/source/WorldServer/Spawn.cpp

@@ -1448,8 +1448,10 @@ void Spawn::SetHP(sint32 new_val, bool setUpdateFlags){
 	}
 }
 void Spawn::SetTotalHP(sint32 new_val){
-	if(basic_info.hp_base == 0)
+	if(basic_info.hp_base == 0) {
 		SetTotalHPBase(new_val);
+		SetTotalHPBaseInstance(new_val);
+	}
 	SetInfo(&basic_info.max_hp, new_val);
 
 	if(GetZone() && basic_info.cur_hp > 0 && basic_info.cur_hp < basic_info.max_hp)
@@ -1534,8 +1536,10 @@ void Spawn::SetPower(sint32 power, bool setUpdateFlags){
 }
 void Spawn::SetTotalPower(sint32 new_val)
 {
-	if(basic_info.power_base == 0)
+	if(basic_info.power_base == 0) {
 		SetTotalPowerBase(new_val);
+		SetTotalPowerBaseInstance(new_val);
+	}
 	SetInfo(&basic_info.max_power, new_val);
 
 	if(GetZone() && basic_info.cur_power < basic_info.max_power)

+ 2 - 0
EQ2/source/WorldServer/WorldDatabase.cpp

@@ -1023,7 +1023,9 @@ void WorldDatabase::LoadNPCs(ZoneServer* zone){
 		npc->appearance.hide_hood = atoi(row[70]);
 		npc->appearance.randomize = atoi(row[61]);
 		npc->SetTotalHP(atoul(row[26]));
+		npc->SetTotalHPBaseInstance(atoul(row[26]));
 		npc->SetTotalPower(atoul(row[27]));
+		npc->SetTotalPowerBaseInstance(atoul(row[27]));
 		npc->SetHP(npc->GetTotalHP());
 		npc->SetPower(npc->GetTotalPower());
 		if(npc->GetTotalHP() == 0){

+ 2 - 0
EQ2/source/WorldServer/client.cpp

@@ -5045,7 +5045,9 @@ void Client::ChangeLevel(int16 old_level, int16 new_level) {
 	LogWrite(MISC__TODO, 1, "TODO", "Get new HP/POWER/stat based on default values from DB\n\t(%s, function: %s, line #: %i)", __FILE__, __FUNCTION__, __LINE__);
 
 	GetPlayer()->SetTotalHPBase(new_level * new_level * 2 + 40);
+	GetPlayer()->SetTotalHPBaseInstance(GetPlayer()->GetTotalHPBaseInstance());
 	GetPlayer()->SetTotalPowerBase((sint32)(new_level * new_level * 2.1 + 45));
+	GetPlayer()->SetTotalPowerBaseInstance(GetPlayer()->GetTotalPowerBaseInstance());
 	GetPlayer()->CalculateBonuses();
 	GetPlayer()->SetHP(GetPlayer()->GetTotalHP());
 	GetPlayer()->SetPower(GetPlayer()->GetTotalPower());