aboutsummaryrefslogtreecommitdiff
path: root/src/querymanager.hh
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-07-11 11:55:03 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-07-11 11:55:03 -0300
commit3ab6d1d312e2b1ecbd858be56bd7a5d6bc451a85 (patch)
tree8418bf31a3578cbe9f5fb6406054360f42e6cd18 /src/querymanager.hh
parent8dbd1d39e3dbd1276e2351070a0645c5e973da9e (diff)
downloadquerymanager-3ab6d1d312e2b1ecbd858be56bd7a5d6bc451a85.tar.gz
querymanager-3ab6d1d312e2b1ecbd858be56bd7a5d6bc451a85.zip
implement more queries + overall improvements
Diffstat (limited to 'src/querymanager.hh')
-rw-r--r--src/querymanager.hh64
1 files changed, 51 insertions, 13 deletions
diff --git a/src/querymanager.hh b/src/querymanager.hh
index b1b197d..2eab216 100644
--- a/src/querymanager.hh
+++ b/src/querymanager.hh
@@ -168,6 +168,10 @@ inline void BufferWrite32BE(uint8 *Buffer, uint32 Value){
}
struct TReadBuffer{
+ uint8 *Buffer;
+ int Size;
+ int Position;
+
TReadBuffer(uint8 *Buffer, int Size)
: Buffer(Buffer), Size(Size), Position(0) {}
@@ -179,6 +183,10 @@ struct TReadBuffer{
return this->Position > this->Size;
}
+ bool ReadFlag(void){
+ return this->Read8() != 0x00;
+ }
+
uint8 Read8(void){
uint8 Result = 0;
if(this->CanRead(1)){
@@ -241,15 +249,13 @@ struct TReadBuffer{
this->Position += Length;
}
+};
- // DATA
- // =================
+struct TWriteBuffer{
uint8 *Buffer;
int Size;
int Position;
-};
-struct TWriteBuffer{
TWriteBuffer(uint8 *Buffer, int Size)
: Buffer(Buffer), Size(Size), Position(0) {}
@@ -261,6 +267,10 @@ struct TWriteBuffer{
return this->Position > this->Size;
}
+ void WriteFlag(bool Value){
+ this->Write8(Value ? 0x01 : 0x00);
+ }
+
void Write8(uint8 Value){
if(this->CanWrite(1)){
BufferWrite8(this->Buffer + this->Position, Value);
@@ -334,12 +344,6 @@ struct TWriteBuffer{
this->Position += 4;
}
}
-
- // DATA
- // =================
- uint8 *Buffer;
- int Size;
- int Position;
};
// Dynamic Array
@@ -565,7 +569,7 @@ struct TConnection{
uint8 *Buffer;
bool Authorized;
int ApplicationType;
- char ApplicationData[30];
+ int WorldID;
char RemoteAddress[30];
};
@@ -649,6 +653,30 @@ struct THouseOwner{
int PaidUntil;
};
+struct THouse{
+ int HouseID;
+ char Name[50];
+ int Rent;
+ char Description[500];
+ int Size;
+ int PositionX;
+ int PositionY;
+ int PositionZ;
+ char Town[30];
+ bool GuildHouse;
+};
+
+struct TOnlineCharacter{
+ char Name[30];
+ int Level;
+ char Profession[30];
+};
+
+struct TCharacterIndexEntry{
+ char Name[30];
+ int CharacterID;
+};
+
struct TWorldConfig{
int Type;
int RebootTime;
@@ -660,8 +688,18 @@ struct TWorldConfig{
int PremiumNewbieBuffer;
};
-bool LoadHouseOwners(const char *WorldName, DynamicArray<THouseOwner> *HouseOwners);
-bool LoadWorldConfig(const char *WorldName, TWorldConfig *WorldConfig);
+bool LoadWorldID(const char *WorldName, int *WorldID);
+//bool DecrementIsOnline(int WorldID, int CharacterID);
+bool LoadHouseOwners(int WorldID, DynamicArray<THouseOwner> *HouseOwners);
+bool DeleteHouses(int WorldID);
+bool InsertHouses(int WorldID, int NumHouses, THouse *Houses);
+bool ClearIsOnline(int WorldID, int *NumAffectedCharacters);
+bool DeleteOnlineCharacters(int WorldID);
+bool InsertOnlineCharacters(int WorldID, int NumCharacters, TOnlineCharacter *Characters);
+bool CheckOnlineRecord(int WorldID, int NumCharacters, bool *NewRecord);
+bool LoadCharacterIndex(int WorldID, int MinimumCharacterID,
+ int MaxEntries, int *NumEntries, TCharacterIndexEntry *Entries);
+bool LoadWorldConfig(int WorldID, TWorldConfig *WorldConfig);
bool InitDatabase(void);
void ExitDatabase(void);