mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 08:11:30 +00:00
[Cleanup] Cleanup #door Command. (#2783)
* [Cleanup] Cleanup #door Command. # Notes - Resolves an issue with `.1` versus `0.1`. - Resolves an issue with updating a pre-existing door. - Adds `heading` to the update/insert. * Update doors.cpp
This commit is contained in:
parent
08c8393988
commit
bf39a0540c
@ -802,20 +802,75 @@ void Doors::CreateDatabaseEntry()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
content_db.InsertDoor(
|
const auto& l = DoorsRepository::GetWhere(
|
||||||
GetDoorDBID(),
|
content_db,
|
||||||
GetDoorID(),
|
fmt::format(
|
||||||
GetDoorName(),
|
"zone = '{}' AND doorid = {}",
|
||||||
m_position,
|
zone->GetShortName(),
|
||||||
GetOpenType(),
|
GetDoorID()
|
||||||
static_cast<uint16>(GetGuildID()),
|
)
|
||||||
GetLockpick(),
|
|
||||||
GetKeyItem(),
|
|
||||||
static_cast<uint8>(GetDoorParam()),
|
|
||||||
static_cast<uint8>(GetInvertState()),
|
|
||||||
GetIncline(),
|
|
||||||
GetSize()
|
|
||||||
);
|
);
|
||||||
|
if (!l.empty()) {
|
||||||
|
auto e = l[0];
|
||||||
|
|
||||||
|
e.name = GetDoorName();
|
||||||
|
e.pos_x = GetX();
|
||||||
|
e.pos_y = GetY();
|
||||||
|
e.pos_z = GetZ();
|
||||||
|
e.heading = GetHeading();
|
||||||
|
e.opentype = GetOpenType();
|
||||||
|
e.guild = static_cast<uint16>(GetGuildID());
|
||||||
|
e.lockpick = GetLockpick();
|
||||||
|
e.keyitem = GetKeyItem();
|
||||||
|
e.door_param = static_cast<uint8>(GetDoorParam());
|
||||||
|
e.invert_state = static_cast<uint8>(GetInvertState());
|
||||||
|
e.incline = GetIncline();
|
||||||
|
e.size = GetSize();
|
||||||
|
|
||||||
|
auto updated = DoorsRepository::UpdateOne(content_db, e);
|
||||||
|
if (!updated) {
|
||||||
|
LogError(
|
||||||
|
"Failed to update door in Zone [{}] Version [{}] Database ID [{}] ID [{}]",
|
||||||
|
zone->GetShortName(),
|
||||||
|
zone->GetInstanceVersion(),
|
||||||
|
GetDoorDBID(),
|
||||||
|
GetDoorID()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto e = DoorsRepository::NewEntity();
|
||||||
|
|
||||||
|
e.id = GetDoorDBID();
|
||||||
|
e.doorid = GetDoorID();
|
||||||
|
e.zone = zone->GetShortName();
|
||||||
|
e.version = zone->GetInstanceVersion();
|
||||||
|
e.name = GetDoorName();
|
||||||
|
e.pos_x = GetX();
|
||||||
|
e.pos_y = GetY();
|
||||||
|
e.pos_z = GetZ();
|
||||||
|
e.heading = GetHeading();
|
||||||
|
e.opentype = GetOpenType();
|
||||||
|
e.guild = static_cast<uint16>(GetGuildID());
|
||||||
|
e.lockpick = GetLockpick();
|
||||||
|
e.keyitem = GetKeyItem();
|
||||||
|
e.door_param = static_cast<uint8>(GetDoorParam());
|
||||||
|
e.invert_state = static_cast<uint8>(GetInvertState());
|
||||||
|
e.incline = GetIncline();
|
||||||
|
e.size = GetSize();
|
||||||
|
|
||||||
|
const auto& n = DoorsRepository::InsertOne(content_db, e);
|
||||||
|
if (!n.id) {
|
||||||
|
LogError(
|
||||||
|
"Failed to create door in Zone [{}] Version [{}] Database ID [{}] ID [{}]",
|
||||||
|
zone->GetShortName(),
|
||||||
|
zone->GetInstanceVersion(),
|
||||||
|
GetDoorDBID(),
|
||||||
|
GetDoorID()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Doors::GetX()
|
float Doors::GetX()
|
||||||
@ -832,3 +887,8 @@ float Doors::GetZ()
|
|||||||
{
|
{
|
||||||
return m_position.z;
|
return m_position.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Doors::GetHeading()
|
||||||
|
{
|
||||||
|
return m_position.w;
|
||||||
|
}
|
||||||
|
|||||||
@ -65,6 +65,7 @@ public:
|
|||||||
float GetX();
|
float GetX();
|
||||||
float GetY();
|
float GetY();
|
||||||
float GetZ();
|
float GetZ();
|
||||||
|
float GetHeading();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@ -187,7 +187,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
std::vector<std::string> set_size_options_negative;
|
std::vector<std::string> set_size_options_negative;
|
||||||
|
|
||||||
std::vector<std::string> xyz_values = {
|
std::vector<std::string> xyz_values = {
|
||||||
".1", "1", "5", "10", "25", "50", "100"
|
"0.1", "1", "5", "10", "25", "50", "100"
|
||||||
};
|
};
|
||||||
|
|
||||||
// build positive options x/y/z
|
// build positive options x/y/z
|
||||||
|
|||||||
@ -3075,53 +3075,6 @@ void ZoneDatabase::QGlobalPurge()
|
|||||||
database.QueryDatabase(query);
|
database.QueryDatabase(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneDatabase::InsertDoor(
|
|
||||||
uint32 database_id,
|
|
||||||
uint8 id,
|
|
||||||
std::string name,
|
|
||||||
const glm::vec4 &position,
|
|
||||||
uint8 open_type,
|
|
||||||
uint16 guild_id,
|
|
||||||
uint32 lockpick,
|
|
||||||
uint32 key_item_id,
|
|
||||||
uint8 door_param,
|
|
||||||
uint8 invert,
|
|
||||||
int incline,
|
|
||||||
uint16 size,
|
|
||||||
bool disable_timer
|
|
||||||
) {
|
|
||||||
auto e = DoorsRepository::NewEntity();
|
|
||||||
|
|
||||||
e.id = database_id;
|
|
||||||
e.doorid = id;
|
|
||||||
e.zone = zone->GetShortName();
|
|
||||||
e.version = zone->GetInstanceVersion();
|
|
||||||
e.name = name;
|
|
||||||
e.pos_x = position.x;
|
|
||||||
e.pos_y = position.y;
|
|
||||||
e.pos_z = position.z;
|
|
||||||
e.opentype = open_type;
|
|
||||||
e.guild = guild_id;
|
|
||||||
e.lockpick = lockpick;
|
|
||||||
e.keyitem = key_item_id;
|
|
||||||
e.disable_timer = static_cast<int8_t>(disable_timer);
|
|
||||||
e.door_param = door_param;
|
|
||||||
e.invert_state = invert;
|
|
||||||
e.incline = incline;
|
|
||||||
e.size = size;
|
|
||||||
|
|
||||||
const auto& n = DoorsRepository::InsertOne(*this, e);
|
|
||||||
if (!n.id) {
|
|
||||||
LogError(
|
|
||||||
"Failed to create door in Zone [{}] Version [{}] Database ID [{}] ID [{}]",
|
|
||||||
zone->GetShortName(),
|
|
||||||
zone->GetInstanceVersion(),
|
|
||||||
database_id,
|
|
||||||
id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> ¤cy) {
|
void ZoneDatabase::LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> ¤cy) {
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT currency_id, amount "
|
std::string query = StringFormat("SELECT currency_id, amount "
|
||||||
|
|||||||
@ -570,21 +570,6 @@ public:
|
|||||||
std::vector<DoorsRepository::Doors> LoadDoors(const std::string& zone_name, int16 version);
|
std::vector<DoorsRepository::Doors> LoadDoors(const std::string& zone_name, int16 version);
|
||||||
uint32 GetDoorsCountPlusOne();
|
uint32 GetDoorsCountPlusOne();
|
||||||
int GetDoorsDBCountPlusOne(std::string zone_short_name, int16 version);
|
int GetDoorsDBCountPlusOne(std::string zone_short_name, int16 version);
|
||||||
void InsertDoor(
|
|
||||||
uint32 database_id,
|
|
||||||
uint8 id,
|
|
||||||
std::string name,
|
|
||||||
const glm::vec4 &position,
|
|
||||||
uint8 open_type,
|
|
||||||
uint16 guild_id,
|
|
||||||
uint32 ockpick,
|
|
||||||
uint32 key_item_id,
|
|
||||||
uint8 door_param,
|
|
||||||
uint8 invert,
|
|
||||||
int incline,
|
|
||||||
uint16 size,
|
|
||||||
bool disable_timer = false
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Blocked Spells */
|
/* Blocked Spells */
|
||||||
int32 GetBlockedSpellsCount(uint32 zoneid);
|
int32 GetBlockedSpellsCount(uint32 zoneid);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user