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

Further expanded spawn_location_placement stat overrides

Devn00b преди 2 години
родител
ревизия
f52e5f59db
променени са 3 файла, в които са добавени 94 реда и са изтрити 11 реда
  1. 14 0
      EQ2/source/WorldServer/SpawnLists.h
  2. 20 6
      EQ2/source/WorldServer/WorldDatabase.cpp
  3. 60 5
      EQ2/source/WorldServer/zoneserver.cpp

+ 14 - 0
EQ2/source/WorldServer/SpawnLists.h

@@ -48,9 +48,23 @@ struct SpawnEntry{
 	int32	respawn;
 	int32	expire_time;
 	int32	expire_offset;
+	//devn00b: added spawn location overrides, added these to accomodate.
 	int32   lvl_override;
 	int32	hp_override;
 	int32   mp_override;
+	int32   str_override;
+	int32   sta_override;
+	int32   wis_override;
+	int32   int_override;
+	int32   agi_override;
+	int32	heat_override;
+	int32	cold_override;
+	int32	magic_override;
+	int32	mental_override;
+	int32	divine_override;
+	int32	disease_override;
+	int32	poison_override;
+	int32   difficulty_override; //aka EncounterLevel
 };
 class SpawnLocation{
 public:

+ 20 - 6
EQ2/source/WorldServer/WorldDatabase.cpp

@@ -3134,6 +3134,7 @@ int32 WorldDatabase::ProcessSpawnLocations(ZoneServer* zone, const char* sql_que
 				spawn_location = new SpawnLocation();
 			}
 			SpawnEntry* entry = new SpawnEntry;
+
 			spawn_location_id = atoul(row[0]);
 			entry->spawn_location_id = spawn_location_id;
 			entry->spawn_entry_id = atoul(row[1]);
@@ -3143,10 +3144,23 @@ int32 WorldDatabase::ProcessSpawnLocations(ZoneServer* zone, const char* sql_que
 			entry->respawn = atoul(row[11]);
 			entry->expire_time = atoul(row[14]);
 			entry->expire_offset = atoul(row[15]);
-			//devn00b add stat overrides
+			//devn00b add stat overrides. Just a slight increase in size. Used in ZoneServer::AddNPCSpawn.
 			entry->lvl_override = atoul(row[19]);
 			entry->hp_override = atoul(row[20]);
 			entry->mp_override = atoul(row[21]);
+			entry->str_override = atoul(row[22]);
+			entry->sta_override = atoul(row[23]);
+			entry->wis_override = atoul(row[24]);
+			entry->int_override = atoul(row[25]);
+			entry->agi_override = atoul(row[26]);
+			entry->heat_override = atoul(row[27]);
+			entry->cold_override = atoul(row[28]);
+			entry->magic_override = atoul(row[29]);
+			entry->mental_override = atoul(row[30]);
+			entry->divine_override = atoul(row[31]);
+			entry->disease_override = atoul(row[32]);
+			entry->poison_override = atoul(row[33]);
+			entry->difficulty_override = atoul(row[34]);
 			spawn_location->x = atof(row[2]);
 			spawn_location->y = atof(row[3]);
 			spawn_location->z = atof(row[4]);
@@ -3197,11 +3211,11 @@ void WorldDatabase::LoadSpawns(ZoneServer* zone)
 
 	LogWrite(SPAWN__TRACE, 0, "Spawn", "Enter LoadSpawns");
 
-	npcs = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_npcs sn where sn.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_NPC);
-	objects = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_objects so where so.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_OBJECT);
-	widgets = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_widgets sw where sw.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_WIDGET);
-	signs = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_signs ss where ss.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_SIGN);
-	ground_spawns = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_ground sg where sg.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_GROUNDSPAWN);
+	npcs = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_npcs sn where sn.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_NPC);
+	objects = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_objects so where so.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_OBJECT);
+	widgets = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_widgets sw where sw.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_WIDGET);
+	signs = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_signs ss where ss.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_SIGN);
+	ground_spawns = ProcessSpawnLocations(zone, "SELECT sln.id, sle.id, slp.x, slp.y, slp.z, slp.x_offset, slp.y_offset, slp.z_offset, slp.heading, sle.spawn_id, sle.spawnpercentage, slp.respawn, slp.grid_id, slp.id, slp.expire_timer, slp.expire_offset, slp.pitch, slp.roll, sle.condition, slp.lvl_override, slp.hp_override, slp.mp_override, slp.str_override, slp.sta_override, slp.wis_override, slp.int_override, slp.agi_override, slp.heat_override, slp.cold_override, slp.magic_override, slp.mental_override, slp.divine_override, slp.disease_override, slp.poison_override, difficulty_override FROM spawn_location_placement slp, spawn_location_name sln, spawn_location_entry sle, spawn_ground sg where sg.spawn_id = sle.spawn_id and sln.id = sle.spawn_location_id and sln.id = slp.spawn_location_id and slp.zone_id=%i ORDER BY sln.id, sle.id", SPAWN_ENTRY_TYPE_GROUNDSPAWN);
 	spawn_groups = LoadSpawnLocationGroups(zone);
 	spawn_group_associations = LoadSpawnLocationGroupAssociations(zone);
 	spawn_group_chances = LoadSpawnGroupChances(zone);

+ 60 - 5
EQ2/source/WorldServer/zoneserver.cpp

@@ -2587,20 +2587,75 @@ NPC* ZoneServer::AddNPCSpawn(SpawnLocation* spawnlocation, SpawnEntry* spawnentr
 	LogWrite(SPAWN__TRACE, 1, "Spawn", "Enter %s", __FUNCTION__);
 	NPC* npc = GetNewNPC(spawnentry->spawn_id);
 	if(npc && !npc->IsOmittedByDBFlag()){
+		InfoStruct* info = npc->GetInfoStruct();
 		DeterminePosition(spawnlocation, npc);
 		npc->SetDatabaseID(spawnentry->spawn_id);
 		npc->SetSpawnLocationID(spawnentry->spawn_location_id);
 		npc->SetSpawnEntryID(spawnentry->spawn_entry_id);
 		npc->SetRespawnTime(spawnentry->respawn);
 		npc->SetExpireTime(spawnentry->expire_time);
+
 		//devn00b add overrides for some spawns
-		if(spawnentry->hp_override > 0)
+		if(spawnentry->hp_override > 0){
 			npc->SetHP(spawnentry->hp_override);
-		if(spawnentry->lvl_override > 0)
+		}
+		if(spawnentry->lvl_override > 0){
 			npc->SetLevel(spawnentry->lvl_override);
-		if(spawnentry->mp_override > 0)
-			npc->SetPower(spawnentry->mp_override);
-
+		}
+		if(spawnentry->mp_override > 0){
+			npc->SetPower(spawnentry->mp_override); 
+		}
+		if(spawnentry->str_override > 0){
+			info->set_str_base(spawnentry->str_override);
+			info->set_str(spawnentry->str_override);
+		}
+		if(spawnentry->sta_override > 0){
+			info->set_sta_base(spawnentry->sta_override);
+			info->set_sta(spawnentry->sta_override);
+		}
+		if(spawnentry->wis_override > 0){
+			info->set_wis_base(spawnentry->wis_override);
+			info->set_wis(spawnentry->wis_override);
+		}
+		if(spawnentry->int_override > 0){
+			info->set_intel_base(spawnentry->int_override);
+			info->set_intel(spawnentry->int_override);
+		}		
+		if(spawnentry->agi_override > 0){
+			info->set_agi_base(spawnentry->agi_override);
+			info->set_agi(spawnentry->agi_override);
+		}				
+		if(spawnentry->heat_override > 0){
+			info->set_heat_base(spawnentry->heat_override);
+			info->set_heat(spawnentry->heat_override);
+		}	
+		if(spawnentry->cold_override > 0){
+			info->set_cold_base(spawnentry->cold_override);
+			info->set_cold(spawnentry->cold_override);
+		}		
+		if(spawnentry->magic_override > 0){
+			info->set_magic_base(spawnentry->magic_override);
+			info->set_magic(spawnentry->magic_override);
+		}
+		if(spawnentry->mental_override > 0){
+			info->set_mental_base(spawnentry->mental_override);
+			info->set_mental(spawnentry->mental_override);
+		}
+		if(spawnentry->divine_override > 0){
+			info->set_divine_base(spawnentry->divine_override);
+			info->set_divine(spawnentry->divine_override);
+		}
+		if(spawnentry->disease_override > 0){
+			info->set_disease_base(spawnentry->disease_override);
+			info->set_disease(spawnentry->disease_override);
+		}
+		if(spawnentry->poison_override > 0){
+			info->set_poison_base(spawnentry->poison_override);
+			info->set_poison(spawnentry->poison_override);
+		}
+		if(spawnentry->difficulty_override > 0){
+			npc->SetEncounterLevel(spawnentry->difficulty_override, 1);
+		}
 		if (spawnentry->expire_time > 0)
 			AddSpawnExpireTimer(npc, spawnentry->expire_time, spawnentry->expire_offset);
 		AddLoot(npc);