mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
[Ground Spawns] Convert Ground Spawns to Repositories (#3967)
# Notes - Convert `LoadGroundSpawns()` to repositories.
This commit is contained in:
parent
71f78b757e
commit
eb33e5a064
@ -3445,7 +3445,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
|||||||
uint32 min_dmg;
|
uint32 min_dmg;
|
||||||
uint32 max_dmg;
|
uint32 max_dmg;
|
||||||
};
|
};
|
||||||
struct Ground_Spawn{
|
struct GroundSpawn{
|
||||||
float max_x;
|
float max_x;
|
||||||
float max_y;
|
float max_y;
|
||||||
float min_x;
|
float min_x;
|
||||||
@ -3457,8 +3457,8 @@ struct Ground_Spawn{
|
|||||||
uint32 max_allowed;
|
uint32 max_allowed;
|
||||||
uint32 respawntimer;
|
uint32 respawntimer;
|
||||||
};
|
};
|
||||||
struct Ground_Spawns {
|
struct GroundSpawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct PetitionBug_Struct{
|
//struct PetitionBug_Struct{
|
||||||
|
|||||||
@ -3619,7 +3619,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
|||||||
uint32 min_dmg;
|
uint32 min_dmg;
|
||||||
uint32 max_dmg;
|
uint32 max_dmg;
|
||||||
};
|
};
|
||||||
struct Ground_Spawn{
|
struct GroundSpawn{
|
||||||
float max_x;
|
float max_x;
|
||||||
float max_y;
|
float max_y;
|
||||||
float min_x;
|
float min_x;
|
||||||
@ -3631,8 +3631,8 @@ struct Ground_Spawn{
|
|||||||
uint32 max_allowed;
|
uint32 max_allowed;
|
||||||
uint32 respawntimer;
|
uint32 respawntimer;
|
||||||
};
|
};
|
||||||
struct Ground_Spawns {
|
struct GroundSpawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct PetitionBug_Struct{
|
//struct PetitionBug_Struct{
|
||||||
|
|||||||
@ -3556,7 +3556,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
|||||||
uint32 min_dmg;
|
uint32 min_dmg;
|
||||||
uint32 max_dmg;
|
uint32 max_dmg;
|
||||||
};
|
};
|
||||||
struct Ground_Spawn{
|
struct GroundSpawn{
|
||||||
float max_x;
|
float max_x;
|
||||||
float max_y;
|
float max_y;
|
||||||
float min_x;
|
float min_x;
|
||||||
@ -3568,8 +3568,8 @@ struct Ground_Spawn{
|
|||||||
uint32 max_allowed;
|
uint32 max_allowed;
|
||||||
uint32 respawntimer;
|
uint32 respawntimer;
|
||||||
};
|
};
|
||||||
struct Ground_Spawns {
|
struct GroundSpawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct PetitionBug_Struct{
|
//struct PetitionBug_Struct{
|
||||||
|
|||||||
@ -3026,7 +3026,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
|||||||
uint32 min_dmg;
|
uint32 min_dmg;
|
||||||
uint32 max_dmg;
|
uint32 max_dmg;
|
||||||
};
|
};
|
||||||
struct Ground_Spawn{
|
struct GroundSpawn{
|
||||||
float max_x;
|
float max_x;
|
||||||
float max_y;
|
float max_y;
|
||||||
float min_x;
|
float min_x;
|
||||||
@ -3038,8 +3038,8 @@ struct Ground_Spawn{
|
|||||||
uint32 max_allowed;
|
uint32 max_allowed;
|
||||||
uint32 respawntimer;
|
uint32 respawntimer;
|
||||||
};
|
};
|
||||||
struct Ground_Spawns {
|
struct GroundSpawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct PetitionBug_Struct{
|
//struct PetitionBug_Struct{
|
||||||
|
|||||||
@ -2951,7 +2951,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
|||||||
uint32 min_dmg;
|
uint32 min_dmg;
|
||||||
uint32 max_dmg;
|
uint32 max_dmg;
|
||||||
};
|
};
|
||||||
struct Ground_Spawn{
|
struct GroundSpawn{
|
||||||
float max_x;
|
float max_x;
|
||||||
float max_y;
|
float max_y;
|
||||||
float min_x;
|
float min_x;
|
||||||
@ -2963,8 +2963,8 @@ struct Ground_Spawn{
|
|||||||
uint32 max_allowed;
|
uint32 max_allowed;
|
||||||
uint32 respawntimer;
|
uint32 respawntimer;
|
||||||
};
|
};
|
||||||
struct Ground_Spawns {
|
struct GroundSpawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct PetitionBug_Struct{
|
//struct PetitionBug_Struct{
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@ -2604,7 +2604,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
|||||||
uint32 min_dmg;
|
uint32 min_dmg;
|
||||||
uint32 max_dmg;
|
uint32 max_dmg;
|
||||||
};
|
};
|
||||||
struct Ground_Spawn{
|
struct GroundSpawn{
|
||||||
float max_x;
|
float max_x;
|
||||||
float max_y;
|
float max_y;
|
||||||
float min_x;
|
float min_x;
|
||||||
@ -2616,8 +2616,8 @@ struct Ground_Spawn{
|
|||||||
uint32 max_allowed;
|
uint32 max_allowed;
|
||||||
uint32 respawntimer;
|
uint32 respawntimer;
|
||||||
};
|
};
|
||||||
struct Ground_Spawns {
|
struct GroundSpawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct PetitionBug_Struct{
|
//struct PetitionBug_Struct{
|
||||||
|
|||||||
@ -3078,7 +3078,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
|||||||
uint32 min_dmg;
|
uint32 min_dmg;
|
||||||
uint32 max_dmg;
|
uint32 max_dmg;
|
||||||
};
|
};
|
||||||
struct Ground_Spawn{
|
struct GroundSpawn{
|
||||||
float max_x;
|
float max_x;
|
||||||
float max_y;
|
float max_y;
|
||||||
float min_x;
|
float min_x;
|
||||||
@ -3090,8 +3090,8 @@ struct Ground_Spawn{
|
|||||||
uint32 max_allowed;
|
uint32 max_allowed;
|
||||||
uint32 respawntimer;
|
uint32 respawntimer;
|
||||||
};
|
};
|
||||||
struct Ground_Spawns {
|
struct GroundSpawns {
|
||||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||||
};
|
};
|
||||||
|
|
||||||
//struct PetitionBug_Struct{
|
//struct PetitionBug_Struct{
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
#include "zonedb.h"
|
#include "zonedb.h"
|
||||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||||
#include "../common/events/player_event_logs.h"
|
#include "../common/events/player_event_logs.h"
|
||||||
|
#include "../common/repositories/ground_spawns_repository.h"
|
||||||
|
|
||||||
|
|
||||||
const char DEFAULT_OBJECT_NAME[] = "IT63_ACTORDEF";
|
const char DEFAULT_OBJECT_NAME[] = "IT63_ACTORDEF";
|
||||||
@ -748,39 +749,44 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
GroundSpawns* ZoneDatabase::LoadGroundSpawns(
|
||||||
Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs) {
|
uint32 zone_id,
|
||||||
|
int16 instance_version,
|
||||||
std::string query = StringFormat(
|
GroundSpawns* gs
|
||||||
"SELECT max_x, max_y, max_z, "
|
)
|
||||||
"min_x, min_y, heading, name, "
|
{
|
||||||
"item, max_allowed, respawn_timer "
|
const auto& l = GroundSpawnsRepository::GetWhere(
|
||||||
"FROM ground_spawns "
|
*this,
|
||||||
"WHERE zoneid = %i AND (version = %u OR version = -1) %s "
|
fmt::format(
|
||||||
"LIMIT 50",
|
"`zoneid` = {} AND (`version` = {} OR `version` = -1) {} LIMIT 50",
|
||||||
zone_id,
|
zone_id,
|
||||||
version,
|
instance_version,
|
||||||
ContentFilterCriteria::apply().c_str()
|
ContentFilterCriteria::apply()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
if (l.empty()) {
|
||||||
if (!results.Success()) {
|
|
||||||
return gs;
|
return gs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spawnIndex=0;
|
uint32 slot_id = 0;
|
||||||
for (auto row = results.begin(); row != results.end(); ++row, ++spawnIndex) {
|
|
||||||
gs->spawn[spawnIndex].max_x=Strings::ToFloat(row[0]);
|
for (const auto& e : l) {
|
||||||
gs->spawn[spawnIndex].max_y=Strings::ToFloat(row[1]);
|
strcpy(gs->spawn[slot_id].name, e.name.c_str());
|
||||||
gs->spawn[spawnIndex].max_z=Strings::ToFloat(row[2]);
|
|
||||||
gs->spawn[spawnIndex].min_x=Strings::ToFloat(row[3]);
|
gs->spawn[slot_id].max_x = e.max_x;
|
||||||
gs->spawn[spawnIndex].min_y=Strings::ToFloat(row[4]);
|
gs->spawn[slot_id].max_y = e.max_y;
|
||||||
gs->spawn[spawnIndex].heading=Strings::ToFloat(row[5]);
|
gs->spawn[slot_id].max_z = e.max_z;
|
||||||
strcpy(gs->spawn[spawnIndex].name,row[6]);
|
gs->spawn[slot_id].min_x = e.min_x;
|
||||||
gs->spawn[spawnIndex].item=Strings::ToInt(row[7]);
|
gs->spawn[slot_id].min_y = e.min_y;
|
||||||
gs->spawn[spawnIndex].max_allowed=Strings::ToInt(row[8]);
|
gs->spawn[slot_id].heading = e.heading;
|
||||||
gs->spawn[spawnIndex].respawntimer=Strings::ToInt(row[9]);
|
gs->spawn[slot_id].item = e.item;
|
||||||
}
|
gs->spawn[slot_id].max_allowed = e.max_allowed;
|
||||||
|
gs->spawn[slot_id].respawntimer = e.respawn_timer;
|
||||||
|
|
||||||
|
slot_id++;
|
||||||
|
}
|
||||||
|
|
||||||
return gs;
|
return gs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -349,7 +349,7 @@ bool Zone::IsSpecialBindLocation(const glm::vec4& location)
|
|||||||
|
|
||||||
//this also just loads into entity_list, not really into zone
|
//this also just loads into entity_list, not really into zone
|
||||||
bool Zone::LoadGroundSpawns() {
|
bool Zone::LoadGroundSpawns() {
|
||||||
Ground_Spawns groundspawn;
|
GroundSpawns groundspawn;
|
||||||
|
|
||||||
memset(&groundspawn, 0, sizeof(groundspawn));
|
memset(&groundspawn, 0, sizeof(groundspawn));
|
||||||
int gsindex=0;
|
int gsindex=0;
|
||||||
|
|||||||
@ -381,7 +381,7 @@ public:
|
|||||||
uint32 AddObject(uint32 type, uint32 icon, const Object_Struct& object, const EQ::ItemInstance* inst);
|
uint32 AddObject(uint32 type, uint32 icon, const Object_Struct& object, const EQ::ItemInstance* inst);
|
||||||
void UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const EQ::ItemInstance* inst);
|
void UpdateObject(uint32 id, uint32 type, uint32 icon, const Object_Struct& object, const EQ::ItemInstance* inst);
|
||||||
void DeleteObject(uint32 id);
|
void DeleteObject(uint32 id);
|
||||||
Ground_Spawns* LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs);
|
GroundSpawns* LoadGroundSpawns(uint32 zone_id, int16 instance_version, GroundSpawns* gs);
|
||||||
|
|
||||||
/* Traders */
|
/* Traders */
|
||||||
void SaveTraderItem(uint32 char_id,uint32 itemid,uint32 uniqueid, int32 charges,uint32 itemcost,uint8 slot);
|
void SaveTraderItem(uint32 char_id,uint32 itemid,uint32 uniqueid, int32 charges,uint32 itemcost,uint8 slot);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user