Skip to content

Commit b03f52d

Browse files
authored
[Commands] Cleanup #object Command (#3722)
* [Commands] Cleanup #object Command # Notes - Cleanup messages and logic. - Introduce enum for object types. - Set ground work for object manipulation similar to door manipulation. * Update object_manipulation.cpp * Final push * Update client_packet.cpp * Update object_manipulation.cpp * Update object_manipulation.cpp * Update object.h * Update client_packet.cpp * Update client_packet.cpp * Push. * Update version.h * Update database_update_manifest.cpp * Update zone.cpp
1 parent 226cc3d commit b03f52d

15 files changed

+1562
-1395
lines changed

common/database/database_update_manifest.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -5093,6 +5093,19 @@ RENAME TABLE `starting_items_new` TO `starting_items`;
50935093
.sql = R"(
50945094
ALTER TABLE `items` MODIFY COLUMN `updated` datetime NULL DEFAULT NULL;
50955095
)"
5096+
},
5097+
ManifestEntry{
5098+
.version = 9245,
5099+
.description = "2023_12_03_object_incline.sql",
5100+
.check = "SHOW COLUMNS FROM `object` LIKE 'incline'",
5101+
.condition = "empty",
5102+
.match = "",
5103+
.sql = R"(
5104+
ALTER TABLE `object`
5105+
CHANGE COLUMN `unknown08` `size_percentage` float NOT NULL DEFAULT 0 AFTER `icon`;
5106+
CHANGE COLUMN `unknown10` `solid_type` mediumint(5) NOT NULL DEFAULT 0 AFTER `size`,
5107+
CHANGE COLUMN `unknown20` `incline` int(11) NOT NULL DEFAULT 0 AFTER `solid_type`;
5108+
)"
50965109
}
50975110

50985111
// -- template; copy/paste this when you need to create a new entry

common/eq_packet_structs.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2594,11 +2594,11 @@ struct BookButton_Struct
25942594
struct Object_Struct {
25952595
/*00*/ uint32 linked_list_addr[2];// They are, get this, prev and next, ala linked list
25962596
/*08*/ float size; //
2597-
/*10*/ uint16 solidtype; //
2597+
/*10*/ uint16 solid_type; //
25982598
/*12*/ uint32 drop_id; // Unique object id for zone
25992599
/*16*/ uint16 zone_id; // Redudant, but: Zone the object appears in
26002600
/*18*/ uint16 zone_instance; //
2601-
/*20*/ uint32 unknown020; //
2601+
/*20*/ uint32 incline; //
26022602
/*24*/ uint32 unknown024; //
26032603
/*28*/ float tilt_x;
26042604
/*32*/ float tilt_y;

common/repositories/base/base_object_repository.h

+33-31
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "../../strings.h"
1717
#include <ctime>
1818

19+
1920
class BaseObjectRepository {
2021
public:
2122
struct Object {
@@ -31,9 +32,9 @@ class BaseObjectRepository {
3132
std::string objectname;
3233
int32_t type;
3334
int32_t icon;
34-
int32_t unknown08;
35-
int32_t unknown10;
36-
int32_t unknown20;
35+
float size_percentage;
36+
int32_t solid_type;
37+
int32_t incline;
3738
int32_t unknown24;
3839
int32_t unknown60;
3940
int32_t unknown64;
@@ -71,9 +72,9 @@ class BaseObjectRepository {
7172
"objectname",
7273
"type",
7374
"icon",
74-
"unknown08",
75-
"unknown10",
76-
"unknown20",
75+
"size_percentage",
76+
"solid_type",
77+
"incline",
7778
"unknown24",
7879
"unknown60",
7980
"unknown64",
@@ -107,9 +108,9 @@ class BaseObjectRepository {
107108
"objectname",
108109
"type",
109110
"icon",
110-
"unknown08",
111-
"unknown10",
112-
"unknown20",
111+
"size_percentage",
112+
"solid_type",
113+
"incline",
113114
"unknown24",
114115
"unknown60",
115116
"unknown64",
@@ -177,9 +178,9 @@ class BaseObjectRepository {
177178
e.objectname = "";
178179
e.type = 0;
179180
e.icon = 0;
180-
e.unknown08 = 0;
181-
e.unknown10 = 0;
182-
e.unknown20 = 0;
181+
e.size_percentage = 0;
182+
e.solid_type = 0;
183+
e.incline = 0;
183184
e.unknown24 = 0;
184185
e.unknown60 = 0;
185186
e.unknown64 = 0;
@@ -220,8 +221,9 @@ class BaseObjectRepository {
220221
{
221222
auto results = db.QueryDatabase(
222223
fmt::format(
223-
"{} WHERE id = {} LIMIT 1",
224+
"{} WHERE {} = {} LIMIT 1",
224225
BaseSelect(),
226+
PrimaryKey(),
225227
object_id
226228
)
227229
);
@@ -242,9 +244,9 @@ class BaseObjectRepository {
242244
e.objectname = row[9] ? row[9] : "";
243245
e.type = static_cast<int32_t>(atoi(row[10]));
244246
e.icon = static_cast<int32_t>(atoi(row[11]));
245-
e.unknown08 = static_cast<int32_t>(atoi(row[12]));
246-
e.unknown10 = static_cast<int32_t>(atoi(row[13]));
247-
e.unknown20 = static_cast<int32_t>(atoi(row[14]));
247+
e.size_percentage = strtof(row[12], nullptr);
248+
e.solid_type = static_cast<int32_t>(atoi(row[13]));
249+
e.incline = static_cast<int32_t>(atoi(row[14]));
248250
e.unknown24 = static_cast<int32_t>(atoi(row[15]));
249251
e.unknown60 = static_cast<int32_t>(atoi(row[16]));
250252
e.unknown64 = static_cast<int32_t>(atoi(row[17]));
@@ -304,9 +306,9 @@ class BaseObjectRepository {
304306
v.push_back(columns[9] + " = '" + Strings::Escape(e.objectname) + "'");
305307
v.push_back(columns[10] + " = " + std::to_string(e.type));
306308
v.push_back(columns[11] + " = " + std::to_string(e.icon));
307-
v.push_back(columns[12] + " = " + std::to_string(e.unknown08));
308-
v.push_back(columns[13] + " = " + std::to_string(e.unknown10));
309-
v.push_back(columns[14] + " = " + std::to_string(e.unknown20));
309+
v.push_back(columns[12] + " = " + std::to_string(e.size_percentage));
310+
v.push_back(columns[13] + " = " + std::to_string(e.solid_type));
311+
v.push_back(columns[14] + " = " + std::to_string(e.incline));
310312
v.push_back(columns[15] + " = " + std::to_string(e.unknown24));
311313
v.push_back(columns[16] + " = " + std::to_string(e.unknown60));
312314
v.push_back(columns[17] + " = " + std::to_string(e.unknown64));
@@ -355,9 +357,9 @@ class BaseObjectRepository {
355357
v.push_back("'" + Strings::Escape(e.objectname) + "'");
356358
v.push_back(std::to_string(e.type));
357359
v.push_back(std::to_string(e.icon));
358-
v.push_back(std::to_string(e.unknown08));
359-
v.push_back(std::to_string(e.unknown10));
360-
v.push_back(std::to_string(e.unknown20));
360+
v.push_back(std::to_string(e.size_percentage));
361+
v.push_back(std::to_string(e.solid_type));
362+
v.push_back(std::to_string(e.incline));
361363
v.push_back(std::to_string(e.unknown24));
362364
v.push_back(std::to_string(e.unknown60));
363365
v.push_back(std::to_string(e.unknown64));
@@ -414,9 +416,9 @@ class BaseObjectRepository {
414416
v.push_back("'" + Strings::Escape(e.objectname) + "'");
415417
v.push_back(std::to_string(e.type));
416418
v.push_back(std::to_string(e.icon));
417-
v.push_back(std::to_string(e.unknown08));
418-
v.push_back(std::to_string(e.unknown10));
419-
v.push_back(std::to_string(e.unknown20));
419+
v.push_back(std::to_string(e.size_percentage));
420+
v.push_back(std::to_string(e.solid_type));
421+
v.push_back(std::to_string(e.incline));
420422
v.push_back(std::to_string(e.unknown24));
421423
v.push_back(std::to_string(e.unknown60));
422424
v.push_back(std::to_string(e.unknown64));
@@ -477,9 +479,9 @@ class BaseObjectRepository {
477479
e.objectname = row[9] ? row[9] : "";
478480
e.type = static_cast<int32_t>(atoi(row[10]));
479481
e.icon = static_cast<int32_t>(atoi(row[11]));
480-
e.unknown08 = static_cast<int32_t>(atoi(row[12]));
481-
e.unknown10 = static_cast<int32_t>(atoi(row[13]));
482-
e.unknown20 = static_cast<int32_t>(atoi(row[14]));
482+
e.size_percentage = strtof(row[12], nullptr);
483+
e.solid_type = static_cast<int32_t>(atoi(row[13]));
484+
e.incline = static_cast<int32_t>(atoi(row[14]));
483485
e.unknown24 = static_cast<int32_t>(atoi(row[15]));
484486
e.unknown60 = static_cast<int32_t>(atoi(row[16]));
485487
e.unknown64 = static_cast<int32_t>(atoi(row[17]));
@@ -531,9 +533,9 @@ class BaseObjectRepository {
531533
e.objectname = row[9] ? row[9] : "";
532534
e.type = static_cast<int32_t>(atoi(row[10]));
533535
e.icon = static_cast<int32_t>(atoi(row[11]));
534-
e.unknown08 = static_cast<int32_t>(atoi(row[12]));
535-
e.unknown10 = static_cast<int32_t>(atoi(row[13]));
536-
e.unknown20 = static_cast<int32_t>(atoi(row[14]));
536+
e.size_percentage = strtof(row[12], nullptr);
537+
e.solid_type = static_cast<int32_t>(atoi(row[13]));
538+
e.incline = static_cast<int32_t>(atoi(row[14]));
537539
e.unknown24 = static_cast<int32_t>(atoi(row[15]));
538540
e.unknown60 = static_cast<int32_t>(atoi(row[16]));
539541
e.unknown64 = static_cast<int32_t>(atoi(row[17]));

common/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
4343
*/
4444

45-
#define CURRENT_BINARY_DATABASE_VERSION 9244
45+
#define CURRENT_BINARY_DATABASE_VERSION 9245
4646

4747
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9040
4848

zone/client.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -10355,6 +10355,16 @@ void Client::SetDoorToolEntityId(uint16 door_tool_entity_id)
1035510355
Client::m_door_tool_entity_id = door_tool_entity_id;
1035610356
}
1035710357

10358+
uint16 Client::GetObjectToolEntityId() const
10359+
{
10360+
return m_object_tool_entity_id;
10361+
}
10362+
10363+
void Client::SetObjectToolEntityId(uint16 object_tool_entity_id)
10364+
{
10365+
Client::m_object_tool_entity_id = object_tool_entity_id;
10366+
}
10367+
1035810368
int Client::GetIPExemption()
1035910369
{
1036010370
return database.GetIPExemption(GetIPString());

zone/client.h

+3
Original file line numberDiff line numberDiff line change
@@ -1814,9 +1814,12 @@ class Client : public Mob
18141814
bool dev_tools_enabled;
18151815

18161816
uint16 m_door_tool_entity_id;
1817+
uint16 m_object_tool_entity_id;
18171818
public:
18181819
uint16 GetDoorToolEntityId() const;
18191820
void SetDoorToolEntityId(uint16 door_tool_entity_id);
1821+
uint16 GetObjectToolEntityId() const;
1822+
void SetObjectToolEntityId(uint16 object_tool_entity_id);
18201823
private:
18211824

18221825
int32 max_end;

zone/client_packet.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6060
#include "../common/repositories/criteria/content_filter_criteria.h"
6161
#include "../common/shared_tasks.h"
6262
#include "gm_commands/door_manipulation.h"
63+
#include "gm_commands/object_manipulation.h"
6364
#include "client.h"
6465
#include "../common/repositories/account_repository.h"
6566

@@ -4650,6 +4651,20 @@ void Client::Handle_OP_ClickObject(const EQApplicationPacket *app)
46504651
std::vector<std::any> args = { object };
46514652
parse->EventPlayer(EVENT_CLICK_OBJECT, this, std::to_string(click_object->drop_id), GetID(), &args);
46524653
}
4654+
4655+
if (IsDevToolsEnabled()) {
4656+
SetObjectToolEntityId(entity->GetID());
4657+
ObjectManipulation::CommandHeader(this);
4658+
Message(
4659+
Chat::White,
4660+
fmt::format(
4661+
"Object ({}) [{}] [{}]",
4662+
entity->CastToObject()->GetDBID(),
4663+
Saylink::Silent("#object edit", "Edit"),
4664+
Saylink::Silent("#object delete", "Delete")
4665+
).c_str()
4666+
);
4667+
}
46534668
}
46544669

46554670
// Observed in RoF after OP_ClickObjectAction:

zone/command.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ void command_bot(Client *c, const Seperator *sep)
866866
#include "gm_commands/nukebuffs.cpp"
867867
#include "gm_commands/nukeitem.cpp"
868868
#include "gm_commands/object.cpp"
869+
#include "gm_commands/object_manipulation.cpp"
869870
#include "gm_commands/path.cpp"
870871
#include "gm_commands/peqzone.cpp"
871872
#include "gm_commands/petitems.cpp"

zone/gm_commands/door.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "../client.h"
22
#include "door_manipulation.h"
3-
#include "../doors.h"
43

54
void command_door(Client *c, const Seperator *sep)
65
{

0 commit comments

Comments
 (0)