mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Migrate doors [skip ci]
This commit is contained in:
parent
7c2a3f602c
commit
c98d2743c5
@ -1130,9 +1130,9 @@ uint32 Database::GetZoneID(const char* zonename) {
|
|||||||
if (zonename == nullptr)
|
if (zonename == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (auto iter = zonename_array.begin(); iter != zonename_array.end(); ++iter)
|
for (auto & iter : zonename_array)
|
||||||
if (strcasecmp(iter->second.c_str(), zonename) == 0)
|
if (strcasecmp(iter.second.c_str(), zonename) == 0)
|
||||||
return iter->first;
|
return iter.first;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,8 +83,8 @@ Doors::Doors(const char *model, const glm::vec4 &position, uint8 open_type, uint
|
|||||||
strn0cpy(door_name, model, 32);
|
strn0cpy(door_name, model, 32);
|
||||||
strn0cpy(destination_zone_name, "NONE", 32);
|
strn0cpy(destination_zone_name, "NONE", 32);
|
||||||
|
|
||||||
this->database_id = (uint32) database.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
this->database_id = (uint32) content_db.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
||||||
this->door_id = (uint8) database.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
this->door_id = (uint8) content_db.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
||||||
|
|
||||||
this->open_type = open_type;
|
this->open_type = open_type;
|
||||||
this->size = size;
|
this->size = size;
|
||||||
@ -451,7 +451,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
if (!disable_add_to_key_ring) {
|
if (!disable_add_to_key_ring) {
|
||||||
sender->KeyRingAdd(player_key);
|
sender->KeyRingAdd(player_key);
|
||||||
}
|
}
|
||||||
if (database.GetZoneID(destination_zone_name) == zone->GetZoneID()) {
|
if (content_db.GetZoneID(destination_zone_name) == zone->GetZoneID()) {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
zone->GetZoneID(),
|
zone->GetZoneID(),
|
||||||
zone->GetInstanceID(),
|
zone->GetInstanceID(),
|
||||||
@ -462,7 +462,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
database.GetZoneID(destination_zone_name),
|
content_db.GetZoneID(destination_zone_name),
|
||||||
static_cast<uint32>(destination_instance_id),
|
static_cast<uint32>(destination_instance_id),
|
||||||
m_Destination.x,
|
m_Destination.x,
|
||||||
m_Destination.y,
|
m_Destination.y,
|
||||||
@ -473,7 +473,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!IsDoorOpen() || open_type == 58) && (!required_key_item)) {
|
if ((!IsDoorOpen() || open_type == 58) && (!required_key_item)) {
|
||||||
if (database.GetZoneID(destination_zone_name) == zone->GetZoneID()) {
|
if (content_db.GetZoneID(destination_zone_name) == zone->GetZoneID()) {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
zone->GetZoneID(),
|
zone->GetZoneID(),
|
||||||
zone->GetInstanceID(),
|
zone->GetInstanceID(),
|
||||||
@ -484,7 +484,7 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
database.GetZoneID(destination_zone_name),
|
content_db.GetZoneID(destination_zone_name),
|
||||||
static_cast<uint32>(this->destination_instance_id),
|
static_cast<uint32>(this->destination_instance_id),
|
||||||
m_Destination.x,
|
m_Destination.x,
|
||||||
m_Destination.y,
|
m_Destination.y,
|
||||||
@ -820,14 +820,14 @@ void Doors::SetDisableTimer(bool flag) {
|
|||||||
|
|
||||||
void Doors::CreateDatabaseEntry()
|
void Doors::CreateDatabaseEntry()
|
||||||
{
|
{
|
||||||
if (database.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()) - 1 >= 255) {
|
if (content_db.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion()) - 1 >= 255) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist
|
* Persist
|
||||||
*/
|
*/
|
||||||
database.InsertDoor(
|
content_db.InsertDoor(
|
||||||
GetDoorDBID(),
|
GetDoorDBID(),
|
||||||
GetDoorID(),
|
GetDoorID(),
|
||||||
GetDoorName(),
|
GetDoorName(),
|
||||||
|
|||||||
@ -408,35 +408,3 @@ void Client::GuildChangeRank(const char* name, uint32 guild_id, uint32 oldrank,
|
|||||||
SendGuildMembers(guild_id, true);
|
SendGuildMembers(guild_id, true);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
bool ZoneDatabase::CheckGuildDoor(uint8 doorid, uint16 guild_id, const char* zone) {
|
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT guild FROM doors WHERE doorid = %i AND zone = '%s'",
|
|
||||||
doorid-128, zone);
|
|
||||||
auto results = QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (results.RowCount() != 1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto row = results.begin();
|
|
||||||
return atoi(row[0]) == guild_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ZoneDatabase::SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone) {
|
|
||||||
|
|
||||||
if (doorid > 127)
|
|
||||||
doorid = doorid - 128;
|
|
||||||
|
|
||||||
std::string query = StringFormat("UPDATE doors SET guild = %i WHERE (doorid=%i) AND (zone='%s')",
|
|
||||||
guild_id, doorid, zone);
|
|
||||||
auto results = QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (results.RowsAffected() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -743,7 +743,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version)
|
|||||||
LogInfo("Loading doors for [{}] ", zone);
|
LogInfo("Loading doors for [{}] ", zone);
|
||||||
|
|
||||||
uint32 maxid;
|
uint32 maxid;
|
||||||
int32 count = database.GetDoorsCount(&maxid, zone, version);
|
int32 count = content_db.GetDoorsCount(&maxid, zone, version);
|
||||||
if(count < 1) {
|
if(count < 1) {
|
||||||
LogInfo("No doors loaded");
|
LogInfo("No doors loaded");
|
||||||
return;
|
return;
|
||||||
@ -751,7 +751,7 @@ void Zone::LoadZoneDoors(const char* zone, int16 version)
|
|||||||
|
|
||||||
auto dlist = new Door[count];
|
auto dlist = new Door[count];
|
||||||
|
|
||||||
if(!database.LoadDoors(count, dlist, zone, version)) {
|
if(!content_db.LoadDoors(count, dlist, zone, version)) {
|
||||||
LogError("Failed to load doors");
|
LogError("Failed to load doors");
|
||||||
delete[] dlist;
|
delete[] dlist;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -503,8 +503,6 @@ public:
|
|||||||
bool DoorIsOpen(uint8 door_id,const char* zone_name);
|
bool DoorIsOpen(uint8 door_id,const char* zone_name);
|
||||||
void SetDoorPlace(uint8 value,uint8 door_id,const char* zone_name);
|
void SetDoorPlace(uint8 value,uint8 door_id,const char* zone_name);
|
||||||
bool LoadDoors(int32 door_count, Door *into, const char *zone_name, int16 version);
|
bool LoadDoors(int32 door_count, Door *into, const char *zone_name, int16 version);
|
||||||
bool CheckGuildDoor(uint8 doorid,uint16 guild_id, const char* zone);
|
|
||||||
bool SetGuildDoor(uint8 doorid,uint16 guild_id, const char* zone);
|
|
||||||
uint32 GetGuildEQID(uint32 guilddbid);
|
uint32 GetGuildEQID(uint32 guilddbid);
|
||||||
void UpdateDoorGuildID(int doorid, int guild_id);
|
void UpdateDoorGuildID(int doorid, int guild_id);
|
||||||
int32 GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version);
|
int32 GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user