mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 17:26:30 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d7cf4235c | |||
| 187ee10218 | |||
| 6bd758b3dd | |||
| 9938755517 | |||
| 630da0eee6 | |||
| 3158386aa3 | |||
| 12ada57ee8 | |||
| 7a841c11c5 | |||
| a49d1446b7 | |||
| b2d0fa6a2f | |||
| 62ac015fff | |||
| 4977a7c2e0 | |||
| 9967384ab8 | |||
| d3da2e5501 | |||
| 33f5c4c6a7 | |||
| e4aa6a6957 | |||
| e4d812f4b4 | |||
| bcedfe7032 | |||
| c1df3fbcb0 | |||
| 011e1d05e7 | |||
| 3f0f95976c | |||
| 77de9619b5 | |||
| 20d3ab2ac5 | |||
| 0ea47fadee | |||
| 1ce51ca3b0 | |||
| 25ef3d2cdb | |||
| 95249889a6 | |||
| 428cccfa50 | |||
| 41dd8a5754 | |||
| d02d766563 | |||
| dfd2729b28 | |||
| b92eafd21b | |||
| d6d5d992cb | |||
| d524cb6a5a | |||
| e6469878ce | |||
| 9583099ace | |||
| cf3483b402 | |||
| 311af7bbe9 |
+154
@@ -1,3 +1,157 @@
|
|||||||
|
## [22.60.0] 11/25/2024
|
||||||
|
|
||||||
|
### Bazaar
|
||||||
|
|
||||||
|
* Further refinements for instanced bazaar ([#4544](https://github.com/EQEmu/Server/pull/4544)) @neckkola 2024-11-16
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Fix build with older C++ libraries ([#4549](https://github.com/EQEmu/Server/pull/4549)) @hgtw 2024-11-24
|
||||||
|
|
||||||
|
### Config
|
||||||
|
|
||||||
|
* Fix World TCP Address Configuration Default ([#4551](https://github.com/EQEmu/Server/pull/4551)) @Akkadius 2024-11-24
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fix Issue with Perl EVENT_PAYLOAD ([#4545](https://github.com/EQEmu/Server/pull/4545)) @Kinglykrab 2024-11-24
|
||||||
|
* Fix Possible Item Loss in Trades ([#4554](https://github.com/EQEmu/Server/pull/4554)) @Kinglykrab 2024-11-24
|
||||||
|
* Fix Strings::Commify bug with #mystats ([#4547](https://github.com/EQEmu/Server/pull/4547)) @carolus21rex 2024-11-22
|
||||||
|
* Fix an edge case with augmented items inside parceled containers ([#4546](https://github.com/EQEmu/Server/pull/4546)) @neckkola 2024-11-21
|
||||||
|
* Fix for bazaar search of containers. ([#4540](https://github.com/EQEmu/Server/pull/4540)) @neckkola 2024-11-15
|
||||||
|
* Fix for mult-instanced bazaar zones ([#4541](https://github.com/EQEmu/Server/pull/4541)) @neckkola 2024-11-15
|
||||||
|
* Fix for sending money via Parcel, then changing your mind ([#4552](https://github.com/EQEmu/Server/pull/4552)) @neckkola 2024-11-24
|
||||||
|
* Fix issue where NPC's are being hidden as traders ([#4539](https://github.com/EQEmu/Server/pull/4539)) @Akkadius 2024-11-15
|
||||||
|
* Players could become flagged as a Trader when they were not trading ([#4553](https://github.com/EQEmu/Server/pull/4553)) @neckkola 2024-11-24
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
* Add Rule to Disable NPCs Facing Target ([#4543](https://github.com/EQEmu/Server/pull/4543)) @Kinglykrab 2024-11-24
|
||||||
|
|
||||||
|
### Tasks
|
||||||
|
|
||||||
|
* Update tasks in all zones if invalid zone set ([#4550](https://github.com/EQEmu/Server/pull/4550)) @hgtw 2024-11-25
|
||||||
|
|
||||||
|
## [22.59.1] 11/13/2024
|
||||||
|
|
||||||
|
### Hotfix
|
||||||
|
|
||||||
|
* Fix faulty database migration condition with databuckets (9285)
|
||||||
|
|
||||||
|
## [22.59.0] 11/13/2024
|
||||||
|
|
||||||
|
### Databuckets
|
||||||
|
|
||||||
|
* Add database index to data_buckets ([#4535](https://github.com/EQEmu/Server/pull/4535)) @Akkadius 2024-11-09
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Bazaar two edge case issues resolved ([#4533](https://github.com/EQEmu/Server/pull/4533)) @neckkola 2024-11-09
|
||||||
|
* Check if the mob is already in the close mobs list before inserting @Akkadius 2024-11-11
|
||||||
|
* ScanCloseMobs - Ensure scanning mob has an entity ID @Akkadius 2024-11-10
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Improvements to ScanCloseMobs logic ([#4534](https://github.com/EQEmu/Server/pull/4534)) @Akkadius 2024-11-08
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add Native Database Querying Interface ([#4531](https://github.com/EQEmu/Server/pull/4531)) @hgtw 2024-11-13
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
* Add Rule for restricting client versions to world server ([#4527](https://github.com/EQEmu/Server/pull/4527)) @knervous 2024-11-12
|
||||||
|
|
||||||
|
## [22.58.0] 11/5/2024
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Add mysql prepared statement support ([#4530](https://github.com/EQEmu/Server/pull/4530)) @hgtw 2024-11-06
|
||||||
|
* Update perlbind to 1.1.0 ([#4529](https://github.com/EQEmu/Server/pull/4529)) @hgtw 2024-11-06
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Focus Skill Attack Spells ([#4528](https://github.com/EQEmu/Server/pull/4528)) @mmcgarvey 2024-10-31
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add Missing Lua Registers ([#4525](https://github.com/EQEmu/Server/pull/4525)) @Kinglykrab 2024-10-24
|
||||||
|
* Fix cross_zone_set_entity_variable_by_char_id in Lua ([#4526](https://github.com/EQEmu/Server/pull/4526)) @Kinglykrab 2024-10-24
|
||||||
|
|
||||||
|
### Loginserver
|
||||||
|
|
||||||
|
* Automatifc Opcode File Creation ([#4521](https://github.com/EQEmu/Server/pull/4521)) @KimLS 2024-10-22
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add Spawn Circle/Grid Methods to Perl/Lua ([#4524](https://github.com/EQEmu/Server/pull/4524)) @Kinglykrab 2024-10-24
|
||||||
|
|
||||||
|
## [22.57.1] 10/22/2024
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Enable Bot Commands Only if Rule Enabled ([#4519](https://github.com/EQEmu/Server/pull/4519)) @Kinglykrab 2024-10-22
|
||||||
|
* Fix pet buffs from saving duplicates every save ([#4520](https://github.com/EQEmu/Server/pull/4520)) @nytmyr 2024-10-22
|
||||||
|
|
||||||
|
### Loginserver
|
||||||
|
|
||||||
|
* Automatic Opcode File Creation ([#4521](https://github.com/EQEmu/Server/pull/4521)) @KimLS 2024-10-22
|
||||||
|
|
||||||
|
## [22.57.0] 10/20/2024
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Add "silent" option to ^spawn and mute raid spawn ([#4494](https://github.com/EQEmu/Server/pull/4494)) @nytmyr 2024-10-05
|
||||||
|
* Add attack flag when told to attack ([#4490](https://github.com/EQEmu/Server/pull/4490)) @nytmyr 2024-09-29
|
||||||
|
* Fix timers loading on spawn and zone ([#4516](https://github.com/EQEmu/Server/pull/4516)) @nytmyr 2024-10-20
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Fixed a typo in Zoning.cpp ([#4515](https://github.com/EQEmu/Server/pull/4515)) @carolus21rex 2024-10-20
|
||||||
|
* Optimization Code Cleanup ([#4489](https://github.com/EQEmu/Server/pull/4489)) @Akkadius 2024-09-30
|
||||||
|
* Remove Extra Skill in EQ::skills::GetExtraDamageSkills() ([#4486](https://github.com/EQEmu/Server/pull/4486)) @Kinglykrab 2024-10-03
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Fixes a crash when the faction_list db table is empty. ([#4511](https://github.com/EQEmu/Server/pull/4511)) @KimLS 2024-10-14
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add character_instance_safereturns to tables_to_zero_id ([#4485](https://github.com/EQEmu/Server/pull/4485)) @Morzain 2024-09-26
|
||||||
|
* Correctly limit max targets of PBAOE ([#4507](https://github.com/EQEmu/Server/pull/4507)) @catapultam-habeo 2024-10-11
|
||||||
|
* FindBestZ selecting false zone floor as bestz - Results in roambox failures ([#4504](https://github.com/EQEmu/Server/pull/4504)) @fryguy503 2024-10-13
|
||||||
|
* Fix #set motd Crash ([#4495](https://github.com/EQEmu/Server/pull/4495)) @Kinglykrab 2024-10-05
|
||||||
|
* Fix `character_exp_modifiers` Default Values ([#4502](https://github.com/EQEmu/Server/pull/4502)) @Kinglykrab 2024-10-09
|
||||||
|
* Fix a display error regarding a few trader/buyer query errors ([#4514](https://github.com/EQEmu/Server/pull/4514)) @neckkola 2024-10-17
|
||||||
|
* Fix Group ID 0 in Group::SaveGroupLeaderAA() ([#4487](https://github.com/EQEmu/Server/pull/4487)) @Kinglykrab 2024-10-03
|
||||||
|
* Fix Mercenary Encounter Crash ([#4509](https://github.com/EQEmu/Server/pull/4509)) @Kinglykrab 2024-10-12
|
||||||
|
* Fix NPC::CanTalk() Crash ([#4499](https://github.com/EQEmu/Server/pull/4499)) @Kinglykrab 2024-10-07
|
||||||
|
* Fix Spells:DefaultAOEMaxTargets Default Value ([#4508](https://github.com/EQEmu/Server/pull/4508)) @Kinglykrab 2024-10-12
|
||||||
|
* Fix Targeted AOE Max Targets Rule ([#4488](https://github.com/EQEmu/Server/pull/4488)) @Kinglykrab 2024-10-03
|
||||||
|
* fixed a bug where it would use npc value instead of faction value in the database. ([#4491](https://github.com/EQEmu/Server/pull/4491)) @regneq 2024-09-29
|
||||||
|
* Master of Disguise should apply to illusions casted by others. ([#4506](https://github.com/EQEmu/Server/pull/4506)) @fryguy503 2024-10-11
|
||||||
|
* Spells - Self Only (Yellow) cast when non group member is targeted ([#4503](https://github.com/EQEmu/Server/pull/4503)) @fryguy503 2024-10-11
|
||||||
|
|
||||||
|
### Loginserver
|
||||||
|
|
||||||
|
* Larion loginserver support ([#4492](https://github.com/EQEmu/Server/pull/4492)) @KimLS 2024-10-03
|
||||||
|
* Login Fatal Error Spamming ([#4476](https://github.com/EQEmu/Server/pull/4476)) @KimLS 2024-10-09
|
||||||
|
|
||||||
|
### Logs
|
||||||
|
|
||||||
|
* Add NPC Trades to Player Events ([#4505](https://github.com/EQEmu/Server/pull/4505)) @Kinglykrab 2024-10-13
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add Buff Fade Methods to Perl/Lua ([#4501](https://github.com/EQEmu/Server/pull/4501)) @Kinglykrab 2024-10-09
|
||||||
|
* Add EVENT_READ_ITEM to Perl/Lua ([#4497](https://github.com/EQEmu/Server/pull/4497)) @Kinglykrab 2024-10-08
|
||||||
|
* Add NPC List Filter Methods to Perl/Lua ([#4493](https://github.com/EQEmu/Server/pull/4493)) @Kinglykrab 2024-10-04
|
||||||
|
* Add Scripting Support to Mercenaries ([#4500](https://github.com/EQEmu/Server/pull/4500)) @Kinglykrab 2024-10-11
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
* Add Rule to disable PVP Regions ([#4513](https://github.com/EQEmu/Server/pull/4513)) @Kinglykrab 2024-10-17
|
||||||
|
|
||||||
## [22.56.3] 9/23/2024
|
## [22.56.3] 9/23/2024
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
+2
-12
@@ -62,6 +62,7 @@ SET(common_sources
|
|||||||
mutex.cpp
|
mutex.cpp
|
||||||
mysql_request_result.cpp
|
mysql_request_result.cpp
|
||||||
mysql_request_row.cpp
|
mysql_request_row.cpp
|
||||||
|
mysql_stmt.cpp
|
||||||
opcode_map.cpp
|
opcode_map.cpp
|
||||||
opcodemgr.cpp
|
opcodemgr.cpp
|
||||||
packet_dump.cpp
|
packet_dump.cpp
|
||||||
@@ -111,8 +112,6 @@ SET(common_sources
|
|||||||
net/websocket_server.cpp
|
net/websocket_server.cpp
|
||||||
net/websocket_server_connection.cpp
|
net/websocket_server_connection.cpp
|
||||||
patches/patches.cpp
|
patches/patches.cpp
|
||||||
patches/larion.cpp
|
|
||||||
patches/larion_limits.cpp
|
|
||||||
patches/sod.cpp
|
patches/sod.cpp
|
||||||
patches/sod_limits.cpp
|
patches/sod_limits.cpp
|
||||||
patches/sof.cpp
|
patches/sof.cpp
|
||||||
@@ -588,6 +587,7 @@ SET(common_headers
|
|||||||
mutex.h
|
mutex.h
|
||||||
mysql_request_result.h
|
mysql_request_result.h
|
||||||
mysql_request_row.h
|
mysql_request_row.h
|
||||||
|
mysql_stmt.h
|
||||||
op_codes.h
|
op_codes.h
|
||||||
opcode_dispatch.h
|
opcode_dispatch.h
|
||||||
opcodemgr.h
|
opcodemgr.h
|
||||||
@@ -655,10 +655,6 @@ SET(common_headers
|
|||||||
net/websocket_server.h
|
net/websocket_server.h
|
||||||
net/websocket_server_connection.h
|
net/websocket_server_connection.h
|
||||||
patches/patches.h
|
patches/patches.h
|
||||||
patches/larion.h
|
|
||||||
patches/larion_limits.h
|
|
||||||
patches/larion_ops.h
|
|
||||||
patches/larion_structs.h
|
|
||||||
patches/sod.h
|
patches/sod.h
|
||||||
patches/sod_limits.h
|
patches/sod_limits.h
|
||||||
patches/sod_ops.h
|
patches/sod_ops.h
|
||||||
@@ -745,10 +741,6 @@ SOURCE_GROUP(Net FILES
|
|||||||
|
|
||||||
SOURCE_GROUP(Patches FILES
|
SOURCE_GROUP(Patches FILES
|
||||||
patches/patches.h
|
patches/patches.h
|
||||||
patches/larion.h
|
|
||||||
patches/larion_limits.h
|
|
||||||
patches/larion_ops.h
|
|
||||||
patches/larion_structs.h
|
|
||||||
patches/sod.h
|
patches/sod.h
|
||||||
patches/sod_limits.h
|
patches/sod_limits.h
|
||||||
patches/sod_ops.h
|
patches/sod_ops.h
|
||||||
@@ -777,8 +769,6 @@ SOURCE_GROUP(Patches FILES
|
|||||||
patches/uf_ops.h
|
patches/uf_ops.h
|
||||||
patches/uf_structs.h
|
patches/uf_structs.h
|
||||||
patches/patches.cpp
|
patches/patches.cpp
|
||||||
patches/larion.cpp
|
|
||||||
patches/larion_limits.cpp
|
|
||||||
patches/sod.cpp
|
patches/sod.cpp
|
||||||
patches/sod_limits.cpp
|
patches/sod_limits.cpp
|
||||||
patches/sof.cpp
|
patches/sof.cpp
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ public:
|
|||||||
void WriteUInt8(uint8 value) { *(uint8 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint8); }
|
void WriteUInt8(uint8 value) { *(uint8 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint8); }
|
||||||
void WriteUInt32(uint32 value) { *(uint32 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint32); }
|
void WriteUInt32(uint32 value) { *(uint32 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint32); }
|
||||||
void WriteUInt64(uint64 value) { *(uint64 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint64); }
|
void WriteUInt64(uint64 value) { *(uint64 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint64); }
|
||||||
void WriteSInt16(int32 value) { *(int16*)(pBuffer + _wpos) = value; _wpos += sizeof(int16); }
|
|
||||||
void WriteUInt16(uint32 value) { *(uint16 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint16); }
|
void WriteUInt16(uint32 value) { *(uint16 *)(pBuffer + _wpos) = value; _wpos += sizeof(uint16); }
|
||||||
void WriteSInt32(int32 value) { *(int32 *)(pBuffer + _wpos) = value; _wpos += sizeof(int32); }
|
void WriteSInt32(int32 value) { *(int32 *)(pBuffer + _wpos) = value; _wpos += sizeof(int32); }
|
||||||
void WriteFloat(float value) { *(float *)(pBuffer + _wpos) = value; _wpos += sizeof(float); }
|
void WriteFloat(float value) { *(float *)(pBuffer + _wpos) = value; _wpos += sizeof(float); }
|
||||||
|
|||||||
+2
-1
@@ -235,7 +235,8 @@ Bazaar::GetSearchResults(
|
|||||||
std::vector<ItemSearchType> item_search_types = {
|
std::vector<ItemSearchType> item_search_types = {
|
||||||
{EQ::item::ItemType::ItemTypeAll, true},
|
{EQ::item::ItemType::ItemTypeAll, true},
|
||||||
{EQ::item::ItemType::ItemTypeBook, item->ItemClass == EQ::item::ItemType::ItemTypeBook},
|
{EQ::item::ItemType::ItemTypeBook, item->ItemClass == EQ::item::ItemType::ItemTypeBook},
|
||||||
{EQ::item::ItemType::ItemTypeContainer, item->ItemClass == EQ::item::ItemType::ItemTypeContainer},
|
{EQ::item::ItemType::ItemTypeContainer, item->ItemClass == EQ::item::ItemType::ItemTypeContainer ||
|
||||||
|
item->IsClassBag()},
|
||||||
{EQ::item::ItemType::ItemTypeAllEffects, item->Scroll.Effect > 0 && item->Scroll.Effect < 65000},
|
{EQ::item::ItemType::ItemTypeAllEffects, item->Scroll.Effect > 0 && item->Scroll.Effect < 65000},
|
||||||
{EQ::item::ItemType::ItemTypeUnknown9, item->Worn.Effect == 998},
|
{EQ::item::ItemType::ItemTypeUnknown9, item->Worn.Effect == 998},
|
||||||
{EQ::item::ItemType::ItemTypeUnknown10, item->Worn.Effect >= 1298 && item->Worn.Effect <= 1307},
|
{EQ::item::ItemType::ItemTypeUnknown10, item->Worn.Effect >= 1298 && item->Worn.Effect <= 1307},
|
||||||
|
|||||||
@@ -101,24 +101,6 @@ void CRC32::SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at)
|
|||||||
memcpy(in_data, (char*)&check, 4);
|
memcpy(in_data, (char*)&check, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long CRC32::GetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at)
|
|
||||||
{
|
|
||||||
unsigned long data;
|
|
||||||
unsigned long check = 0xffffffff;
|
|
||||||
|
|
||||||
for (uint32 i = start_at; i < in_length; i++)
|
|
||||||
{
|
|
||||||
data = in_data[i];
|
|
||||||
data = data ^ (check);
|
|
||||||
data = data & 0x000000ff;
|
|
||||||
check = check >> 8;
|
|
||||||
data = CRC32Table[data];
|
|
||||||
check = check ^ data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return check;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 crc32var) {
|
uint32 CRC32::Update(const uint8* buf, uint32 bufsize, uint32 crc32var) {
|
||||||
for(uint32 i=0; i < bufsize; i++)
|
for(uint32 i=0; i < bufsize; i++)
|
||||||
Calc(buf[i], crc32var);
|
Calc(buf[i], crc32var);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ public:
|
|||||||
static uint32 Generate(const uint8* buf, uint32 bufsize);
|
static uint32 Generate(const uint8* buf, uint32 bufsize);
|
||||||
static uint32 GenerateNoFlip(const uint8* buf, uint32 bufsize); // Same as Generate(), but without the ~
|
static uint32 GenerateNoFlip(const uint8* buf, uint32 bufsize); // Same as Generate(), but without the ~
|
||||||
static void SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at=4);
|
static void SetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at=4);
|
||||||
static unsigned long GetEQChecksum(uchar* in_data, uint32 in_length, uint32 start_at = 4);
|
|
||||||
|
|
||||||
// Multiple buffer CRC32
|
// Multiple buffer CRC32
|
||||||
static uint32 Update(const uint8* buf, uint32 bufsize, uint32 crc32 = 0xFFFFFFFF);
|
static uint32 Update(const uint8* buf, uint32 bufsize, uint32 crc32 = 0xFFFFFFFF);
|
||||||
|
|||||||
@@ -5758,6 +5758,18 @@ ALTER TABLE `inventory_snapshots`
|
|||||||
ALTER TABLE `character_exp_modifiers`
|
ALTER TABLE `character_exp_modifiers`
|
||||||
MODIFY COLUMN `aa_modifier` float NOT NULL DEFAULT 1.0 AFTER `instance_version`,
|
MODIFY COLUMN `aa_modifier` float NOT NULL DEFAULT 1.0 AFTER `instance_version`,
|
||||||
MODIFY COLUMN `exp_modifier` float NOT NULL DEFAULT 1.0 AFTER `aa_modifier`;
|
MODIFY COLUMN `exp_modifier` float NOT NULL DEFAULT 1.0 AFTER `aa_modifier`;
|
||||||
|
)"
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9285,
|
||||||
|
.description = "2024_11_08_data_buckets_indexes.sql",
|
||||||
|
.check = "SHOW CREATE TABLE `data_buckets`",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_character_expires",
|
||||||
|
.sql = R"(
|
||||||
|
CREATE INDEX idx_character_expires ON data_buckets (character_id, expires);
|
||||||
|
CREATE INDEX idx_npc_expires ON data_buckets (npc_id, expires);
|
||||||
|
CREATE INDEX idx_bot_expires ON data_buckets (bot_id, expires);
|
||||||
)"
|
)"
|
||||||
}
|
}
|
||||||
// -- template; copy/paste this when you need to create a new entry
|
// -- template; copy/paste this when you need to create a new entry
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
#include "dbcore.h"
|
#include "dbcore.h"
|
||||||
|
#include "mysql_stmt.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -436,3 +437,8 @@ MySQLRequestResult DBcore::QueryDatabaseMulti(const std::string &query)
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mysql::PreparedStmt DBcore::Prepare(std::string query)
|
||||||
|
{
|
||||||
|
return mysql::PreparedStmt(*mysql, std::move(query), m_mutex);
|
||||||
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
#define CR_SERVER_GONE_ERROR 2006
|
#define CR_SERVER_GONE_ERROR 2006
|
||||||
#define CR_SERVER_LOST 2013
|
#define CR_SERVER_LOST 2013
|
||||||
|
|
||||||
|
namespace mysql { class PreparedStmt; }
|
||||||
|
|
||||||
class DBcore {
|
class DBcore {
|
||||||
public:
|
public:
|
||||||
enum eStatus {
|
enum eStatus {
|
||||||
@@ -48,6 +50,11 @@ public:
|
|||||||
}
|
}
|
||||||
void SetMutex(Mutex *mutex);
|
void SetMutex(Mutex *mutex);
|
||||||
|
|
||||||
|
// only safe on connections shared with other threads if results buffered
|
||||||
|
// unsafe to use off main thread due to internal server logging
|
||||||
|
// throws std::runtime_error on failure
|
||||||
|
mysql::PreparedStmt Prepare(std::string query);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool Open(
|
bool Open(
|
||||||
const char *iHost,
|
const char *iHost,
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ const char* EQ::versions::ClientVersionName(ClientVersion client_version)
|
|||||||
return "RoF";
|
return "RoF";
|
||||||
case ClientVersion::RoF2:
|
case ClientVersion::RoF2:
|
||||||
return "RoF2";
|
return "RoF2";
|
||||||
case ClientVersion::Larion:
|
|
||||||
return "Larion";
|
|
||||||
default:
|
default:
|
||||||
return "Invalid Version";
|
return "Invalid Version";
|
||||||
};
|
};
|
||||||
@@ -78,8 +76,6 @@ uint32 EQ::versions::ConvertClientVersionToClientVersionBit(ClientVersion client
|
|||||||
return bitRoF;
|
return bitRoF;
|
||||||
case ClientVersion::RoF2:
|
case ClientVersion::RoF2:
|
||||||
return bitRoF2;
|
return bitRoF2;
|
||||||
case ClientVersion::Larion:
|
|
||||||
return bitLarion;
|
|
||||||
default:
|
default:
|
||||||
return bitUnknown;
|
return bitUnknown;
|
||||||
}
|
}
|
||||||
@@ -100,8 +96,6 @@ EQ::versions::ClientVersion EQ::versions::ConvertClientVersionBitToClientVersion
|
|||||||
return ClientVersion::RoF;
|
return ClientVersion::RoF;
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
|
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
|
||||||
return ClientVersion::RoF2;
|
return ClientVersion::RoF2;
|
||||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Larion) - 1)):
|
|
||||||
return ClientVersion::Larion;
|
|
||||||
default:
|
default:
|
||||||
return ClientVersion::Unknown;
|
return ClientVersion::Unknown;
|
||||||
}
|
}
|
||||||
@@ -190,8 +184,6 @@ const char* EQ::versions::MobVersionName(MobVersion mob_version)
|
|||||||
return "RoF";
|
return "RoF";
|
||||||
case MobVersion::RoF2:
|
case MobVersion::RoF2:
|
||||||
return "RoF2";
|
return "RoF2";
|
||||||
case MobVersion::Larion:
|
|
||||||
return "Larion";
|
|
||||||
case MobVersion::NPC:
|
case MobVersion::NPC:
|
||||||
return "NPC";
|
return "NPC";
|
||||||
case MobVersion::NPCMerchant:
|
case MobVersion::NPCMerchant:
|
||||||
@@ -220,8 +212,6 @@ const char* EQ::versions::MobVersionName(MobVersion mob_version)
|
|||||||
return "Offline RoF";
|
return "Offline RoF";
|
||||||
case MobVersion::OfflineRoF2:
|
case MobVersion::OfflineRoF2:
|
||||||
return "Offline RoF2";
|
return "Offline RoF2";
|
||||||
case MobVersion::OfflineLarion:
|
|
||||||
return "Offline Larion";
|
|
||||||
default:
|
default:
|
||||||
return "Invalid Version";
|
return "Invalid Version";
|
||||||
};
|
};
|
||||||
@@ -245,8 +235,6 @@ EQ::versions::ClientVersion EQ::versions::ConvertMobVersionToClientVersion(MobVe
|
|||||||
return ClientVersion::RoF;
|
return ClientVersion::RoF;
|
||||||
case MobVersion::RoF2:
|
case MobVersion::RoF2:
|
||||||
return ClientVersion::RoF2;
|
return ClientVersion::RoF2;
|
||||||
case MobVersion::Larion:
|
|
||||||
return ClientVersion::Larion;
|
|
||||||
default:
|
default:
|
||||||
return ClientVersion::Unknown;
|
return ClientVersion::Unknown;
|
||||||
}
|
}
|
||||||
@@ -270,8 +258,6 @@ EQ::versions::MobVersion EQ::versions::ConvertClientVersionToMobVersion(ClientVe
|
|||||||
return MobVersion::RoF;
|
return MobVersion::RoF;
|
||||||
case ClientVersion::RoF2:
|
case ClientVersion::RoF2:
|
||||||
return MobVersion::RoF2;
|
return MobVersion::RoF2;
|
||||||
case ClientVersion::Larion:
|
|
||||||
return MobVersion::Larion;
|
|
||||||
default:
|
default:
|
||||||
return MobVersion::Unknown;
|
return MobVersion::Unknown;
|
||||||
}
|
}
|
||||||
@@ -292,8 +278,6 @@ EQ::versions::MobVersion EQ::versions::ConvertPCMobVersionToOfflinePCMobVersion(
|
|||||||
return MobVersion::OfflineRoF;
|
return MobVersion::OfflineRoF;
|
||||||
case MobVersion::RoF2:
|
case MobVersion::RoF2:
|
||||||
return MobVersion::OfflineRoF2;
|
return MobVersion::OfflineRoF2;
|
||||||
case MobVersion::Larion:
|
|
||||||
return MobVersion::OfflineLarion;
|
|
||||||
default:
|
default:
|
||||||
return MobVersion::Unknown;
|
return MobVersion::Unknown;
|
||||||
}
|
}
|
||||||
@@ -314,8 +298,6 @@ EQ::versions::MobVersion EQ::versions::ConvertOfflinePCMobVersionToPCMobVersion(
|
|||||||
return MobVersion::RoF;
|
return MobVersion::RoF;
|
||||||
case MobVersion::OfflineRoF2:
|
case MobVersion::OfflineRoF2:
|
||||||
return MobVersion::RoF2;
|
return MobVersion::RoF2;
|
||||||
case MobVersion::OfflineLarion:
|
|
||||||
return MobVersion::Larion;
|
|
||||||
default:
|
default:
|
||||||
return MobVersion::Unknown;
|
return MobVersion::Unknown;
|
||||||
}
|
}
|
||||||
@@ -336,8 +318,6 @@ EQ::versions::ClientVersion EQ::versions::ConvertOfflinePCMobVersionToClientVers
|
|||||||
return ClientVersion::RoF;
|
return ClientVersion::RoF;
|
||||||
case MobVersion::OfflineRoF2:
|
case MobVersion::OfflineRoF2:
|
||||||
return ClientVersion::RoF2;
|
return ClientVersion::RoF2;
|
||||||
case MobVersion::OfflineLarion:
|
|
||||||
return ClientVersion::Larion;
|
|
||||||
default:
|
default:
|
||||||
return ClientVersion::Unknown;
|
return ClientVersion::Unknown;
|
||||||
}
|
}
|
||||||
@@ -358,8 +338,6 @@ EQ::versions::MobVersion EQ::versions::ConvertClientVersionToOfflinePCMobVersion
|
|||||||
return MobVersion::OfflineRoF;
|
return MobVersion::OfflineRoF;
|
||||||
case ClientVersion::RoF2:
|
case ClientVersion::RoF2:
|
||||||
return MobVersion::OfflineRoF2;
|
return MobVersion::OfflineRoF2;
|
||||||
case ClientVersion::Larion:
|
|
||||||
return MobVersion::OfflineLarion;
|
|
||||||
default:
|
default:
|
||||||
return MobVersion::Unknown;
|
return MobVersion::Unknown;
|
||||||
}
|
}
|
||||||
@@ -410,27 +388,6 @@ const char* EQ::expansions::ExpansionName(Expansion expansion)
|
|||||||
return "Rain of Fear";
|
return "Rain of Fear";
|
||||||
case Expansion::CotF:
|
case Expansion::CotF:
|
||||||
return "Call of the Forsaken";
|
return "Call of the Forsaken";
|
||||||
case Expansion::TDS:
|
|
||||||
return "The Darkened Sea";
|
|
||||||
case Expansion::TBM:
|
|
||||||
return "The Broken Mirror";
|
|
||||||
case Expansion::EoK:
|
|
||||||
return "Empires of Kunark";
|
|
||||||
case Expansion::RoS:
|
|
||||||
return "Ring of Scale";
|
|
||||||
case Expansion::TBL:
|
|
||||||
return "The Burning Lands";
|
|
||||||
case Expansion::ToV:
|
|
||||||
return "Torment of Velious";
|
|
||||||
case Expansion::CoV:
|
|
||||||
return "Claws of Veeshan";
|
|
||||||
case Expansion::ToL:
|
|
||||||
return "Terror of Luclin";
|
|
||||||
case Expansion::NoS:
|
|
||||||
return "Night of Shadows";
|
|
||||||
case Expansion::LS:
|
|
||||||
return "Laurion's Song";
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "Invalid Expansion";
|
return "Invalid Expansion";
|
||||||
}
|
}
|
||||||
@@ -484,26 +441,6 @@ uint32 EQ::expansions::ConvertExpansionToExpansionBit(Expansion expansion)
|
|||||||
return bitRoF;
|
return bitRoF;
|
||||||
case Expansion::CotF:
|
case Expansion::CotF:
|
||||||
return bitCotF;
|
return bitCotF;
|
||||||
case Expansion::TDS:
|
|
||||||
return bitTDS;
|
|
||||||
case Expansion::TBM:
|
|
||||||
return bitTBM;
|
|
||||||
case Expansion::EoK:
|
|
||||||
return bitEoK;
|
|
||||||
case Expansion::RoS:
|
|
||||||
return bitRoS;
|
|
||||||
case Expansion::TBL:
|
|
||||||
return bitTBL;
|
|
||||||
case Expansion::ToV:
|
|
||||||
return bitToV;
|
|
||||||
case Expansion::CoV:
|
|
||||||
return bitCoV;
|
|
||||||
case Expansion::ToL:
|
|
||||||
return bitToL;
|
|
||||||
case Expansion::NoS:
|
|
||||||
return bitNoS;
|
|
||||||
case Expansion::LS:
|
|
||||||
return bitLS;
|
|
||||||
default:
|
default:
|
||||||
return bitEverQuest;
|
return bitEverQuest;
|
||||||
}
|
}
|
||||||
@@ -552,26 +489,6 @@ EQ::expansions::Expansion EQ::expansions::ConvertExpansionBitToExpansion(uint32
|
|||||||
return Expansion::RoF;
|
return Expansion::RoF;
|
||||||
case bitCotF:
|
case bitCotF:
|
||||||
return Expansion::CotF;
|
return Expansion::CotF;
|
||||||
case bitTDS:
|
|
||||||
return Expansion::TDS;
|
|
||||||
case bitTBM:
|
|
||||||
return Expansion::TBM;
|
|
||||||
case bitEoK:
|
|
||||||
return Expansion::EoK;
|
|
||||||
case bitRoS:
|
|
||||||
return Expansion::RoS;
|
|
||||||
case bitTBL:
|
|
||||||
return Expansion::TBL;
|
|
||||||
case bitToV:
|
|
||||||
return Expansion::ToV;
|
|
||||||
case bitCoV:
|
|
||||||
return Expansion::CoV;
|
|
||||||
case bitToL:
|
|
||||||
return Expansion::ToL;
|
|
||||||
case bitNoS:
|
|
||||||
return Expansion::NoS;
|
|
||||||
case bitLS:
|
|
||||||
return Expansion::LS;
|
|
||||||
default:
|
default:
|
||||||
return Expansion::EverQuest;
|
return Expansion::EverQuest;
|
||||||
}
|
}
|
||||||
@@ -620,26 +537,6 @@ uint32 EQ::expansions::ConvertExpansionToExpansionsMask(Expansion expansion)
|
|||||||
return maskRoF;
|
return maskRoF;
|
||||||
case Expansion::CotF:
|
case Expansion::CotF:
|
||||||
return maskCotF;
|
return maskCotF;
|
||||||
case Expansion::TDS:
|
|
||||||
return maskTDS;
|
|
||||||
case Expansion::TBM:
|
|
||||||
return maskTBM;
|
|
||||||
case Expansion::EoK:
|
|
||||||
return maskEoK;
|
|
||||||
case Expansion::RoS:
|
|
||||||
return maskRoS;
|
|
||||||
case Expansion::TBL:
|
|
||||||
return maskTBL;
|
|
||||||
case Expansion::ToV:
|
|
||||||
return maskToV;
|
|
||||||
case Expansion::CoV:
|
|
||||||
return maskCoV;
|
|
||||||
case Expansion::ToL:
|
|
||||||
return maskToL;
|
|
||||||
case Expansion::NoS:
|
|
||||||
return maskNoS;
|
|
||||||
case Expansion::LS:
|
|
||||||
return maskLS;
|
|
||||||
default:
|
default:
|
||||||
return maskEverQuest;
|
return maskEverQuest;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-45
@@ -36,8 +36,7 @@ namespace EQ
|
|||||||
SoD, // Build: 'Dec 19 2008 15:22:49'
|
SoD, // Build: 'Dec 19 2008 15:22:49'
|
||||||
UF, // Build: 'Jun 8 2010 16:44:32'
|
UF, // Build: 'Jun 8 2010 16:44:32'
|
||||||
RoF, // Build: 'Dec 10 2012 17:35:44'
|
RoF, // Build: 'Dec 10 2012 17:35:44'
|
||||||
RoF2, // Build: 'May 10 2013 23:30:08'
|
RoF2 // Build: 'May 10 2013 23:30:08'
|
||||||
Larion
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ClientVersionBitmask : uint32 {
|
enum ClientVersionBitmask : uint32 {
|
||||||
@@ -49,7 +48,6 @@ namespace EQ
|
|||||||
bitUF = 0x00000010,
|
bitUF = 0x00000010,
|
||||||
bitRoF = 0x00000020,
|
bitRoF = 0x00000020,
|
||||||
bitRoF2 = 0x00000040,
|
bitRoF2 = 0x00000040,
|
||||||
bitLarion = 0x00000080,
|
|
||||||
maskUnknown = 0x00000000,
|
maskUnknown = 0x00000000,
|
||||||
maskTitaniumAndEarlier = 0x00000003,
|
maskTitaniumAndEarlier = 0x00000003,
|
||||||
maskSoFAndEarlier = 0x00000007,
|
maskSoFAndEarlier = 0x00000007,
|
||||||
@@ -61,11 +59,10 @@ namespace EQ
|
|||||||
maskUFAndLater = 0xFFFFFFF0,
|
maskUFAndLater = 0xFFFFFFF0,
|
||||||
maskRoFAndLater = 0xFFFFFFE0,
|
maskRoFAndLater = 0xFFFFFFE0,
|
||||||
maskRoF2AndLater = 0xFFFFFFC0,
|
maskRoF2AndLater = 0xFFFFFFC0,
|
||||||
maskLarionAndLater = 0xFFFFFF80,
|
|
||||||
maskAllClients = 0xFFFFFFFF
|
maskAllClients = 0xFFFFFFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
const ClientVersion LastClientVersion = ClientVersion::Larion;
|
const ClientVersion LastClientVersion = ClientVersion::RoF2;
|
||||||
const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
|
const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
|
||||||
|
|
||||||
bool IsValidClientVersion(ClientVersion client_version);
|
bool IsValidClientVersion(ClientVersion client_version);
|
||||||
@@ -83,7 +80,6 @@ namespace EQ
|
|||||||
UF,
|
UF,
|
||||||
RoF,
|
RoF,
|
||||||
RoF2,
|
RoF2,
|
||||||
Larion,
|
|
||||||
NPC,
|
NPC,
|
||||||
NPCMerchant,
|
NPCMerchant,
|
||||||
Merc,
|
Merc,
|
||||||
@@ -97,14 +93,13 @@ namespace EQ
|
|||||||
OfflineSoD,
|
OfflineSoD,
|
||||||
OfflineUF,
|
OfflineUF,
|
||||||
OfflineRoF,
|
OfflineRoF,
|
||||||
OfflineRoF2,
|
OfflineRoF2
|
||||||
OfflineLarion
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const MobVersion LastMobVersion = MobVersion::OfflineLarion;
|
const MobVersion LastMobVersion = MobVersion::OfflineRoF2;
|
||||||
const MobVersion LastPCMobVersion = MobVersion::Larion;
|
const MobVersion LastPCMobVersion = MobVersion::RoF2;
|
||||||
const MobVersion LastNonPCMobVersion = MobVersion::BotPet;
|
const MobVersion LastNonPCMobVersion = MobVersion::BotPet;
|
||||||
const MobVersion LastOfflinePCMobVersion = MobVersion::OfflineLarion;
|
const MobVersion LastOfflinePCMobVersion = MobVersion::OfflineRoF2;
|
||||||
const size_t MobVersionCount = (static_cast<size_t>(LastMobVersion) + 1);
|
const size_t MobVersionCount = (static_cast<size_t>(LastMobVersion) + 1);
|
||||||
|
|
||||||
bool IsValidMobVersion(MobVersion mob_version);
|
bool IsValidMobVersion(MobVersion mob_version);
|
||||||
@@ -136,8 +131,7 @@ namespace EQ
|
|||||||
ucsSoDCombined = 'D',
|
ucsSoDCombined = 'D',
|
||||||
ucsUFCombined = 'E',
|
ucsUFCombined = 'E',
|
||||||
ucsRoFCombined = 'F',
|
ucsRoFCombined = 'F',
|
||||||
ucsRoF2Combined = 'G',
|
ucsRoF2Combined = 'G'
|
||||||
ucsLaurionCombined = 'G'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} /*versions*/
|
} /*versions*/
|
||||||
@@ -164,17 +158,7 @@ namespace EQ
|
|||||||
HoT,
|
HoT,
|
||||||
VoA,
|
VoA,
|
||||||
RoF,
|
RoF,
|
||||||
CotF,
|
CotF
|
||||||
TDS,
|
|
||||||
TBM,
|
|
||||||
EoK,
|
|
||||||
RoS,
|
|
||||||
TBL,
|
|
||||||
ToV,
|
|
||||||
CoV,
|
|
||||||
ToL,
|
|
||||||
NoS,
|
|
||||||
LS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ExpansionBitmask : uint32 {
|
enum ExpansionBitmask : uint32 {
|
||||||
@@ -199,16 +183,6 @@ namespace EQ
|
|||||||
bitVoA = 0x00020000,
|
bitVoA = 0x00020000,
|
||||||
bitRoF = 0x00040000,
|
bitRoF = 0x00040000,
|
||||||
bitCotF = 0x00080000,
|
bitCotF = 0x00080000,
|
||||||
bitTDS = 0x00100000,
|
|
||||||
bitTBM = 0x00200000,
|
|
||||||
bitEoK = 0x00400000,
|
|
||||||
bitRoS = 0x00800000,
|
|
||||||
bitTBL = 0x01000000,
|
|
||||||
bitToV = 0x02000000,
|
|
||||||
bitCoV = 0x04000000,
|
|
||||||
bitToL = 0x08000000,
|
|
||||||
bitNoS = 0x10000000,
|
|
||||||
bitLS = 0x20000000,
|
|
||||||
maskEverQuest = 0x00000000,
|
maskEverQuest = 0x00000000,
|
||||||
maskRoK = 0x00000001,
|
maskRoK = 0x00000001,
|
||||||
maskSoV = 0x00000003,
|
maskSoV = 0x00000003,
|
||||||
@@ -229,17 +203,7 @@ namespace EQ
|
|||||||
maskHoT = 0x0001FFFF,
|
maskHoT = 0x0001FFFF,
|
||||||
maskVoA = 0x0003FFFF,
|
maskVoA = 0x0003FFFF,
|
||||||
maskRoF = 0x0007FFFF,
|
maskRoF = 0x0007FFFF,
|
||||||
maskCotF = 0x000FFFFF,
|
maskCotF = 0x000FFFFF
|
||||||
maskTDS = 0x001FFFFF,
|
|
||||||
maskTBM = 0x003FFFFF,
|
|
||||||
maskEoK = 0x007FFFFF,
|
|
||||||
maskRoS = 0x00FFFFFF,
|
|
||||||
maskTBL = 0x01FFFFFF,
|
|
||||||
maskToV = 0x03FFFFFF,
|
|
||||||
maskCoV = 0x07FFFFFF,
|
|
||||||
maskToL = 0x0FFFFFFF,
|
|
||||||
maskNoS = 0x1FFFFFFF,
|
|
||||||
maskLS = 0x3FFFFFFF,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* ExpansionName(Expansion expansion);
|
const char* ExpansionName(Expansion expansion);
|
||||||
|
|||||||
@@ -104,14 +104,6 @@ static const EQ::constants::LookupEntry constants_static_lookup_entries[EQ::vers
|
|||||||
RoF2::constants::EXPANSIONS_MASK,
|
RoF2::constants::EXPANSIONS_MASK,
|
||||||
RoF2::constants::CHARACTER_CREATION_LIMIT,
|
RoF2::constants::CHARACTER_CREATION_LIMIT,
|
||||||
RoF2::constants::SAY_LINK_BODY_SIZE
|
RoF2::constants::SAY_LINK_BODY_SIZE
|
||||||
),
|
|
||||||
/*[ClientVersion::Larion] =*/
|
|
||||||
EQ::constants::LookupEntry(
|
|
||||||
Larion::constants::EXPANSION,
|
|
||||||
Larion::constants::EXPANSION_BIT,
|
|
||||||
Larion::constants::EXPANSIONS_MASK,
|
|
||||||
Larion::constants::CHARACTER_CREATION_LIMIT,
|
|
||||||
Larion::constants::SAY_LINK_BODY_SIZE
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -378,33 +370,6 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF2::inventory::ConcatenateInvTypeLimbo,
|
RoF2::inventory::ConcatenateInvTypeLimbo,
|
||||||
RoF2::inventory::AllowOverLevelEquipment
|
RoF2::inventory::AllowOverLevelEquipment
|
||||||
),
|
),
|
||||||
/*[MobVersion::LS] =*/
|
|
||||||
EQ::inventory::LookupEntry(
|
|
||||||
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
|
|
||||||
EQ::invtype::POSSESSIONS_SIZE, RoF2::invtype::BANK_SIZE, RoF2::invtype::SHARED_BANK_SIZE,
|
|
||||||
RoF2::invtype::TRADE_SIZE, RoF2::invtype::WORLD_SIZE, RoF2::invtype::LIMBO_SIZE,
|
|
||||||
RoF2::invtype::TRIBUTE_SIZE, RoF2::invtype::TROPHY_TRIBUTE_SIZE, RoF2::invtype::GUILD_TRIBUTE_SIZE,
|
|
||||||
RoF2::invtype::MERCHANT_SIZE, RoF2::invtype::DELETED_SIZE, RoF2::invtype::CORPSE_SIZE,
|
|
||||||
RoF2::invtype::BAZAAR_SIZE, RoF2::invtype::INSPECT_SIZE, RoF2::invtype::REAL_ESTATE_SIZE,
|
|
||||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
|
||||||
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
|
||||||
RoF2::invtype::OTHER_SIZE
|
|
||||||
),
|
|
||||||
|
|
||||||
RoF2::invslot::EQUIPMENT_BITMASK,
|
|
||||||
RoF2::invslot::GENERAL_BITMASK,
|
|
||||||
RoF2::invslot::CURSOR_BITMASK,
|
|
||||||
RoF2::invslot::POSSESSIONS_BITMASK,
|
|
||||||
RoF2::invslot::CORPSE_BITMASK,
|
|
||||||
RoF2::invbag::SLOT_COUNT,
|
|
||||||
RoF2::invaug::SOCKET_COUNT,
|
|
||||||
|
|
||||||
RoF2::inventory::AllowEmptyBagInBag,
|
|
||||||
RoF2::inventory::AllowClickCastFromBag,
|
|
||||||
RoF2::inventory::ConcatenateInvTypeLimbo,
|
|
||||||
RoF2::inventory::AllowOverLevelEquipment
|
|
||||||
),
|
|
||||||
/*[MobVersion::NPC] =*/
|
/*[MobVersion::NPC] =*/
|
||||||
EQ::inventory::LookupEntry(
|
EQ::inventory::LookupEntry(
|
||||||
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
|
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
|
||||||
@@ -778,33 +743,6 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF2::invbag::SLOT_COUNT,
|
RoF2::invbag::SLOT_COUNT,
|
||||||
RoF2::invaug::SOCKET_COUNT,
|
RoF2::invaug::SOCKET_COUNT,
|
||||||
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
/*[MobVersion::OfflineLS] =*/
|
|
||||||
EQ::inventory::LookupEntry(
|
|
||||||
EQ::inventory::LookupEntry::InventoryTypeSize_Struct(
|
|
||||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
|
||||||
RoF2::invtype::TRADE_SIZE, RoF2::INULL, RoF2::INULL,
|
|
||||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
|
||||||
RoF2::invtype::MERCHANT_SIZE, RoF2::INULL, RoF2::INULL,
|
|
||||||
RoF2::invtype::BAZAAR_SIZE, RoF2::invtype::INSPECT_SIZE, RoF2::INULL,
|
|
||||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
|
||||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
|
||||||
RoF2::INULL
|
|
||||||
),
|
|
||||||
|
|
||||||
RoF2::INULL,
|
|
||||||
RoF2::INULL,
|
|
||||||
RoF2::INULL,
|
|
||||||
RoF2::INULL,
|
|
||||||
RoF2::INULL,
|
|
||||||
RoF2::invbag::SLOT_COUNT,
|
|
||||||
RoF2::invaug::SOCKET_COUNT,
|
|
||||||
|
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@@ -1056,10 +994,6 @@ static const EQ::behavior::LookupEntry behavior_static_lookup_entries[EQ::versio
|
|||||||
EQ::behavior::LookupEntry(
|
EQ::behavior::LookupEntry(
|
||||||
RoF2::behavior::CoinHasWeight
|
RoF2::behavior::CoinHasWeight
|
||||||
),
|
),
|
||||||
/*[MobVersion::LS] =*/
|
|
||||||
EQ::behavior::LookupEntry(
|
|
||||||
RoF2::behavior::CoinHasWeight
|
|
||||||
),
|
|
||||||
/*[MobVersion::NPC] =*/
|
/*[MobVersion::NPC] =*/
|
||||||
EQ::behavior::LookupEntry(
|
EQ::behavior::LookupEntry(
|
||||||
EQ::behavior::CoinHasWeight
|
EQ::behavior::CoinHasWeight
|
||||||
@@ -1113,10 +1047,6 @@ static const EQ::behavior::LookupEntry behavior_static_lookup_entries[EQ::versio
|
|||||||
RoF::behavior::CoinHasWeight
|
RoF::behavior::CoinHasWeight
|
||||||
),
|
),
|
||||||
/*[MobVersion::OfflineRoF2] =*/
|
/*[MobVersion::OfflineRoF2] =*/
|
||||||
EQ::behavior::LookupEntry(
|
|
||||||
RoF2::behavior::CoinHasWeight
|
|
||||||
),
|
|
||||||
/*[MobVersion::OfflineLS] =*/
|
|
||||||
EQ::behavior::LookupEntry(
|
EQ::behavior::LookupEntry(
|
||||||
RoF2::behavior::CoinHasWeight
|
RoF2::behavior::CoinHasWeight
|
||||||
)
|
)
|
||||||
@@ -1272,19 +1202,6 @@ static const EQ::spells::LookupEntry spells_static_lookup_entries[EQ::versions::
|
|||||||
RoF2::spells::NPC_BUFFS,
|
RoF2::spells::NPC_BUFFS,
|
||||||
RoF2::spells::PET_BUFFS,
|
RoF2::spells::PET_BUFFS,
|
||||||
RoF2::spells::MERC_BUFFS
|
RoF2::spells::MERC_BUFFS
|
||||||
),
|
|
||||||
/*[ClientVersion::Larion] =*/
|
|
||||||
EQ::spells::LookupEntry(
|
|
||||||
Larion::spells::SPELL_ID_MAX,
|
|
||||||
Larion::spells::SPELLBOOK_SIZE,
|
|
||||||
UF::spells::SPELL_GEM_COUNT, // client translators are setup to allow the max value a client supports..however, the top 4 indices are not valid in this case
|
|
||||||
Larion::spells::LONG_BUFFS,
|
|
||||||
Larion::spells::SHORT_BUFFS,
|
|
||||||
Larion::spells::DISC_BUFFS,
|
|
||||||
Larion::spells::TOTAL_BUFFS,
|
|
||||||
Larion::spells::NPC_BUFFS,
|
|
||||||
Larion::spells::PET_BUFFS,
|
|
||||||
Larion::spells::MERC_BUFFS
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@
|
|||||||
#include "../common/patches/uf_limits.h"
|
#include "../common/patches/uf_limits.h"
|
||||||
#include "../common/patches/rof_limits.h"
|
#include "../common/patches/rof_limits.h"
|
||||||
#include "../common/patches/rof2_limits.h"
|
#include "../common/patches/rof2_limits.h"
|
||||||
#include "../common/patches/larion_limits.h"
|
|
||||||
|
|
||||||
namespace EQ
|
namespace EQ
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3221,6 +3221,7 @@ struct BuyerMessaging_Struct {
|
|||||||
char item_name[64];
|
char item_name[64];
|
||||||
uint32 slot;
|
uint32 slot;
|
||||||
uint32 seller_quantity;
|
uint32 seller_quantity;
|
||||||
|
uint32 purchase_method; // 0 direct merchant, 1 via /barter window
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuyerAddBuyertoBarterWindow_Struct {
|
struct BuyerAddBuyertoBarterWindow_Struct {
|
||||||
@@ -6435,13 +6436,6 @@ struct BuylineItemDetails_Struct {
|
|||||||
uint32 item_quantity;
|
uint32 item_quantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EqGuid
|
|
||||||
{
|
|
||||||
uint32_t Id;
|
|
||||||
uint16_t WorldId;
|
|
||||||
uint16_t Reserved;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Restore structure packing to default
|
// Restore structure packing to default
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void EQEmuConfig::parse_config()
|
|||||||
auto_database_updates = true;
|
auto_database_updates = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldIP = _root["server"]["world"]["tcp"].get("host", "127.0.0.1").asString();
|
WorldIP = _root["server"]["world"]["tcp"].get("ip", "127.0.0.1").asString();
|
||||||
WorldTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["tcp"].get("port", "9000").asString());
|
WorldTCPPort = Strings::ToUnsignedInt(_root["server"]["world"]["tcp"].get("port", "9000").asString());
|
||||||
|
|
||||||
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
TelnetIP = _root["server"]["world"]["telnet"].get("ip", "127.0.0.1").asString();
|
||||||
@@ -171,6 +171,7 @@ void EQEmuConfig::parse_config()
|
|||||||
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
||||||
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
||||||
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
||||||
|
OpcodeDir = _root["server"]["directories"].get("opcodes", "./").asString();
|
||||||
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
||||||
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ class EQEmuConfig
|
|||||||
std::string PluginDir;
|
std::string PluginDir;
|
||||||
std::string LuaModuleDir;
|
std::string LuaModuleDir;
|
||||||
std::string PatchDir;
|
std::string PatchDir;
|
||||||
|
std::string OpcodeDir;
|
||||||
std::string SharedMemDir;
|
std::string SharedMemDir;
|
||||||
std::string LogDir;
|
std::string LogDir;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,600 @@
|
|||||||
|
#include "mysql_stmt.h"
|
||||||
|
#include "eqemu_logsys.h"
|
||||||
|
#include "mutex.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include <charconv>
|
||||||
|
|
||||||
|
namespace mysql
|
||||||
|
{
|
||||||
|
|
||||||
|
void PreparedStmt::StmtDeleter::operator()(MYSQL_STMT* stmt) noexcept
|
||||||
|
{
|
||||||
|
// The connection must be locked when closing the stmt to avoid mysql errors
|
||||||
|
// in case another thread tries to use it during the close. If the mutex is
|
||||||
|
// changed to one that throws then exceptions need to be caught here.
|
||||||
|
LockMutex lock(mutex);
|
||||||
|
mysql_stmt_close(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
PreparedStmt::PreparedStmt(MYSQL& mysql, std::string query, Mutex* mutex, StmtOptions opts)
|
||||||
|
: m_stmt(mysql_stmt_init(&mysql), { mutex }), m_query(std::move(query)), m_mutex(mutex), m_options(opts)
|
||||||
|
{
|
||||||
|
LockMutex lock(m_mutex);
|
||||||
|
if (mysql_stmt_prepare(m_stmt.get(), m_query.c_str(), static_cast<unsigned long>(m_query.size())) != 0)
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Prepare error: {}", GetStmtError()));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_params.resize(mysql_stmt_param_count(m_stmt.get()));
|
||||||
|
m_inputs.resize(m_params.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparedStmt::ThrowError(const std::string& error)
|
||||||
|
{
|
||||||
|
LogMySQLError("{}", error);
|
||||||
|
throw std::runtime_error(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string PreparedStmt::GetStmtError()
|
||||||
|
{
|
||||||
|
auto err = mysql_stmt_errno(m_stmt.get());
|
||||||
|
auto str = mysql_stmt_error(m_stmt.get());
|
||||||
|
return fmt::format("({}) [{}] for query [{}]", err, str, m_query);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void PreparedStmt::BindInput(size_t index, T value)
|
||||||
|
{
|
||||||
|
if (index >= m_inputs.size())
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Cannot bind input, index {} out of range", index));
|
||||||
|
}
|
||||||
|
|
||||||
|
impl::Bind& arg = m_inputs[index];
|
||||||
|
arg.is_null = std::is_same_v<T, std::nullptr_t>;
|
||||||
|
|
||||||
|
MYSQL_BIND& bind = m_params[index];
|
||||||
|
bind.is_unsigned = std::is_unsigned_v<T>;
|
||||||
|
bind.is_null = &arg.is_null;
|
||||||
|
bind.length = &arg.length;
|
||||||
|
|
||||||
|
auto old_type = bind.buffer_type;
|
||||||
|
|
||||||
|
if constexpr (std::is_arithmetic_v<T>)
|
||||||
|
{
|
||||||
|
if (arg.buffer.size() < sizeof(T))
|
||||||
|
{
|
||||||
|
arg.buffer.resize(std::max(sizeof(T), sizeof(int64_t)));
|
||||||
|
bind.buffer = arg.buffer.data();
|
||||||
|
m_need_bind = true;
|
||||||
|
}
|
||||||
|
memcpy(arg.buffer.data(), &value, sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
if constexpr (std::is_same_v<T, int8_t> || std::is_same_v<T, uint8_t> || std::is_same_v<T, bool>)
|
||||||
|
{
|
||||||
|
bind.buffer_type = MYSQL_TYPE_TINY;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, int16_t> || std::is_same_v<T, uint16_t>)
|
||||||
|
{
|
||||||
|
bind.buffer_type = MYSQL_TYPE_SHORT;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t>)
|
||||||
|
{
|
||||||
|
bind.buffer_type = MYSQL_TYPE_LONG;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, int64_t> || std::is_same_v<T, uint64_t>)
|
||||||
|
{
|
||||||
|
bind.buffer_type = MYSQL_TYPE_LONGLONG;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, float>)
|
||||||
|
{
|
||||||
|
bind.buffer_type = MYSQL_TYPE_FLOAT;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, double>)
|
||||||
|
{
|
||||||
|
bind.buffer_type = MYSQL_TYPE_DOUBLE;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, std::string_view>)
|
||||||
|
{
|
||||||
|
bind.buffer_type = MYSQL_TYPE_STRING;
|
||||||
|
if (arg.buffer.empty() || arg.buffer.size() < value.size())
|
||||||
|
{
|
||||||
|
arg.buffer.resize(static_cast<size_t>((value.size() + 1) * 1.5));
|
||||||
|
bind.buffer = arg.buffer.data();
|
||||||
|
bind.buffer_length = static_cast<unsigned long>(arg.buffer.size());
|
||||||
|
m_need_bind = true;
|
||||||
|
}
|
||||||
|
std::copy(value.begin(), value.end(), arg.buffer.begin());
|
||||||
|
arg.length = static_cast<unsigned long>(value.size());
|
||||||
|
}
|
||||||
|
else if constexpr (!std::is_same_v<T, std::nullptr_t>)
|
||||||
|
{
|
||||||
|
static_assert(false_v<T>, "Cannot bind unsupported type");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (old_type != bind.buffer_type)
|
||||||
|
{
|
||||||
|
m_need_bind = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparedStmt::BindInput(size_t index, const char* str)
|
||||||
|
{
|
||||||
|
BindInput(index, std::string_view(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparedStmt::BindInput(size_t index, const std::string& str)
|
||||||
|
{
|
||||||
|
BindInput(index, std::string_view(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
StmtResult PreparedStmt::Execute()
|
||||||
|
{
|
||||||
|
CheckArgs(0);
|
||||||
|
return DoExecute();
|
||||||
|
}
|
||||||
|
|
||||||
|
StmtResult PreparedStmt::Execute(const std::vector<param_t>& args)
|
||||||
|
{
|
||||||
|
CheckArgs(args.size());
|
||||||
|
for (size_t i = 0; i < args.size(); ++i)
|
||||||
|
{
|
||||||
|
std::visit([&](const auto& arg) { BindInput(i, arg); }, args[i]);
|
||||||
|
}
|
||||||
|
return DoExecute();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
StmtResult PreparedStmt::Execute(const std::vector<T>& args)
|
||||||
|
{
|
||||||
|
CheckArgs(args.size());
|
||||||
|
for (size_t i = 0; i < args.size(); ++i)
|
||||||
|
{
|
||||||
|
BindInput(i, args[i]);
|
||||||
|
}
|
||||||
|
return DoExecute();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparedStmt::CheckArgs(size_t argc)
|
||||||
|
{
|
||||||
|
if (argc != m_params.size())
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Bad arg count (got {}, expected {}) for [{}]", argc, m_params.size(), m_query));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StmtResult PreparedStmt::DoExecute()
|
||||||
|
{
|
||||||
|
BenchTimer timer;
|
||||||
|
LockMutex lock(m_mutex);
|
||||||
|
|
||||||
|
if (m_need_bind && mysql_stmt_bind_param(m_stmt.get(), m_params.data()) != 0)
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Bind param error: {}", GetStmtError()));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_need_bind = false;
|
||||||
|
|
||||||
|
if (mysql_stmt_execute(m_stmt.get()) != 0)
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Execute error: {}", GetStmtError()));
|
||||||
|
}
|
||||||
|
|
||||||
|
my_bool attr = m_options.use_max_length;
|
||||||
|
mysql_stmt_attr_set(m_stmt.get(), STMT_ATTR_UPDATE_MAX_LENGTH, &attr);
|
||||||
|
|
||||||
|
if (m_options.buffer_results && mysql_stmt_store_result(m_stmt.get()) != 0)
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Store result error: {}", GetStmtError()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Result buffers are bound on first execute and re-used if needed
|
||||||
|
if (m_results.empty())
|
||||||
|
{
|
||||||
|
BindResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
StmtResult res(m_stmt.get(), m_results.size());
|
||||||
|
|
||||||
|
if (m_results.empty())
|
||||||
|
{
|
||||||
|
LogMySQLQuery("{} -- ({} row(s) affected) ({:.6f}s)", m_query, res.RowsAffected(), timer.elapsed());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogMySQLQuery("{} -- ({} row(s) returned) ({:.6f}s)", m_query, res.RowCount(), timer.elapsed());
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparedStmt::BindResults()
|
||||||
|
{
|
||||||
|
MYSQL_RES* res = mysql_stmt_result_metadata(m_stmt.get());
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
return; // did not produce a result set
|
||||||
|
}
|
||||||
|
|
||||||
|
MYSQL_FIELD* fields = mysql_fetch_fields(res);
|
||||||
|
m_columns.resize(mysql_num_fields(res));
|
||||||
|
m_results.resize(m_columns.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < static_cast<int>(m_columns.size()); ++i)
|
||||||
|
{
|
||||||
|
impl::BindColumn& col = m_columns[i].m_col;
|
||||||
|
MYSQL_BIND& bind = m_results[i];
|
||||||
|
|
||||||
|
col.index = i;
|
||||||
|
col.name = fields[i].name;
|
||||||
|
col.buffer_type = fields[i].type;
|
||||||
|
col.is_unsigned = (fields[i].flags & UNSIGNED_FLAG) != 0;
|
||||||
|
col.buffer.resize(GetResultBufferSize(fields[i]));
|
||||||
|
|
||||||
|
bind.buffer_type = col.buffer_type;
|
||||||
|
bind.buffer = col.buffer.data();
|
||||||
|
bind.buffer_length = static_cast<unsigned long>(col.buffer.size());
|
||||||
|
bind.is_unsigned = col.is_unsigned;
|
||||||
|
bind.is_null = &col.is_null;
|
||||||
|
bind.length = &col.length;
|
||||||
|
bind.error = &col.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
mysql_free_result(res);
|
||||||
|
|
||||||
|
if (!m_results.empty() && mysql_stmt_bind_result(m_stmt.get(), m_results.data()) != 0)
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Bind result error: {}", GetStmtError()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int PreparedStmt::GetResultBufferSize(const MYSQL_FIELD& field) const
|
||||||
|
{
|
||||||
|
switch (field.type)
|
||||||
|
{
|
||||||
|
case MYSQL_TYPE_TINY:
|
||||||
|
return sizeof(int8_t);
|
||||||
|
case MYSQL_TYPE_SHORT:
|
||||||
|
return sizeof(int16_t);
|
||||||
|
case MYSQL_TYPE_INT24:
|
||||||
|
case MYSQL_TYPE_LONG:
|
||||||
|
return sizeof(int32_t);
|
||||||
|
case MYSQL_TYPE_LONGLONG:
|
||||||
|
return sizeof(int64_t);
|
||||||
|
case MYSQL_TYPE_FLOAT:
|
||||||
|
return sizeof(float);
|
||||||
|
case MYSQL_TYPE_DOUBLE:
|
||||||
|
return sizeof(double);
|
||||||
|
case MYSQL_TYPE_TIME:
|
||||||
|
case MYSQL_TYPE_DATE:
|
||||||
|
case MYSQL_TYPE_DATETIME:
|
||||||
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
|
return sizeof(MYSQL_TIME);
|
||||||
|
default: // if max_length is unavailable for strings buffers are resized on fetch
|
||||||
|
return field.max_length + 1; // ensure valid buffer created
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StmtRow PreparedStmt::Fetch()
|
||||||
|
{
|
||||||
|
StmtRow row;
|
||||||
|
if (!m_columns.empty())
|
||||||
|
{
|
||||||
|
int rc = mysql_stmt_fetch(m_stmt.get());
|
||||||
|
if (rc == 1)
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Fetch error: {}", GetStmtError()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc != MYSQL_NO_DATA)
|
||||||
|
{
|
||||||
|
if (rc == MYSQL_DATA_TRUNCATED)
|
||||||
|
{
|
||||||
|
FetchTruncated();
|
||||||
|
}
|
||||||
|
row = StmtRow(m_columns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreparedStmt::FetchTruncated()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < static_cast<int>(m_columns.size()); ++i)
|
||||||
|
{
|
||||||
|
impl::BindColumn& col = m_columns[i].m_col;
|
||||||
|
if (col.error)
|
||||||
|
{
|
||||||
|
MYSQL_BIND& bind = m_results[i];
|
||||||
|
col.buffer.resize(static_cast<size_t>(col.length * 1.5));
|
||||||
|
bind.buffer = col.buffer.data();
|
||||||
|
bind.buffer_length = static_cast<unsigned long>(col.buffer.size());
|
||||||
|
|
||||||
|
mysql_stmt_fetch_column(m_stmt.get(), &bind, i, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mysql_stmt_bind_result(m_stmt.get(), m_results.data()) != 0)
|
||||||
|
{
|
||||||
|
ThrowError(fmt::format("Fetch rebind result error: {}", GetStmtError()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
StmtResult::StmtResult(MYSQL_STMT* stmt, size_t columns)
|
||||||
|
{
|
||||||
|
m_num_cols = static_cast<int>(columns);
|
||||||
|
m_num_rows = mysql_stmt_num_rows(stmt); // requires buffered results
|
||||||
|
m_affected = mysql_stmt_affected_rows(stmt);
|
||||||
|
m_insert_id = mysql_stmt_insert_id(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const StmtColumn* StmtRow::GetColumn(size_t index) const
|
||||||
|
{
|
||||||
|
return index < m_columns.size() ? &m_columns[index] : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const StmtColumn* StmtRow::GetColumn(std::string_view name) const
|
||||||
|
{
|
||||||
|
auto it = std::ranges::find_if(m_columns,
|
||||||
|
[name](const StmtColumn& col) { return col.Name() == name; });
|
||||||
|
|
||||||
|
return it != m_columns.end() ? &(*it) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> StmtRow::operator[](size_t index) const
|
||||||
|
{
|
||||||
|
return GetStr(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> StmtRow::operator[](std::string_view name) const
|
||||||
|
{
|
||||||
|
return GetStr(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> StmtRow::GetStr(size_t index) const
|
||||||
|
{
|
||||||
|
const StmtColumn* col = GetColumn(index);
|
||||||
|
return col ? col->GetStr() : std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> StmtRow::GetStr(std::string_view name) const
|
||||||
|
{
|
||||||
|
const StmtColumn* col = GetColumn(name);
|
||||||
|
return col ? col->GetStr() : std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> requires std::is_arithmetic_v<T>
|
||||||
|
std::optional<T> StmtRow::Get(size_t index) const
|
||||||
|
{
|
||||||
|
const StmtColumn* col = GetColumn(index);
|
||||||
|
return col ? col->Get<T>() : std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> requires std::is_arithmetic_v<T>
|
||||||
|
std::optional<T> StmtRow::Get(std::string_view name) const
|
||||||
|
{
|
||||||
|
const StmtColumn* col = GetColumn(name);
|
||||||
|
return col ? col->Get<T>() : std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static time_t MakeTime(const MYSQL_TIME& mt)
|
||||||
|
{
|
||||||
|
// buffer mt given in mysql session time zone (assumes local)
|
||||||
|
std::tm tm{};
|
||||||
|
tm.tm_year = mt.year - 1900;
|
||||||
|
tm.tm_mon = mt.month - 1;
|
||||||
|
tm.tm_mday = mt.day;
|
||||||
|
tm.tm_hour = mt.hour;
|
||||||
|
tm.tm_min = mt.minute;
|
||||||
|
tm.tm_sec = mt.second;
|
||||||
|
tm.tm_isdst = -1;
|
||||||
|
return std::mktime(&tm);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int MakeSeconds(const MYSQL_TIME& mt)
|
||||||
|
{
|
||||||
|
return (mt.neg ? -1 : 1) * static_cast<int>(mt.hour * 3600 + mt.minute * 60 + mt.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint64_t MakeBits(std::span<const uint8_t> data)
|
||||||
|
{
|
||||||
|
// byte stream for bits is in big endian
|
||||||
|
uint64_t bits = 0;
|
||||||
|
for (size_t i = 0; i < data.size() && i < sizeof(uint64_t); ++i)
|
||||||
|
{
|
||||||
|
bits |= static_cast<uint64_t>(data[data.size() - i - 1] & 0xff) << (i * 8);
|
||||||
|
}
|
||||||
|
return bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
concept has_from_chars = requires (const char* first, const char* last, T value)
|
||||||
|
{
|
||||||
|
std::from_chars(first, last, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static T FromString(std::string_view sv)
|
||||||
|
{
|
||||||
|
if constexpr (std::is_same_v<T, bool>)
|
||||||
|
{
|
||||||
|
// return false for empty (zero-length) strings
|
||||||
|
return !sv.empty();
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, float> && !has_from_chars<T>)
|
||||||
|
{
|
||||||
|
return std::strtof(std::string(sv).c_str(), nullptr);
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, double> && !has_from_chars<T>)
|
||||||
|
{
|
||||||
|
return std::strtod(std::string(sv).c_str(), nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// non numbers return a zero initialized T (could return nullopt instead)
|
||||||
|
T value = {};
|
||||||
|
std::from_chars(sv.data(), sv.data() + sv.size(), value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string FormatTime(enum_field_types type, const MYSQL_TIME& mt)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case MYSQL_TYPE_TIME: // hhh:mm:ss '-838:59:59' to '838:59:59'
|
||||||
|
return fmt::format("{}{:02d}:{:02d}:{:02d}", mt.neg ? "-" : "", mt.hour, mt.minute, mt.second);
|
||||||
|
case MYSQL_TYPE_DATE: // YYYY-MM-DD '1000-01-01' to '9999-12-31'
|
||||||
|
return fmt::format("{}-{:02d}-{:02d}", mt.year, mt.month, mt.day);
|
||||||
|
case MYSQL_TYPE_DATETIME: // YYYY-MM-DD hh:mm:ss '1000-01-01 00:00:00' to '9999-12-31 23:59:59'
|
||||||
|
case MYSQL_TYPE_TIMESTAMP: // YYYY-MM-DD hh:mm:ss '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC
|
||||||
|
return fmt::format("{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}", mt.year, mt.month, mt.day, mt.hour, mt.minute, mt.second);
|
||||||
|
default:
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string_view> StmtColumn::GetStrView() const
|
||||||
|
{
|
||||||
|
if (m_col.is_null)
|
||||||
|
{
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (m_col.buffer_type)
|
||||||
|
{
|
||||||
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
|
case MYSQL_TYPE_BLOB:
|
||||||
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
|
case MYSQL_TYPE_STRING:
|
||||||
|
return std::make_optional<std::string_view>(reinterpret_cast<const char*>(m_col.buffer.data()), m_col.length);
|
||||||
|
default:
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> StmtColumn::GetStr() const
|
||||||
|
{
|
||||||
|
if (m_col.is_null)
|
||||||
|
{
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (m_col.buffer_type)
|
||||||
|
{
|
||||||
|
case MYSQL_TYPE_TINY:
|
||||||
|
return m_col.is_unsigned ? fmt::format_int(BitCast<uint8_t>()).c_str() : fmt::format_int(BitCast<int8_t>()).c_str();
|
||||||
|
case MYSQL_TYPE_SHORT:
|
||||||
|
return m_col.is_unsigned ? fmt::format_int(BitCast<uint16_t>()).c_str() : fmt::format_int(BitCast<int16_t>()).c_str();
|
||||||
|
case MYSQL_TYPE_INT24:
|
||||||
|
case MYSQL_TYPE_LONG:
|
||||||
|
return m_col.is_unsigned ? fmt::format_int(BitCast<uint32_t>()).c_str() : fmt::format_int(BitCast<int32_t>()).c_str();
|
||||||
|
case MYSQL_TYPE_LONGLONG:
|
||||||
|
return m_col.is_unsigned ? fmt::format_int(BitCast<uint64_t>()).c_str() : fmt::format_int(BitCast<int64_t>()).c_str();
|
||||||
|
case MYSQL_TYPE_FLOAT:
|
||||||
|
return fmt::format("{}", BitCast<float>());
|
||||||
|
case MYSQL_TYPE_DOUBLE:
|
||||||
|
return fmt::format("{}", BitCast<double>());
|
||||||
|
case MYSQL_TYPE_TIME:
|
||||||
|
case MYSQL_TYPE_DATE:
|
||||||
|
case MYSQL_TYPE_DATETIME:
|
||||||
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
|
return FormatTime(m_col.buffer_type, BitCast<MYSQL_TIME>());
|
||||||
|
case MYSQL_TYPE_BIT:
|
||||||
|
return fmt::format_int(*Get<uint64_t>()).c_str();
|
||||||
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
|
case MYSQL_TYPE_BLOB:
|
||||||
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
|
case MYSQL_TYPE_STRING:
|
||||||
|
return std::make_optional<std::string>(reinterpret_cast<const char*>(m_col.buffer.data()), m_col.length);
|
||||||
|
default:
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> requires std::is_arithmetic_v<T>
|
||||||
|
std::optional<T> StmtColumn::Get() const
|
||||||
|
{
|
||||||
|
if (m_col.is_null)
|
||||||
|
{
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (m_col.buffer_type)
|
||||||
|
{
|
||||||
|
case MYSQL_TYPE_TINY:
|
||||||
|
return m_col.is_unsigned ? static_cast<T>(BitCast<uint8_t>()) : static_cast<T>(BitCast<int8_t>());
|
||||||
|
case MYSQL_TYPE_SHORT:
|
||||||
|
return m_col.is_unsigned ? static_cast<T>(BitCast<uint16_t>()) : static_cast<T>(BitCast<int16_t>());
|
||||||
|
case MYSQL_TYPE_INT24:
|
||||||
|
case MYSQL_TYPE_LONG:
|
||||||
|
return m_col.is_unsigned ? static_cast<T>(BitCast<uint32_t>()) : static_cast<T>(BitCast<int32_t>());
|
||||||
|
case MYSQL_TYPE_LONGLONG:
|
||||||
|
return m_col.is_unsigned ? static_cast<T>(BitCast<uint64_t>()) : static_cast<T>(BitCast<int64_t>());
|
||||||
|
case MYSQL_TYPE_FLOAT:
|
||||||
|
return static_cast<T>(BitCast<float>());
|
||||||
|
case MYSQL_TYPE_DOUBLE:
|
||||||
|
return static_cast<T>(BitCast<double>());
|
||||||
|
case MYSQL_TYPE_TIME: // return as total seconds
|
||||||
|
return static_cast<T>(MakeSeconds(BitCast<MYSQL_TIME>()));
|
||||||
|
case MYSQL_TYPE_DATE:
|
||||||
|
case MYSQL_TYPE_DATETIME:
|
||||||
|
case MYSQL_TYPE_TIMESTAMP: // return as epoch timestamp
|
||||||
|
return static_cast<T>(MakeTime(BitCast<MYSQL_TIME>()));
|
||||||
|
case MYSQL_TYPE_BIT:
|
||||||
|
return static_cast<T>(MakeBits({ m_col.buffer.data(), m_col.length }));
|
||||||
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
|
case MYSQL_TYPE_BLOB:
|
||||||
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
|
case MYSQL_TYPE_STRING:
|
||||||
|
return FromString<T>({ reinterpret_cast<const char*>(m_col.buffer.data()), m_col.length });
|
||||||
|
default:
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// explicit template instantiations for supported types
|
||||||
|
template void PreparedStmt::BindInput(size_t, std::string_view);
|
||||||
|
template void PreparedStmt::BindInput(size_t, std::nullptr_t);
|
||||||
|
template StmtResult PreparedStmt::Execute(const std::vector<std::string_view>&);
|
||||||
|
template StmtResult PreparedStmt::Execute(const std::vector<std::string>&);
|
||||||
|
template StmtResult PreparedStmt::Execute(const std::vector<const char*>&);
|
||||||
|
|
||||||
|
#define INSTANTIATE(T) \
|
||||||
|
template void PreparedStmt::BindInput(size_t, T); \
|
||||||
|
template StmtResult PreparedStmt::Execute(const std::vector<T>&); \
|
||||||
|
template std::optional<T> StmtRow::Get(size_t) const; \
|
||||||
|
template std::optional<T> StmtRow::Get(std::string_view) const; \
|
||||||
|
template std::optional<T> StmtColumn::Get() const;
|
||||||
|
|
||||||
|
INSTANTIATE(bool);
|
||||||
|
INSTANTIATE(int8_t);
|
||||||
|
INSTANTIATE(uint8_t);
|
||||||
|
INSTANTIATE(int16_t);
|
||||||
|
INSTANTIATE(uint16_t);
|
||||||
|
INSTANTIATE(int32_t);
|
||||||
|
INSTANTIATE(uint32_t);
|
||||||
|
INSTANTIATE(int64_t);
|
||||||
|
INSTANTIATE(uint64_t);
|
||||||
|
INSTANTIATE(float);
|
||||||
|
INSTANTIATE(double);
|
||||||
|
|
||||||
|
} // namespace mysql
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "mysql.h"
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <variant>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class Mutex;
|
||||||
|
|
||||||
|
namespace mysql
|
||||||
|
{
|
||||||
|
|
||||||
|
// support MySQL 8.0.1+ API which removed the my_bool type
|
||||||
|
#if !defined(MARIADB_VERSION_ID) && MYSQL_VERSION_ID >= 80001
|
||||||
|
using my_bool = bool;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename>
|
||||||
|
inline constexpr bool false_v = false;
|
||||||
|
|
||||||
|
namespace impl
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Bind
|
||||||
|
{
|
||||||
|
std::vector<uint8_t> buffer;
|
||||||
|
unsigned long length = 0;
|
||||||
|
my_bool is_null = false;
|
||||||
|
my_bool error = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BindColumn : Bind
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
std::string name;
|
||||||
|
bool is_unsigned = false;
|
||||||
|
enum_field_types buffer_type = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace impl
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
struct StmtOptions
|
||||||
|
{
|
||||||
|
// Enable buffering (storing) entire result set after executing a statement
|
||||||
|
bool buffer_results = true;
|
||||||
|
|
||||||
|
// Enable MySQL to update max_length of fields in execute result set (requires buffering)
|
||||||
|
bool use_max_length = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Holds ownership of bound column value buffer
|
||||||
|
class StmtColumn
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int Index() const { return m_col.index; }
|
||||||
|
bool IsNull() const { return m_col.is_null; }
|
||||||
|
bool IsUnsigned() const { return m_col.is_unsigned; }
|
||||||
|
enum_field_types Type() const { return m_col.buffer_type; }
|
||||||
|
const std::string& Name() const { return m_col.name; }
|
||||||
|
|
||||||
|
// Get view of column value buffer
|
||||||
|
std::span<const uint8_t> GetBuf() const { return { m_col.buffer.data(), m_col.length }; }
|
||||||
|
|
||||||
|
// Get view of column string value. Returns nullopt if value is NULL or not a string
|
||||||
|
std::optional<std::string_view> GetStrView() const;
|
||||||
|
|
||||||
|
// Get column value as string. Returns nullopt if value is NULL or field type unsupported
|
||||||
|
std::optional<std::string> GetStr() const;
|
||||||
|
|
||||||
|
// Get column value as numeric T. Returns nullopt if value NULL or field type unsupported
|
||||||
|
template <typename T> requires std::is_arithmetic_v<T>
|
||||||
|
std::optional<T> Get() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// uses memcpy for type punning buffer data to avoid UB with strict aliasing
|
||||||
|
template <typename T>
|
||||||
|
T BitCast() const
|
||||||
|
{
|
||||||
|
T val;
|
||||||
|
assert(sizeof(T) == m_col.length);
|
||||||
|
memcpy(&val, m_col.buffer.data(), sizeof(T));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend class PreparedStmt; // access to allocate and bind buffers
|
||||||
|
friend class StmtResult; // access to resize truncated buffers
|
||||||
|
impl::BindColumn m_col;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Provides a non-owning view of PreparedStmt column value buffers
|
||||||
|
// Evaluates false if it does not contain a valid row
|
||||||
|
class StmtRow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
StmtRow() = default;
|
||||||
|
StmtRow(std::span<const StmtColumn> columns) : m_columns(columns) {};
|
||||||
|
|
||||||
|
explicit operator bool() const noexcept { return !m_columns.empty(); }
|
||||||
|
|
||||||
|
int ColumnCount() const { return static_cast<int>(m_columns.size()); }
|
||||||
|
const StmtColumn* GetColumn(size_t index) const;
|
||||||
|
const StmtColumn* GetColumn(std::string_view name) const;
|
||||||
|
|
||||||
|
// Get specified column value as string
|
||||||
|
// Returns nullopt if column invalid, value is NULL, or field type unsupported
|
||||||
|
std::optional<std::string> operator[](size_t index) const;
|
||||||
|
std::optional<std::string> operator[](std::string_view name) const;
|
||||||
|
std::optional<std::string> GetStr(size_t index) const;
|
||||||
|
std::optional<std::string> GetStr(std::string_view name) const;
|
||||||
|
|
||||||
|
// Get specified column value as numeric T
|
||||||
|
// Returns nullopt if column invalid, value is NULL, or field type unsupported
|
||||||
|
template <typename T> requires std::is_arithmetic_v<T>
|
||||||
|
std::optional<T> Get(size_t index) const;
|
||||||
|
|
||||||
|
template <typename T> requires std::is_arithmetic_v<T>
|
||||||
|
std::optional<T> Get(std::string_view name) const;
|
||||||
|
|
||||||
|
auto begin() const { return m_columns.begin(); }
|
||||||
|
auto end() const { return m_columns.end(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::span<const StmtColumn> m_columns;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Result meta data for an executed prepared statement
|
||||||
|
class StmtResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
StmtResult() = default;
|
||||||
|
StmtResult(MYSQL_STMT* stmt, size_t columns);
|
||||||
|
|
||||||
|
int ColumnCount() const { return m_num_cols; }
|
||||||
|
uint64_t RowCount() const { return m_num_rows; }
|
||||||
|
uint64_t RowsAffected() const { return m_affected; }
|
||||||
|
uint64_t LastInsertID() const { return m_insert_id; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_num_cols = 0;
|
||||||
|
uint64_t m_num_rows = 0;
|
||||||
|
uint64_t m_affected = 0;
|
||||||
|
uint64_t m_insert_id = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class PreparedStmt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Supported argument types for execute
|
||||||
|
using param_t = std::variant<int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
|
||||||
|
int64_t, uint64_t, float, double, bool, std::string_view, std::nullptr_t>;
|
||||||
|
|
||||||
|
PreparedStmt() = delete;
|
||||||
|
PreparedStmt(MYSQL& mysql, std::string query, Mutex* mutex, StmtOptions opts = {});
|
||||||
|
|
||||||
|
const std::string& GetQuery() const { return m_query; }
|
||||||
|
StmtOptions GetOptions() const { return m_options; }
|
||||||
|
void SetOptions(StmtOptions options) { m_options = options; }
|
||||||
|
void FreeResult() { mysql_stmt_free_result(m_stmt.get()); }
|
||||||
|
|
||||||
|
// Execute the prepared statement with specified arguments
|
||||||
|
// Throws exception on error
|
||||||
|
template <typename T>
|
||||||
|
StmtResult Execute(const std::vector<T>& args);
|
||||||
|
StmtResult Execute(const std::vector<param_t>& args);
|
||||||
|
StmtResult Execute();
|
||||||
|
|
||||||
|
// Fetch the next row into column buffers (overwrites previous row values)
|
||||||
|
// Return value evaluates false if no more rows to fetch
|
||||||
|
// Throws exception on error
|
||||||
|
StmtRow Fetch();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CheckArgs(size_t argc);
|
||||||
|
StmtResult DoExecute();
|
||||||
|
void BindResults();
|
||||||
|
void FetchTruncated();
|
||||||
|
int GetResultBufferSize(const MYSQL_FIELD& field) const;
|
||||||
|
void ThrowError(const std::string& error);
|
||||||
|
std::string GetStmtError();
|
||||||
|
|
||||||
|
// bind an input value to a query parameter by index
|
||||||
|
template <typename T>
|
||||||
|
void BindInput(size_t index, T value);
|
||||||
|
void BindInput(size_t index, const char* str);
|
||||||
|
void BindInput(size_t index, const std::string& str);
|
||||||
|
|
||||||
|
struct StmtDeleter
|
||||||
|
{
|
||||||
|
Mutex* mutex = nullptr;
|
||||||
|
void operator()(MYSQL_STMT* stmt) noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<MYSQL_STMT, StmtDeleter> m_stmt;
|
||||||
|
std::vector<MYSQL_BIND> m_params; // input binds
|
||||||
|
std::vector<MYSQL_BIND> m_results; // result binds
|
||||||
|
std::vector<impl::Bind> m_inputs; // execute buffers (addresses bound)
|
||||||
|
std::vector<StmtColumn> m_columns; // fetch buffers (addresses bound)
|
||||||
|
std::string m_query;
|
||||||
|
StmtOptions m_options = {};
|
||||||
|
bool m_need_bind = true;
|
||||||
|
Mutex* m_mutex = nullptr; // connection mutex
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mysql
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
are required to give you total support for your newly bought product;
|
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMMON_LARION_H
|
|
||||||
#define COMMON_LARION_H
|
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
|
||||||
|
|
||||||
namespace Larion
|
|
||||||
{
|
|
||||||
|
|
||||||
//these are the only public member of this namespace.
|
|
||||||
extern void Register(EQStreamIdentifier& into);
|
|
||||||
extern void Reload();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//you should not directly access anything below..
|
|
||||||
//I just dont feel like making a seperate header for it.
|
|
||||||
|
|
||||||
class Strategy : public StructStrategy {
|
|
||||||
public:
|
|
||||||
Strategy();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual std::string Describe() const;
|
|
||||||
virtual const EQ::versions::ClientVersion ClientVersion() const;
|
|
||||||
|
|
||||||
//magic macro to declare our opcode processors
|
|
||||||
#include "ss_declare.h"
|
|
||||||
#include "larion_ops.h"
|
|
||||||
};
|
|
||||||
|
|
||||||
}; /*Larion*/
|
|
||||||
|
|
||||||
#endif /*COMMON_LARION_H*/
|
|
||||||
@@ -1,284 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
are required to give you total support for your newly bought product;
|
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "larion_limits.h"
|
|
||||||
|
|
||||||
#include "../strings.h"
|
|
||||||
|
|
||||||
|
|
||||||
int16 Larion::invtype::GetInvTypeSize(int16 inv_type)
|
|
||||||
{
|
|
||||||
switch (inv_type) {
|
|
||||||
case invtype::typePossessions:
|
|
||||||
return invtype::POSSESSIONS_SIZE;
|
|
||||||
case invtype::typeBank:
|
|
||||||
return invtype::BANK_SIZE;
|
|
||||||
case invtype::typeSharedBank:
|
|
||||||
return invtype::SHARED_BANK_SIZE;
|
|
||||||
case invtype::typeTrade:
|
|
||||||
return invtype::TRADE_SIZE;
|
|
||||||
case invtype::typeWorld:
|
|
||||||
return invtype::WORLD_SIZE;
|
|
||||||
case invtype::typeLimbo:
|
|
||||||
return invtype::LIMBO_SIZE;
|
|
||||||
case invtype::typeTribute:
|
|
||||||
return invtype::TRIBUTE_SIZE;
|
|
||||||
case invtype::typeTrophyTribute:
|
|
||||||
return invtype::TROPHY_TRIBUTE_SIZE;
|
|
||||||
case invtype::typeGuildTribute:
|
|
||||||
return invtype::GUILD_TRIBUTE_SIZE;
|
|
||||||
case invtype::typeMerchant:
|
|
||||||
return invtype::MERCHANT_SIZE;
|
|
||||||
case invtype::typeDeleted:
|
|
||||||
return invtype::DELETED_SIZE;
|
|
||||||
case invtype::typeCorpse:
|
|
||||||
return invtype::CORPSE_SIZE;
|
|
||||||
case invtype::typeBazaar:
|
|
||||||
return invtype::BAZAAR_SIZE;
|
|
||||||
case invtype::typeInspect:
|
|
||||||
return invtype::INSPECT_SIZE;
|
|
||||||
case invtype::typeRealEstate:
|
|
||||||
return invtype::REAL_ESTATE_SIZE;
|
|
||||||
case invtype::typeViewMODPC:
|
|
||||||
return invtype::VIEW_MOD_PC_SIZE;
|
|
||||||
case invtype::typeViewMODBank:
|
|
||||||
return invtype::VIEW_MOD_BANK_SIZE;
|
|
||||||
case invtype::typeViewMODSharedBank:
|
|
||||||
return invtype::VIEW_MOD_SHARED_BANK_SIZE;
|
|
||||||
case invtype::typeViewMODLimbo:
|
|
||||||
return invtype::VIEW_MOD_LIMBO_SIZE;
|
|
||||||
case invtype::typeAltStorage:
|
|
||||||
return invtype::ALT_STORAGE_SIZE;
|
|
||||||
case invtype::typeArchived:
|
|
||||||
return invtype::ARCHIVED_SIZE;
|
|
||||||
case invtype::typeMail:
|
|
||||||
return invtype::MAIL_SIZE;
|
|
||||||
case invtype::typeGuildTrophyTribute:
|
|
||||||
return invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
|
||||||
case invtype::typeKrono:
|
|
||||||
return invtype::KRONO_SIZE;
|
|
||||||
case invtype::typeOther:
|
|
||||||
return invtype::OTHER_SIZE;
|
|
||||||
default:
|
|
||||||
return INULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* Larion::invtype::GetInvTypeName(int16 inv_type)
|
|
||||||
{
|
|
||||||
switch (inv_type) {
|
|
||||||
case invtype::TYPE_INVALID:
|
|
||||||
return "Invalid Type";
|
|
||||||
case invtype::typePossessions:
|
|
||||||
return "Possessions";
|
|
||||||
case invtype::typeBank:
|
|
||||||
return "Bank";
|
|
||||||
case invtype::typeSharedBank:
|
|
||||||
return "Shared Bank";
|
|
||||||
case invtype::typeTrade:
|
|
||||||
return "Trade";
|
|
||||||
case invtype::typeWorld:
|
|
||||||
return "World";
|
|
||||||
case invtype::typeLimbo:
|
|
||||||
return "Limbo";
|
|
||||||
case invtype::typeTribute:
|
|
||||||
return "Tribute";
|
|
||||||
case invtype::typeTrophyTribute:
|
|
||||||
return "Trophy Tribute";
|
|
||||||
case invtype::typeGuildTribute:
|
|
||||||
return "Guild Tribute";
|
|
||||||
case invtype::typeMerchant:
|
|
||||||
return "Merchant";
|
|
||||||
case invtype::typeDeleted:
|
|
||||||
return "Deleted";
|
|
||||||
case invtype::typeCorpse:
|
|
||||||
return "Corpse";
|
|
||||||
case invtype::typeBazaar:
|
|
||||||
return "Bazaar";
|
|
||||||
case invtype::typeInspect:
|
|
||||||
return "Inspect";
|
|
||||||
case invtype::typeRealEstate:
|
|
||||||
return "Real Estate";
|
|
||||||
case invtype::typeViewMODPC:
|
|
||||||
return "View MOD PC";
|
|
||||||
case invtype::typeViewMODBank:
|
|
||||||
return "View MOD Bank";
|
|
||||||
case invtype::typeViewMODSharedBank:
|
|
||||||
return "View MOD Shared Bank";
|
|
||||||
case invtype::typeViewMODLimbo:
|
|
||||||
return "View MOD Limbo";
|
|
||||||
case invtype::typeAltStorage:
|
|
||||||
return "Alt Storage";
|
|
||||||
case invtype::typeArchived:
|
|
||||||
return "Archived";
|
|
||||||
case invtype::typeMail:
|
|
||||||
return "Mail";
|
|
||||||
case invtype::typeGuildTrophyTribute:
|
|
||||||
return "Guild Trophy Tribute";
|
|
||||||
case invtype::typeKrono:
|
|
||||||
return "Krono";
|
|
||||||
case invtype::typeOther:
|
|
||||||
return "Other";
|
|
||||||
default:
|
|
||||||
return "Unknown Type";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Larion::invtype::IsInvTypePersistent(int16 inv_type)
|
|
||||||
{
|
|
||||||
switch (inv_type) {
|
|
||||||
case invtype::typePossessions:
|
|
||||||
case invtype::typeBank:
|
|
||||||
case invtype::typeSharedBank:
|
|
||||||
case invtype::typeTrade:
|
|
||||||
case invtype::typeWorld:
|
|
||||||
case invtype::typeLimbo:
|
|
||||||
case invtype::typeTribute:
|
|
||||||
case invtype::typeTrophyTribute:
|
|
||||||
case invtype::typeGuildTribute:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* Larion::invslot::GetInvPossessionsSlotName(int16 inv_slot)
|
|
||||||
{
|
|
||||||
switch (inv_slot) {
|
|
||||||
case invslot::SLOT_INVALID:
|
|
||||||
return "Invalid Slot";
|
|
||||||
case invslot::slotCharm:
|
|
||||||
return "Charm";
|
|
||||||
case invslot::slotEar1:
|
|
||||||
return "Ear 1";
|
|
||||||
case invslot::slotHead:
|
|
||||||
return "Head";
|
|
||||||
case invslot::slotFace:
|
|
||||||
return "Face";
|
|
||||||
case invslot::slotEar2:
|
|
||||||
return "Ear 2";
|
|
||||||
case invslot::slotNeck:
|
|
||||||
return "Neck";
|
|
||||||
case invslot::slotShoulders:
|
|
||||||
return "Shoulders";
|
|
||||||
case invslot::slotArms:
|
|
||||||
return "Arms";
|
|
||||||
case invslot::slotBack:
|
|
||||||
return "Back";
|
|
||||||
case invslot::slotWrist1:
|
|
||||||
return "Wrist 1";
|
|
||||||
case invslot::slotWrist2:
|
|
||||||
return "Wrist 2";
|
|
||||||
case invslot::slotRange:
|
|
||||||
return "Range";
|
|
||||||
case invslot::slotHands:
|
|
||||||
return "Hands";
|
|
||||||
case invslot::slotPrimary:
|
|
||||||
return "Primary";
|
|
||||||
case invslot::slotSecondary:
|
|
||||||
return "Secondary";
|
|
||||||
case invslot::slotFinger1:
|
|
||||||
return "Finger 1";
|
|
||||||
case invslot::slotFinger2:
|
|
||||||
return "Finger 2";
|
|
||||||
case invslot::slotChest:
|
|
||||||
return "Chest";
|
|
||||||
case invslot::slotLegs:
|
|
||||||
return "Legs";
|
|
||||||
case invslot::slotFeet:
|
|
||||||
return "Feet";
|
|
||||||
case invslot::slotWaist:
|
|
||||||
return "Waist";
|
|
||||||
case invslot::slotPowerSource:
|
|
||||||
return "Power Source";
|
|
||||||
case invslot::slotAmmo:
|
|
||||||
return "Ammo";
|
|
||||||
case invslot::slotGeneral1:
|
|
||||||
return "General 1";
|
|
||||||
case invslot::slotGeneral2:
|
|
||||||
return "General 2";
|
|
||||||
case invslot::slotGeneral3:
|
|
||||||
return "General 3";
|
|
||||||
case invslot::slotGeneral4:
|
|
||||||
return "General 4";
|
|
||||||
case invslot::slotGeneral5:
|
|
||||||
return "General 5";
|
|
||||||
case invslot::slotGeneral6:
|
|
||||||
return "General 6";
|
|
||||||
case invslot::slotGeneral7:
|
|
||||||
return "General 7";
|
|
||||||
case invslot::slotGeneral8:
|
|
||||||
return "General 8";
|
|
||||||
case invslot::slotGeneral9:
|
|
||||||
return "General 9";
|
|
||||||
case invslot::slotGeneral10:
|
|
||||||
return "General 10";
|
|
||||||
case invslot::slotCursor:
|
|
||||||
return "Cursor";
|
|
||||||
default:
|
|
||||||
return "Unknown Slot";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* Larion::invslot::GetInvSlotName(int16 inv_type, int16 inv_slot)
|
|
||||||
{
|
|
||||||
if (inv_type == invtype::typePossessions)
|
|
||||||
return invslot::GetInvPossessionsSlotName(inv_slot);
|
|
||||||
|
|
||||||
int16 type_size = invtype::GetInvTypeSize(inv_type);
|
|
||||||
|
|
||||||
if (!type_size || inv_slot == invslot::SLOT_INVALID)
|
|
||||||
return "Invalid Slot";
|
|
||||||
|
|
||||||
if ((inv_slot + 1) >= type_size)
|
|
||||||
return "Unknown Slot";
|
|
||||||
|
|
||||||
static std::string ret_str;
|
|
||||||
ret_str = StringFormat("Slot %i", (inv_slot + 1));
|
|
||||||
|
|
||||||
return ret_str.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* Larion::invbag::GetInvBagIndexName(int16 bag_index)
|
|
||||||
{
|
|
||||||
if (bag_index == invbag::SLOT_INVALID)
|
|
||||||
return "Invalid Bag";
|
|
||||||
|
|
||||||
if (bag_index >= invbag::SLOT_COUNT)
|
|
||||||
return "Unknown Bag";
|
|
||||||
|
|
||||||
static std::string ret_str;
|
|
||||||
ret_str = StringFormat("Bag %i", (bag_index + 1));
|
|
||||||
|
|
||||||
return ret_str.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* Larion::invaug::GetInvAugIndexName(int16 aug_index)
|
|
||||||
{
|
|
||||||
if (aug_index == invaug::SOCKET_INVALID)
|
|
||||||
return "Invalid Augment";
|
|
||||||
|
|
||||||
if (aug_index >= invaug::SOCKET_COUNT)
|
|
||||||
return "Unknown Augment";
|
|
||||||
|
|
||||||
static std::string ret_str;
|
|
||||||
ret_str = StringFormat("Augment %i", (aug_index + 1));
|
|
||||||
|
|
||||||
return ret_str.c_str();
|
|
||||||
}
|
|
||||||
@@ -1,330 +0,0 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
|
||||||
|
|
||||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
are required to give you total support for your newly bought product;
|
|
||||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef COMMON_LARION_LIMITS_H
|
|
||||||
#define COMMON_LARION_LIMITS_H
|
|
||||||
|
|
||||||
#include "../types.h"
|
|
||||||
#include "../emu_versions.h"
|
|
||||||
#include "../skills.h"
|
|
||||||
|
|
||||||
namespace Larion
|
|
||||||
{
|
|
||||||
const int16 IINVALID = -1;
|
|
||||||
const int16 INULL = 0;
|
|
||||||
|
|
||||||
namespace inventory {
|
|
||||||
inline EQ::versions::ClientVersion GetInventoryRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
const bool ConcatenateInvTypeLimbo = false;
|
|
||||||
|
|
||||||
const bool AllowOverLevelEquipment = true;
|
|
||||||
|
|
||||||
const bool AllowEmptyBagInBag = true;
|
|
||||||
const bool AllowClickCastFromBag = true;
|
|
||||||
|
|
||||||
} /*inventory*/
|
|
||||||
|
|
||||||
namespace invtype {
|
|
||||||
inline EQ::versions::ClientVersion GetInvTypeRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
namespace enum_ {
|
|
||||||
enum InventoryTypes : int16 {
|
|
||||||
typePossessions = INULL,
|
|
||||||
typeBank,
|
|
||||||
typeSharedBank,
|
|
||||||
typeTrade,
|
|
||||||
typeWorld,
|
|
||||||
typeLimbo,
|
|
||||||
typeTribute,
|
|
||||||
typeTrophyTribute,
|
|
||||||
typeGuildTribute,
|
|
||||||
typeMerchant,
|
|
||||||
typeDeleted,
|
|
||||||
typeCorpse,
|
|
||||||
typeBazaar,
|
|
||||||
typeInspect,
|
|
||||||
typeRealEstate,
|
|
||||||
typeViewMODPC,
|
|
||||||
typeViewMODBank,
|
|
||||||
typeViewMODSharedBank,
|
|
||||||
typeViewMODLimbo,
|
|
||||||
typeAltStorage,
|
|
||||||
typeArchived,
|
|
||||||
typeMail,
|
|
||||||
typeGuildTrophyTribute,
|
|
||||||
typeKrono,
|
|
||||||
typeOther
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace enum_
|
|
||||||
using namespace enum_;
|
|
||||||
|
|
||||||
const int16 POSSESSIONS_SIZE = 34;
|
|
||||||
const int16 BANK_SIZE = 24;
|
|
||||||
const int16 SHARED_BANK_SIZE = 2;
|
|
||||||
const int16 TRADE_SIZE = 8;
|
|
||||||
const int16 WORLD_SIZE = 10;
|
|
||||||
const int16 LIMBO_SIZE = 36;
|
|
||||||
const int16 TRIBUTE_SIZE = 5;
|
|
||||||
const int16 TROPHY_TRIBUTE_SIZE = 0;//unknown
|
|
||||||
const int16 GUILD_TRIBUTE_SIZE = 2;//unverified
|
|
||||||
const int16 MERCHANT_SIZE = 200;
|
|
||||||
const int16 DELETED_SIZE = 0;//unknown - "Recovery Tab"
|
|
||||||
const int16 CORPSE_SIZE = POSSESSIONS_SIZE;
|
|
||||||
const int16 BAZAAR_SIZE = 200;
|
|
||||||
const int16 INSPECT_SIZE = 23;
|
|
||||||
const int16 REAL_ESTATE_SIZE = 0;//unknown
|
|
||||||
const int16 VIEW_MOD_PC_SIZE = POSSESSIONS_SIZE;
|
|
||||||
const int16 VIEW_MOD_BANK_SIZE = BANK_SIZE;
|
|
||||||
const int16 VIEW_MOD_SHARED_BANK_SIZE = SHARED_BANK_SIZE;
|
|
||||||
const int16 VIEW_MOD_LIMBO_SIZE = LIMBO_SIZE;
|
|
||||||
const int16 ALT_STORAGE_SIZE = 0;//unknown - "Shroud Bank"
|
|
||||||
const int16 ARCHIVED_SIZE = 0;//unknown
|
|
||||||
const int16 MAIL_SIZE = 0;//unknown
|
|
||||||
const int16 GUILD_TROPHY_TRIBUTE_SIZE = 0;//unknown
|
|
||||||
const int16 KRONO_SIZE = 0;//unknown
|
|
||||||
const int16 OTHER_SIZE = 0;//unknown
|
|
||||||
|
|
||||||
const int16 TRADE_NPC_SIZE = 4; // defined by implication
|
|
||||||
|
|
||||||
const int16 TYPE_INVALID = IINVALID;
|
|
||||||
const int16 TYPE_BEGIN = typePossessions;
|
|
||||||
const int16 TYPE_END = typeOther;
|
|
||||||
const int16 TYPE_COUNT = (TYPE_END - TYPE_BEGIN) + 1;
|
|
||||||
|
|
||||||
int16 GetInvTypeSize(int16 inv_type);
|
|
||||||
const char* GetInvTypeName(int16 inv_type);
|
|
||||||
|
|
||||||
bool IsInvTypePersistent(int16 inv_type);
|
|
||||||
|
|
||||||
} /*invtype*/
|
|
||||||
|
|
||||||
namespace invslot {
|
|
||||||
inline EQ::versions::ClientVersion GetInvSlotRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
namespace enum_ {
|
|
||||||
enum InventorySlots : int16 {
|
|
||||||
slotCharm = INULL,
|
|
||||||
slotEar1,
|
|
||||||
slotHead,
|
|
||||||
slotFace,
|
|
||||||
slotEar2,
|
|
||||||
slotNeck,
|
|
||||||
slotShoulders,
|
|
||||||
slotArms,
|
|
||||||
slotBack,
|
|
||||||
slotWrist1,
|
|
||||||
slotWrist2,
|
|
||||||
slotRange,
|
|
||||||
slotHands,
|
|
||||||
slotPrimary,
|
|
||||||
slotSecondary,
|
|
||||||
slotFinger1,
|
|
||||||
slotFinger2,
|
|
||||||
slotChest,
|
|
||||||
slotLegs,
|
|
||||||
slotFeet,
|
|
||||||
slotWaist,
|
|
||||||
slotPowerSource,
|
|
||||||
slotAmmo,
|
|
||||||
slotGeneral1,
|
|
||||||
slotGeneral2,
|
|
||||||
slotGeneral3,
|
|
||||||
slotGeneral4,
|
|
||||||
slotGeneral5,
|
|
||||||
slotGeneral6,
|
|
||||||
slotGeneral7,
|
|
||||||
slotGeneral8,
|
|
||||||
slotGeneral9,
|
|
||||||
slotGeneral10,
|
|
||||||
slotCursor
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr int16 format_as(InventorySlots slot) { return static_cast<int16>(slot); }
|
|
||||||
} // namespace enum_
|
|
||||||
using namespace enum_;
|
|
||||||
|
|
||||||
const int16 SLOT_INVALID = IINVALID;
|
|
||||||
const int16 SLOT_BEGIN = INULL;
|
|
||||||
|
|
||||||
const int16 POSSESSIONS_BEGIN = slotCharm;
|
|
||||||
const int16 POSSESSIONS_END = slotCursor;
|
|
||||||
const int16 POSSESSIONS_COUNT = (POSSESSIONS_END - POSSESSIONS_BEGIN) + 1;
|
|
||||||
|
|
||||||
const int16 EQUIPMENT_BEGIN = slotCharm;
|
|
||||||
const int16 EQUIPMENT_END = slotAmmo;
|
|
||||||
const int16 EQUIPMENT_COUNT = (EQUIPMENT_END - EQUIPMENT_BEGIN) + 1;
|
|
||||||
|
|
||||||
const int16 GENERAL_BEGIN = slotGeneral1;
|
|
||||||
const int16 GENERAL_END = slotGeneral10;
|
|
||||||
const int16 GENERAL_COUNT = (GENERAL_END - GENERAL_BEGIN) + 1;
|
|
||||||
|
|
||||||
const int16 BONUS_BEGIN = invslot::slotCharm;
|
|
||||||
const int16 BONUS_STAT_END = invslot::slotPowerSource;
|
|
||||||
const int16 BONUS_SKILL_END = invslot::slotAmmo;
|
|
||||||
|
|
||||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
|
||||||
const int16 CORPSE_END = invslot::slotGeneral1 + invslot::slotCursor;
|
|
||||||
|
|
||||||
const uint64 EQUIPMENT_BITMASK = 0x00000000007FFFFF;
|
|
||||||
const uint64 GENERAL_BITMASK = 0x00000001FF800000;
|
|
||||||
const uint64 CURSOR_BITMASK = 0x0000000200000000;
|
|
||||||
const uint64 POSSESSIONS_BITMASK = (EQUIPMENT_BITMASK | GENERAL_BITMASK | CURSOR_BITMASK); // based on 34-slot count (RoF+)
|
|
||||||
const uint64 CORPSE_BITMASK = (GENERAL_BITMASK | CURSOR_BITMASK | (EQUIPMENT_BITMASK << 34)); // based on 34-slot count (RoF+)
|
|
||||||
|
|
||||||
|
|
||||||
const char* GetInvPossessionsSlotName(int16 inv_slot);
|
|
||||||
const char* GetInvSlotName(int16 inv_type, int16 inv_slot);
|
|
||||||
|
|
||||||
} /*invslot*/
|
|
||||||
|
|
||||||
namespace invbag {
|
|
||||||
inline EQ::versions::ClientVersion GetInvBagRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
const int16 SLOT_INVALID = IINVALID;
|
|
||||||
const int16 SLOT_BEGIN = INULL;
|
|
||||||
const int16 SLOT_END = 9; //254;
|
|
||||||
const int16 SLOT_COUNT = 10; //255; // server Size will be 255..unsure what actual client is (test)
|
|
||||||
|
|
||||||
const char* GetInvBagIndexName(int16 bag_index);
|
|
||||||
|
|
||||||
} /*invbag*/
|
|
||||||
|
|
||||||
namespace invaug {
|
|
||||||
inline EQ::versions::ClientVersion GetInvAugRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
const int16 SOCKET_INVALID = IINVALID;
|
|
||||||
const int16 SOCKET_BEGIN = INULL;
|
|
||||||
const int16 SOCKET_END = 5;
|
|
||||||
const int16 SOCKET_COUNT = 6;
|
|
||||||
|
|
||||||
const char* GetInvAugIndexName(int16 aug_index);
|
|
||||||
|
|
||||||
} /*invaug*/
|
|
||||||
|
|
||||||
namespace item {
|
|
||||||
inline EQ::versions::ClientVersion GetItemRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
//enum Unknown : int { // looks like item class..but, RoF has it too - nothing in UF-
|
|
||||||
// Unknown1 = 0,
|
|
||||||
// Unknown2 = 1,
|
|
||||||
// Unknown3 = 2,
|
|
||||||
// Unknown4 = 5 // krono?
|
|
||||||
//};
|
|
||||||
|
|
||||||
enum ItemPacketType : int {
|
|
||||||
ItemPacketMerchant = 100,
|
|
||||||
ItemPacketTradeView = 101,
|
|
||||||
ItemPacketLoot = 102,
|
|
||||||
ItemPacketTrade = 103,
|
|
||||||
ItemPacketCharInventory = 105,
|
|
||||||
ItemPacketLimbo = 106,
|
|
||||||
ItemPacketWorldContainer = 107,
|
|
||||||
ItemPacketTributeItem = 108,
|
|
||||||
ItemPacketGuildTribute = 109,
|
|
||||||
ItemPacket10 = 110,
|
|
||||||
ItemPacket11 = 111,
|
|
||||||
ItemPacket12 = 112,
|
|
||||||
ItemPacketRecovery = 113,
|
|
||||||
ItemPacket14 = 115 // Parcel? adds to merchant window too
|
|
||||||
};
|
|
||||||
|
|
||||||
} /*item*/
|
|
||||||
|
|
||||||
namespace profile {
|
|
||||||
inline EQ::versions::ClientVersion GetProfileRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
const int16 BANDOLIERS_SIZE = 20; // number of bandolier instances
|
|
||||||
const int16 BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance
|
|
||||||
|
|
||||||
const int16 POTION_BELT_SIZE = 5;
|
|
||||||
|
|
||||||
const int16 SKILL_ARRAY_SIZE = 100;
|
|
||||||
|
|
||||||
} /*profile*/
|
|
||||||
|
|
||||||
namespace constants {
|
|
||||||
inline EQ::versions::ClientVersion GetConstantsRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
const EQ::expansions::Expansion EXPANSION = EQ::expansions::Expansion::LS;
|
|
||||||
const uint32 EXPANSION_BIT = EQ::expansions::bitLS;
|
|
||||||
const uint32 EXPANSIONS_MASK = EQ::expansions::maskLS;
|
|
||||||
|
|
||||||
const size_t CHARACTER_CREATION_LIMIT = 12;
|
|
||||||
|
|
||||||
const size_t SAY_LINK_BODY_SIZE = 56;
|
|
||||||
const uint32 MAX_GUILD_ID = 50000;
|
|
||||||
|
|
||||||
} /*constants*/
|
|
||||||
|
|
||||||
namespace behavior {
|
|
||||||
inline EQ::versions::ClientVersion GetBehaviorRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
const bool CoinHasWeight = false;
|
|
||||||
|
|
||||||
} /*behavior*/
|
|
||||||
|
|
||||||
namespace skills {
|
|
||||||
inline EQ::versions::ClientVersion GetSkillsRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
const size_t LastUsableSkill = EQ::skills::Skill2HPiercing;
|
|
||||||
|
|
||||||
} /*skills*/
|
|
||||||
|
|
||||||
namespace spells {
|
|
||||||
inline EQ::versions::ClientVersion GetSkillsRef() { return EQ::versions::ClientVersion::Larion; }
|
|
||||||
|
|
||||||
enum class CastingSlot : uint32 {
|
|
||||||
Gem1 = 0,
|
|
||||||
Gem2 = 1,
|
|
||||||
Gem3 = 2,
|
|
||||||
Gem4 = 3,
|
|
||||||
Gem5 = 4,
|
|
||||||
Gem6 = 5,
|
|
||||||
Gem7 = 6,
|
|
||||||
Gem8 = 7,
|
|
||||||
Gem9 = 8,
|
|
||||||
Gem10 = 9,
|
|
||||||
Gem11 = 10,
|
|
||||||
Gem12 = 11,
|
|
||||||
MaxGems = 18, // fallacy..only 12 slot are useable...
|
|
||||||
Item = 12,
|
|
||||||
Discipline = 13,
|
|
||||||
AltAbility = 0xFF
|
|
||||||
};
|
|
||||||
|
|
||||||
const int SPELL_ID_MAX = 71999;
|
|
||||||
const int SPELLBOOK_SIZE = 1120;
|
|
||||||
const int SPELL_GEM_COUNT = static_cast<uint32>(CastingSlot::MaxGems);
|
|
||||||
const int SPELL_GEM_RECAST_TIMER = 15;
|
|
||||||
|
|
||||||
const int LONG_BUFFS = 42;
|
|
||||||
const int SHORT_BUFFS = 20;
|
|
||||||
const int DISC_BUFFS = 1;
|
|
||||||
const int TOTAL_BUFFS = LONG_BUFFS + SHORT_BUFFS + DISC_BUFFS;
|
|
||||||
const int NPC_BUFFS = 97;
|
|
||||||
const int PET_BUFFS = NPC_BUFFS;
|
|
||||||
const int MERC_BUFFS = LONG_BUFFS;
|
|
||||||
|
|
||||||
} /*spells*/
|
|
||||||
|
|
||||||
}; /* Larion */
|
|
||||||
|
|
||||||
#endif /*COMMON_LARION_LIMITS_H*/
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
|
|
||||||
//list of packets we need to encode on the way out:
|
|
||||||
E(OP_LogServer)
|
|
||||||
E(OP_SendMembership)
|
|
||||||
E(OP_SendMembershipDetails)
|
|
||||||
E(OP_SendMaxCharacters)
|
|
||||||
E(OP_SendCharInfo)
|
|
||||||
E(OP_ExpansionInfo)
|
|
||||||
E(OP_SpawnAppearance)
|
|
||||||
//E(OP_SendAATable)
|
|
||||||
E(OP_PlayerProfile)
|
|
||||||
E(OP_ZoneEntry)
|
|
||||||
E(OP_ZoneSpawns)
|
|
||||||
|
|
||||||
//list of packets we need to decode on the way in:
|
|
||||||
D(OP_ZoneEntry)
|
|
||||||
|
|
||||||
#undef E
|
|
||||||
#undef D
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
#ifndef LARION_STRUCTS_H_
|
|
||||||
#define LARION_STRUCTS_H_
|
|
||||||
|
|
||||||
namespace Larion {
|
|
||||||
namespace structs {
|
|
||||||
// constants
|
|
||||||
static const uint32 MAX_PP_AA_ARRAY = 300;
|
|
||||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE;
|
|
||||||
static const uint32 MAX_PP_INNATE_SKILL = 25;
|
|
||||||
static const uint32 MAX_PP_DISCIPLINES = 300;
|
|
||||||
static const uint32 MAX_PP_COMBAT_ABILITY_TIMERS = 25;
|
|
||||||
static const uint32 MAX_PP_UNKNOWN_ABILITIES = 25;
|
|
||||||
static const uint32 MAX_RECAST_TYPES = 25;
|
|
||||||
static const uint32 MAX_ITEM_RECAST_TYPES = 100;
|
|
||||||
static const uint32 BUFF_COUNT = 62;
|
|
||||||
static const uint32 MAX_PP_LANGUAGE = 32;
|
|
||||||
#pragma pack(1)
|
|
||||||
|
|
||||||
struct LoginInfo_Struct {
|
|
||||||
/*000*/ char login_info[64];
|
|
||||||
/*064*/ uint8 unknown064[124];
|
|
||||||
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
|
||||||
/*189*/ uint8 unknown189[275];
|
|
||||||
/*488*/
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ClientZoneEntry_Struct {
|
|
||||||
/*00*/ uint32 unknown00; // ***Placeholder
|
|
||||||
/*04*/ char char_name[64]; // Player firstname [32]
|
|
||||||
/*68*/ uint32 unknown68;
|
|
||||||
/*72*/ uint32 unknown72;
|
|
||||||
/*76*/ uint32 unknown76;
|
|
||||||
/*80*/ uint32 unknown80;
|
|
||||||
/*84*/ uint32 unknown84;
|
|
||||||
/*88*/ uint32 unknown88;
|
|
||||||
/*92*/
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Membership_Struct
|
|
||||||
{
|
|
||||||
/*000*/ uint8 membership; //0 not gold, 2 gold
|
|
||||||
/*001*/ uint32 races; // Seen ff ff 01 00
|
|
||||||
/*005*/ uint32 classes; // Seen ff ff 01 00
|
|
||||||
/*009*/ uint32 entrysize; // Seen 33
|
|
||||||
/*013*/ int32 entries[33]; // Most -1, 1, and 0 for Gold Status
|
|
||||||
/*145*/
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Membership_Entry_Struct
|
|
||||||
{
|
|
||||||
/*000*/ uint32 purchase_id; // Seen 1, then increments 90287 to 90300
|
|
||||||
/*004*/ uint32 bitwise_entry; // Seen 16 to 65536 - Skips 4096
|
|
||||||
/*008*/
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Membership_Setting_Struct
|
|
||||||
{
|
|
||||||
/*000*/ int8 setting_index; // 0, 1, 2 or 3: f2p, silver, gold, platinum?
|
|
||||||
/*001*/ int32 setting_id; // 0 to 23 actually seen but the OP_Membership packet has up to 32
|
|
||||||
/*005*/ int32 setting_value;
|
|
||||||
/*009*/
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Membership_Details_Struct
|
|
||||||
{
|
|
||||||
/*000*/ uint32 membership_setting_count; // Seen 96
|
|
||||||
/*004*/ Membership_Setting_Struct settings[96]; // 864 Bytes
|
|
||||||
/*364*/ uint32 race_entry_count; // Seen 17
|
|
||||||
/*368*/ Membership_Entry_Struct membership_races[17]; // 136 Bytes
|
|
||||||
/*3f0*/ uint32 class_entry_count; // Seen 15
|
|
||||||
/*3f4*/ Membership_Entry_Struct membership_classes[17]; // 136 Bytes
|
|
||||||
/*47c*/ uint32 exit_url_length; // Length of the exit_url string (0 for none)
|
|
||||||
/*480*/ //char exit_url[42]; // Upgrade to Silver or Gold Membership URL
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MaxCharacters_Struct {
|
|
||||||
/*000*/ uint32 max_chars;
|
|
||||||
/*004*/ uint32 marketplace_chars;
|
|
||||||
/*008*/ int32 unknown008; //some of these probably deal with heroic characters or something
|
|
||||||
/*00c*/ int32 unknown00c;
|
|
||||||
/*010*/ int32 unknown010;
|
|
||||||
/*014*/ int32 unknown014;
|
|
||||||
/*018*/ int32 unknown018;
|
|
||||||
/*01c*/ int32 unknown01c;
|
|
||||||
/*020*/ int32 unknown020;
|
|
||||||
/*024*/ int32 unknown024;
|
|
||||||
/*028*/ int32 unknown028;
|
|
||||||
/*02c*/ int32 unknown02c;
|
|
||||||
/*030*/ int32 unknown030;
|
|
||||||
/*034*/ int32 unknown034;
|
|
||||||
/*038*/
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ExpansionInfo_Struct {
|
|
||||||
/*000*/ char Unknown000[64];
|
|
||||||
/*064*/ uint32 Expansions;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Visible equiptment.
|
|
||||||
* Size: 20 Octets
|
|
||||||
*/
|
|
||||||
struct Texture_Struct
|
|
||||||
{
|
|
||||||
uint32 Material;
|
|
||||||
uint32 Unknown1;
|
|
||||||
uint32 EliteMaterial;
|
|
||||||
uint32 HeroForgeModel;
|
|
||||||
uint32 Material2; // Same as material?
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Color_Struct
|
|
||||||
** Size: 4 bytes
|
|
||||||
** Used for convenience
|
|
||||||
** Merth: Gave struct a name so gcc 2.96 would compile
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
struct Tint_Struct
|
|
||||||
{
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
uint8 Blue;
|
|
||||||
uint8 Green;
|
|
||||||
uint8 Red;
|
|
||||||
uint8 UseTint; // if there's a tint this is FF
|
|
||||||
};
|
|
||||||
uint32 Color;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CharSelectEquip : Texture_Struct, Tint_Struct {};
|
|
||||||
|
|
||||||
struct CharacterSelectEntry_Struct
|
|
||||||
{
|
|
||||||
char Name[1];
|
|
||||||
uint32 Class;
|
|
||||||
uint32 Race;
|
|
||||||
uint8 Level;
|
|
||||||
uint32 ShroudClass;
|
|
||||||
uint32 ShroudRace;
|
|
||||||
uint16 Zone;
|
|
||||||
uint16 Instance;
|
|
||||||
uint8 Gender;
|
|
||||||
uint8 Face;
|
|
||||||
CharSelectEquip Equip[9];
|
|
||||||
uint8 Unknown1; //Seen 256
|
|
||||||
uint8 Unknown2; //Seen 0
|
|
||||||
uint32 DrakkinTattoo;
|
|
||||||
uint32 DrakkinDetails;
|
|
||||||
uint32 Deity;
|
|
||||||
uint32 PrimaryIDFile;
|
|
||||||
uint32 SecondaryIDFile;
|
|
||||||
uint8 HairColor;
|
|
||||||
uint8 BeardColor;
|
|
||||||
uint8 EyeColor1;
|
|
||||||
uint8 EyeColor2;
|
|
||||||
uint8 HairStyle;
|
|
||||||
uint8 Beard;
|
|
||||||
uint8 Enabled;
|
|
||||||
uint8 Tutorial;
|
|
||||||
uint32 DrakkinHeritage;
|
|
||||||
uint8 Unknown3;
|
|
||||||
uint8 GoHome;
|
|
||||||
uint32 LastLogin;
|
|
||||||
uint8 Unknown4; // Seen 0
|
|
||||||
uint8 Unknown5; // Seen 0
|
|
||||||
uint8 Unknown6; // Seen 0
|
|
||||||
uint8 Unknown7; // Seen 0
|
|
||||||
uint32 CharacterId; //A Guess, Character I made a little bit after has a number a few hundred after the first
|
|
||||||
uint32 Unknown8; // Seen 1
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Character Selection Struct
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
struct CharacterSelect_Struct
|
|
||||||
{
|
|
||||||
/*000*/ uint32 CharCount; //number of chars in this packet
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SpawnAppearance_Struct
|
|
||||||
{
|
|
||||||
/*0000*/ uint32 spawn_id; // ID of the spawn
|
|
||||||
/*0004*/ uint32 type; // Values associated with the type
|
|
||||||
/*0008*/ uint32 parameter; // Type of data sent
|
|
||||||
/*0012*/ uint32 unknown012;
|
|
||||||
/*0016*/ uint32 unknown016;
|
|
||||||
/*0020*/ uint32 unknown020;
|
|
||||||
/*0024*/
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Spawn_Struct_Bitfields
|
|
||||||
{
|
|
||||||
// byte 1
|
|
||||||
/*00*/ unsigned gender : 2; // Gender (0=male, 1=female, 2=monster)
|
|
||||||
/*02*/ unsigned ispet : 1; // Guessed based on observing live spawns
|
|
||||||
/*03*/ unsigned afk : 1; // 0=no, 1=afk
|
|
||||||
/*04*/ unsigned anon : 2; // 0=normal, 1=anon, 2=roleplay
|
|
||||||
/*06*/ unsigned gm : 1;
|
|
||||||
/*07*/ unsigned sneak : 1;
|
|
||||||
// byte 2
|
|
||||||
/*08*/ unsigned lfg : 1;
|
|
||||||
/*09*/ unsigned unk9 : 1;
|
|
||||||
/*10*/ unsigned invis : 12; // there are 3000 different (non-GM) invis levels
|
|
||||||
/*22*/ unsigned linkdead : 1; // 1 Toggles LD on or off after name. Correct for RoF2
|
|
||||||
/*23*/ unsigned showhelm : 1;
|
|
||||||
// byte 4
|
|
||||||
/*24*/ unsigned betabuffed : 1; // Prefixes name with !
|
|
||||||
/*25*/ unsigned trader : 1;
|
|
||||||
/*26*/ unsigned animationonpop : 1;
|
|
||||||
/*27*/ unsigned targetable : 1;
|
|
||||||
/*28*/ unsigned targetable_with_hotkey : 1;
|
|
||||||
/*29*/ unsigned showname : 1;
|
|
||||||
/*30*/ unsigned idleanimationsoff : 1; // what we called statue?
|
|
||||||
/*31*/ unsigned untargetable : 1; // bClickThrough
|
|
||||||
// byte 5
|
|
||||||
/*32*/ unsigned buyer : 1;
|
|
||||||
/*33*/ unsigned offline : 1;
|
|
||||||
/*34*/ unsigned interactiveobject : 1;
|
|
||||||
/*35*/ unsigned missile : 1;
|
|
||||||
/*36*/ unsigned title : 1;
|
|
||||||
/*37*/ unsigned suffix : 1;
|
|
||||||
/*38*/ unsigned unk38 : 1;
|
|
||||||
/*39*/ unsigned unk39 : 1;
|
|
||||||
};
|
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
}; //end namespace structs
|
|
||||||
}; //end namespace larion
|
|
||||||
|
|
||||||
#endif /*LARION_STRUCTS_H_*/
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "sod.h"
|
#include "sod.h"
|
||||||
#include "rof.h"
|
#include "rof.h"
|
||||||
#include "rof2.h"
|
#include "rof2.h"
|
||||||
#include "larion.h"
|
|
||||||
|
|
||||||
void RegisterAllPatches(EQStreamIdentifier &into)
|
void RegisterAllPatches(EQStreamIdentifier &into)
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,6 @@ void RegisterAllPatches(EQStreamIdentifier &into)
|
|||||||
UF::Register(into);
|
UF::Register(into);
|
||||||
RoF::Register(into);
|
RoF::Register(into);
|
||||||
RoF2::Register(into);
|
RoF2::Register(into);
|
||||||
Larion::Register(into);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReloadAllPatches()
|
void ReloadAllPatches()
|
||||||
@@ -47,5 +46,4 @@ void ReloadAllPatches()
|
|||||||
UF::Reload();
|
UF::Reload();
|
||||||
RoF::Reload();
|
RoF::Reload();
|
||||||
RoF2::Reload();
|
RoF2::Reload();
|
||||||
Larion::Reload();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2680,7 +2680,7 @@ namespace RoF2
|
|||||||
{
|
{
|
||||||
float instrument_mod = 0.0f;
|
float instrument_mod = 0.0f;
|
||||||
uint8 effect_type = emu->buffs[r].effect_type;
|
uint8 effect_type = emu->buffs[r].effect_type;
|
||||||
uint32 player_id = emu->buffs[r].player_id;
|
uint32 player_id = emu->buffs[r].player_id;;
|
||||||
|
|
||||||
if (emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0)
|
if (emu->buffs[r].spellid != 0xFFFF && emu->buffs[r].spellid != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ void PathManager::LoadPaths()
|
|||||||
m_patch_path = fs::relative(fs::path{m_server_path + "/" + c->PatchDir}).string();
|
m_patch_path = fs::relative(fs::path{m_server_path + "/" + c->PatchDir}).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// patches
|
||||||
|
if (File::Exists(fs::path{ m_server_path + "/" + c->OpcodeDir }.string())) {
|
||||||
|
m_opcode_path = fs::relative(fs::path{ m_server_path + "/" + c->OpcodeDir }).string();
|
||||||
|
}
|
||||||
|
|
||||||
// shared_memory_path
|
// shared_memory_path
|
||||||
if (File::Exists(fs::path{m_server_path + "/" + c->SharedMemDir}.string())) {
|
if (File::Exists(fs::path{m_server_path + "/" + c->SharedMemDir}.string())) {
|
||||||
m_shared_memory_path = fs::relative(fs::path{ m_server_path + "/" + c->SharedMemDir }).string();
|
m_shared_memory_path = fs::relative(fs::path{ m_server_path + "/" + c->SharedMemDir }).string();
|
||||||
@@ -89,6 +94,7 @@ void PathManager::LoadPaths()
|
|||||||
LogInfo("lua_modules path [{}]", m_lua_modules_path);
|
LogInfo("lua_modules path [{}]", m_lua_modules_path);
|
||||||
LogInfo("maps path [{}]", m_maps_path);
|
LogInfo("maps path [{}]", m_maps_path);
|
||||||
LogInfo("patches path [{}]", m_patch_path);
|
LogInfo("patches path [{}]", m_patch_path);
|
||||||
|
LogInfo("opcode path [{}]", m_opcode_path);
|
||||||
LogInfo("plugins path [{}]", m_plugins_path);
|
LogInfo("plugins path [{}]", m_plugins_path);
|
||||||
LogInfo("quests path [{}]", m_quests_path);
|
LogInfo("quests path [{}]", m_quests_path);
|
||||||
LogInfo("shared_memory path [{}]", m_shared_memory_path);
|
LogInfo("shared_memory path [{}]", m_shared_memory_path);
|
||||||
@@ -129,6 +135,11 @@ const std::string &PathManager::GetPatchPath() const
|
|||||||
return m_patch_path;
|
return m_patch_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string &PathManager::GetOpcodePath() const
|
||||||
|
{
|
||||||
|
return m_opcode_path;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string &PathManager::GetLuaModulesPath() const
|
const std::string &PathManager::GetLuaModulesPath() const
|
||||||
{
|
{
|
||||||
return m_lua_modules_path;
|
return m_lua_modules_path;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public:
|
|||||||
[[nodiscard]] const std::string &GetLuaModulesPath() const;
|
[[nodiscard]] const std::string &GetLuaModulesPath() const;
|
||||||
[[nodiscard]] const std::string &GetMapsPath() const;
|
[[nodiscard]] const std::string &GetMapsPath() const;
|
||||||
[[nodiscard]] const std::string &GetPatchPath() const;
|
[[nodiscard]] const std::string &GetPatchPath() const;
|
||||||
|
[[nodiscard]] const std::string &GetOpcodePath() const;
|
||||||
[[nodiscard]] const std::string &GetPluginsPath() const;
|
[[nodiscard]] const std::string &GetPluginsPath() const;
|
||||||
[[nodiscard]] const std::string &GetQuestsPath() const;
|
[[nodiscard]] const std::string &GetQuestsPath() const;
|
||||||
[[nodiscard]] const std::string &GetServerPath() const;
|
[[nodiscard]] const std::string &GetServerPath() const;
|
||||||
@@ -24,6 +25,7 @@ private:
|
|||||||
std::string m_lua_modules_path;
|
std::string m_lua_modules_path;
|
||||||
std::string m_maps_path;
|
std::string m_maps_path;
|
||||||
std::string m_patch_path;
|
std::string m_patch_path;
|
||||||
|
std::string m_opcode_path;
|
||||||
std::string m_plugins_path;
|
std::string m_plugins_path;
|
||||||
std::string m_quests_path;
|
std::string m_quests_path;
|
||||||
std::string m_server_path;
|
std::string m_server_path;
|
||||||
|
|||||||
@@ -164,38 +164,36 @@ public:
|
|||||||
return UpdateOne(db, m);
|
return UpdateOne(db, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Trader GetItemBySerialNumber(Database &db, uint32 serial_number)
|
static Trader GetItemBySerialNumber(Database &db, uint32 serial_number, uint32 trader_id)
|
||||||
{
|
{
|
||||||
Trader e{};
|
Trader e{};
|
||||||
const auto trader_item = GetWhere(
|
const auto trader_item = GetWhere(
|
||||||
db,
|
db,
|
||||||
fmt::format("`item_sn` = '{}' LIMIT 1", serial_number)
|
fmt::format("`char_id` = '{}' AND `item_sn` = '{}' LIMIT 1", trader_id, serial_number)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (trader_item.empty()) {
|
if (trader_item.empty()) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return trader_item.at(0);
|
return trader_item.at(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static Trader GetItemBySerialNumber(Database &db, std::string serial_number)
|
static Trader GetItemBySerialNumber(Database &db, std::string serial_number, uint32 trader_id)
|
||||||
{
|
{
|
||||||
Trader e{};
|
Trader e{};
|
||||||
auto sn = Strings::ToUnsignedBigInt(serial_number);
|
auto sn = Strings::ToUnsignedBigInt(serial_number);
|
||||||
const auto trader_item = GetWhere(
|
const auto trader_item = GetWhere(
|
||||||
db,
|
db,
|
||||||
fmt::format("`item_sn` = '{}' LIMIT 1", sn)
|
fmt::format("`char_id` = '{}' AND `item_sn` = '{}' LIMIT 1", trader_id, sn)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (trader_item.empty()) {
|
if (trader_item.empty()) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return trader_item.at(0);
|
return trader_item.at(0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static int UpdateActiveTransaction(Database &db, uint32 id, bool status)
|
static int UpdateActiveTransaction(Database &db, uint32 id, bool status)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-1
@@ -339,7 +339,7 @@ RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to ha
|
|||||||
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
|
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
|
||||||
RULE_BOOL(World, EnableAutoLogin, false, "Enables or disables auto login of characters, allowing people to log characters in directly from loginserver to ingame")
|
RULE_BOOL(World, EnableAutoLogin, false, "Enables or disables auto login of characters, allowing people to log characters in directly from loginserver to ingame")
|
||||||
RULE_BOOL(World, EnablePVPRegions, true, "Enables or disables PVP Regions automatically setting your PVP flag")
|
RULE_BOOL(World, EnablePVPRegions, true, "Enables or disables PVP Regions automatically setting your PVP flag")
|
||||||
RULE_INT(World, Id, 100, "Used by later clients to create GUIDs, expected to be Unique to the world but ultimately not that important")
|
RULE_STRING(World, SupportedClients, "", "Comma-delimited list of clients to restrict to. Supported values are Titanium | SoF | SoD | UF | RoF | RoF2. Example: Titanium,RoF2")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Zone)
|
RULE_CATEGORY(Zone)
|
||||||
@@ -519,6 +519,7 @@ RULE_BOOL(Spells, SnareOverridesSpeedBonuses, false, "Enabling will allow snares
|
|||||||
RULE_INT(Spells, TargetedAOEMaxTargets, 4, "Max number of targets a Targeted AOE spell can cast on. Set to 0 for no limit.")
|
RULE_INT(Spells, TargetedAOEMaxTargets, 4, "Max number of targets a Targeted AOE spell can cast on. Set to 0 for no limit.")
|
||||||
RULE_INT(Spells, PointBlankAOEMaxTargets, 0, "Max number of targets a Point-Blank AOE spell can cast on. Set to 0 for no limit.")
|
RULE_INT(Spells, PointBlankAOEMaxTargets, 0, "Max number of targets a Point-Blank AOE spell can cast on. Set to 0 for no limit.")
|
||||||
RULE_INT(Spells, DefaultAOEMaxTargets, 0, "Max number of targets that an AOE spell which does not meet other descriptions can cast on. Set to 0 for no limit.")
|
RULE_INT(Spells, DefaultAOEMaxTargets, 0, "Max number of targets that an AOE spell which does not meet other descriptions can cast on. Set to 0 for no limit.")
|
||||||
|
RULE_BOOL(Spells, AllowFocusOnSkillDamageSpells, false, "Allow focus effects 185, 459, and 482 to enhance SkillAttack spell effect 193")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Combat)
|
RULE_CATEGORY(Combat)
|
||||||
@@ -680,6 +681,7 @@ RULE_BOOL(NPC, DisableLastNames, false, "Enable to disable NPC Last Names")
|
|||||||
RULE_BOOL(NPC, NPCIgnoreLevelBasedHasteCaps, false, "Ignores hard coded level based haste caps.")
|
RULE_BOOL(NPC, NPCIgnoreLevelBasedHasteCaps, false, "Ignores hard coded level based haste caps.")
|
||||||
RULE_INT(NPC, NPCHasteCap, 150, "Haste cap for non-v3(over haste) haste")
|
RULE_INT(NPC, NPCHasteCap, 150, "Haste cap for non-v3(over haste) haste")
|
||||||
RULE_INT(NPC, NPCHastev3Cap, 25, "Haste cap for v3(over haste) haste")
|
RULE_INT(NPC, NPCHastev3Cap, 25, "Haste cap for v3(over haste) haste")
|
||||||
|
RULE_STRING(NPC, ExcludedFaceTargetRaces, "52,72,73,141,233,328,329,372,376,377,378,379,380,381,382,383,404,422,423,424,425,426,428,429,445,449,460,462,463,500,501,502,503,504,505,506,507,508,509,510,511,513,514,515,516,533,534,535,536,537,538,539,540,541,542,543,544,545,546,550,551,552,553,554,555,556,557,567,573,577,586,589,590,591,592,593,595,596,599,601,616,619,621,628,629,630,633,634,635,636,665,683,684,685,691,692,693,694,702,703,705,706,707,710,711,714,720,2250,2254", "Race IDs excluded from facing target when hailed")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(Aggro)
|
RULE_CATEGORY(Aggro)
|
||||||
|
|||||||
@@ -1945,6 +1945,7 @@ struct ServerOP_GuildMessage_Struct {
|
|||||||
struct TraderMessaging_Struct {
|
struct TraderMessaging_Struct {
|
||||||
uint32 action;
|
uint32 action;
|
||||||
uint32 zone_id;
|
uint32 zone_id;
|
||||||
|
uint32 instance_id;
|
||||||
uint32 trader_id;
|
uint32 trader_id;
|
||||||
uint32 entity_id;
|
uint32 entity_id;
|
||||||
char trader_name[64];
|
char trader_name[64];
|
||||||
|
|||||||
+4
-3
@@ -83,7 +83,8 @@ struct ActivityInformation {
|
|||||||
if (zone_ids.empty()) {
|
if (zone_ids.empty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool found_zone = std::find(zone_ids.begin(), zone_ids.end(), zone_id) != zone_ids.end();
|
bool found_zone = std::any_of(zone_ids.begin(), zone_ids.end(),
|
||||||
|
[zone_id](int id) { return id <= 0 || id == zone_id; });
|
||||||
|
|
||||||
return found_zone && (zone_version == version || zone_version == -1);
|
return found_zone && (zone_version == version || zone_version == -1);
|
||||||
}
|
}
|
||||||
@@ -100,7 +101,7 @@ struct ActivityInformation {
|
|||||||
out.WriteInt32(activity_type == TaskActivityType::GiveCash ? 1 : goal_count);
|
out.WriteInt32(activity_type == TaskActivityType::GiveCash ? 1 : goal_count);
|
||||||
out.WriteLengthString(skill_list); // used in SkillOn objective type string, "-1" for none
|
out.WriteLengthString(skill_list); // used in SkillOn objective type string, "-1" for none
|
||||||
out.WriteLengthString(spell_list); // used in CastOn objective type string, "0" for none
|
out.WriteLengthString(spell_list); // used in CastOn objective type string, "0" for none
|
||||||
out.WriteString(zones); // used in objective zone column and task select "begins in" (may have multiple, "0" for "unknown zone", empty for "ALL")
|
out.WriteString(zones); // used in ui zone columns and task select "begins in" (may have multiple, invalid id for "Unknown Zone", empty for "ALL")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -114,7 +115,7 @@ struct ActivityInformation {
|
|||||||
out.WriteString(description_override);
|
out.WriteString(description_override);
|
||||||
|
|
||||||
if (client_version >= EQ::versions::ClientVersion::RoF) {
|
if (client_version >= EQ::versions::ClientVersion::RoF) {
|
||||||
out.WriteString(zones); // serialized again after description (seems unused)
|
out.WriteString(zones); // target zone version internal id (unused client side)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
// Build variables
|
// Build variables
|
||||||
// these get injected during the build pipeline
|
// these get injected during the build pipeline
|
||||||
#define CURRENT_VERSION "22.56.3-dev" // always append -dev to the current version for custom-builds
|
#define CURRENT_VERSION "22.60.0-dev" // always append -dev to the current version for custom-builds
|
||||||
#define LOGIN_VERSION "0.8.0"
|
#define LOGIN_VERSION "0.8.0"
|
||||||
#define COMPILE_DATE __DATE__
|
#define COMPILE_DATE __DATE__
|
||||||
#define COMPILE_TIME __TIME__
|
#define COMPILE_TIME __TIME__
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CURRENT_BINARY_DATABASE_VERSION 9284
|
#define CURRENT_BINARY_DATABASE_VERSION 9285
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9045
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9045
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -251,4 +251,6 @@ private:
|
|||||||
scalar m_value;
|
scalar m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using ref = reference;
|
||||||
|
|
||||||
} // namespace perlbind
|
} // namespace perlbind
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ struct pusher
|
|||||||
++m_pushed;
|
++m_pushed;
|
||||||
}
|
}
|
||||||
void push(const std::string& value) { mPUSHp(value.c_str(), value.size()); ++m_pushed; }
|
void push(const std::string& value) { mPUSHp(value.c_str(), value.size()); ++m_pushed; }
|
||||||
void push(scalar value) { mPUSHs(value.release()); ++m_pushed; };
|
void push(scalar value) { mPUSHs(value.release()); ++m_pushed; }
|
||||||
void push(reference value) { mPUSHs(value.release()); ++m_pushed; };
|
void push(reference value) { mPUSHs(value.release()); ++m_pushed; }
|
||||||
|
|
||||||
void push(array value)
|
void push(array value)
|
||||||
{
|
{
|
||||||
@@ -38,7 +38,8 @@ struct pusher
|
|||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
// mortalizes one reference to array element to avoid copying
|
// mortalizes one reference to array element to avoid copying
|
||||||
PUSHs(sv_2mortal(SvREFCNT_inc(value[i].sv())));
|
SV** sv = av_fetch(static_cast<AV*>(value), i, true);
|
||||||
|
mPUSHs(SvREFCNT_inc(*sv));
|
||||||
}
|
}
|
||||||
m_pushed += count;
|
m_pushed += count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ struct read_as<hash>
|
|||||||
static bool check(PerlInterpreter* my_perl, int i, int ax, int items)
|
static bool check(PerlInterpreter* my_perl, int i, int ax, int items)
|
||||||
{
|
{
|
||||||
int remaining = items - i;
|
int remaining = items - i;
|
||||||
return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) == SVt_PV;
|
return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) < SVt_PVAV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hash get(PerlInterpreter* my_perl, int i, int ax, int items)
|
static hash get(PerlInterpreter* my_perl, int i, int ax, int items)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
constexpr int perlbind_version_major = 1;
|
constexpr int perlbind_version_major = 1;
|
||||||
constexpr int perlbind_version_minor = 0;
|
constexpr int perlbind_version_minor = 1;
|
||||||
constexpr int perlbind_version_patch = 0;
|
constexpr int perlbind_version_patch = 0;
|
||||||
|
|
||||||
constexpr int perlbind_version()
|
constexpr int perlbind_version()
|
||||||
|
|||||||
+3
-25
@@ -573,13 +573,10 @@ void Client::SendExpansionPacketData(PlayerLoginReply_Struct& plrs)
|
|||||||
{
|
{
|
||||||
SerializeBuffer buf;
|
SerializeBuffer buf;
|
||||||
//from eqlsstr_us.txt id of each expansion, excluding 'Everquest'
|
//from eqlsstr_us.txt id of each expansion, excluding 'Everquest'
|
||||||
int ExpansionLookup[30] = { 3007, 3008, 3009, 3010, 3012,
|
int ExpansionLookup[20] = { 3007, 3008, 3009, 3010, 3012,
|
||||||
3014, 3031, 3033, 3036, 3040,
|
3014, 3031, 3033, 3036, 3040,
|
||||||
3045, 3046, 3047, 3514, 3516,
|
3045, 3046, 3047, 3514, 3516,
|
||||||
3518, 3520, 3522, 3524, 3526,
|
3518, 3520, 3522, 3524 };
|
||||||
3528, 3530, 3532, 3534, 3535,
|
|
||||||
3536, 3537, 3538, 3539, 3540
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
if (server.options.IsDisplayExpansions()) {
|
if (server.options.IsDisplayExpansions()) {
|
||||||
@@ -587,26 +584,7 @@ void Client::SendExpansionPacketData(PlayerLoginReply_Struct& plrs)
|
|||||||
int32_t expansion = server.options.GetMaxExpansions();
|
int32_t expansion = server.options.GetMaxExpansions();
|
||||||
int32_t owned_expansion = (expansion << 1) | 1;
|
int32_t owned_expansion = (expansion << 1) | 1;
|
||||||
|
|
||||||
if (m_client_version == cv_larion) {
|
if (m_client_version == cv_sod) {
|
||||||
buf.WriteInt32(0x00);
|
|
||||||
buf.WriteInt32(0x00);
|
|
||||||
buf.WriteInt16(0x00);
|
|
||||||
buf.WriteInt32(30);
|
|
||||||
|
|
||||||
for (int i = 0; i < 30; i++)
|
|
||||||
{
|
|
||||||
buf.WriteUInt32(i + 1);
|
|
||||||
buf.WriteUInt8(1);
|
|
||||||
buf.WriteInt32(ExpansionLookup[i]);
|
|
||||||
buf.WriteInt32(6046);
|
|
||||||
buf.WriteUInt32(0xFFFFFFFF);
|
|
||||||
buf.WriteUInt32(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto out = std::make_unique<EQApplicationPacket>(OP_LoginExpansionPacketData, buf);
|
|
||||||
m_connection->QueuePacket(out.get());
|
|
||||||
}
|
|
||||||
else if (m_client_version == cv_sod) {
|
|
||||||
|
|
||||||
// header info of packet. Requires OP_LoginExpansionPacketData=0x0031 to be in login_opcodes_sod.conf
|
// header info of packet. Requires OP_LoginExpansionPacketData=0x0031 to be in login_opcodes_sod.conf
|
||||||
buf.WriteInt32(0x00);
|
buf.WriteInt32(0x00);
|
||||||
|
|||||||
@@ -7,6 +7,79 @@ extern bool run_server;
|
|||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/misc.h"
|
#include "../common/misc.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
|
#include "../common/file.h"
|
||||||
|
|
||||||
|
void CheckTitaniumOpcodeFile(const std::string &path) {
|
||||||
|
if (File::Exists(path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto f = fopen(path.c_str(), "w");
|
||||||
|
if (f) {
|
||||||
|
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
||||||
|
fprintf(f, "OP_SessionReady=0x0001\n");
|
||||||
|
fprintf(f, "OP_Login=0x0002\n");
|
||||||
|
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestResponse=0x0021\n");
|
||||||
|
fprintf(f, "OP_ChatMessage=0x0016\n");
|
||||||
|
fprintf(f, "OP_LoginAccepted=0x0017\n");
|
||||||
|
fprintf(f, "OP_ServerListResponse=0x0018\n");
|
||||||
|
fprintf(f, "OP_Poll=0x0029\n");
|
||||||
|
fprintf(f, "OP_EnterChat=0x000f\n");
|
||||||
|
fprintf(f, "OP_PollResponse=0x0011\n");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckSoDOpcodeFile(const std::string& path) {
|
||||||
|
if (File::Exists(path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto f = fopen(path.c_str(), "w");
|
||||||
|
if (f) {
|
||||||
|
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
||||||
|
fprintf(f, "OP_SessionReady=0x0001\n");
|
||||||
|
fprintf(f, "OP_Login=0x0002\n");
|
||||||
|
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestResponse=0x0022\n");
|
||||||
|
fprintf(f, "OP_ChatMessage=0x0017\n");
|
||||||
|
fprintf(f, "OP_LoginAccepted=0x0018\n");
|
||||||
|
fprintf(f, "OP_ServerListResponse=0x0019\n");
|
||||||
|
fprintf(f, "OP_Poll=0x0029\n");
|
||||||
|
fprintf(f, "OP_LoginExpansionPacketData=0x0031\n");
|
||||||
|
fprintf(f, "OP_EnterChat=0x000f\n");
|
||||||
|
fprintf(f, "OP_PollResponse=0x0011\n");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckLarionOpcodeFile(const std::string& path) {
|
||||||
|
if (File::Exists(path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto f = fopen(path.c_str(), "w");
|
||||||
|
if (f) {
|
||||||
|
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
||||||
|
fprintf(f, "OP_SessionReady=0x0001\n");
|
||||||
|
fprintf(f, "OP_Login=0x0002\n");
|
||||||
|
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestResponse=0x0022\n");
|
||||||
|
fprintf(f, "OP_ChatMessage=0x0017\n");
|
||||||
|
fprintf(f, "OP_LoginAccepted=0x0018\n");
|
||||||
|
fprintf(f, "OP_ServerListResponse=0x0019\n");
|
||||||
|
fprintf(f, "OP_Poll=0x0029\n");
|
||||||
|
fprintf(f, "OP_EnterChat=0x000f\n");
|
||||||
|
fprintf(f, "OP_PollResponse=0x0011\n");
|
||||||
|
fprintf(f, "OP_SystemFingerprint=0x0016\n");
|
||||||
|
fprintf(f, "OP_ExpansionList=0x0030\n");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ClientManager::ClientManager()
|
ClientManager::ClientManager()
|
||||||
{
|
{
|
||||||
@@ -19,14 +92,12 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
std::string opcodes_path = fmt::format(
|
std::string opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetServerPath(),
|
path.GetOpcodePath(),
|
||||||
server.config.GetVariableString(
|
|
||||||
"client_configuration",
|
|
||||||
"titanium_opcodes",
|
|
||||||
"login_opcodes.conf"
|
"login_opcodes.conf"
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CheckTitaniumOpcodeFile(opcodes_path);
|
||||||
|
|
||||||
if (!titanium_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!titanium_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for Titanium file [{0}]",
|
"ClientManager fatal error: couldn't load opcodes for Titanium file [{0}]",
|
||||||
@@ -58,14 +129,12 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetServerPath(),
|
path.GetOpcodePath(),
|
||||||
server.config.GetVariableString(
|
"login_opcodes_sod.conf"
|
||||||
"client_configuration",
|
|
||||||
"sod_opcodes",
|
|
||||||
"login_opcodes.conf"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CheckSoDOpcodeFile(opcodes_path);
|
||||||
|
|
||||||
if (!sod_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!sod_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for SoD file {0}",
|
"ClientManager fatal error: couldn't load opcodes for SoD file {0}",
|
||||||
@@ -98,14 +167,12 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetServerPath(),
|
path.GetOpcodePath(),
|
||||||
server.config.GetVariableString(
|
"login_opcodes_larion.conf"
|
||||||
"client_configuration",
|
|
||||||
"larion_opcodes",
|
|
||||||
"login_opcodes.conf"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CheckLarionOpcodeFile(opcodes_path);
|
||||||
|
|
||||||
if (!larion_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!larion_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for Larion file [{0}]",
|
"ClientManager fatal error: couldn't load opcodes for Larion file [{0}]",
|
||||||
|
|||||||
@@ -977,7 +977,8 @@ bool WorldServer::ValidateWorldServerAdminLogin(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldServer::SerializeForClientServerListLegacy(class SerializeBuffer& out, bool use_local_ip) const {
|
void WorldServer::SerializeForClientServerList(SerializeBuffer& out, bool use_local_ip, LSClientVersion version) const
|
||||||
|
{
|
||||||
// see LoginClientServerData_Struct
|
// see LoginClientServerData_Struct
|
||||||
if (use_local_ip) {
|
if (use_local_ip) {
|
||||||
out.WriteString(GetLocalIP());
|
out.WriteString(GetLocalIP());
|
||||||
@@ -986,6 +987,10 @@ void WorldServer::SerializeForClientServerListLegacy(class SerializeBuffer& out,
|
|||||||
out.WriteString(GetRemoteIP());
|
out.WriteString(GetRemoteIP());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version == cv_larion) {
|
||||||
|
out.WriteUInt32(9000);
|
||||||
|
}
|
||||||
|
|
||||||
switch (GetServerListID()) {
|
switch (GetServerListID()) {
|
||||||
case LS::ServerType::Legends:
|
case LS::ServerType::Legends:
|
||||||
out.WriteInt32(LS::ServerTypeFlags::Legends);
|
out.WriteInt32(LS::ServerTypeFlags::Legends);
|
||||||
@@ -997,8 +1002,15 @@ void WorldServer::SerializeForClientServerListLegacy(class SerializeBuffer& out,
|
|||||||
out.WriteInt32(LS::ServerTypeFlags::Standard);
|
out.WriteInt32(LS::ServerTypeFlags::Standard);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (version == cv_larion) {
|
||||||
|
auto server_id = GetServerId();
|
||||||
|
//if this is 0, the client will not show the server in the list
|
||||||
|
out.WriteUInt32(1);
|
||||||
|
out.WriteUInt32(server_id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
out.WriteUInt32(GetServerId());
|
out.WriteUInt32(GetServerId());
|
||||||
|
}
|
||||||
|
|
||||||
out.WriteString(GetServerLongName());
|
out.WriteString(GetServerLongName());
|
||||||
out.WriteString("us"); // country code
|
out.WriteString("us"); // country code
|
||||||
@@ -1020,61 +1032,6 @@ void WorldServer::SerializeForClientServerListLegacy(class SerializeBuffer& out,
|
|||||||
out.WriteUInt32(GetPlayersOnline());
|
out.WriteUInt32(GetPlayersOnline());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldServer::SerializeForClientServerListLarion(class SerializeBuffer& out, bool use_local_ip) const {
|
|
||||||
if (use_local_ip) {
|
|
||||||
out.WriteString(GetLocalIP());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
out.WriteString(GetRemoteIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
out.WriteUInt32(9000);
|
|
||||||
out.WriteUInt32(0);
|
|
||||||
|
|
||||||
uint32_t flags = 32; //all servers i saw had this set
|
|
||||||
switch (GetServerListID()) {
|
|
||||||
case LS::ServerType::Legends:
|
|
||||||
flags += LS::ServerTypeFlags::Legends;
|
|
||||||
break;
|
|
||||||
case LS::ServerType::Preferred:
|
|
||||||
flags += LS::ServerTypeFlags::Preferred;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
flags += LS::ServerTypeFlags::Standard;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
out.WriteUInt32(flags);
|
|
||||||
out.WriteUInt32(GetServerId());
|
|
||||||
out.WriteString(GetServerLongName());
|
|
||||||
out.WriteString("EN");
|
|
||||||
out.WriteString("US");
|
|
||||||
|
|
||||||
if (GetStatus() < 0) {
|
|
||||||
if (GetZonesBooted() == 0) {
|
|
||||||
out.WriteInt32(LS::ServerStatusFlags::Down);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
out.WriteInt32(LS::ServerStatusFlags::Locked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
out.WriteInt32(LS::ServerStatusFlags::Up);
|
|
||||||
}
|
|
||||||
|
|
||||||
out.WriteUInt32(GetPlayersOnline());
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldServer::SerializeForClientServerList(SerializeBuffer& out, bool use_local_ip, LSClientVersion version) const
|
|
||||||
{
|
|
||||||
if (version == cv_larion) {
|
|
||||||
SerializeForClientServerListLarion(out, use_local_ip);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SerializeForClientServerListLegacy(out, use_local_ip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param in_server_list_id
|
* @param in_server_list_id
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -149,10 +149,7 @@ public:
|
|||||||
|
|
||||||
bool HandleNewLoginserverRegisteredOnly(Database::DbWorldRegistration &world_registration);
|
bool HandleNewLoginserverRegisteredOnly(Database::DbWorldRegistration &world_registration);
|
||||||
bool HandleNewLoginserverInfoUnregisteredAllowed(Database::DbWorldRegistration &world_registration);
|
bool HandleNewLoginserverInfoUnregisteredAllowed(Database::DbWorldRegistration &world_registration);
|
||||||
private:
|
|
||||||
void SerializeForClientServerListLegacy(class SerializeBuffer& out, bool use_local_ip) const;
|
|
||||||
void SerializeForClientServerListLarion(class SerializeBuffer& out, bool use_local_ip) const;
|
|
||||||
public:
|
|
||||||
void SerializeForClientServerList(class SerializeBuffer& out, bool use_local_ip, LSClientVersion version) const;
|
void SerializeForClientServerList(class SerializeBuffer& out, bool use_local_ip, LSClientVersion version) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eqemu-server",
|
"name": "eqemu-server",
|
||||||
"version": "22.56.3",
|
"version": "22.60.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/EQEmu/Server.git"
|
"url": "https://github.com/EQEmu/Server.git"
|
||||||
|
|||||||
@@ -1,730 +0,0 @@
|
|||||||
# ShowEQ Import Notes:
|
|
||||||
# ZERO THE FILE first
|
|
||||||
# perl -pi -e 's/0x[0-9a-fA-F]{4}/0x0000/g' opcodes.conf
|
|
||||||
# Unknown Mapping:
|
|
||||||
# OP_Action2 -> OP_Damage
|
|
||||||
# OP_EnvDamage -> OP_Damage ---> might have been a one time mistake
|
|
||||||
# Name Differences:
|
|
||||||
# OP_CancelInvite -> OP_GroupCancelInvite
|
|
||||||
# OP_GMFind -> OP_FindPersonRequest
|
|
||||||
# OP_CommonMessage -> OP_ChannelMessage
|
|
||||||
|
|
||||||
OP_Unknown=0x0000
|
|
||||||
OP_ExploreUnknown=0x0000 # used for unknown explorer
|
|
||||||
|
|
||||||
# world packets
|
|
||||||
# Required to reach Char Select:
|
|
||||||
OP_SendLoginInfo=0x2fca
|
|
||||||
OP_ApproveWorld=0x0000
|
|
||||||
OP_LogServer=0x6d4d
|
|
||||||
OP_SendCharInfo=0x832
|
|
||||||
OP_ExpansionInfo=0x066d
|
|
||||||
OP_GuildsList=0x0000
|
|
||||||
OP_EnterWorld=0x6691
|
|
||||||
OP_PostEnterWorld=0x2062
|
|
||||||
OP_World_Client_CRC1=0x74c8
|
|
||||||
OP_World_Client_CRC2=0x3984
|
|
||||||
OP_World_Client_CRC3=0x6516
|
|
||||||
OP_SendSpellChecksum=0x0000
|
|
||||||
OP_SendSkillCapsChecksum=0x0000
|
|
||||||
|
|
||||||
# Character Select Related:
|
|
||||||
OP_SendMaxCharacters=0x13af
|
|
||||||
OP_SendMembership=0x2aca
|
|
||||||
OP_SendMembershipDetails=0x2608
|
|
||||||
OP_CharacterCreateRequest=0x0000
|
|
||||||
OP_CharacterCreate=0x0000
|
|
||||||
OP_DeleteCharacter=0x0000
|
|
||||||
OP_RandomNameGenerator=0x0000
|
|
||||||
OP_ApproveName=0x0000
|
|
||||||
OP_MOTD=0x0000
|
|
||||||
OP_SetChatServer=0x2726
|
|
||||||
OP_SetChatServer2=0x0000
|
|
||||||
OP_ZoneServerInfo=0x2273
|
|
||||||
OP_WorldComplete=0x195c
|
|
||||||
OP_WorldUnknown001=0x2049
|
|
||||||
OP_FloatListThing=0x0000
|
|
||||||
|
|
||||||
# Reasons for Disconnect:
|
|
||||||
OP_ZoneUnavail=0x0000
|
|
||||||
OP_WorldClientReady=0x0000
|
|
||||||
OP_CharacterStillInZone=0x0000
|
|
||||||
OP_WorldChecksumFailure=0x0000
|
|
||||||
OP_WorldLoginFailed=0x0000
|
|
||||||
OP_WorldLogout=0x0000
|
|
||||||
OP_WorldLevelTooHigh=0x0000
|
|
||||||
OP_CharInacessable=0x0000
|
|
||||||
OP_UserCompInfo=0x0000
|
|
||||||
OP_SendExeChecksum=0x0000
|
|
||||||
OP_SendBaseDataChecksum=0x0000
|
|
||||||
|
|
||||||
# Zone in opcodes
|
|
||||||
OP_AckPacket=0x77c9
|
|
||||||
OP_ZoneEntry=0x0000
|
|
||||||
OP_ReqNewZone=0x0000
|
|
||||||
OP_NewZone=0x0000
|
|
||||||
OP_ZoneSpawns=0x0000
|
|
||||||
OP_PlayerProfile=0x0000
|
|
||||||
OP_TimeOfDay=0x0000
|
|
||||||
OP_LevelUpdate=0x0000
|
|
||||||
OP_Stamina=0x0000
|
|
||||||
OP_RequestClientZoneChange=0x0000
|
|
||||||
OP_ZoneChange=0x0000
|
|
||||||
OP_LockoutTimerInfo=0x0000
|
|
||||||
OP_ZoneServerReady=0x0000
|
|
||||||
OP_ZoneInUnknown=0x0000
|
|
||||||
OP_LogoutReply=0x0000
|
|
||||||
OP_PreLogoutReply=0x0000
|
|
||||||
|
|
||||||
# Required to fully log in
|
|
||||||
OP_SpawnAppearance=0x0000
|
|
||||||
OP_ChangeSize=0x0000
|
|
||||||
OP_TributeUpdate=0x0000
|
|
||||||
OP_TributeTimer=0x0000
|
|
||||||
OP_SendTributes=0x0000
|
|
||||||
OP_RequestGuildTributes=0x0000
|
|
||||||
OP_TributeInfo=0x0000
|
|
||||||
OP_Weather=0x0000
|
|
||||||
OP_ReqClientSpawn=0x0000
|
|
||||||
OP_SpawnDoor=0x0000
|
|
||||||
OP_GroundSpawn=0x0000
|
|
||||||
OP_SendZonepoints=0x0000
|
|
||||||
OP_BlockedBuffs=0x0000
|
|
||||||
OP_RemoveBlockedBuffs=0x0000
|
|
||||||
OP_ClearBlockedBuffs=0x0000
|
|
||||||
OP_WorldObjectsSent=0x0000
|
|
||||||
OP_SendExpZonein=0x0000
|
|
||||||
OP_SendAATable=0x0000
|
|
||||||
OP_ClearAA=0x0000
|
|
||||||
OP_ClearLeadershipAbilities=0x0000
|
|
||||||
OP_RespondAA=0x0000
|
|
||||||
OP_UpdateAA=0x0000
|
|
||||||
OP_SendAAStats=0x0000
|
|
||||||
OP_AAExpUpdate=0x0000
|
|
||||||
OP_ExpUpdate=0x0000
|
|
||||||
OP_HPUpdate=0x0000
|
|
||||||
OP_ManaChange=0x0000
|
|
||||||
OP_TGB=0x0000
|
|
||||||
OP_SpecialMesg=0x0000
|
|
||||||
OP_GuildMemberList=0x0000
|
|
||||||
OP_GuildMOTD=0x0000
|
|
||||||
OP_CharInventory=0x0000
|
|
||||||
OP_WearChange=0x0000
|
|
||||||
OP_ClientUpdate=0x0000
|
|
||||||
OP_ClientReady=0x0000
|
|
||||||
OP_SetServerFilter=0x0000
|
|
||||||
|
|
||||||
# Guild Opcodes
|
|
||||||
OP_GetGuildMOTD=0x0000
|
|
||||||
OP_GetGuildMOTDReply=0x0000
|
|
||||||
OP_GuildMemberUpdate=0x0000
|
|
||||||
OP_GuildInvite=0x0000
|
|
||||||
OP_GuildRemove=0x0000
|
|
||||||
OP_GuildPeace=0x0000
|
|
||||||
OP_SetGuildMOTD=0x0000
|
|
||||||
OP_GuildWar=0x0000
|
|
||||||
OP_GuildLeader=0x0000
|
|
||||||
OP_GuildDelete=0x0000
|
|
||||||
OP_GuildInviteAccept=0x0000
|
|
||||||
OP_GuildDemote=0x0000
|
|
||||||
OP_GuildPromote=0x0000
|
|
||||||
OP_GuildPublicNote=0x0000
|
|
||||||
OP_GuildManageBanker=0x0000
|
|
||||||
OP_GuildBank=0x0000
|
|
||||||
OP_GuildBankItemList=0x0000
|
|
||||||
OP_SetGuildRank=0x0000
|
|
||||||
OP_GuildUpdate=0x0000
|
|
||||||
OP_GuildStatus=0x0000
|
|
||||||
OP_GuildCreate=0x0000
|
|
||||||
OP_GuildOpenGuildWindow=0x0000
|
|
||||||
OP_GuildMemberLevel=0x0000
|
|
||||||
OP_GuildMemberRankAltBanker=0x0000
|
|
||||||
OP_GuildMemberPublicNote=0x0000
|
|
||||||
OP_GuildMemberAdd=0x0000
|
|
||||||
OP_GuildMemberRename=0x0000
|
|
||||||
OP_GuildMemberDelete=0x0000
|
|
||||||
OP_GuildMemberDetails=0x0000
|
|
||||||
OP_GuildRenameGuild=0x0000
|
|
||||||
OP_LFGuild=0x0000
|
|
||||||
OP_GuildDeleteGuild=0x0000
|
|
||||||
|
|
||||||
# GM/Guide Opcodes
|
|
||||||
OP_GMServers=0x0000
|
|
||||||
OP_GMBecomeNPC=0x0000
|
|
||||||
OP_GMZoneRequest=0x0000
|
|
||||||
OP_GMZoneRequest2=0x0000
|
|
||||||
OP_GMGoto=0x0000
|
|
||||||
OP_GMSearchCorpse=0x0000
|
|
||||||
OP_GMHideMe=0x0000
|
|
||||||
OP_GMDelCorpse=0x0000
|
|
||||||
OP_GMApproval=0x0000
|
|
||||||
OP_GMToggle=0x0000
|
|
||||||
OP_GMSummon=0x0000
|
|
||||||
OP_GMEmoteZone=0x0000
|
|
||||||
OP_GMEmoteWorld=0x0000
|
|
||||||
OP_GMFind=0x0000
|
|
||||||
OP_GMKick=0x0000
|
|
||||||
OP_GMKill=0x0000
|
|
||||||
OP_GMNameChange=0x0000
|
|
||||||
OP_GMLastName=0x0000
|
|
||||||
|
|
||||||
# Misc Opcodes
|
|
||||||
OP_QueryUCSServerStatus=0x0000
|
|
||||||
OP_InspectRequest=0x0000
|
|
||||||
OP_InspectAnswer=0x0000
|
|
||||||
OP_InspectMessageUpdate=0x0000
|
|
||||||
OP_BeginCast=0x0000
|
|
||||||
OP_ColoredText=0x0000
|
|
||||||
OP_ConsentResponse=0x0000
|
|
||||||
OP_MemorizeSpell=0x0000
|
|
||||||
OP_LinkedReuse=0x0000
|
|
||||||
OP_SwapSpell=0x0000
|
|
||||||
OP_CastSpell=0x0000
|
|
||||||
OP_Consider=0x0000
|
|
||||||
OP_FormattedMessage=0x0000
|
|
||||||
OP_SimpleMessage=0x0000
|
|
||||||
OP_Buff=0x0000
|
|
||||||
OP_Illusion=0x0000
|
|
||||||
OP_MoneyOnCorpse=0x0000
|
|
||||||
OP_RandomReply=0x0000
|
|
||||||
OP_DenyResponse=0x0000
|
|
||||||
OP_SkillUpdate=0x04c
|
|
||||||
OP_GMTrainSkillConfirm=0x0000
|
|
||||||
OP_RandomReq=0x0000
|
|
||||||
OP_Death=0x0000
|
|
||||||
OP_GMTraining=0x0000
|
|
||||||
OP_GMEndTraining=0x0000
|
|
||||||
OP_GMTrainSkill=0x0000
|
|
||||||
OP_Animation=0x0000
|
|
||||||
OP_Begging=0x0000
|
|
||||||
OP_Consent=0x0000
|
|
||||||
OP_ConsentDeny=0x0000
|
|
||||||
OP_AutoFire=0x0000
|
|
||||||
OP_PetCommands=0x0000
|
|
||||||
OP_PetCommandState=0x0000
|
|
||||||
OP_PetHoTT=0x0000
|
|
||||||
OP_DeleteSpell=0x0000
|
|
||||||
OP_Surname=0x0000
|
|
||||||
OP_ClearSurname=0x0000
|
|
||||||
OP_FaceChange=0x0000
|
|
||||||
OP_SetFace=0x0000
|
|
||||||
OP_SenseHeading=0x0000
|
|
||||||
OP_Action=0x0000
|
|
||||||
OP_ConsiderCorpse=0x0000
|
|
||||||
OP_HideCorpse=0x0000
|
|
||||||
OP_CorpseDrag=0x0000
|
|
||||||
OP_CorpseDrop=0x0000
|
|
||||||
OP_Bug=0x0000
|
|
||||||
OP_Feedback=0x0000
|
|
||||||
OP_Report=0x0000
|
|
||||||
OP_Damage=0x0000
|
|
||||||
OP_ChannelMessage=0x0000
|
|
||||||
OP_Assist=0x0000
|
|
||||||
OP_AssistGroup=0x0000
|
|
||||||
OP_MoveCoin=0x0000
|
|
||||||
OP_ZonePlayerToBind=0x0000
|
|
||||||
OP_KeyRing=0x0000
|
|
||||||
OP_WhoAllRequest=0x0000
|
|
||||||
OP_WhoAllResponse=0x0000
|
|
||||||
OP_FriendsWho=0x0000
|
|
||||||
OP_ConfirmDelete=0x0000
|
|
||||||
OP_Logout=0x0000
|
|
||||||
OP_Rewind=0x0000
|
|
||||||
OP_TargetCommand=0x0000
|
|
||||||
OP_Hide=0x0000
|
|
||||||
OP_Jump=0x0000
|
|
||||||
OP_Camp=0x0000
|
|
||||||
OP_Emote=0x0000
|
|
||||||
OP_SetRunMode=0x0000
|
|
||||||
OP_BankerChange=0x0000
|
|
||||||
OP_TargetMouse=0x0000
|
|
||||||
OP_MobHealth=0x0000
|
|
||||||
OP_InitialMobHealth=0x0000 # Unused?
|
|
||||||
OP_TargetHoTT=0x0000
|
|
||||||
OP_TargetBuffs=0x0000
|
|
||||||
OP_XTargetResponse=0x0000
|
|
||||||
OP_XTargetRequest=0x0000
|
|
||||||
OP_XTargetAutoAddHaters=0x0000
|
|
||||||
OP_XTargetOpen=0x0000
|
|
||||||
OP_XTargetOpenResponse=0x0000
|
|
||||||
OP_BuffCreate=0x0000
|
|
||||||
OP_BuffRemoveRequest=0x0000
|
|
||||||
OP_DeleteSpawn=0x0000
|
|
||||||
OP_AutoAttack=0x0000
|
|
||||||
OP_AutoAttack2=0x0000
|
|
||||||
OP_Consume=0x0000
|
|
||||||
OP_MoveItem=0x0000
|
|
||||||
OP_MoveMultipleItems=0x0000
|
|
||||||
OP_DeleteItem=0x0000
|
|
||||||
OP_DeleteCharge=0x0000
|
|
||||||
OP_ItemPacket=0x0000
|
|
||||||
OP_ItemLinkResponse=0x0000
|
|
||||||
OP_ItemLinkClick=0x0000
|
|
||||||
OP_ItemPreview=0x0000
|
|
||||||
OP_NewSpawn=0x0000
|
|
||||||
OP_Track=0x0000
|
|
||||||
OP_TrackTarget=0x0000
|
|
||||||
OP_TrackUnknown=0x0000
|
|
||||||
OP_ClickDoor=0x0000
|
|
||||||
OP_MoveDoor=0x0000
|
|
||||||
OP_RemoveAllDoors=0x0000
|
|
||||||
OP_EnvDamage=0x0000
|
|
||||||
OP_BoardBoat=0x0000
|
|
||||||
OP_LeaveBoat=0x0000
|
|
||||||
OP_ControlBoat=0x0000
|
|
||||||
OP_Forage=0x0000
|
|
||||||
OP_SafeFallSuccess=0x0000
|
|
||||||
OP_RezzComplete=0x0000
|
|
||||||
OP_RezzRequest=0x0000
|
|
||||||
OP_RezzAnswer=0x0000
|
|
||||||
OP_Shielding=0x0000
|
|
||||||
OP_RequestDuel=0x0000
|
|
||||||
OP_MobRename=0x0000
|
|
||||||
OP_AugmentItem=0x0000
|
|
||||||
OP_WeaponEquip1=0x0000
|
|
||||||
OP_PlayerStateAdd=0x0000
|
|
||||||
OP_PlayerStateRemove=0x0000
|
|
||||||
OP_ApplyPoison=0x0000
|
|
||||||
OP_Save=0x0000
|
|
||||||
OP_TestBuff=0x0000
|
|
||||||
OP_CustomTitles=0x0000
|
|
||||||
OP_Split=0x0000
|
|
||||||
OP_YellForHelp=0x0000
|
|
||||||
OP_LoadSpellSet=0x0000
|
|
||||||
OP_Bandolier=0x0000
|
|
||||||
OP_PotionBelt=0x0000
|
|
||||||
OP_DuelDecline=0x0000
|
|
||||||
OP_DuelAccept=0x0000
|
|
||||||
OP_SaveOnZoneReq=0x0000
|
|
||||||
OP_ReadBook=0x0000
|
|
||||||
OP_Dye=0x0000
|
|
||||||
OP_InterruptCast=0x0000
|
|
||||||
OP_AAAction=0x0000
|
|
||||||
OP_LeadershipExpToggle=0x0000
|
|
||||||
OP_LeadershipExpUpdate=0x0000
|
|
||||||
OP_PurchaseLeadershipAA=0x0000
|
|
||||||
OP_UpdateLeadershipAA=0x0000
|
|
||||||
OP_MarkNPC=0x0000
|
|
||||||
OP_ClearNPCMarks=0x0000
|
|
||||||
OP_DelegateAbility=0x0000
|
|
||||||
OP_SetGroupTarget=0x0000
|
|
||||||
OP_Charm=0x0000
|
|
||||||
OP_Stun=0x0000
|
|
||||||
OP_SendFindableNPCs=0x0000
|
|
||||||
OP_FindPersonRequest=0x0000
|
|
||||||
OP_FindPersonReply=0x0000
|
|
||||||
OP_Sound=0x0000
|
|
||||||
OP_CashReward=0x0000
|
|
||||||
OP_PetBuffWindow=0x0000
|
|
||||||
OP_LevelAppearance=0x0000
|
|
||||||
OP_Translocate=0x0000
|
|
||||||
OP_Sacrifice=0x0000
|
|
||||||
OP_PopupResponse=0x0000
|
|
||||||
OP_OnLevelMessage=0x0000
|
|
||||||
OP_AugmentInfo=0x0000
|
|
||||||
OP_Petition=0x0000
|
|
||||||
OP_SomeItemPacketMaybe=0x0000
|
|
||||||
OP_PVPStats=0x0000
|
|
||||||
OP_PVPLeaderBoardRequest=0x0000
|
|
||||||
OP_PVPLeaderBoardReply=0x0000
|
|
||||||
OP_PVPLeaderBoardDetailsRequest=0x0000
|
|
||||||
OP_PVPLeaderBoardDetailsReply=0x0000
|
|
||||||
OP_RestState=0x0000
|
|
||||||
OP_RespawnWindow=0x0000
|
|
||||||
OP_LDoNButton=0x0000
|
|
||||||
OP_SetStartCity=0x0000
|
|
||||||
OP_VoiceMacroIn=0x0000
|
|
||||||
OP_VoiceMacroOut=0x0000
|
|
||||||
OP_ItemViewUnknown=0x0000
|
|
||||||
OP_VetRewardsAvaliable=0x0000
|
|
||||||
OP_VetClaimRequest=0x0000
|
|
||||||
OP_VetClaimReply=0x0000
|
|
||||||
OP_DisciplineUpdate=0x0000
|
|
||||||
OP_DisciplineTimer=0x0000
|
|
||||||
OP_BecomeCorpse=0x0000 # Unused?
|
|
||||||
OP_Action2=0x0000 # Unused?
|
|
||||||
OP_MobUpdate=0x0000
|
|
||||||
OP_NPCMoveUpdate=0x0000
|
|
||||||
OP_CameraEffect=0x0000
|
|
||||||
OP_SpellEffect=0x0000
|
|
||||||
OP_AddNimbusEffect=0x0000
|
|
||||||
OP_RemoveNimbusEffect=0x0000
|
|
||||||
OP_AltCurrency=0x0000
|
|
||||||
OP_AltCurrencyMerchantRequest=0x0000
|
|
||||||
OP_AltCurrencyMerchantReply=0x0000
|
|
||||||
OP_AltCurrencyPurchase=0x0000
|
|
||||||
OP_AltCurrencySell=0x0000
|
|
||||||
OP_AltCurrencySellSelection=0x0000
|
|
||||||
OP_AltCurrencyReclaim=0x0000
|
|
||||||
OP_CrystalCountUpdate=0x0000
|
|
||||||
OP_CrystalCreate=0x0000
|
|
||||||
OP_CrystalReclaim=0x0000
|
|
||||||
OP_Untargetable=0x0000
|
|
||||||
OP_IncreaseStats=0x0000
|
|
||||||
OP_Weblink=0x0000
|
|
||||||
OP_OpenContainer=0x0000
|
|
||||||
OP_Marquee=0x0000
|
|
||||||
OP_ItemRecastDelay=0x0000
|
|
||||||
#OP_OpenInventory=0x0000 # Likely does not exist in RoF -U
|
|
||||||
OP_ResetAA=0x0000
|
|
||||||
OP_Fling=0x0000
|
|
||||||
OP_CancelSneakHide=0x0000
|
|
||||||
OP_AggroMeterLockTarget=0x0000
|
|
||||||
OP_AggroMeterTargetInfo=0x0000
|
|
||||||
OP_AggroMeterUpdate=0x0000
|
|
||||||
OP_UnderWorld=0x0000 # clients sends up when they detect an underworld issue, might be useful for cheat detection
|
|
||||||
OP_KickPlayers=0x0000
|
|
||||||
OP_BookButton=0x0000
|
|
||||||
|
|
||||||
# Expeditions
|
|
||||||
OP_DzQuit=0x0000
|
|
||||||
OP_DzListTimers=0x0000
|
|
||||||
OP_DzAddPlayer=0x0000
|
|
||||||
OP_DzRemovePlayer=0x0000
|
|
||||||
OP_DzSwapPlayer=0x0000
|
|
||||||
OP_DzMakeLeader=0x0000
|
|
||||||
OP_DzPlayerList=0x0000
|
|
||||||
OP_DzExpeditionInvite=0x0000
|
|
||||||
OP_DzExpeditionInviteResponse=0x0000
|
|
||||||
OP_DzExpeditionInfo=0x0000
|
|
||||||
OP_DzExpeditionLockoutTimers=0x0000
|
|
||||||
OP_DzMemberList=0x0000
|
|
||||||
OP_DzMemberListName=0x0000
|
|
||||||
OP_DzMemberListStatus=0x0000
|
|
||||||
OP_DzSetLeaderName=0x0000
|
|
||||||
OP_DzExpeditionEndsWarning=0x0000
|
|
||||||
OP_DzCompass=0x0000
|
|
||||||
OP_DzChooseZone=0x0000
|
|
||||||
OP_DzChooseZoneReply=0x0000
|
|
||||||
|
|
||||||
# New Opcodes
|
|
||||||
OP_SpawnPositionUpdate=0x0000 # Actually OP_MobUpdate ?
|
|
||||||
OP_ManaUpdate=0x0000
|
|
||||||
OP_EnduranceUpdate=0x0000
|
|
||||||
OP_MobManaUpdate=0x0000
|
|
||||||
OP_MobEnduranceUpdate=0x0000
|
|
||||||
|
|
||||||
# Mercenary Opcodes
|
|
||||||
OP_MercenaryDataUpdateRequest=0x0000
|
|
||||||
OP_MercenaryDataUpdate=0x0000
|
|
||||||
OP_MercenaryDataRequest=0x0000
|
|
||||||
OP_MercenaryDataResponse=0x0000
|
|
||||||
OP_MercenaryHire=0x0000
|
|
||||||
OP_MercenaryDismiss=0x0000
|
|
||||||
OP_MercenaryTimerRequest=0x0000
|
|
||||||
OP_MercenaryTimer=0x0000
|
|
||||||
OP_MercenaryUnknown1=0x0000
|
|
||||||
OP_MercenaryCommand=0x0000
|
|
||||||
OP_MercenarySuspendRequest=0x0000
|
|
||||||
OP_MercenarySuspendResponse=0x0000
|
|
||||||
OP_MercenaryUnsuspendResponse=0x0000
|
|
||||||
|
|
||||||
# Looting
|
|
||||||
OP_LootRequest=0x0000
|
|
||||||
OP_EndLootRequest=0x0000
|
|
||||||
OP_LootItem=0x0000
|
|
||||||
OP_LootComplete=0x0000
|
|
||||||
|
|
||||||
# bazaar trader stuff:
|
|
||||||
OP_BazaarSearch=0x0000
|
|
||||||
OP_TraderDelItem=0x0000
|
|
||||||
OP_BecomeTrader=0x0000
|
|
||||||
OP_TraderShop=0x0000
|
|
||||||
OP_TraderBulkSend=0x0000
|
|
||||||
OP_Trader=0x0000
|
|
||||||
OP_Barter=0x0000
|
|
||||||
OP_BuyerItems=0x0000
|
|
||||||
OP_TraderBuy=0x0000
|
|
||||||
OP_ShopItem=0x0000
|
|
||||||
OP_BazaarInspect=0x0000
|
|
||||||
OP_Bazaar=0x0000
|
|
||||||
OP_TraderItemUpdate=0x0000
|
|
||||||
|
|
||||||
# pc/npc trading
|
|
||||||
OP_TradeRequest=0x0000
|
|
||||||
OP_TradeAcceptClick=0x0000
|
|
||||||
OP_TradeRequestAck=0x0000
|
|
||||||
OP_TradeCoins=0x0000
|
|
||||||
OP_FinishTrade=0x0000
|
|
||||||
OP_CancelTrade=0x0000
|
|
||||||
OP_TradeMoneyUpdate=0x0000
|
|
||||||
OP_MoneyUpdate=0x0000
|
|
||||||
OP_TradeBusy=0x0000
|
|
||||||
|
|
||||||
# Sent after canceling trade or after closing tradeskill object
|
|
||||||
OP_FinishWindow=0x0000
|
|
||||||
OP_FinishWindow2=0x0000
|
|
||||||
|
|
||||||
# Sent on Live for what seems to be item existance verification
|
|
||||||
# Ex. Before Right Click Effect happens from items
|
|
||||||
OP_ItemVerifyRequest=0x0000
|
|
||||||
OP_ItemVerifyReply=0x0000
|
|
||||||
|
|
||||||
OP_ItemAdvancedLoreText=0x0000
|
|
||||||
|
|
||||||
# merchant stuff
|
|
||||||
OP_ShopPlayerSell=0x0000
|
|
||||||
OP_ShopRequest=0x0000
|
|
||||||
OP_ShopEnd=0x0000
|
|
||||||
OP_ShopEndConfirm=0x0000
|
|
||||||
OP_ShopPlayerBuy=0x0000
|
|
||||||
OP_ShopDelItem=0x0000
|
|
||||||
OP_ShopSendParcel=0x0000
|
|
||||||
OP_ShopDeleteParcel=0x0000
|
|
||||||
OP_ShopRetrieveParcel=0x0000
|
|
||||||
OP_ShopParcelIcon=0x0000
|
|
||||||
|
|
||||||
# tradeskill stuff:
|
|
||||||
OP_ClickObject=0x0000
|
|
||||||
OP_ClickObjectAction=0x0000
|
|
||||||
OP_ClearObject=0x0000
|
|
||||||
OP_RecipeDetails=0x0000
|
|
||||||
OP_RecipesFavorite=0x0000
|
|
||||||
OP_RecipesSearch=0x0000
|
|
||||||
OP_RecipeReply=0x0000
|
|
||||||
OP_RecipeAutoCombine=0x0000
|
|
||||||
OP_TradeSkillCombine=0x0000
|
|
||||||
|
|
||||||
# Tribute Packets:
|
|
||||||
OP_OpenTributeMaster=0x0000
|
|
||||||
OP_SelectTribute=0x0000
|
|
||||||
OP_TributeItem=0x0000
|
|
||||||
OP_TributeMoney=0x0000
|
|
||||||
OP_TributeToggle=0x0000
|
|
||||||
OP_TributePointUpdate=0x0000
|
|
||||||
OP_TributeNPC=0x0000
|
|
||||||
OP_GuildTributeInfo=0x0000
|
|
||||||
OP_OpenTributeReply=0x0000
|
|
||||||
OP_GuildTributeStatus=0x0000
|
|
||||||
OP_GuildSaveActiveTributes=0x0000
|
|
||||||
OP_GuildSendActiveTributes=0x0000
|
|
||||||
OP_GuildTributeToggleReq=0x0000
|
|
||||||
OP_GuildTributeToggleReply=0x0000
|
|
||||||
OP_GuildTributeFavorAndTimer=0x0000
|
|
||||||
OP_GuildTributeDonateItem=0x0000
|
|
||||||
OP_GuildTributeDonatePlat=0x0000
|
|
||||||
OP_GuildSelectTribute=0x0000
|
|
||||||
OP_GuildModifyBenefits=0x0000
|
|
||||||
OP_GuildOptInOut=0x0000
|
|
||||||
OP_SendGuildTributes=0x0000
|
|
||||||
OP_OpenGuildTributeMaster=0x0000
|
|
||||||
|
|
||||||
# Adventure packets:
|
|
||||||
OP_LeaveAdventure=0x0000
|
|
||||||
OP_AdventureFinish=0x0000
|
|
||||||
OP_AdventureInfoRequest=0x0000
|
|
||||||
OP_AdventureInfo=0x0000
|
|
||||||
OP_AdventureRequest=0x0000
|
|
||||||
OP_AdventureDetails=0x0000
|
|
||||||
OP_AdventureData=0x0000
|
|
||||||
OP_AdventureUpdate=0x0000
|
|
||||||
OP_AdventureMerchantRequest=0x0000
|
|
||||||
OP_AdventureMerchantResponse=0x0000
|
|
||||||
OP_AdventureMerchantPurchase=0x0000
|
|
||||||
OP_AdventureMerchantSell=0x0000
|
|
||||||
OP_AdventurePointsUpdate=0x0000
|
|
||||||
OP_AdventureStatsRequest=0x0000
|
|
||||||
OP_AdventureStatsReply=0x0000
|
|
||||||
OP_AdventureLeaderboardRequest=0x0000
|
|
||||||
OP_AdventureLeaderboardReply=0x0000
|
|
||||||
|
|
||||||
# Group Opcodes
|
|
||||||
OP_GroupDisband=0x0000
|
|
||||||
OP_GroupInvite=0x0000
|
|
||||||
OP_GroupFollow=0x0000
|
|
||||||
OP_GroupUpdate=0x0000
|
|
||||||
OP_GroupUpdateB=0x0000
|
|
||||||
OP_GroupCancelInvite=0x0000
|
|
||||||
OP_GroupAcknowledge=0x0000
|
|
||||||
OP_GroupDelete=0x0000
|
|
||||||
OP_CancelInvite=0x0000
|
|
||||||
OP_GroupFollow2=0x0000
|
|
||||||
OP_GroupInvite2=0x0000
|
|
||||||
OP_GroupDisbandYou=0x0000
|
|
||||||
OP_GroupDisbandOther=0x0000
|
|
||||||
OP_GroupLeaderChange=0x0000
|
|
||||||
OP_GroupRoles=0x0000
|
|
||||||
OP_GroupMakeLeader=0x0000
|
|
||||||
OP_DoGroupLeadershipAbility=0x0000
|
|
||||||
OP_GroupLeadershipAAUpdate=0x0000
|
|
||||||
OP_GroupMentor=0x0000
|
|
||||||
OP_InspectBuffs=0x0000
|
|
||||||
|
|
||||||
# LFG/LFP Opcodes
|
|
||||||
OP_LFGCommand=0x0000
|
|
||||||
OP_LFGGetMatchesRequest=0x0000
|
|
||||||
OP_LFGGetMatchesResponse=0x0000
|
|
||||||
OP_LFPGetMatchesRequest=0x0000
|
|
||||||
OP_LFPGetMatchesResponse=0x0000
|
|
||||||
OP_LFPCommand=0x0000
|
|
||||||
OP_LFGAppearance=0x0000
|
|
||||||
OP_LFGResponse=0x0000
|
|
||||||
|
|
||||||
# Raid Opcodes
|
|
||||||
OP_RaidInvite=0x0000
|
|
||||||
OP_RaidUpdate=0x0000
|
|
||||||
OP_RaidJoin=0x0000
|
|
||||||
OP_RaidDelegateAbility=0x0000
|
|
||||||
OP_MarkRaidNPC=0x0000
|
|
||||||
OP_RaidClearNPCMarks=0x0000
|
|
||||||
|
|
||||||
# Button-push commands
|
|
||||||
OP_Taunt=0x0000
|
|
||||||
OP_CombatAbility=0x0000
|
|
||||||
OP_SenseTraps=0x0000
|
|
||||||
OP_PickPocket=0x0000
|
|
||||||
OP_DisarmTraps=0x0000
|
|
||||||
OP_Disarm=0x0000
|
|
||||||
OP_Sneak=0x0000
|
|
||||||
OP_Fishing=0x0000
|
|
||||||
OP_InstillDoubt=0x0000
|
|
||||||
OP_FeignDeath=0x0000
|
|
||||||
OP_Mend=0x0000
|
|
||||||
OP_Bind_Wound=0x0000
|
|
||||||
OP_LDoNOpen=0x0000
|
|
||||||
#OP_LDoNDisarmTraps= #Same as OP_DisarmTraps in RoF
|
|
||||||
OP_LDoNPickLock=0x0000
|
|
||||||
OP_LDoNInspect=0x0000
|
|
||||||
|
|
||||||
# Task packets
|
|
||||||
OP_TaskDescription=0x0000
|
|
||||||
OP_TaskActivity=0x0000
|
|
||||||
OP_CompletedTasks=0x0000
|
|
||||||
OP_TaskActivityComplete=0x0000
|
|
||||||
OP_AcceptNewTask=0x0000
|
|
||||||
OP_CancelTask=0x0000
|
|
||||||
OP_AvaliableTask=0x0000
|
|
||||||
OP_TaskHistoryRequest=0x0000
|
|
||||||
OP_TaskHistoryReply=0x0000
|
|
||||||
OP_DeclineAllTasks=0x0000
|
|
||||||
OP_TaskRequestTimer=0x0000
|
|
||||||
OP_TaskSelectWindow=0x0000
|
|
||||||
|
|
||||||
# Shared Tasks
|
|
||||||
OP_SharedTaskMemberList=0x0000 #
|
|
||||||
OP_SharedTaskRemovePlayer=0x0000 # /taskremoveplayer
|
|
||||||
OP_SharedTaskAddPlayer=0x0000 # /taskaddplayer
|
|
||||||
OP_SharedTaskMakeLeader=0x0000 # /taskmakeleader
|
|
||||||
OP_SharedTaskInvite=0x0000 # Dialog window
|
|
||||||
OP_SharedTaskInviteResponse=0x0000 # Dialog window response
|
|
||||||
OP_SharedTaskAcceptNew=0x0000 #
|
|
||||||
OP_SharedTaskMemberChange=0x0000 #
|
|
||||||
OP_TaskTimers=0x0000 # /tasktimers
|
|
||||||
OP_SharedTaskQuit=0x0000 # /taskquit
|
|
||||||
OP_SharedTaskSelectWindow=0x0000
|
|
||||||
OP_SharedTaskPlayerList=0x0000 # /taskplayerlist
|
|
||||||
|
|
||||||
# Title opcodes
|
|
||||||
OP_NewTitlesAvailable=0x0000
|
|
||||||
OP_RequestTitles=0x0000
|
|
||||||
OP_SendTitleList=0x0000
|
|
||||||
OP_SetTitle=0x0000
|
|
||||||
OP_SetTitleReply=0x0000
|
|
||||||
|
|
||||||
# mail opcodes
|
|
||||||
OP_Command=0x0000
|
|
||||||
OP_MailboxHeader=0x0000
|
|
||||||
OP_MailHeader=0x0000
|
|
||||||
OP_MailBody=0x0000
|
|
||||||
OP_NewMail=0x0000
|
|
||||||
OP_SentConfirm=0x0000
|
|
||||||
|
|
||||||
########### Below this point should not be needed ###########
|
|
||||||
|
|
||||||
# This section are all unknown in Titanium
|
|
||||||
OP_ForceFindPerson=0x0000
|
|
||||||
OP_LocInfo=0x0000
|
|
||||||
OP_ReloadUI=0x0000
|
|
||||||
OP_ItemName=0x0000
|
|
||||||
OP_ItemLinkText=0x0000
|
|
||||||
OP_MultiLineMsg=0x0000
|
|
||||||
OP_MendHPUpdate=0x0000
|
|
||||||
OP_TargetReject=0x0000
|
|
||||||
OP_SafePoint=0x0000
|
|
||||||
OP_ApproveZone=0x0000
|
|
||||||
OP_ZoneComplete=0x0000
|
|
||||||
OP_ClientError=0x0000
|
|
||||||
OP_DumpName=0x0000
|
|
||||||
OP_Heartbeat=0x0000
|
|
||||||
OP_CrashDump=0x0000
|
|
||||||
OP_LoginComplete=0x0000
|
|
||||||
|
|
||||||
# discovered opcodes not yet used:
|
|
||||||
OP_PickLockSuccess=0x0000
|
|
||||||
OP_PlayMP3=0x0000
|
|
||||||
OP_ReclaimCrystals=0x0000
|
|
||||||
OP_DynamicWall=0x0000
|
|
||||||
OP_OpenDiscordMerchant=0x0000
|
|
||||||
OP_DiscordMerchantInventory=0x0000
|
|
||||||
OP_GiveMoney=0x0000
|
|
||||||
OP_RequestKnowledgeBase=0x0000
|
|
||||||
OP_KnowledgeBase=0x0000
|
|
||||||
OP_SlashAdventure=0x0000 # /adventure
|
|
||||||
OP_BecomePVPPrompt=0x0000
|
|
||||||
OP_MoveLogRequest=0x0000 # gone I think
|
|
||||||
OP_MoveLogDisregard=0x0000 # gone I think
|
|
||||||
|
|
||||||
# named unknowns, to make looking for real unknown easier
|
|
||||||
OP_AnnoyingZoneUnknown=0x0000
|
|
||||||
OP_Some6ByteHPUpdate=0x0000 #seems to happen when you target group members
|
|
||||||
OP_QueryResponseThing=0x0000
|
|
||||||
|
|
||||||
|
|
||||||
# realityincarnate: these are just here to stop annoying several thousand byte packet dumps
|
|
||||||
#OP_LoginUnknown1=0x0000 # OP_SendSpellChecksum
|
|
||||||
#OP_LoginUnknown2=0x0000 # OP_SendSkillCapsChecksum
|
|
||||||
|
|
||||||
# Petition Opcodes
|
|
||||||
OP_PetitionSearch=0x0000 #search term for petition
|
|
||||||
OP_PetitionSearchResults=0x0000 #(list of?) matches from search
|
|
||||||
OP_PetitionSearchText=0x0000 #text results of search
|
|
||||||
|
|
||||||
OP_PetitionUpdate=0x0000
|
|
||||||
OP_PetitionCheckout=0x0000
|
|
||||||
OP_PetitionCheckIn=0x0000
|
|
||||||
OP_PetitionQue=0x0000
|
|
||||||
OP_PetitionUnCheckout=0x0000
|
|
||||||
OP_PetitionDelete=0x0000
|
|
||||||
OP_DeletePetition=0x0000
|
|
||||||
OP_PetitionResolve=0x0000
|
|
||||||
OP_PDeletePetition=0x0000
|
|
||||||
OP_PetitionBug=0x0000
|
|
||||||
OP_PetitionRefresh=0x0000
|
|
||||||
OP_PetitionCheckout2=0x0000
|
|
||||||
OP_PetitionViewPetition=0x0000
|
|
||||||
|
|
||||||
# Login opcodes
|
|
||||||
OP_SessionReady=0x0000
|
|
||||||
OP_Login=0x0000
|
|
||||||
OP_ServerListRequest=0x0000
|
|
||||||
OP_PlayEverquestRequest=0x0000
|
|
||||||
OP_PlayEverquestResponse=0x0000
|
|
||||||
OP_ChatMessage=0x0000
|
|
||||||
OP_LoginAccepted=0x0000
|
|
||||||
OP_ServerListResponse=0x0000
|
|
||||||
OP_Poll=0x0000
|
|
||||||
OP_EnterChat=0x0000
|
|
||||||
OP_PollResponse=0x0000
|
|
||||||
|
|
||||||
# raw opcodes
|
|
||||||
OP_RAWSessionRequest=0x0000
|
|
||||||
OP_RAWSessionResponse=0x0000
|
|
||||||
OP_RAWCombined=0x0000
|
|
||||||
OP_RAWSessionDisconnect=0x0000
|
|
||||||
OP_RAWKeepAlive=0x0000
|
|
||||||
OP_RAWSessionStatRequest=0x0000
|
|
||||||
OP_RAWSessionStatResponse=0x0000
|
|
||||||
OP_RAWPacket=0x0000
|
|
||||||
OP_RAWFragment=0x0000
|
|
||||||
OP_RAWOutOfOrderAck=0x0000
|
|
||||||
OP_RAWAck=0x0000
|
|
||||||
OP_RAWAppCombined=0x0000
|
|
||||||
OP_RAWOutOfSession=0x0000
|
|
||||||
|
|
||||||
# we need to document the differences between these packets to make identifying them easier
|
|
||||||
OP_Some3ByteHPUpdate=0x0000 # initial HP update for mobs
|
|
||||||
OP_InitialHPUpdate=0x0000
|
|
||||||
|
|
||||||
#aura related
|
|
||||||
OP_UpdateAura=0x0000
|
|
||||||
OP_RemoveTrap=0x0000
|
|
||||||
@@ -1,388 +0,0 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
|
||||||
## files generated by popular Visual Studio add-ons.
|
|
||||||
##
|
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.rsuser
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Mono auto generated files
|
|
||||||
mono_crash.*
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
[Ww][Ii][Nn]32/
|
|
||||||
[Aa][Rr][Mm]/
|
|
||||||
[Aa][Rr][Mm]64/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Ll]og/
|
|
||||||
[Ll]ogs/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
|
||||||
Generated\ Files/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUnit
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
nunit-*.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
|
|
||||||
# ASP.NET Scaffolding
|
|
||||||
ScaffoldingReadMe.txt
|
|
||||||
|
|
||||||
# StyleCop
|
|
||||||
StyleCopReport.xml
|
|
||||||
|
|
||||||
# Files built by Visual Studio
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_h.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.iobj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.ipdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*_wpftmp.csproj
|
|
||||||
*.log
|
|
||||||
*.tlog
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
|
||||||
*.e2e
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Coverlet is a free, cross platform Code Coverage Tool
|
|
||||||
coverage*.json
|
|
||||||
coverage*.xml
|
|
||||||
coverage*.info
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# NuGet Symbol Packages
|
|
||||||
*.snupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/[Pp]ackages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/[Pp]ackages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/[Pp]ackages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Nuget personal access tokens and Credentials
|
|
||||||
nuget.config
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
*.appxbundle
|
|
||||||
*.appxupload
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!?*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*~
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
||||||
#*.snk
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
ServiceFabricBackup/
|
|
||||||
*.rptproj.bak
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
*.rptproj.rsuser
|
|
||||||
*- [Bb]ackup.rdl
|
|
||||||
*- [Bb]ackup ([0-9]).rdl
|
|
||||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# CodeRush personal settings
|
|
||||||
.cr/personal
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
|
||||||
OpenCover/
|
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
|
||||||
ASALocalRun/
|
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
|
||||||
*.binlog
|
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
|
||||||
*.nvuser
|
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
|
||||||
.mfractor/
|
|
||||||
|
|
||||||
# Local History for Visual Studio
|
|
||||||
.localhistory/
|
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
|
||||||
healthchecksdb
|
|
||||||
|
|
||||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
|
||||||
MigrationBackup/
|
|
||||||
|
|
||||||
# Ionide (cross platform F# VS Code tools) working folder
|
|
||||||
.ionide/
|
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
|
||||||
FodyWeavers.xsd
|
|
||||||
|
|
||||||
# VS Code files for those working on multiple tools
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
*.code-workspace
|
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
|
||||||
.history/
|
|
||||||
|
|
||||||
# Windows Installer files from build outputs
|
|
||||||
*.cab
|
|
||||||
*.msi
|
|
||||||
*.msix
|
|
||||||
*.msm
|
|
||||||
*.msp
|
|
||||||
|
|
||||||
# JetBrains Rider
|
|
||||||
.idea/
|
|
||||||
*.sln.iml
|
|
||||||
@@ -1,621 +0,0 @@
|
|||||||
using Ionic.Zlib;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StreamParser.Common.Daybreak
|
|
||||||
{
|
|
||||||
public class Connection : IConnection
|
|
||||||
{
|
|
||||||
private class EncodeType
|
|
||||||
{
|
|
||||||
public const int None = 0;
|
|
||||||
public const int Compression = 1;
|
|
||||||
public const int XOR = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum SequenceOrder
|
|
||||||
{
|
|
||||||
Past,
|
|
||||||
Current,
|
|
||||||
Future
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly IParser _owner;
|
|
||||||
private readonly IPAddress _srcAddr;
|
|
||||||
private readonly int _srcPort;
|
|
||||||
private readonly IPAddress _dstAddr;
|
|
||||||
private readonly int _dstPort;
|
|
||||||
private readonly Util.Crc32 _crc_generator = new Util.Crc32();
|
|
||||||
private readonly Guid _id = Guid.NewGuid();
|
|
||||||
private uint _connect_code = 0;
|
|
||||||
private int _encode_key = 0;
|
|
||||||
private int _crc_bytes = 0;
|
|
||||||
private int[] _encode_pass = new int[2] { 0, 0 };
|
|
||||||
private ConnectionStream[] _client_streams = new ConnectionStream[4] {
|
|
||||||
new ConnectionStream(),
|
|
||||||
new ConnectionStream(),
|
|
||||||
new ConnectionStream(),
|
|
||||||
new ConnectionStream()
|
|
||||||
};
|
|
||||||
private ConnectionStream[] _server_streams = new ConnectionStream[4] {
|
|
||||||
new ConnectionStream(),
|
|
||||||
new ConnectionStream(),
|
|
||||||
new ConnectionStream(),
|
|
||||||
new ConnectionStream()
|
|
||||||
};
|
|
||||||
|
|
||||||
public IConnection.OnPacketRecvHandler OnPacketRecv { get; set; }
|
|
||||||
|
|
||||||
public IPAddress ClientAddress => _srcAddr;
|
|
||||||
public int ClientPort => _srcPort;
|
|
||||||
public IPAddress ServerAddress => _dstAddr;
|
|
||||||
public int ServerPort => _dstPort;
|
|
||||||
public Guid Id => _id;
|
|
||||||
|
|
||||||
public ConnectionType ConnectionType {
|
|
||||||
get
|
|
||||||
{
|
|
||||||
//World servers used to be coded to always be 9000 but live started using dynamic ports
|
|
||||||
//I've seen from 9000 to 9008 on live
|
|
||||||
if (_dstPort >= 9000 && _dstPort <= 9010)
|
|
||||||
{
|
|
||||||
return ConnectionType.World;
|
|
||||||
}
|
|
||||||
else if (_encode_pass[0] == EncodeType.None && _encode_pass[1] == EncodeType.None)
|
|
||||||
{
|
|
||||||
return ConnectionType.Login;
|
|
||||||
}
|
|
||||||
else if (_encode_pass[0] == EncodeType.XOR && _encode_pass[1] == EncodeType.None)
|
|
||||||
{
|
|
||||||
return ConnectionType.Chat;
|
|
||||||
}
|
|
||||||
else if (_encode_pass[0] == EncodeType.Compression && _encode_pass[1] == EncodeType.None)
|
|
||||||
{
|
|
||||||
return ConnectionType.Zone;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ConnectionType.Unknown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Connection(IParser owner, IPAddress srcAddr, int srcPort, IPAddress dstAddr, int dstPort)
|
|
||||||
{
|
|
||||||
_owner = owner;
|
|
||||||
_srcAddr = srcAddr;
|
|
||||||
_srcPort = srcPort;
|
|
||||||
_dstAddr = dstAddr;
|
|
||||||
_dstPort = dstPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ProcessPacket(IPAddress srcAddr, int srcPort, DateTime packetTime, ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
if (data.Length < 1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var opcode = data[1];
|
|
||||||
if (data[0] == 0 && (opcode == Opcode.KeepAlive || opcode == Opcode.OutboundPing))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PacketCanBeDecoded(data))
|
|
||||||
{
|
|
||||||
if (!ValidateCRC(data))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_encode_pass[0] == EncodeType.None && _encode_pass[1] == EncodeType.None)
|
|
||||||
{
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, packetTime, data.Slice(0, data.Length - _crc_bytes));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//unfortunately we can't avoid a copy here
|
|
||||||
var temp = data.Slice(0, data.Length - _crc_bytes).ToArray();
|
|
||||||
for (int i = 1; i >= 0; --i)
|
|
||||||
{
|
|
||||||
switch(_encode_pass[i])
|
|
||||||
{
|
|
||||||
case EncodeType.Compression:
|
|
||||||
if(temp[0] == 0)
|
|
||||||
{
|
|
||||||
temp = Decompress(temp, 2, temp.Length - 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
temp = Decompress(temp, 1, temp.Length - 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EncodeType.XOR:
|
|
||||||
if (temp[0] == 0)
|
|
||||||
{
|
|
||||||
temp = Decode(temp, 2, temp.Length - 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
temp = Decode(temp, 1, temp.Length - 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, packetTime, temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, packetTime, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessDecodedPacket(IPAddress srcAddr, int srcPort, DateTime packetTime, ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
if (data.Length < 1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data[0] == 0)
|
|
||||||
{
|
|
||||||
if (data.Length < 2)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var opcode = data[1];
|
|
||||||
switch (opcode)
|
|
||||||
{
|
|
||||||
case Opcode.SessionResponse:
|
|
||||||
if (_connect_code == 0)
|
|
||||||
{
|
|
||||||
if(data.Length != 21)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_connect_code = BitConverter.ToUInt32(data.Slice(2, 4));
|
|
||||||
_encode_key = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(data.Slice(6, 4)));
|
|
||||||
_crc_bytes = data[10];
|
|
||||||
_encode_pass[0] = data[11];
|
|
||||||
_encode_pass[1] = data[12];
|
|
||||||
_owner.OnNewConnection?.Invoke(this, packetTime);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Opcode.SessionDisconnect:
|
|
||||||
if(_connect_code != 0)
|
|
||||||
{
|
|
||||||
_connect_code = 0;
|
|
||||||
_encode_key = 0;
|
|
||||||
_crc_bytes = 0;
|
|
||||||
_encode_pass[0] = 0;
|
|
||||||
_encode_pass[1] = 0;
|
|
||||||
_owner.OnLostConnection?.Invoke(this, packetTime);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Opcode.Combined:
|
|
||||||
{
|
|
||||||
int current = 2;
|
|
||||||
int end = data.Length;
|
|
||||||
while (current < end)
|
|
||||||
{
|
|
||||||
byte subpacket_length = data[current];
|
|
||||||
current += 1;
|
|
||||||
|
|
||||||
if (end < current + subpacket_length)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var subpacket = data.Slice(current, subpacket_length);
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, packetTime, subpacket);
|
|
||||||
current += subpacket_length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Opcode.AppCombined:
|
|
||||||
{
|
|
||||||
int current = 2;
|
|
||||||
int end = data.Length;
|
|
||||||
while (current < end)
|
|
||||||
{
|
|
||||||
int subpacket_length = 0;
|
|
||||||
if (data[current] == 0xff)
|
|
||||||
{
|
|
||||||
if (end < current + 3)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data[current + 1] == 0xff && data[current + 2] == 0xff)
|
|
||||||
{
|
|
||||||
if (end < current + 7)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
subpacket_length =
|
|
||||||
((data[current + 3]) << 24) |
|
|
||||||
((data[current + 4]) << 16) |
|
|
||||||
((data[current + 5]) << 8) |
|
|
||||||
(data[current + 6]);
|
|
||||||
|
|
||||||
current += 7;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
subpacket_length =
|
|
||||||
((data[current + 1]) << 8) |
|
|
||||||
(data[current + 2]);
|
|
||||||
|
|
||||||
current += 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
subpacket_length = data[current];
|
|
||||||
current += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var subpacket = data.Slice(current, subpacket_length);
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, packetTime, subpacket);
|
|
||||||
current += subpacket_length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Opcode.Packet:
|
|
||||||
case Opcode.Packet2:
|
|
||||||
case Opcode.Packet3:
|
|
||||||
case Opcode.Packet4:
|
|
||||||
{
|
|
||||||
var stream_id = opcode - Opcode.Packet;
|
|
||||||
var stream = FindStream(srcAddr, srcPort, stream_id);
|
|
||||||
var sequence = (ushort)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(data.Slice(2, 2)));
|
|
||||||
var order = CompareSequence(stream.Sequence, sequence);
|
|
||||||
if (order == SequenceOrder.Future)
|
|
||||||
{
|
|
||||||
if (!stream.PacketQueue.ContainsKey(sequence))
|
|
||||||
{
|
|
||||||
stream.PacketQueue.Add(sequence, new ConnectionStream.QueuedPacket
|
|
||||||
{
|
|
||||||
Data = data.ToArray(),
|
|
||||||
PacketTime = packetTime
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (order == SequenceOrder.Current)
|
|
||||||
{
|
|
||||||
if (stream.PacketQueue.ContainsKey(sequence))
|
|
||||||
{
|
|
||||||
stream.PacketQueue.Remove(sequence);
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Sequence++;
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, packetTime, data.Slice(4));
|
|
||||||
ProcessQueue(srcAddr, srcPort, stream_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Opcode.Fragment:
|
|
||||||
case Opcode.Fragment2:
|
|
||||||
case Opcode.Fragment3:
|
|
||||||
case Opcode.Fragment4:
|
|
||||||
{
|
|
||||||
var stream_id = opcode - Opcode.Fragment;
|
|
||||||
var stream = FindStream(srcAddr, srcPort, stream_id);
|
|
||||||
var sequence = (ushort)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(data.Slice(2, 2)));
|
|
||||||
var order = CompareSequence(stream.Sequence, sequence);
|
|
||||||
if (order == SequenceOrder.Future)
|
|
||||||
{
|
|
||||||
if (!stream.PacketQueue.ContainsKey(sequence))
|
|
||||||
{
|
|
||||||
stream.PacketQueue.Add(sequence, new ConnectionStream.QueuedPacket
|
|
||||||
{
|
|
||||||
Data = data.ToArray(),
|
|
||||||
PacketTime = packetTime
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (order == SequenceOrder.Current)
|
|
||||||
{
|
|
||||||
if (stream.PacketQueue.ContainsKey(sequence))
|
|
||||||
{
|
|
||||||
stream.PacketQueue.Remove(sequence);
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Sequence++;
|
|
||||||
|
|
||||||
if (stream.TotalFragmentedBytes == 0)
|
|
||||||
{
|
|
||||||
stream.TotalFragmentedBytes = (uint)IPAddress.NetworkToHostOrder(BitConverter.ToInt32(data.Slice(4, 4)));
|
|
||||||
stream.CurrentFragmentedBytes = (uint)(data.Length - 8);
|
|
||||||
|
|
||||||
if(stream.FragmentBuffer == null || stream.FragmentBuffer.Length < (stream.TotalFragmentedBytes + 512))
|
|
||||||
{
|
|
||||||
stream.FragmentBuffer = new byte[stream.TotalFragmentedBytes + 512];
|
|
||||||
}
|
|
||||||
|
|
||||||
var target = stream.FragmentBuffer.AsSpan();
|
|
||||||
data.Slice(8).CopyTo(target);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
var target = stream.FragmentBuffer.AsSpan((int)stream.CurrentFragmentedBytes);
|
|
||||||
data.Slice(4).CopyTo(target);
|
|
||||||
|
|
||||||
stream.CurrentFragmentedBytes += (uint)(data.Length - 4);
|
|
||||||
|
|
||||||
if (stream.CurrentFragmentedBytes >= stream.TotalFragmentedBytes)
|
|
||||||
{
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, packetTime,
|
|
||||||
stream.FragmentBuffer.AsSpan(0, (int)stream.TotalFragmentedBytes));
|
|
||||||
stream.CurrentFragmentedBytes = 0;
|
|
||||||
stream.TotalFragmentedBytes = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessQueue(srcAddr, srcPort, stream_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Opcode.Padding:
|
|
||||||
OnPacketRecv?.Invoke(this, GetDirection(srcAddr, srcPort), packetTime, data.Slice(1));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
OnPacketRecv?.Invoke(this, GetDirection(srcAddr, srcPort), packetTime, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessQueue(IPAddress srcAddr, int srcPort, int stream_id)
|
|
||||||
{
|
|
||||||
var stream = FindStream(srcAddr, srcPort, stream_id);
|
|
||||||
var sequence = stream.Sequence;
|
|
||||||
|
|
||||||
//try to get the current sequence in the queue, if it exists then process it
|
|
||||||
ConnectionStream.QueuedPacket value;
|
|
||||||
if(stream.PacketQueue.TryGetValue(sequence, out value))
|
|
||||||
{
|
|
||||||
ProcessDecodedPacket(srcAddr, srcPort, value.PacketTime, value.Data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Match(IPAddress srcAddr, int srcPort, IPAddress dstAddr, int dstPort)
|
|
||||||
{
|
|
||||||
var p1 = _srcAddr.Equals(srcAddr) && _srcPort == srcPort && _dstAddr.Equals(dstAddr) && _dstPort == dstPort;
|
|
||||||
var p2 = _srcAddr.Equals(dstAddr) && _srcPort == dstPort && _dstAddr.Equals(srcAddr) && _dstPort == srcPort;
|
|
||||||
return p1 || p2;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SequenceOrder CompareSequence(ushort expected, ushort actual)
|
|
||||||
{
|
|
||||||
int diff = (int)actual - (int)expected;
|
|
||||||
|
|
||||||
if (diff == 0)
|
|
||||||
{
|
|
||||||
return SequenceOrder.Current;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (diff > 0)
|
|
||||||
{
|
|
||||||
if (diff > 10000)
|
|
||||||
{
|
|
||||||
return SequenceOrder.Past;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SequenceOrder.Future;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (diff < -10000)
|
|
||||||
{
|
|
||||||
return SequenceOrder.Future;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SequenceOrder.Past;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool PacketCanBeDecoded(ReadOnlySpan<byte> p)
|
|
||||||
{
|
|
||||||
if (p.Length < 2)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p[0] != 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var opcode = p[1];
|
|
||||||
|
|
||||||
if (opcode == Opcode.SessionRequest || opcode == Opcode.SessionResponse || opcode == Opcode.OutOfSession)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool ValidateCRC(ReadOnlySpan<byte> p)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_crc_bytes == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int actual = 0;
|
|
||||||
int calculated = _crc_generator.Calculate(p.Slice(0, p.Length - _crc_bytes), _encode_key);
|
|
||||||
switch (_crc_bytes)
|
|
||||||
{
|
|
||||||
case 2:
|
|
||||||
actual = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(p.Slice(p.Length - 2, 2))) & 0xFFFF;
|
|
||||||
calculated = calculated & 0xFFFF;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
actual = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(p.Slice(p.Length - 4, 4)));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return actual == calculated;
|
|
||||||
} catch(Exception ex)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] Decompress(byte[] p, int offset, int length)
|
|
||||||
{
|
|
||||||
if (length < 2)
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
Span<byte> header = p.AsSpan(0, offset);
|
|
||||||
byte flag = p[offset];
|
|
||||||
Span<byte> payload = p.AsSpan(offset + 1, length - 1);
|
|
||||||
|
|
||||||
if (flag == 0x5a)
|
|
||||||
{
|
|
||||||
var pl = payload.ToArray();
|
|
||||||
var inflated = Inflate(payload.ToArray());
|
|
||||||
byte[] ret = new byte[offset + inflated.Length];
|
|
||||||
Array.Copy(p, 0, ret, 0, offset);
|
|
||||||
Array.Copy(inflated, 0, ret, offset, inflated.Length);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
else if (flag == 0xa5)
|
|
||||||
{
|
|
||||||
byte[] ret = new byte[offset + length - 1];
|
|
||||||
Array.Copy(p, 0, ret, 0, offset);
|
|
||||||
Array.Copy(p, offset + 1, ret, offset, length - 1);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] Inflate(byte[] p)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var out_stream = new MemoryStream())
|
|
||||||
{
|
|
||||||
using (var in_stream = new MemoryStream(p))
|
|
||||||
{
|
|
||||||
var buffer = new byte[512];
|
|
||||||
using (var zs = new ZlibStream(in_stream, CompressionMode.Decompress))
|
|
||||||
{
|
|
||||||
int r = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
r = zs.Read(buffer, 0, 512);
|
|
||||||
out_stream.Write(buffer, 0, r);
|
|
||||||
} while (r == 512);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var ret = out_stream.ToArray();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] Decode(byte[] p, int offset, int length)
|
|
||||||
{
|
|
||||||
int key = _encode_key;
|
|
||||||
Span<byte> buffer = p.AsSpan(offset, length);
|
|
||||||
int i = 0;
|
|
||||||
for (i = 0; i + 4 <= length; i += 4)
|
|
||||||
{
|
|
||||||
int pt = BitConverter.ToInt32(buffer.Slice(i)) ^ key;
|
|
||||||
key = BitConverter.ToInt32(buffer.Slice(i));
|
|
||||||
|
|
||||||
if(BitConverter.TryWriteBytes(buffer.Slice(i), pt) == false)
|
|
||||||
{
|
|
||||||
throw new Exception("Error writing bytes back in decode.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
byte kc = (byte)(key & 0xFF);
|
|
||||||
for (; i < length; i++)
|
|
||||||
{
|
|
||||||
buffer[i] = (byte)(buffer[i] ^ kc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Direction GetDirection(IPAddress srcAddr, int srcPort)
|
|
||||||
{
|
|
||||||
if(srcAddr.Equals(_srcAddr) && srcPort == _srcPort)
|
|
||||||
{
|
|
||||||
return Direction.ClientToServer;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return Direction.ServerToClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ConnectionStream FindStream(IPAddress srcAddr, int srcPort, int index)
|
|
||||||
{
|
|
||||||
if (index < 0 || index > 3)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var dir = GetDirection(srcAddr, srcPort);
|
|
||||||
|
|
||||||
if(dir == Direction.ClientToServer)
|
|
||||||
{
|
|
||||||
return _client_streams[index];
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return _server_streams[index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ConnectionStream
|
|
||||||
{
|
|
||||||
public class QueuedPacket
|
|
||||||
{
|
|
||||||
public byte[] Data { get; set; }
|
|
||||||
public DateTime PacketTime { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConnectionStream()
|
|
||||||
{
|
|
||||||
Sequence = 0;
|
|
||||||
CurrentFragmentedBytes = 0;
|
|
||||||
TotalFragmentedBytes = 0;
|
|
||||||
FragmentBuffer = null;
|
|
||||||
PacketQueue = new Dictionary<ushort, QueuedPacket>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ushort Sequence { get; set; }
|
|
||||||
public uint CurrentFragmentedBytes { get; set; }
|
|
||||||
public uint TotalFragmentedBytes { get; set; }
|
|
||||||
public byte[] FragmentBuffer { get; set; }
|
|
||||||
public Dictionary<ushort, QueuedPacket> PacketQueue { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StreamParser.Common.Daybreak
|
|
||||||
{
|
|
||||||
public ref struct GamePacket
|
|
||||||
{
|
|
||||||
private readonly ReadOnlySpan<byte> _data;
|
|
||||||
|
|
||||||
public GamePacket(ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
_data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly override string ToString()
|
|
||||||
{
|
|
||||||
return ToString(16);
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly string ToString(int columns)
|
|
||||||
{
|
|
||||||
int rows = _data.Length / columns;
|
|
||||||
if (_data.Length % columns != 0)
|
|
||||||
{
|
|
||||||
rows += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int expected = (10 + columns * 4) * rows;
|
|
||||||
var sb = new StringBuilder(expected);
|
|
||||||
|
|
||||||
for(var i = 0; i < rows; ++i)
|
|
||||||
{
|
|
||||||
sb.AppendFormat("{0} |", (i * columns).ToString("X5"));
|
|
||||||
|
|
||||||
for(var j = 0; j < columns; ++j)
|
|
||||||
{
|
|
||||||
var index = (i * 16) + j;
|
|
||||||
if (index >= _data.Length)
|
|
||||||
{
|
|
||||||
sb.Append(" ");
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
var c = _data[index];
|
|
||||||
sb.AppendFormat("{0,3}", c.ToString("X2"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.Append(" | ");
|
|
||||||
|
|
||||||
for (var j = 0; j < columns; ++j)
|
|
||||||
{
|
|
||||||
var index = (i * 16) + j;
|
|
||||||
if (index >= _data.Length)
|
|
||||||
{
|
|
||||||
sb.Append(" ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var c = _data[index];
|
|
||||||
var ch = (char)c;
|
|
||||||
if (char.IsLetterOrDigit(ch) || char.IsPunctuation(ch) || char.IsSymbol(ch) || (ch == ' '))
|
|
||||||
{
|
|
||||||
sb.Append(ch);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.Append(".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.AppendLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly string ToModelString(int max_taken, bool hex)
|
|
||||||
{
|
|
||||||
int expected = Math.Min(_data.Length, max_taken) * (hex ? 2 : 1);
|
|
||||||
if(expected <= 0)
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sb = new StringBuilder(expected);
|
|
||||||
|
|
||||||
for(var i = 0; i < Math.Min(_data.Length, max_taken); ++i)
|
|
||||||
{
|
|
||||||
var c = _data[i];
|
|
||||||
if(hex)
|
|
||||||
{
|
|
||||||
sb.Append(c.ToString("X2"));
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
var ch = (char)c;
|
|
||||||
if (char.IsLetterOrDigit(ch) || char.IsPunctuation(ch) || char.IsSymbol(ch) || (ch == ' '))
|
|
||||||
{
|
|
||||||
sb.Append(ch);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sb.Append(".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StreamParser.Common.Daybreak
|
|
||||||
{
|
|
||||||
public enum Direction
|
|
||||||
{
|
|
||||||
ClientToServer,
|
|
||||||
ServerToClient
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ConnectionType
|
|
||||||
{
|
|
||||||
Unknown,
|
|
||||||
Login,
|
|
||||||
World,
|
|
||||||
Chat,
|
|
||||||
Zone
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IConnection
|
|
||||||
{
|
|
||||||
delegate void OnPacketRecvHandler(Connection connection, Direction direction, DateTime packetTime, ReadOnlySpan<byte> data);
|
|
||||||
OnPacketRecvHandler OnPacketRecv { get; set; }
|
|
||||||
|
|
||||||
void ProcessPacket(IPAddress srcAddr, int srcPort, DateTime packetTime, ReadOnlySpan<byte> data);
|
|
||||||
bool Match(IPAddress srcAddr, int srcPort, IPAddress dstAddr, int dstPort);
|
|
||||||
|
|
||||||
ConnectionType ConnectionType { get; }
|
|
||||||
IPAddress ClientAddress { get; }
|
|
||||||
int ClientPort { get; }
|
|
||||||
IPAddress ServerAddress { get; }
|
|
||||||
int ServerPort { get; }
|
|
||||||
Guid Id { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StreamParser.Common.Daybreak
|
|
||||||
{
|
|
||||||
public interface IParser
|
|
||||||
{
|
|
||||||
delegate void ConnectionHandler(IConnection connection, DateTime connectionTime);
|
|
||||||
ConnectionHandler OnNewConnection { get; set; }
|
|
||||||
ConnectionHandler OnLostConnection { get; set; }
|
|
||||||
void Parse(string filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StreamParser.Common.Daybreak
|
|
||||||
{
|
|
||||||
public class Opcode
|
|
||||||
{
|
|
||||||
public const byte Padding = 0;
|
|
||||||
public const byte SessionRequest = 1;
|
|
||||||
public const byte SessionResponse = 2;
|
|
||||||
public const byte Combined = 3;
|
|
||||||
public const byte SessionDisconnect = 5;
|
|
||||||
public const byte KeepAlive = 6;
|
|
||||||
public const byte SessionStatRequest = 7;
|
|
||||||
public const byte SessionStatResponse = 8;
|
|
||||||
public const byte Packet = 9;
|
|
||||||
public const byte Packet2 = 10;
|
|
||||||
public const byte Packet3 = 11;
|
|
||||||
public const byte Packet4 = 12;
|
|
||||||
public const byte Fragment = 13;
|
|
||||||
public const byte Fragment2 = 14;
|
|
||||||
public const byte Fragment3 = 15;
|
|
||||||
public const byte Fragment4 = 16;
|
|
||||||
public const byte OutOfOrderAck = 17;
|
|
||||||
public const byte OutOfOrderAck2 = 18;
|
|
||||||
public const byte OutOfOrderAck3 = 19;
|
|
||||||
public const byte OutOfOrderAck4 = 20;
|
|
||||||
public const byte Ack = 21;
|
|
||||||
public const byte Ack2 = 22;
|
|
||||||
public const byte Ack3 = 23;
|
|
||||||
public const byte Ack4 = 22;
|
|
||||||
public const byte AppCombined = 25;
|
|
||||||
public const byte OutboundPing = 28;
|
|
||||||
public const byte OutOfSession = 29;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SharpPcap;
|
|
||||||
using SharpPcap.LibPcap;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace StreamParser.Common.Daybreak
|
|
||||||
{
|
|
||||||
public class Parser : IParser
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Dependencies
|
|
||||||
*/
|
|
||||||
private readonly ILogger<Parser> _logger;
|
|
||||||
private readonly List<IConnection> _connections = new List<IConnection>();
|
|
||||||
|
|
||||||
public IParser.ConnectionHandler OnNewConnection { get; set; }
|
|
||||||
public IParser.ConnectionHandler OnLostConnection { get; set; }
|
|
||||||
|
|
||||||
public Parser(ILogger<Parser> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Parse(string filename)
|
|
||||||
{
|
|
||||||
ICaptureDevice device = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
device = new CaptureFileReaderDevice(filename);
|
|
||||||
device.Open();
|
|
||||||
|
|
||||||
device.OnPacketArrival += new PacketArrivalEventHandler(OnPacketCapture);
|
|
||||||
|
|
||||||
device.Capture();
|
|
||||||
device.Close();
|
|
||||||
} catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error reading device capture.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPacketCapture(object sender, PacketCapture capture)
|
|
||||||
{
|
|
||||||
var raw = capture.GetPacket();
|
|
||||||
if (raw.LinkLayerType == PacketDotNet.LinkLayers.Ethernet)
|
|
||||||
{
|
|
||||||
var packet = PacketDotNet.Packet.ParsePacket(raw.LinkLayerType, raw.Data);
|
|
||||||
var ipPacket = packet.Extract<PacketDotNet.IPv4Packet>();
|
|
||||||
var udpPacket = packet.Extract<PacketDotNet.UdpPacket>();
|
|
||||||
|
|
||||||
if (ipPacket != null && udpPacket != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ProcessPacket(ipPacket.SourceAddress,
|
|
||||||
udpPacket.SourcePort,
|
|
||||||
ipPacket.DestinationAddress,
|
|
||||||
udpPacket.DestinationPort,
|
|
||||||
raw.Timeval.Date,
|
|
||||||
udpPacket.PayloadData);
|
|
||||||
} catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error processing packet");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessPacket(IPAddress srcAddr, int srcPort, IPAddress dstAddr, int dstPort, DateTime packetTime, ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
if(data.Length < 2)
|
|
||||||
{
|
|
||||||
_logger.LogTrace("Tossing packet, {0} was less than minimum packet size", data.Length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var c = FindConnection(srcAddr, srcPort, dstAddr, dstPort);
|
|
||||||
|
|
||||||
if(c != null)
|
|
||||||
{
|
|
||||||
c.ProcessPacket(srcAddr, srcPort, packetTime, data);
|
|
||||||
}
|
|
||||||
else if (data[0] == 0 && data[1] == Opcode.SessionRequest)
|
|
||||||
{
|
|
||||||
if(data.Length != 24)
|
|
||||||
{
|
|
||||||
_logger.LogTrace("Tossing packet, {0} was not the right size for a SessionRequest", data.Length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
c = new Connection(this, srcAddr, srcPort, dstAddr, dstPort);
|
|
||||||
_connections.Add(c);
|
|
||||||
c.ProcessPacket(srcAddr, srcPort, packetTime, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IConnection FindConnection(IPAddress srcAddr, int srcPort, IPAddress dstAddr, int dstPort)
|
|
||||||
{
|
|
||||||
foreach (var c in _connections)
|
|
||||||
{
|
|
||||||
if (c.Match(srcAddr, srcPort, dstAddr, dstPort))
|
|
||||||
{
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace StreamParser.Common.Util
|
|
||||||
{
|
|
||||||
public class Crc32
|
|
||||||
{
|
|
||||||
private uint[] _encodeTable =
|
|
||||||
{
|
|
||||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
|
|
||||||
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
|
||||||
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
|
|
||||||
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
|
|
||||||
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
|
|
||||||
0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
|
|
||||||
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
|
|
||||||
0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
|
|
||||||
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
|
|
||||||
0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
|
|
||||||
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
|
|
||||||
0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
|
|
||||||
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
|
|
||||||
0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
|
|
||||||
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
|
|
||||||
0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
|
|
||||||
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
|
|
||||||
0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
|
|
||||||
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
|
|
||||||
0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
|
|
||||||
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
|
|
||||||
0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
|
|
||||||
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
|
|
||||||
0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
|
|
||||||
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
|
|
||||||
0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
|
|
||||||
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
|
|
||||||
0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
|
|
||||||
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
|
|
||||||
0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
|
|
||||||
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
|
|
||||||
0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
|
|
||||||
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
|
|
||||||
0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
|
|
||||||
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
|
|
||||||
0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
|
|
||||||
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
|
|
||||||
0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
|
|
||||||
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
|
|
||||||
0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
|
|
||||||
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
|
|
||||||
0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
|
|
||||||
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
|
|
||||||
0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
|
|
||||||
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
|
|
||||||
0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
|
|
||||||
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
|
|
||||||
0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
|
|
||||||
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
|
|
||||||
0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
|
|
||||||
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
|
|
||||||
0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
|
|
||||||
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
|
|
||||||
0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
|
|
||||||
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
|
|
||||||
0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
|
|
||||||
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
|
|
||||||
0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
|
|
||||||
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
|
|
||||||
0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
|
|
||||||
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
|
|
||||||
0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
|
|
||||||
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
|
|
||||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
|
|
||||||
};
|
|
||||||
|
|
||||||
public int Calculate(ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
uint crc = 0xffffffff;
|
|
||||||
|
|
||||||
for (int i = 0; i < data.Length; ++i)
|
|
||||||
{
|
|
||||||
crc = ((crc >> 8) & 0x00FFFFFF) ^ _encodeTable[(crc ^ data[i]) & 0x000000FF];
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int)~crc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Calculate(ReadOnlySpan<byte> data, int key)
|
|
||||||
{
|
|
||||||
uint crc = 0xffffffff;
|
|
||||||
for (int i = 0; i < 4; ++i)
|
|
||||||
{
|
|
||||||
crc = ((crc >> 8) & 0x00FFFFFF) ^ _encodeTable[(crc ^ ((key >> (i * 8)) & 0xff)) & 0x000000FF];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < data.Length; ++i)
|
|
||||||
{
|
|
||||||
crc = ((crc >> 8) & 0x00FFFFFF) ^ _encodeTable[(crc ^ data[i]) & 0x000000FF];
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int)~crc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<RootNamespace>StreamParser.Common</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Iconic.Zlib.Netstandard" Version="1.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
|
|
||||||
<PackageReference Include="SharpPcap" Version="6.3.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 16
|
|
||||||
VisualStudioVersion = 16.6.30114.105
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "stream_parser", "stream_parser\stream_parser.csproj", "{A5662497-4771-4A00-92E7-E7790CEB20E9}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "common", "common\common.csproj", "{FC625344-C003-4602-A571-D8811CF5B37A}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{A5662497-4771-4A00-92E7-E7790CEB20E9}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{FC625344-C003-4602-A571-D8811CF5B37A}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {89CDF826-F878-4BF4-8583-B9E66FE8B61D}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,337 +0,0 @@
|
|||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using StreamParser.Common.Daybreak;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Net;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using CommandLine;
|
|
||||||
using System.Globalization;
|
|
||||||
using Org.BouncyCastle.Crypto.Engines;
|
|
||||||
using Org.BouncyCastle.Crypto.Modes;
|
|
||||||
using Org.BouncyCastle.Crypto;
|
|
||||||
using Org.BouncyCastle.Crypto.Parameters;
|
|
||||||
using Ionic.Zlib;
|
|
||||||
|
|
||||||
namespace StreamParser
|
|
||||||
{
|
|
||||||
public class ConsoleHostedService : IHostedService
|
|
||||||
{
|
|
||||||
private class ParsedPacket {
|
|
||||||
public byte[] Data { get; set; }
|
|
||||||
public Direction Direction { get; set; }
|
|
||||||
public DateTime Time { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ParsedConnection
|
|
||||||
{
|
|
||||||
public IPAddress ClientAddress { get; set; }
|
|
||||||
public int ClientPort { get; set; }
|
|
||||||
public IPAddress ServerAddress { get; set; }
|
|
||||||
public int ServerPort { get; set; }
|
|
||||||
public ConnectionType ConnectionType { get; set; }
|
|
||||||
public List<ParsedPacket> Packets { get; set; }
|
|
||||||
public DateTime ConnectedTime { get; set; }
|
|
||||||
public DateTime? DisconnectedTime { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly ILogger<ConsoleHostedService> _logger;
|
|
||||||
private readonly IHostApplicationLifetime _applicationLifetime;
|
|
||||||
private readonly IParser _parser;
|
|
||||||
private readonly Dictionary<Guid, ParsedConnection> _connections = new Dictionary<Guid, ParsedConnection>();
|
|
||||||
|
|
||||||
public ConsoleHostedService(ILogger<ConsoleHostedService> logger,
|
|
||||||
IHostApplicationLifetime applicationLifetime,
|
|
||||||
IParser parser)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_applicationLifetime = applicationLifetime;
|
|
||||||
_parser = parser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task StartAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_applicationLifetime.ApplicationStarted.Register(() =>
|
|
||||||
{
|
|
||||||
var args = Environment.GetCommandLineArgs();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CommandLine.Parser.Default.ParseArguments<ConsoleHostedServiceOptions>(args)
|
|
||||||
.WithParsed<ConsoleHostedServiceOptions>(o =>
|
|
||||||
{
|
|
||||||
_parser.OnNewConnection += OnNewConnection;
|
|
||||||
_parser.OnLostConnection += OnLostConnection;
|
|
||||||
|
|
||||||
foreach (var f in o.Input)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("Parsing {0}...", f);
|
|
||||||
_parser.Parse(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var c in _connections)
|
|
||||||
{
|
|
||||||
if (c.Value.ConnectionType == ConnectionType.Unknown && !o.DumpUnknownStreams)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o.Text)
|
|
||||||
{
|
|
||||||
DumpConnectionToTextFile(c.Value, o.Output, o.Decrypt, o.DecompressOpcodes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_applicationLifetime.StopApplication();
|
|
||||||
})
|
|
||||||
.WithNotParsed<ConsoleHostedServiceOptions>(e =>
|
|
||||||
{
|
|
||||||
bool stops_processing = false;
|
|
||||||
foreach (var err in e)
|
|
||||||
{
|
|
||||||
stops_processing = stops_processing || err.StopsProcessing || err is MissingRequiredOptionError;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stops_processing)
|
|
||||||
{
|
|
||||||
_applicationLifetime.StopApplication();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error parsing command line arguments");
|
|
||||||
_applicationLifetime.StopApplication();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task StopAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnNewConnection(IConnection connection, DateTime connectionTime)
|
|
||||||
{
|
|
||||||
_logger.LogTrace("New connection {0}:{1} <-> {2}:{3} of type {4}",
|
|
||||||
connection.ClientAddress,
|
|
||||||
connection.ClientPort,
|
|
||||||
connection.ServerAddress,
|
|
||||||
connection.ServerPort,
|
|
||||||
connection.ConnectionType);
|
|
||||||
connection.OnPacketRecv += OnPacketRecv;
|
|
||||||
|
|
||||||
_connections.Add(connection.Id, new ParsedConnection
|
|
||||||
{
|
|
||||||
ClientAddress = connection.ClientAddress,
|
|
||||||
ClientPort = connection.ClientPort,
|
|
||||||
ServerAddress = connection.ServerAddress,
|
|
||||||
ServerPort = connection.ServerPort,
|
|
||||||
ConnectionType = connection.ConnectionType,
|
|
||||||
Packets = new List<ParsedPacket>(),
|
|
||||||
ConnectedTime = connectionTime,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnLostConnection(IConnection connection, DateTime connectionTime)
|
|
||||||
{
|
|
||||||
_logger.LogTrace("Lost connection {0}:{1} <-> {2}:{3}",
|
|
||||||
connection.ClientAddress,
|
|
||||||
connection.ClientPort,
|
|
||||||
connection.ServerAddress,
|
|
||||||
connection.ServerPort);
|
|
||||||
connection.OnPacketRecv -= OnPacketRecv;
|
|
||||||
|
|
||||||
var parsedConnection = _connections.GetValueOrDefault(connection.Id);
|
|
||||||
parsedConnection.DisconnectedTime = connectionTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPacketRecv(IConnection connection, Direction direction, DateTime packetTime, ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
var parsedConnection = _connections.GetValueOrDefault(connection.Id);
|
|
||||||
parsedConnection.Packets.Add(new ParsedPacket
|
|
||||||
{
|
|
||||||
Data = data.ToArray(),
|
|
||||||
Direction = direction,
|
|
||||||
Time = packetTime
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DumpConnectionToTextFile(ParsedConnection c, string output, bool decrypt, IEnumerable<int> decompressOpcodes)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var path = output + string.Format("{0}-{1}.txt", c.ConnectionType.ToString().ToLower(), c.ConnectedTime.ToString("yyyyMMddHHmmssfff"));
|
|
||||||
if (File.Exists(path))
|
|
||||||
{
|
|
||||||
File.Delete(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
File.AppendAllText(path, string.Format("### type: {0}\n", c.ConnectionType));
|
|
||||||
File.AppendAllText(path, string.Format("### started: {0}\n", c.ConnectedTime.ToString("s")));
|
|
||||||
File.AppendAllText(path, string.Format("### ended: {0}\n", c.DisconnectedTime.HasValue ? c.DisconnectedTime.Value.ToString("s") : "unknown"));
|
|
||||||
File.AppendAllText(path, string.Format("### client: {0}:{1}\n", c.ClientAddress.ToString(), c.ClientPort));
|
|
||||||
File.AppendAllText(path, string.Format("### server: {0}:{1}\n\n", c.ServerAddress.ToString(), c.ServerPort));
|
|
||||||
|
|
||||||
foreach(var p in c.Packets)
|
|
||||||
{
|
|
||||||
ReadOnlySpan<byte> data = p.Data;
|
|
||||||
string dir = p.Direction == Direction.ClientToServer ? "Client -> Server" : "Server -> Client";
|
|
||||||
|
|
||||||
switch (c.ConnectionType)
|
|
||||||
{
|
|
||||||
case ConnectionType.Login:
|
|
||||||
{
|
|
||||||
int opcode = BitConverter.ToUInt16(data.Slice(0, 2));
|
|
||||||
{
|
|
||||||
File.AppendAllText(path,
|
|
||||||
string.Format("{0} [Opcode: 0x{1}, Size: {2}] ({3})\n", dir, opcode.ToString("X4"), data.Length - 2, p.Time.ToString("s")));
|
|
||||||
|
|
||||||
var gp = new GamePacket(data.Slice(2));
|
|
||||||
File.AppendAllText(path, string.Format("{0}\n", gp.ToString()));
|
|
||||||
|
|
||||||
if(decrypt && opcode == 2 || opcode == 24)
|
|
||||||
{
|
|
||||||
var encrypted_block = data.Slice(12, data.Length - 12);
|
|
||||||
var dec = EQDecrypt(encrypted_block);
|
|
||||||
|
|
||||||
if(dec != null)
|
|
||||||
{
|
|
||||||
File.AppendAllText(path, string.Format("[Decrypted Data, Offset: {0}, Size: {1}]\n", 10, dec.Length));
|
|
||||||
gp = new GamePacket(dec);
|
|
||||||
File.AppendAllText(path, string.Format("{0}\n", gp.ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ConnectionType.Chat:
|
|
||||||
{
|
|
||||||
int opcode = data[0];
|
|
||||||
File.AppendAllText(path,
|
|
||||||
string.Format("{0} [Opcode: 0x{1}, Size: {2}] ({3})\n", dir, opcode.ToString("X2"), data.Length - 1, p.Time.ToString("s")));
|
|
||||||
|
|
||||||
var gp = new GamePacket(data.Slice(1));
|
|
||||||
File.AppendAllText(path, string.Format("{0}\n", gp.ToString()));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
bool reported_decompressed = false;
|
|
||||||
int opcode = BitConverter.ToUInt16(data.Slice(0, 2));
|
|
||||||
foreach (var decompressOpcode in decompressOpcodes)
|
|
||||||
{
|
|
||||||
if (opcode == decompressOpcode && data.Length > 12)
|
|
||||||
{
|
|
||||||
if (data[10] == 0x78 && data[11] == 0xDA)
|
|
||||||
{
|
|
||||||
var totalLen = BitConverter.ToInt32(data.Slice(6, 4));
|
|
||||||
if (totalLen > 0)
|
|
||||||
{
|
|
||||||
var decompressed = Inflate(data.Slice(10));
|
|
||||||
if(decompressed != null)
|
|
||||||
{
|
|
||||||
var decompressed_gp = new GamePacket(decompressed);
|
|
||||||
File.AppendAllText(path,
|
|
||||||
string.Format("{0} [Opcode: 0x{1}, Size (decompressed): {2}] ({3})\n", dir, opcode.ToString("X4"), totalLen, p.Time.ToString("s")));
|
|
||||||
|
|
||||||
File.AppendAllText(path, string.Format("{0}\n", decompressed_gp.ToString()));
|
|
||||||
reported_decompressed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (data[6] == 0x78 && data[7] == 0xDA)
|
|
||||||
{
|
|
||||||
var totalLen = BitConverter.ToInt32(data.Slice(2, 4));
|
|
||||||
if (totalLen > 0)
|
|
||||||
{
|
|
||||||
var decompressed = Inflate(data.Slice(6));
|
|
||||||
if (decompressed != null)
|
|
||||||
{
|
|
||||||
File.AppendAllText(path,
|
|
||||||
string.Format("{0} [Opcode: 0x{1}, Size (decompressed): {2}] ({3})\n", dir, opcode.ToString("X4"), totalLen, p.Time.ToString("s")));
|
|
||||||
|
|
||||||
var decompressed_gp = new GamePacket(decompressed);
|
|
||||||
File.AppendAllText(path, string.Format("{0}\n", decompressed_gp.ToString()));
|
|
||||||
reported_decompressed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reported_decompressed)
|
|
||||||
{
|
|
||||||
File.AppendAllText(path,
|
|
||||||
string.Format("{0} [Opcode: 0x{1}, Size: {2}] ({3})\n", dir, opcode.ToString("X4"), data.Length - 2, p.Time.ToString("s")));
|
|
||||||
var gp = new GamePacket(data.Slice(2));
|
|
||||||
File.AppendAllText(path, string.Format("{0}\n", gp.ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error dumping connection {0} to txt file", c.ConnectedTime.ToString("s"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] Inflate(ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var out_stream = new MemoryStream())
|
|
||||||
using (var in_stream = new MemoryStream(data.ToArray()))
|
|
||||||
{
|
|
||||||
const int bufferLen = 4096;
|
|
||||||
var buffer = new byte[bufferLen];
|
|
||||||
using (var zs = new ZlibStream(in_stream, CompressionMode.Decompress))
|
|
||||||
{
|
|
||||||
int r = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
r = zs.Read(buffer, 0, bufferLen);
|
|
||||||
out_stream.Write(buffer, 0, r);
|
|
||||||
} while (r == bufferLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
var ret = out_stream.ToArray();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error inflating data");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] EQDecrypt(ReadOnlySpan<byte> data)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var desEngine = new DesEngine();
|
|
||||||
var cbcBlockCipher = new CbcBlockCipher(desEngine);
|
|
||||||
var bufferedBlockCipher = new BufferedBlockCipher(cbcBlockCipher);
|
|
||||||
bufferedBlockCipher.Init(false, new ParametersWithIV(new KeyParameter(new byte[16]), new byte[8]));
|
|
||||||
var cipherData = new byte[bufferedBlockCipher.GetOutputSize(data.Length)];
|
|
||||||
var outputLength = bufferedBlockCipher.ProcessBytes(data.ToArray(), 0, data.Length, cipherData, 0);
|
|
||||||
bufferedBlockCipher.DoFinal(cipherData, outputLength);
|
|
||||||
return cipherData;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Error decrypting EQ Datablock");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using CommandLine;
|
|
||||||
|
|
||||||
namespace StreamParser
|
|
||||||
{
|
|
||||||
public class ConsoleHostedServiceOptions
|
|
||||||
{
|
|
||||||
[Option("input", Required = true, HelpText = "Input pcap files to be processed.")]
|
|
||||||
public IEnumerable<string> Input { get; set; }
|
|
||||||
|
|
||||||
[Option("output", Default = "output/", HelpText = "Directory to put output files")]
|
|
||||||
public string Output { get; set; }
|
|
||||||
|
|
||||||
[Option("text", Default = true, HelpText = "Dump connections to text files.")]
|
|
||||||
public bool Text { get; set; }
|
|
||||||
|
|
||||||
[Option("binary", Default = false, HelpText = "Dump connections to binary files.")]
|
|
||||||
public bool Binary { get; set; }
|
|
||||||
|
|
||||||
[Option("decrypt", Default = false, HelpText = "Decrypt the \"Encrypted\" packets.")]
|
|
||||||
public bool Decrypt { get; set; }
|
|
||||||
|
|
||||||
[Option("decompress", Default = null, HelpText = "Which opcodes to attempt to decompress")]
|
|
||||||
public IEnumerable<int> DecompressOpcodes { get; set; }
|
|
||||||
|
|
||||||
[Option("enable-unknown-streams", Default = false, HelpText = "Enable dumping of unknown streams; they will be skipped otherwise.")]
|
|
||||||
public bool DumpUnknownStreams { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using StreamParser.Common.Daybreak;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace StreamParser
|
|
||||||
{
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
CreateHostBuilder(args).Build().Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
|
||||||
{
|
|
||||||
return Host.CreateDefaultBuilder(args)
|
|
||||||
.ConfigureServices((hostContext, services) =>
|
|
||||||
{
|
|
||||||
services.AddScoped<IParser, Parser>();
|
|
||||||
services.AddHostedService<ConsoleHostedService>();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"profiles": {
|
|
||||||
"stream_parser": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"commandLineArgs": "--input input/cap_login_to_zone_10_16_2024.pcap --output output_test/ --binary --decrypt --decompress 16742 168 30346",
|
|
||||||
"workingDirectory": "E:\\Projects\\stream_parser\\stream_parser\\bin\\Debug\\net6.0\\"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<RootNamespace>StreamParser</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
|
||||||
<PackageReference Include="CsvHelper" Version="33.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
|
|
||||||
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\common\common.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -526,10 +526,28 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
|||||||
SendEnterWorld(cle->name());
|
SendEnterWorld(cle->name());
|
||||||
SendPostEnterWorld();
|
SendPostEnterWorld();
|
||||||
if (!is_player_zoning) {
|
if (!is_player_zoning) {
|
||||||
|
const auto supported_clients = RuleS(World, SupportedClients);
|
||||||
|
bool skip_char_info = false;
|
||||||
|
if (!supported_clients.empty()) {
|
||||||
|
const std::string& name = EQ::versions::ClientVersionName(m_ClientVersion);
|
||||||
|
const auto& clients = Strings::Split(supported_clients, ",");
|
||||||
|
if (std::find(clients.begin(), clients.end(), name) == clients.end()) {
|
||||||
|
SendUnsupportedClientPacket(
|
||||||
|
fmt::format(
|
||||||
|
"Client Not In Supported List [{}]",
|
||||||
|
supported_clients
|
||||||
|
)
|
||||||
|
);
|
||||||
|
skip_char_info = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skip_char_info) {
|
||||||
SendExpansionInfo();
|
SendExpansionInfo();
|
||||||
SendCharInfo();
|
SendCharInfo();
|
||||||
database.LoginIP(cle->AccountID(), long2ip(GetIP()));
|
database.LoginIP(cle->AccountID(), long2ip(GetIP()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cle->SetIP(GetIP());
|
cle->SetIP(GetIP());
|
||||||
return true;
|
return true;
|
||||||
@@ -2453,3 +2471,34 @@ void Client::SendGuildTributeOptInToggle(const GuildTributeMemberToggle *in)
|
|||||||
QueuePacket(outapp);
|
QueuePacket(outapp);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::SendUnsupportedClientPacket(const std::string& message)
|
||||||
|
{
|
||||||
|
EQApplicationPacket packet(OP_SendCharInfo, sizeof(CharacterSelect_Struct) + sizeof(CharacterSelectEntry_Struct));
|
||||||
|
|
||||||
|
unsigned char* buff_ptr = packet.pBuffer;
|
||||||
|
auto cs = (CharacterSelect_Struct*) buff_ptr;
|
||||||
|
|
||||||
|
cs->CharCount = 1;
|
||||||
|
cs->TotalChars = 1;
|
||||||
|
|
||||||
|
buff_ptr += sizeof(CharacterSelect_Struct);
|
||||||
|
|
||||||
|
auto e = (CharacterSelectEntry_Struct*) buff_ptr;
|
||||||
|
|
||||||
|
strcpy(e->Name, message.c_str());
|
||||||
|
|
||||||
|
e->Race = Race::Human;
|
||||||
|
e->Class = Class::Warrior;
|
||||||
|
e->Level = 1;
|
||||||
|
e->ShroudClass = e->Class;
|
||||||
|
e->ShroudRace = e->Race;
|
||||||
|
e->Zone = std::numeric_limits<uint16>::max();
|
||||||
|
e->Instance = 0;
|
||||||
|
e->Gender = Gender::Male;
|
||||||
|
e->GoHome = 0;
|
||||||
|
e->Tutorial = 0;
|
||||||
|
e->Enabled = 0;
|
||||||
|
|
||||||
|
QueuePacket(&packet);
|
||||||
|
}
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ private:
|
|||||||
EQStreamInterface* eqs;
|
EQStreamInterface* eqs;
|
||||||
bool CanTradeFVNoDropItem();
|
bool CanTradeFVNoDropItem();
|
||||||
void RecordPossibleHack(const std::string& message);
|
void RecordPossibleHack(const std::string& message);
|
||||||
|
void SendUnsupportedClientPacket(const std::string& message);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
|
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
|
||||||
|
|||||||
@@ -294,6 +294,13 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
|||||||
database.ClearBuyerDetails();
|
database.ClearBuyerDetails();
|
||||||
LogInfo("Clearing buyer table details");
|
LogInfo("Clearing buyer table details");
|
||||||
|
|
||||||
|
if (RuleB(Bots, Enabled)) {
|
||||||
|
LogInfo("Clearing [bot_pet_buffs] table of stale entries");
|
||||||
|
database.QueryDatabase(
|
||||||
|
"DELETE FROM bot_pet_buffs WHERE NOT EXISTS (SELECT * FROM bot_pets WHERE bot_pets.pets_index = bot_pet_buffs.pets_index)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!content_db.LoadItems(hotfix_name)) {
|
if (!content_db.LoadItems(hotfix_name)) {
|
||||||
LogError("Error: Could not load item data. But ignoring");
|
LogError("Error: Could not load item data. But ignoring");
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-3
@@ -1755,7 +1755,11 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoneserver_list.SendPacket(Zones::BAZAAR, pack);
|
auto trader = client_list.FindCLEByCharacterID(in->trader_buy_struct.trader_id);
|
||||||
|
if (trader) {
|
||||||
|
zoneserver_list.SendPacket(trader->zone(), trader->instance(), pack);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_BuyerMessaging: {
|
case ServerOP_BuyerMessaging: {
|
||||||
@@ -1775,12 +1779,20 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Barter_SellItem: {
|
case Barter_SellItem: {
|
||||||
zoneserver_list.SendPacket(Zones::BAZAAR, pack);
|
auto buyer = client_list.FindCharacter(in->buyer_name);
|
||||||
|
if (buyer) {
|
||||||
|
zoneserver_list.SendPacket(buyer->zone(), buyer->instance(), pack);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Barter_FailedTransaction:
|
case Barter_FailedTransaction:
|
||||||
case Barter_BuyerTransactionComplete: {
|
case Barter_BuyerTransactionComplete: {
|
||||||
zoneserver_list.SendPacket(in->zone_id, pack);
|
auto seller = client_list.FindCharacter(in->seller_name);
|
||||||
|
if (seller) {
|
||||||
|
zoneserver_list.SendPacket(seller->zone(), seller->instance(), pack);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ SET(zone_sources
|
|||||||
lua_buff.cpp
|
lua_buff.cpp
|
||||||
lua_corpse.cpp
|
lua_corpse.cpp
|
||||||
lua_client.cpp
|
lua_client.cpp
|
||||||
|
lua_database.cpp
|
||||||
lua_door.cpp
|
lua_door.cpp
|
||||||
lua_encounter.cpp
|
lua_encounter.cpp
|
||||||
lua_entity.cpp
|
lua_entity.cpp
|
||||||
@@ -110,6 +111,7 @@ SET(zone_sources
|
|||||||
perl_bot.cpp
|
perl_bot.cpp
|
||||||
perl_buff.cpp
|
perl_buff.cpp
|
||||||
perl_client.cpp
|
perl_client.cpp
|
||||||
|
perl_database.cpp
|
||||||
perl_doors.cpp
|
perl_doors.cpp
|
||||||
perl_entity.cpp
|
perl_entity.cpp
|
||||||
perl_expedition.cpp
|
perl_expedition.cpp
|
||||||
@@ -135,6 +137,7 @@ SET(zone_sources
|
|||||||
qglobals.cpp
|
qglobals.cpp
|
||||||
queryserv.cpp
|
queryserv.cpp
|
||||||
questmgr.cpp
|
questmgr.cpp
|
||||||
|
quest_db.cpp
|
||||||
quest_parser_collection.cpp
|
quest_parser_collection.cpp
|
||||||
raids.cpp
|
raids.cpp
|
||||||
raycast_mesh.cpp
|
raycast_mesh.cpp
|
||||||
@@ -215,6 +218,7 @@ SET(zone_headers
|
|||||||
lua_buff.h
|
lua_buff.h
|
||||||
lua_client.h
|
lua_client.h
|
||||||
lua_corpse.h
|
lua_corpse.h
|
||||||
|
lua_database.h
|
||||||
lua_door.h
|
lua_door.h
|
||||||
lua_encounter.h
|
lua_encounter.h
|
||||||
lua_entity.h
|
lua_entity.h
|
||||||
@@ -251,6 +255,7 @@ SET(zone_headers
|
|||||||
pathfinder_interface.h
|
pathfinder_interface.h
|
||||||
pathfinder_nav_mesh.h
|
pathfinder_nav_mesh.h
|
||||||
pathfinder_null.h
|
pathfinder_null.h
|
||||||
|
perl_database.h
|
||||||
perlpacket.h
|
perlpacket.h
|
||||||
petitions.h
|
petitions.h
|
||||||
pets.h
|
pets.h
|
||||||
@@ -260,6 +265,7 @@ SET(zone_headers
|
|||||||
queryserv.h
|
queryserv.h
|
||||||
quest_interface.h
|
quest_interface.h
|
||||||
questmgr.h
|
questmgr.h
|
||||||
|
quest_db.h
|
||||||
quest_parser_collection.h
|
quest_parser_collection.h
|
||||||
raids.h
|
raids.h
|
||||||
raycast_mesh.h
|
raycast_mesh.h
|
||||||
|
|||||||
+4
-1
@@ -1578,7 +1578,10 @@ bool Bot::Process()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanCloseMobProcess();
|
if (m_scan_close_mobs_timer.Check()) {
|
||||||
|
entity_list.ScanCloseMobs(this);
|
||||||
|
}
|
||||||
|
|
||||||
SpellProcess();
|
SpellProcess();
|
||||||
|
|
||||||
if (tic_timer.Check()) {
|
if (tic_timer.Check()) {
|
||||||
|
|||||||
@@ -828,7 +828,7 @@ bool BotDatabase::LoadTimers(Bot* b)
|
|||||||
BotTimer_Struct t{ };
|
BotTimer_Struct t{ };
|
||||||
|
|
||||||
for (const auto& e : l) {
|
for (const auto& e : l) {
|
||||||
if (t.timer_value < (Timer::GetCurrentTime() + t.recast_time)) {
|
if (e.timer_value < (Timer::GetCurrentTime() + e.recast_time)) {
|
||||||
t.timer_id = e.timer_id;
|
t.timer_id = e.timer_id;
|
||||||
t.timer_value = e.timer_value;
|
t.timer_value = e.timer_value;
|
||||||
t.recast_time = e.recast_time;
|
t.recast_time = e.recast_time;
|
||||||
@@ -1451,7 +1451,7 @@ bool BotDatabase::DeletePetBuffs(const uint32 bot_id)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotPetBuffsRepository::DeleteOne(database, saved_pet_index);
|
BotPetBuffsRepository::DeleteWhere(database, fmt::format("pets_index = {}", saved_pet_index));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2731,6 +2731,14 @@ void Client::Handle_OP_AltCurrencyReclaim(const EQApplicationPacket *app)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsTrader()) {
|
||||||
|
TraderEndTrader();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsBuyer()) {
|
||||||
|
ToggleBuyerMode(false);
|
||||||
|
}
|
||||||
|
|
||||||
/* Item to Currency Storage */
|
/* Item to Currency Storage */
|
||||||
if (reclaim->reclaim_flag == 1) {
|
if (reclaim->reclaim_flag == 1) {
|
||||||
uint32 removed = NukeItem(item_id, invWhereWorn | invWherePersonal | invWhereCursor);
|
uint32 removed = NukeItem(item_id, invWhereWorn | invWherePersonal | invWhereCursor);
|
||||||
@@ -5013,7 +5021,11 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) {
|
|||||||
SetMoving(!(cy == m_Position.y && cx == m_Position.x));
|
SetMoving(!(cy == m_Position.y && cx == m_Position.x));
|
||||||
|
|
||||||
CheckClientToNpcAggroTimer();
|
CheckClientToNpcAggroTimer();
|
||||||
|
|
||||||
|
if (m_mob_check_moving_timer.Check()) {
|
||||||
CheckScanCloseMobsMovingTimer();
|
CheckScanCloseMobsMovingTimer();
|
||||||
|
}
|
||||||
|
|
||||||
CheckSendBulkClientPositionUpdate();
|
CheckSendBulkClientPositionUpdate();
|
||||||
|
|
||||||
int32 new_animation = ppu->animation;
|
int32 new_animation = ppu->animation;
|
||||||
|
|||||||
@@ -281,7 +281,9 @@ bool Client::Process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanCloseMobProcess();
|
if (m_scan_close_mobs_timer.Check()) {
|
||||||
|
entity_list.ScanCloseMobs(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (RuleB(Inventory, LazyLoadBank)) {
|
if (RuleB(Inventory, LazyLoadBank)) {
|
||||||
// poll once a second to see if we are close to a banker and we haven't loaded the bank yet
|
// poll once a second to see if we are close to a banker and we haven't loaded the bank yet
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ int command_init(void)
|
|||||||
command_add("augmentitem", "Force augments an item. Must have the augment item window open.", AccountStatus::GMImpossible, command_augmentitem) ||
|
command_add("augmentitem", "Force augments an item. Must have the augment item window open.", AccountStatus::GMImpossible, command_augmentitem) ||
|
||||||
command_add("ban", "[Character Name] [Reason] - Ban by character name", AccountStatus::GMLeadAdmin, command_ban) ||
|
command_add("ban", "[Character Name] [Reason] - Ban by character name", AccountStatus::GMLeadAdmin, command_ban) ||
|
||||||
command_add("bugs", "[Close|Delete|Review|Search|View] - Handles player bug reports", AccountStatus::QuestTroupe, command_bugs) ||
|
command_add("bugs", "[Close|Delete|Review|Search|View] - Handles player bug reports", AccountStatus::QuestTroupe, command_bugs) ||
|
||||||
command_add("bot", "Type \"#bot help\" or \"^help\" to the see the list of available commands for bots.", AccountStatus::Player, command_bot) ||
|
(RuleB(Bots, Enabled) && command_add("bot", "Type \"#bot help\" or \"^help\" to the see the list of available commands for bots.", AccountStatus::Player, command_bot)) ||
|
||||||
command_add("camerashake", "[Duration (Milliseconds)] [Intensity (1-10)] - Shakes the camera on everyone's screen globally.", AccountStatus::QuestTroupe, command_camerashake) ||
|
command_add("camerashake", "[Duration (Milliseconds)] [Intensity (1-10)] - Shakes the camera on everyone's screen globally.", AccountStatus::QuestTroupe, command_camerashake) ||
|
||||||
command_add("castspell", "[Spell ID] [Instant (0 = False, 1 = True, Default is 1 if Unused)] - Cast a spell", AccountStatus::Guide, command_castspell) ||
|
command_add("castspell", "[Spell ID] [Instant (0 = False, 1 = True, Default is 1 if Unused)] - Cast a spell", AccountStatus::Guide, command_castspell) ||
|
||||||
command_add("chat", "[Channel ID] [Message] - Send a channel message to all zones", AccountStatus::GMMgmt, command_chat) ||
|
command_add("chat", "[Channel ID] [Message] - Send a channel message to all zones", AccountStatus::GMMgmt, command_chat) ||
|
||||||
|
|||||||
+3
-1
@@ -58,6 +58,7 @@ void perl_register_expedition_lock_messages();
|
|||||||
void perl_register_bot();
|
void perl_register_bot();
|
||||||
void perl_register_buff();
|
void perl_register_buff();
|
||||||
void perl_register_merc();
|
void perl_register_merc();
|
||||||
|
void perl_register_database();
|
||||||
#endif // EMBPERL_XS_CLASSES
|
#endif // EMBPERL_XS_CLASSES
|
||||||
#endif // EMBPERL_XS
|
#endif // EMBPERL_XS
|
||||||
|
|
||||||
@@ -1185,6 +1186,7 @@ void PerlembParser::MapFunctions()
|
|||||||
perl_register_bot();
|
perl_register_bot();
|
||||||
perl_register_buff();
|
perl_register_buff();
|
||||||
perl_register_merc();
|
perl_register_merc();
|
||||||
|
perl_register_database();
|
||||||
#endif // EMBPERL_XS_CLASSES
|
#endif // EMBPERL_XS_CLASSES
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1734,7 +1736,7 @@ void PerlembParser::ExportEventVariables(
|
|||||||
case EVENT_PAYLOAD: {
|
case EVENT_PAYLOAD: {
|
||||||
Seperator sep(data);
|
Seperator sep(data);
|
||||||
ExportVar(package_name.c_str(), "payload_id", sep.arg[0]);
|
ExportVar(package_name.c_str(), "payload_id", sep.arg[0]);
|
||||||
ExportVar(package_name.c_str(), "payload_value", sep.arg[1]);
|
ExportVar(package_name.c_str(), "payload_value", sep.argplus[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5978,6 +5978,16 @@ bool Perl__aretaskscompleted(perl::array task_ids)
|
|||||||
return quest_manager.aretaskscompleted(v);
|
return quest_manager.aretaskscompleted(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Perl__SpawnCircle(uint32 npc_id, float x, float y, float z, float heading, float radius, uint32 points)
|
||||||
|
{
|
||||||
|
quest_manager.SpawnCircle(npc_id, glm::vec4(x, y, z, heading), radius, points);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl__SpawnGrid(uint32 npc_id, float x, float y, float z, float heading, float spacing, uint32 spawn_count)
|
||||||
|
{
|
||||||
|
quest_manager.SpawnGrid(npc_id, glm::vec4(x, y, z, heading), spacing, spawn_count);
|
||||||
|
}
|
||||||
|
|
||||||
void perl_register_quest()
|
void perl_register_quest()
|
||||||
{
|
{
|
||||||
perl::interpreter perl(PERL_GET_THX);
|
perl::interpreter perl(PERL_GET_THX);
|
||||||
@@ -6287,6 +6297,8 @@ void perl_register_quest()
|
|||||||
package.add("SendMail", &Perl__SendMail);
|
package.add("SendMail", &Perl__SendMail);
|
||||||
package.add("SetAutoLoginCharacterNameByAccountID", &Perl__SetAutoLoginCharacterNameByAccountID);
|
package.add("SetAutoLoginCharacterNameByAccountID", &Perl__SetAutoLoginCharacterNameByAccountID);
|
||||||
package.add("SetRunning", &Perl__SetRunning);
|
package.add("SetRunning", &Perl__SetRunning);
|
||||||
|
package.add("SpawnCircle", &Perl__SpawnCircle);
|
||||||
|
package.add("SpawnGrid", &Perl__SpawnGrid);
|
||||||
package.add("activespeakactivity", &Perl__activespeakactivity);
|
package.add("activespeakactivity", &Perl__activespeakactivity);
|
||||||
package.add("activespeaktask", &Perl__activespeaktask);
|
package.add("activespeaktask", &Perl__activespeaktask);
|
||||||
package.add("activetasksinset", &Perl__activetasksinset);
|
package.add("activetasksinset", &Perl__activetasksinset);
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ Eglin
|
|||||||
#include <perlbind/perlbind.h>
|
#include <perlbind/perlbind.h>
|
||||||
namespace perl = perlbind;
|
namespace perl = perlbind;
|
||||||
|
|
||||||
|
#undef connect
|
||||||
|
#undef bind
|
||||||
#undef Null
|
#undef Null
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
+22
-19
@@ -2945,8 +2945,22 @@ void EntityList::RemoveAuraFromMobs(Mob *aura)
|
|||||||
// entity list (zone wide)
|
// entity list (zone wide)
|
||||||
void EntityList::ScanCloseMobs(Mob *scanning_mob)
|
void EntityList::ScanCloseMobs(Mob *scanning_mob)
|
||||||
{
|
{
|
||||||
|
if (!scanning_mob) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scanning_mob->GetID() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float scan_range = RuleI(Range, MobCloseScanDistance) * RuleI(Range, MobCloseScanDistance);
|
float scan_range = RuleI(Range, MobCloseScanDistance) * RuleI(Range, MobCloseScanDistance);
|
||||||
|
|
||||||
|
// Reserve memory in m_close_mobs to avoid frequent re-allocations if not already reserved.
|
||||||
|
// Assuming mob_list.size() as an upper bound for reservation.
|
||||||
|
if (scanning_mob->m_close_mobs.bucket_count() < mob_list.size()) {
|
||||||
|
scanning_mob->m_close_mobs.reserve(mob_list.size());
|
||||||
|
}
|
||||||
|
|
||||||
scanning_mob->m_close_mobs.clear();
|
scanning_mob->m_close_mobs.clear();
|
||||||
|
|
||||||
for (auto &e : mob_list) {
|
for (auto &e : mob_list) {
|
||||||
@@ -2957,28 +2971,17 @@ void EntityList::ScanCloseMobs(Mob *scanning_mob)
|
|||||||
|
|
||||||
float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition());
|
float distance = DistanceSquared(scanning_mob->GetPosition(), mob->GetPosition());
|
||||||
if (distance <= scan_range || mob->GetAggroRange() >= scan_range) {
|
if (distance <= scan_range || mob->GetAggroRange() >= scan_range) {
|
||||||
scanning_mob->m_close_mobs.emplace(std::pair<uint16, Mob *>(mob->GetID(), mob));
|
// add mob to scanning_mob's close list and vice versa
|
||||||
|
// check if the mob is already in the close mobs list before inserting
|
||||||
// add self to other mobs close list
|
if (mob->m_close_mobs.find(scanning_mob->GetID()) == mob->m_close_mobs.end()) {
|
||||||
if (scanning_mob->GetID() > 0) {
|
mob->m_close_mobs[scanning_mob->GetID()] = scanning_mob;
|
||||||
bool has_mob = false;
|
}
|
||||||
|
scanning_mob->m_close_mobs[mob->GetID()] = mob;
|
||||||
for (auto &cm: mob->m_close_mobs) {
|
|
||||||
if (scanning_mob->GetID() == cm.first) {
|
|
||||||
has_mob = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_mob) {
|
LogAIScanClose(
|
||||||
mob->m_close_mobs.insert(std::pair<uint16, Mob *>(scanning_mob->GetID(), scanning_mob));
|
"[{}] Scanning close list > list_size [{}] moving [{}]",
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogAIScanCloseDetail(
|
|
||||||
"[{}] Scanning Close List | list_size [{}] moving [{}]",
|
|
||||||
scanning_mob->GetCleanName(),
|
scanning_mob->GetCleanName(),
|
||||||
scanning_mob->m_close_mobs.size(),
|
scanning_mob->m_close_mobs.size(),
|
||||||
scanning_mob->IsMoving() ? "true" : "false"
|
scanning_mob->IsMoving() ? "true" : "false"
|
||||||
|
|||||||
@@ -0,0 +1,214 @@
|
|||||||
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
|
#include "lua_database.h"
|
||||||
|
#include "zonedb.h"
|
||||||
|
#include <luabind/luabind.hpp>
|
||||||
|
#include <luabind/adopt_policy.hpp>
|
||||||
|
|
||||||
|
// Luabind adopts the PreparedStmt wrapper object allocated with new and deletes it via GC
|
||||||
|
// Lua GC is non-deterministic so handles should be closed explicitly to free db resources
|
||||||
|
// Script errors/exceptions will hold resources until GC deletes the wrapper object
|
||||||
|
|
||||||
|
Lua_MySQLPreparedStmt* Lua_Database::Prepare(lua_State* L, std::string query)
|
||||||
|
{
|
||||||
|
return m_db ? new Lua_MySQLPreparedStmt(L, m_db->Prepare(std::move(query))) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lua_Database::Close()
|
||||||
|
{
|
||||||
|
m_db.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void Lua_MySQLPreparedStmt::Close()
|
||||||
|
{
|
||||||
|
m_stmt.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lua_MySQLPreparedStmt::Execute(lua_State* L)
|
||||||
|
{
|
||||||
|
if (m_stmt)
|
||||||
|
{
|
||||||
|
m_res = m_stmt->Execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lua_MySQLPreparedStmt::Execute(lua_State* L, luabind::object args)
|
||||||
|
{
|
||||||
|
if (m_stmt)
|
||||||
|
{
|
||||||
|
std::vector<mysql::PreparedStmt::param_t> inputs;
|
||||||
|
|
||||||
|
// iterate table until nil like ipairs to guarantee traversal order
|
||||||
|
for (int i = 1, type; (type = luabind::type(args[i])) != LUA_TNIL; ++i)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case LUA_TBOOLEAN:
|
||||||
|
inputs.emplace_back(luabind::object_cast<bool>(args[i]));
|
||||||
|
break;
|
||||||
|
case LUA_TNUMBER: // all numbers are doubles in lua before 5.3
|
||||||
|
inputs.emplace_back(luabind::object_cast<lua_Number>(args[i]));
|
||||||
|
break;
|
||||||
|
case LUA_TSTRING:
|
||||||
|
inputs.emplace_back(luabind::object_cast<const char*>(args[i]));
|
||||||
|
break;
|
||||||
|
case LUA_TTABLE: // let tables substitute for null since nils can't exist
|
||||||
|
inputs.emplace_back(nullptr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_res = m_stmt->Execute(inputs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lua_MySQLPreparedStmt::SetOptions(luabind::object table)
|
||||||
|
{
|
||||||
|
if (m_stmt)
|
||||||
|
{
|
||||||
|
mysql::StmtOptions opts = m_stmt->GetOptions();
|
||||||
|
if (luabind::type(table["buffer_results"]) == LUA_TBOOLEAN)
|
||||||
|
{
|
||||||
|
opts.buffer_results = luabind::object_cast<bool>(table["buffer_results"]);
|
||||||
|
}
|
||||||
|
if (luabind::type(table["use_max_length"]) == LUA_TBOOLEAN)
|
||||||
|
{
|
||||||
|
opts.use_max_length = luabind::object_cast<bool>(table["use_max_length"]);
|
||||||
|
}
|
||||||
|
m_stmt->SetOptions(opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PushValue(lua_State* L, const mysql::StmtColumn& col)
|
||||||
|
{
|
||||||
|
if (col.IsNull())
|
||||||
|
{
|
||||||
|
lua_pushnil(L); // clear entry in cache from any previous row
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 64-bit ints are pushed as strings since lua 5.1 only has 53-bit precision
|
||||||
|
switch (col.Type())
|
||||||
|
{
|
||||||
|
case MYSQL_TYPE_TINY:
|
||||||
|
case MYSQL_TYPE_SHORT:
|
||||||
|
case MYSQL_TYPE_INT24:
|
||||||
|
case MYSQL_TYPE_LONG:
|
||||||
|
case MYSQL_TYPE_FLOAT:
|
||||||
|
case MYSQL_TYPE_DOUBLE:
|
||||||
|
lua_pushnumber(L, col.Get<lua_Number>().value());
|
||||||
|
break;
|
||||||
|
case MYSQL_TYPE_LONGLONG:
|
||||||
|
case MYSQL_TYPE_BIT:
|
||||||
|
case MYSQL_TYPE_TIME:
|
||||||
|
case MYSQL_TYPE_DATE:
|
||||||
|
case MYSQL_TYPE_DATETIME:
|
||||||
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
|
{
|
||||||
|
std::string str = col.GetStr().value();
|
||||||
|
lua_pushlstring(L, str.data(), str.size());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: // string types, push raw buffer to avoid copy
|
||||||
|
{
|
||||||
|
std::string_view str = col.GetStrView().value();
|
||||||
|
lua_pushlstring(L, str.data(), str.size());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
luabind::object Lua_MySQLPreparedStmt::FetchArray(lua_State* L)
|
||||||
|
{
|
||||||
|
auto row = m_stmt ? m_stmt->Fetch() : mysql::StmtRow();
|
||||||
|
if (!row)
|
||||||
|
{
|
||||||
|
return luabind::object();
|
||||||
|
}
|
||||||
|
|
||||||
|
// perf: bypass luabind operator[]
|
||||||
|
m_row_array.push(L);
|
||||||
|
for (const mysql::StmtColumn& col : row)
|
||||||
|
{
|
||||||
|
PushValue(L, col);
|
||||||
|
lua_rawseti(L, -2, col.Index() + 1);
|
||||||
|
}
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
return m_row_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
luabind::object Lua_MySQLPreparedStmt::FetchHash(lua_State* L)
|
||||||
|
{
|
||||||
|
auto row = m_stmt ? m_stmt->Fetch() : mysql::StmtRow();
|
||||||
|
if (!row)
|
||||||
|
{
|
||||||
|
return luabind::object();
|
||||||
|
}
|
||||||
|
|
||||||
|
// perf: bypass luabind operator[]
|
||||||
|
m_row_hash.push(L);
|
||||||
|
for (const mysql::StmtColumn& col : row)
|
||||||
|
{
|
||||||
|
PushValue(L, col);
|
||||||
|
lua_setfield(L, -2, col.Name().c_str());
|
||||||
|
}
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
return m_row_hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Lua_MySQLPreparedStmt::ColumnCount()
|
||||||
|
{
|
||||||
|
return m_res.ColumnCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Lua_MySQLPreparedStmt::LastInsertID()
|
||||||
|
{
|
||||||
|
return m_res.LastInsertID();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Lua_MySQLPreparedStmt::RowCount()
|
||||||
|
{
|
||||||
|
return m_res.RowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Lua_MySQLPreparedStmt::RowsAffected()
|
||||||
|
{
|
||||||
|
return m_res.RowsAffected();
|
||||||
|
}
|
||||||
|
|
||||||
|
luabind::scope lua_register_database()
|
||||||
|
{
|
||||||
|
return luabind::class_<Lua_Database>("Database")
|
||||||
|
.enum_("constants")
|
||||||
|
[(
|
||||||
|
luabind::value("Default", static_cast<int>(QuestDB::Connection::Default)),
|
||||||
|
luabind::value("Content", static_cast<int>(QuestDB::Connection::Content))
|
||||||
|
)]
|
||||||
|
.def(luabind::constructor<>())
|
||||||
|
.def(luabind::constructor<QuestDB::Connection>())
|
||||||
|
.def(luabind::constructor<QuestDB::Connection, bool>())
|
||||||
|
.def(luabind::constructor<const char*, const char*, const char*, const char*, uint32_t>())
|
||||||
|
.def("close", &Lua_Database::Close)
|
||||||
|
.def("prepare", &Lua_Database::Prepare, luabind::adopt(luabind::result)),
|
||||||
|
|
||||||
|
luabind::class_<Lua_MySQLPreparedStmt>("MySQLPreparedStmt")
|
||||||
|
.def("close", &Lua_MySQLPreparedStmt::Close)
|
||||||
|
.def("execute", static_cast<void(Lua_MySQLPreparedStmt::*)(lua_State*)>(&Lua_MySQLPreparedStmt::Execute))
|
||||||
|
.def("execute", static_cast<void(Lua_MySQLPreparedStmt::*)(lua_State*, luabind::object)>(&Lua_MySQLPreparedStmt::Execute))
|
||||||
|
.def("fetch", &Lua_MySQLPreparedStmt::FetchArray)
|
||||||
|
.def("fetch_array", &Lua_MySQLPreparedStmt::FetchArray)
|
||||||
|
.def("fetch_hash", &Lua_MySQLPreparedStmt::FetchHash)
|
||||||
|
.def("insert_id", &Lua_MySQLPreparedStmt::LastInsertID)
|
||||||
|
.def("num_fields", &Lua_MySQLPreparedStmt::ColumnCount)
|
||||||
|
.def("num_rows", &Lua_MySQLPreparedStmt::RowCount)
|
||||||
|
.def("rows_affected", &Lua_MySQLPreparedStmt::RowsAffected)
|
||||||
|
.def("set_options", &Lua_MySQLPreparedStmt::SetOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // LUA_EQEMU
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef LUA_EQEMU
|
||||||
|
|
||||||
|
#include "quest_db.h"
|
||||||
|
#include "../common/mysql_stmt.h"
|
||||||
|
#include <luabind/object.hpp>
|
||||||
|
|
||||||
|
namespace luabind { struct scope; }
|
||||||
|
luabind::scope lua_register_database();
|
||||||
|
|
||||||
|
class Lua_MySQLPreparedStmt;
|
||||||
|
|
||||||
|
class Lua_Database : public QuestDB
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using QuestDB::QuestDB;
|
||||||
|
|
||||||
|
void Close();
|
||||||
|
Lua_MySQLPreparedStmt* Prepare(lua_State*, std::string query);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Lua_MySQLPreparedStmt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Lua_MySQLPreparedStmt(lua_State* L, mysql::PreparedStmt&& stmt)
|
||||||
|
: m_stmt(std::make_unique<mysql::PreparedStmt>(std::move(stmt)))
|
||||||
|
, m_row_array(luabind::newtable(L))
|
||||||
|
, m_row_hash(luabind::newtable(L)) {}
|
||||||
|
|
||||||
|
void Close();
|
||||||
|
void Execute(lua_State*);
|
||||||
|
void Execute(lua_State*, luabind::object args);
|
||||||
|
void SetOptions(luabind::object table_opts);
|
||||||
|
luabind::object FetchArray(lua_State*);
|
||||||
|
luabind::object FetchHash(lua_State*);
|
||||||
|
|
||||||
|
// StmtResult functions accessible through this class to simplify api
|
||||||
|
int ColumnCount();
|
||||||
|
uint64_t LastInsertID();
|
||||||
|
uint64_t RowCount();
|
||||||
|
uint64_t RowsAffected();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<mysql::PreparedStmt> m_stmt;
|
||||||
|
mysql::StmtResult m_res = {};
|
||||||
|
luabind::object m_row_array; // perf: table cache for fetches
|
||||||
|
luabind::object m_row_hash;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LUA_EQEMU
|
||||||
+13
-3
@@ -5635,6 +5635,16 @@ int lua_are_tasks_completed(luabind::object task_ids)
|
|||||||
return quest_manager.aretaskscompleted(v);
|
return quest_manager.aretaskscompleted(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lua_spawn_circle(uint32 npc_id, float x, float y, float z, float heading, float radius, uint32 points)
|
||||||
|
{
|
||||||
|
quest_manager.SpawnCircle(npc_id, glm::vec4(x, y, z, heading), radius, points);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lua_spawn_grid(uint32 npc_id, float x, float y, float z, float heading, float spacing, uint32 spawn_count)
|
||||||
|
{
|
||||||
|
quest_manager.SpawnGrid(npc_id, glm::vec4(x, y, z, heading), spacing, spawn_count);
|
||||||
|
}
|
||||||
|
|
||||||
#define LuaCreateNPCParse(name, c_type, default_value) do { \
|
#define LuaCreateNPCParse(name, c_type, default_value) do { \
|
||||||
cur = table[#name]; \
|
cur = table[#name]; \
|
||||||
if(luabind::type(cur) != LUA_TNIL) { \
|
if(luabind::type(cur) != LUA_TNIL) { \
|
||||||
@@ -6442,6 +6452,8 @@ luabind::scope lua_register_general() {
|
|||||||
luabind::def("send_parcel", &lua_send_parcel),
|
luabind::def("send_parcel", &lua_send_parcel),
|
||||||
luabind::def("get_zone_uptime", &lua_get_zone_uptime),
|
luabind::def("get_zone_uptime", &lua_get_zone_uptime),
|
||||||
luabind::def("are_tasks_completed", &lua_are_tasks_completed),
|
luabind::def("are_tasks_completed", &lua_are_tasks_completed),
|
||||||
|
luabind::def("spawn_circle", &lua_spawn_circle),
|
||||||
|
luabind::def("spawn_grid", &lua_spawn_grid),
|
||||||
/*
|
/*
|
||||||
Cross Zone
|
Cross Zone
|
||||||
*/
|
*/
|
||||||
@@ -6583,7 +6595,7 @@ luabind::scope lua_register_general() {
|
|||||||
luabind::def("cross_zone_reset_activity_by_guild_id", &lua_cross_zone_reset_activity_by_guild_id),
|
luabind::def("cross_zone_reset_activity_by_guild_id", &lua_cross_zone_reset_activity_by_guild_id),
|
||||||
luabind::def("cross_zone_reset_activity_by_expedition_id", &lua_cross_zone_reset_activity_by_expedition_id),
|
luabind::def("cross_zone_reset_activity_by_expedition_id", &lua_cross_zone_reset_activity_by_expedition_id),
|
||||||
luabind::def("cross_zone_reset_activity_by_client_name", &lua_cross_zone_reset_activity_by_client_name),
|
luabind::def("cross_zone_reset_activity_by_client_name", &lua_cross_zone_reset_activity_by_client_name),
|
||||||
luabind::def("cross_zone_set_entity_variable_by_client_name", &lua_cross_zone_set_entity_variable_by_client_name),
|
luabind::def("cross_zone_set_entity_variable_by_char_id", &lua_cross_zone_set_entity_variable_by_char_id),
|
||||||
luabind::def("cross_zone_set_entity_variable_by_group_id", &lua_cross_zone_set_entity_variable_by_group_id),
|
luabind::def("cross_zone_set_entity_variable_by_group_id", &lua_cross_zone_set_entity_variable_by_group_id),
|
||||||
luabind::def("cross_zone_set_entity_variable_by_raid_id", &lua_cross_zone_set_entity_variable_by_raid_id),
|
luabind::def("cross_zone_set_entity_variable_by_raid_id", &lua_cross_zone_set_entity_variable_by_raid_id),
|
||||||
luabind::def("cross_zone_set_entity_variable_by_guild_id", &lua_cross_zone_set_entity_variable_by_guild_id),
|
luabind::def("cross_zone_set_entity_variable_by_guild_id", &lua_cross_zone_set_entity_variable_by_guild_id),
|
||||||
@@ -6772,7 +6784,6 @@ luabind::scope lua_register_random() {
|
|||||||
)];
|
)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
luabind::scope lua_register_events() {
|
luabind::scope lua_register_events() {
|
||||||
return luabind::class_<Events>("Event")
|
return luabind::class_<Events>("Event")
|
||||||
.enum_("constants")
|
.enum_("constants")
|
||||||
@@ -8008,7 +8019,6 @@ luabind::scope lua_register_journal_mode() {
|
|||||||
)];
|
)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
luabind::scope lua_register_exp_source() {
|
luabind::scope lua_register_exp_source() {
|
||||||
return luabind::class_<ExpSource>("ExpSource")
|
return luabind::class_<ExpSource>("ExpSource")
|
||||||
.enum_("constants")
|
.enum_("constants")
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ luabind::scope lua_register_rules_const();
|
|||||||
luabind::scope lua_register_rulei();
|
luabind::scope lua_register_rulei();
|
||||||
luabind::scope lua_register_ruler();
|
luabind::scope lua_register_ruler();
|
||||||
luabind::scope lua_register_ruleb();
|
luabind::scope lua_register_ruleb();
|
||||||
|
luabind::scope lua_register_rules();
|
||||||
luabind::scope lua_register_journal_speakmode();
|
luabind::scope lua_register_journal_speakmode();
|
||||||
luabind::scope lua_register_journal_mode();
|
luabind::scope lua_register_journal_mode();
|
||||||
|
luabind::scope lua_register_exp_source();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+5
-1
@@ -42,6 +42,7 @@
|
|||||||
#include "lua_spawn.h"
|
#include "lua_spawn.h"
|
||||||
#include "lua_spell.h"
|
#include "lua_spell.h"
|
||||||
#include "lua_stat_bonuses.h"
|
#include "lua_stat_bonuses.h"
|
||||||
|
#include "lua_database.h"
|
||||||
|
|
||||||
const char *LuaEvents[_LargestEventID] = {
|
const char *LuaEvents[_LargestEventID] = {
|
||||||
"event_say",
|
"event_say",
|
||||||
@@ -1312,11 +1313,14 @@ void LuaParser::MapFunctions(lua_State *L) {
|
|||||||
lua_register_rulei(),
|
lua_register_rulei(),
|
||||||
lua_register_ruler(),
|
lua_register_ruler(),
|
||||||
lua_register_ruleb(),
|
lua_register_ruleb(),
|
||||||
|
lua_register_rules(),
|
||||||
lua_register_journal_speakmode(),
|
lua_register_journal_speakmode(),
|
||||||
lua_register_journal_mode(),
|
lua_register_journal_mode(),
|
||||||
lua_register_expedition(),
|
lua_register_expedition(),
|
||||||
lua_register_expedition_lock_messages(),
|
lua_register_expedition_lock_messages(),
|
||||||
lua_register_buff()
|
lua_register_buff(),
|
||||||
|
lua_register_exp_source(),
|
||||||
|
lua_register_database()
|
||||||
)];
|
)];
|
||||||
|
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
|
|||||||
+25
-37
@@ -1266,8 +1266,6 @@ void Mob::CreateSpawnPacket(EQApplicationPacket* app, NewSpawn_Struct* ns) {
|
|||||||
} else {
|
} else {
|
||||||
strcpy(ns2->spawn.lastName, ns->spawn.lastName);
|
strcpy(ns2->spawn.lastName, ns->spawn.lastName);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&app->pBuffer[sizeof(Spawn_Struct)-7], 0xFF, 7);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||||
@@ -2050,19 +2048,19 @@ void Mob::SendStatsWindow(Client* c, bool use_window)
|
|||||||
case 0: {
|
case 0: {
|
||||||
mod2a_name = "Avoidance";
|
mod2a_name = "Avoidance";
|
||||||
mod2b_name = "Combat Effects";
|
mod2b_name = "Combat Effects";
|
||||||
mod2a_cap = Strings::Commify(RuleI(Character, ItemAvoidanceCap));
|
mod2a_cap = RuleI(Character, ItemAvoidanceCap);
|
||||||
mod2b_cap = Strings::Commify(RuleI(Character, ItemCombatEffectsCap));
|
mod2b_cap = RuleI(Character, ItemCombatEffectsCap);
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2a = Strings::Commify(CastToBot()->GetAvoidance());
|
mod2a = CastToBot()->GetAvoidance();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2a = Strings::Commify(CastToClient()->GetAvoidance());
|
mod2a = CastToClient()->GetAvoidance();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2b = Strings::Commify(CastToBot()->GetCombatEffects());
|
mod2b = CastToBot()->GetCombatEffects();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2b = Strings::Commify(CastToClient()->GetCombatEffects());
|
mod2b = CastToClient()->GetCombatEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -2070,19 +2068,19 @@ void Mob::SendStatsWindow(Client* c, bool use_window)
|
|||||||
case 1: {
|
case 1: {
|
||||||
mod2a_name = "Accuracy";
|
mod2a_name = "Accuracy";
|
||||||
mod2b_name = "Strikethrough";
|
mod2b_name = "Strikethrough";
|
||||||
mod2a_cap = Strings::Commify(RuleI(Character, ItemAccuracyCap));
|
mod2a_cap = RuleI(Character, ItemAccuracyCap);
|
||||||
mod2b_cap = Strings::Commify(RuleI(Character, ItemStrikethroughCap));
|
mod2b_cap = RuleI(Character, ItemStrikethroughCap);
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2a = Strings::Commify(CastToBot()->GetAccuracy());
|
mod2a = CastToBot()->GetAccuracy();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2a = Strings::Commify(CastToClient()->GetAccuracy());
|
mod2a = CastToClient()->GetAccuracy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2b = Strings::Commify(CastToBot()->GetStrikeThrough());
|
mod2b = CastToBot()->GetStrikeThrough();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2b = Strings::Commify(CastToClient()->GetStrikeThrough());
|
mod2b = CastToClient()->GetStrikeThrough();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -2090,20 +2088,20 @@ void Mob::SendStatsWindow(Client* c, bool use_window)
|
|||||||
case 2: {
|
case 2: {
|
||||||
mod2a_name = "Shielding";
|
mod2a_name = "Shielding";
|
||||||
mod2b_name = "Spell Shielding";
|
mod2b_name = "Spell Shielding";
|
||||||
mod2a_cap = Strings::Commify(RuleI(Character, ItemShieldingCap));
|
mod2a_cap = RuleI(Character, ItemShieldingCap);
|
||||||
mod2b_cap = Strings::Commify(RuleI(Character, ItemSpellShieldingCap));
|
mod2b_cap = RuleI(Character, ItemSpellShieldingCap);
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2a = Strings::Commify(CastToBot()->GetShielding());
|
mod2a = CastToBot()->GetShielding();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2a = Strings::Commify(CastToClient()->GetShielding());
|
mod2a = CastToClient()->GetShielding();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2b = Strings::Commify(CastToBot()->GetSpellShield());
|
mod2b = CastToBot()->GetSpellShield();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2b = Strings::Commify(CastToClient()->GetSpellShield());
|
mod2b = CastToClient()->GetSpellShield();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -2111,19 +2109,19 @@ void Mob::SendStatsWindow(Client* c, bool use_window)
|
|||||||
case 3: {
|
case 3: {
|
||||||
mod2a_name = "Stun Resist";
|
mod2a_name = "Stun Resist";
|
||||||
mod2b_name = "DOT Shielding";
|
mod2b_name = "DOT Shielding";
|
||||||
mod2a_cap = Strings::Commify(RuleI(Character, ItemStunResistCap));
|
mod2a_cap = RuleI(Character, ItemStunResistCap);
|
||||||
mod2b_cap = Strings::Commify(RuleI(Character, ItemDoTShieldingCap));
|
mod2b_cap = RuleI(Character, ItemDoTShieldingCap);
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2a = Strings::Commify(CastToBot()->GetStunResist());
|
mod2a = CastToBot()->GetStunResist();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2a = Strings::Commify(CastToClient()->GetStunResist());
|
mod2a = CastToClient()->GetStunResist();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsBot()) {
|
if (IsBot()) {
|
||||||
mod2b = Strings::Commify(CastToBot()->GetDoTShield());
|
mod2b = CastToBot()->GetDoTShield();
|
||||||
} else if (IsClient()) {
|
} else if (IsClient()) {
|
||||||
mod2b = Strings::Commify(CastToClient()->GetDoTShield());
|
mod2b = CastToClient()->GetDoTShield();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -8584,6 +8582,7 @@ bool Mob::HasBotAttackFlag(Mob* tar) {
|
|||||||
const uint16 scan_close_mobs_timer_moving = 6000; // 6 seconds
|
const uint16 scan_close_mobs_timer_moving = 6000; // 6 seconds
|
||||||
const uint16 scan_close_mobs_timer_idle = 60000; // 60 seconds
|
const uint16 scan_close_mobs_timer_idle = 60000; // 60 seconds
|
||||||
|
|
||||||
|
// If the moving timer triggers, lets see if we are moving or idle to restart the appropriate dynamic timer
|
||||||
void Mob::CheckScanCloseMobsMovingTimer()
|
void Mob::CheckScanCloseMobsMovingTimer()
|
||||||
{
|
{
|
||||||
LogAIScanCloseDetail(
|
LogAIScanCloseDetail(
|
||||||
@@ -8593,9 +8592,6 @@ void Mob::CheckScanCloseMobsMovingTimer()
|
|||||||
m_scan_close_mobs_timer.GetRemainingTime()
|
m_scan_close_mobs_timer.GetRemainingTime()
|
||||||
);
|
);
|
||||||
|
|
||||||
// If the moving timer triggers, lets see if we are moving or idle to restart the appropriate
|
|
||||||
// dynamic timer
|
|
||||||
if (m_mob_check_moving_timer.Check()) {
|
|
||||||
// If the mob is still moving, restart the moving timer
|
// If the mob is still moving, restart the moving timer
|
||||||
if (moving) {
|
if (moving) {
|
||||||
if (m_scan_close_mobs_timer.GetRemainingTime() > scan_close_mobs_timer_moving) {
|
if (m_scan_close_mobs_timer.GetRemainingTime() > scan_close_mobs_timer_moving) {
|
||||||
@@ -8612,14 +8608,6 @@ void Mob::CheckScanCloseMobsMovingTimer()
|
|||||||
m_scan_close_mobs_timer.Start(scan_close_mobs_timer_idle);
|
m_scan_close_mobs_timer.Start(scan_close_mobs_timer_idle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Mob::ScanCloseMobProcess()
|
|
||||||
{
|
|
||||||
if (m_scan_close_mobs_timer.Check()) {
|
|
||||||
entity_list.ScanCloseMobs(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unordered_map<uint16, Mob *> &Mob::GetCloseMobList(float distance)
|
std::unordered_map<uint16, Mob *> &Mob::GetCloseMobList(float distance)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1488,7 +1488,6 @@ public:
|
|||||||
|
|
||||||
bool IsCloseToBanker();
|
bool IsCloseToBanker();
|
||||||
|
|
||||||
void ScanCloseMobProcess();
|
|
||||||
std::unordered_map<uint16, Mob *> &GetCloseMobList(float distance = 0.0f);
|
std::unordered_map<uint16, Mob *> &GetCloseMobList(float distance = 0.0f);
|
||||||
void CheckScanCloseMobsMovingTimer();
|
void CheckScanCloseMobsMovingTimer();
|
||||||
|
|
||||||
|
|||||||
+41
-9
@@ -601,8 +601,13 @@ bool NPC::Process()
|
|||||||
DepopSwarmPets();
|
DepopSwarmPets();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanCloseMobProcess();
|
if (m_scan_close_mobs_timer.Check()) {
|
||||||
|
entity_list.ScanCloseMobs(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_mob_check_moving_timer.Check()) {
|
||||||
CheckScanCloseMobsMovingTimer();
|
CheckScanCloseMobsMovingTimer();
|
||||||
|
}
|
||||||
|
|
||||||
if (hp_regen_per_second > 0 && hp_regen_per_second_timer.Check()) {
|
if (hp_regen_per_second > 0 && hp_regen_per_second_timer.Check()) {
|
||||||
if (GetHP() < GetMaxHP()) {
|
if (GetHP() < GetMaxHP()) {
|
||||||
@@ -2151,6 +2156,7 @@ void NPC::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
|||||||
UpdateActiveLight();
|
UpdateActiveLight();
|
||||||
ns->spawn.light = GetActiveLightType();
|
ns->spawn.light = GetActiveLightType();
|
||||||
ns->spawn.show_name = NPCTypedata->show_name;
|
ns->spawn.show_name = NPCTypedata->show_name;
|
||||||
|
ns->spawn.trader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPC::PetOnSpawn(NewSpawn_Struct* ns)
|
void NPC::PetOnSpawn(NewSpawn_Struct* ns)
|
||||||
@@ -3291,16 +3297,28 @@ uint32 NPC::GetSpawnKillCount()
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPC::DoQuestPause(Mob *other) {
|
void NPC::DoQuestPause(Mob* m)
|
||||||
if(IsMoving() && !IsOnHatelist(other)) {
|
{
|
||||||
PauseWandering(RuleI(NPC, SayPauseTimeInSec));
|
if (!m) {
|
||||||
if (other && !other->sneaking)
|
return;
|
||||||
FaceTarget(other);
|
|
||||||
} else if(!IsMoving()) {
|
|
||||||
if (other && !other->sneaking && GetAppearance() != eaSitting && GetAppearance() != eaDead)
|
|
||||||
FaceTarget(other);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsMoving() && !IsOnHatelist(m)) {
|
||||||
|
PauseWandering(RuleI(NPC, SayPauseTimeInSec));
|
||||||
|
|
||||||
|
if (FacesTarget() && !m->sneaking) {
|
||||||
|
FaceTarget(m);
|
||||||
|
}
|
||||||
|
} else if (!IsMoving()) {
|
||||||
|
if (
|
||||||
|
FacesTarget() &&
|
||||||
|
!m->sneaking &&
|
||||||
|
GetAppearance() != eaSitting &&
|
||||||
|
GetAppearance() != eaDead
|
||||||
|
) {
|
||||||
|
FaceTarget(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPC::ChangeLastName(std::string last_name)
|
void NPC::ChangeLastName(std::string last_name)
|
||||||
@@ -4232,3 +4250,17 @@ void NPC::DoNpcToNpcAggroScan()
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NPC::FacesTarget()
|
||||||
|
{
|
||||||
|
const std::string& excluded_races_rule = RuleS(NPC, ExcludedFaceTargetRaces);
|
||||||
|
|
||||||
|
if (excluded_races_rule.empty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& v = Strings::Split(excluded_races_rule, ",");
|
||||||
|
|
||||||
|
return std::find(v.begin(), v.end(), std::to_string(GetBaseRace())) == v.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -482,7 +482,8 @@ public:
|
|||||||
NPC_Emote_Struct* GetNPCEmote(uint32 emote_id, uint8 event_);
|
NPC_Emote_Struct* GetNPCEmote(uint32 emote_id, uint8 event_);
|
||||||
void DoNPCEmote(uint8 event_, uint32 emote_id, Mob* t = nullptr);
|
void DoNPCEmote(uint8 event_, uint32 emote_id, Mob* t = nullptr);
|
||||||
bool CanTalk();
|
bool CanTalk();
|
||||||
void DoQuestPause(Mob *other);
|
void DoQuestPause(Mob* m);
|
||||||
|
bool FacesTarget();
|
||||||
|
|
||||||
inline void SetSpellScale(float amt) { spellscale = amt; }
|
inline void SetSpellScale(float amt) { spellscale = amt; }
|
||||||
inline float GetSpellScale() { return spellscale; }
|
inline float GetSpellScale() { return spellscale; }
|
||||||
|
|||||||
+14
-2
@@ -278,6 +278,19 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parcel_in->money_flag && parcel_in->item_slot != INVALID_INDEX) {
|
||||||
|
Message(
|
||||||
|
Chat::Yellow,
|
||||||
|
fmt::format(
|
||||||
|
"{} tells you, 'I am confused! Do you want to send money or an item?'",
|
||||||
|
merchant->GetCleanName()
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
DoParcelCancel();
|
||||||
|
SendParcelAck();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto num_of_parcels = GetParcelCount();
|
auto num_of_parcels = GetParcelCount();
|
||||||
if (num_of_parcels >= RuleI(Parcel, ParcelMaxItems)) {
|
if (num_of_parcels >= RuleI(Parcel, ParcelMaxItems)) {
|
||||||
SendParcelIconStatus();
|
SendParcelIconStatus();
|
||||||
@@ -406,9 +419,8 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
|
|||||||
|
|
||||||
std::vector<CharacterParcelsContainersRepository::CharacterParcelsContainers> all_entries{};
|
std::vector<CharacterParcelsContainersRepository::CharacterParcelsContainers> all_entries{};
|
||||||
if (inst->IsNoneEmptyContainer()) {
|
if (inst->IsNoneEmptyContainer()) {
|
||||||
CharacterParcelsContainersRepository::CharacterParcelsContainers cpc{};
|
|
||||||
|
|
||||||
for (auto const &kv: *inst->GetContents()) {
|
for (auto const &kv: *inst->GetContents()) {
|
||||||
|
CharacterParcelsContainersRepository::CharacterParcelsContainers cpc{};
|
||||||
cpc.parcels_id = result.id;
|
cpc.parcels_id = result.id;
|
||||||
cpc.slot_id = kv.first;
|
cpc.slot_id = kv.first;
|
||||||
cpc.item_id = kv.second->GetID();
|
cpc.item_id = kv.second->GetID();
|
||||||
|
|||||||
@@ -0,0 +1,255 @@
|
|||||||
|
#include "../common/features.h"
|
||||||
|
|
||||||
|
#ifdef EMBPERL_XS_CLASSES
|
||||||
|
|
||||||
|
#include "embperl.h"
|
||||||
|
#include "perl_database.h"
|
||||||
|
#include "zonedb.h"
|
||||||
|
|
||||||
|
// Perl takes ownership of returned objects allocated with new and deletes
|
||||||
|
// them via the DESTROY method when the last perl reference goes out of scope
|
||||||
|
|
||||||
|
void Perl_Database::Destroy(Perl_Database* ptr)
|
||||||
|
{
|
||||||
|
delete ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Perl_Database* Perl_Database::Connect()
|
||||||
|
{
|
||||||
|
return new Perl_Database();
|
||||||
|
}
|
||||||
|
|
||||||
|
Perl_Database* Perl_Database::Connect(Connection type)
|
||||||
|
{
|
||||||
|
return new Perl_Database(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
Perl_Database* Perl_Database::Connect(Connection type, bool connect)
|
||||||
|
{
|
||||||
|
return new Perl_Database(type, connect);
|
||||||
|
}
|
||||||
|
|
||||||
|
Perl_Database* Perl_Database::Connect(const char* host, const char* user, const char* pass, const char* db, uint32_t port)
|
||||||
|
{
|
||||||
|
return new Perl_Database(host, user, pass, db, port);
|
||||||
|
}
|
||||||
|
|
||||||
|
Perl_MySQLPreparedStmt* Perl_Database::Prepare(std::string query)
|
||||||
|
{
|
||||||
|
return m_db ? new Perl_MySQLPreparedStmt(m_db->Prepare(std::move(query))) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl_Database::Close()
|
||||||
|
{
|
||||||
|
m_db.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void Perl_MySQLPreparedStmt::Destroy(Perl_MySQLPreparedStmt* ptr)
|
||||||
|
{
|
||||||
|
delete ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl_MySQLPreparedStmt::Close()
|
||||||
|
{
|
||||||
|
m_stmt.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl_MySQLPreparedStmt::Execute()
|
||||||
|
{
|
||||||
|
if (m_stmt)
|
||||||
|
{
|
||||||
|
m_res = m_stmt->Execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl_MySQLPreparedStmt::Execute(perl::array args)
|
||||||
|
{
|
||||||
|
// passes all script args as strings
|
||||||
|
if (m_stmt)
|
||||||
|
{
|
||||||
|
std::vector<mysql::PreparedStmt::param_t> inputs;
|
||||||
|
for (const perl::scalar& arg : args)
|
||||||
|
{
|
||||||
|
if (arg.is_null())
|
||||||
|
{
|
||||||
|
inputs.emplace_back(nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inputs.emplace_back(arg.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_res = m_stmt->Execute(inputs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Perl_MySQLPreparedStmt::SetOptions(perl::hash hash)
|
||||||
|
{
|
||||||
|
if (m_stmt)
|
||||||
|
{
|
||||||
|
mysql::StmtOptions opts = m_stmt->GetOptions();
|
||||||
|
if (hash.exists("buffer_results"))
|
||||||
|
{
|
||||||
|
opts.buffer_results = hash["buffer_results"].as<bool>();
|
||||||
|
}
|
||||||
|
if (hash.exists("use_max_length"))
|
||||||
|
{
|
||||||
|
opts.use_max_length = hash["use_max_length"].as<bool>();
|
||||||
|
}
|
||||||
|
m_stmt->SetOptions(opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PushValue(PerlInterpreter* my_perl, SV* sv, const mysql::StmtColumn& col)
|
||||||
|
{
|
||||||
|
if (col.IsNull())
|
||||||
|
{
|
||||||
|
sv_setsv(sv, &PL_sv_undef);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (col.Type())
|
||||||
|
{
|
||||||
|
case MYSQL_TYPE_TINY:
|
||||||
|
case MYSQL_TYPE_SHORT:
|
||||||
|
case MYSQL_TYPE_INT24:
|
||||||
|
case MYSQL_TYPE_LONG:
|
||||||
|
case MYSQL_TYPE_LONGLONG:
|
||||||
|
case MYSQL_TYPE_BIT:
|
||||||
|
if (col.IsUnsigned())
|
||||||
|
{
|
||||||
|
sv_setuv(sv, col.Get<UV>().value());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sv_setiv(sv, col.Get<IV>().value());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MYSQL_TYPE_FLOAT:
|
||||||
|
case MYSQL_TYPE_DOUBLE:
|
||||||
|
sv_setnv(sv, col.Get<NV>().value());
|
||||||
|
break;
|
||||||
|
case MYSQL_TYPE_TIME:
|
||||||
|
case MYSQL_TYPE_DATE:
|
||||||
|
case MYSQL_TYPE_DATETIME:
|
||||||
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
|
{
|
||||||
|
std::string str = col.GetStr().value();
|
||||||
|
sv_setpvn(sv, str.data(), str.size());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: // string types, push raw buffer to avoid copy
|
||||||
|
{
|
||||||
|
std::string_view str = col.GetStrView().value();
|
||||||
|
sv_setpvn(sv, str.data(), str.size());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
perl::array Perl_MySQLPreparedStmt::FetchArray()
|
||||||
|
{
|
||||||
|
auto row = m_stmt ? m_stmt->Fetch() : mysql::StmtRow();
|
||||||
|
if (!row)
|
||||||
|
{
|
||||||
|
return perl::array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// perf: bypass perlbind operator[]/push and use cache to limit SV allocs
|
||||||
|
dTHX;
|
||||||
|
AV* av = static_cast<AV*>(m_row_array);
|
||||||
|
for (const mysql::StmtColumn& col : row)
|
||||||
|
{
|
||||||
|
SV** sv = av_fetch(av, col.Index(), true);
|
||||||
|
PushValue(my_perl, *sv, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
SvREFCNT_inc(av); // return a ref to our cache (no copy)
|
||||||
|
return perl::array(std::move(av));
|
||||||
|
}
|
||||||
|
|
||||||
|
perl::reference Perl_MySQLPreparedStmt::FetchArrayRef()
|
||||||
|
{
|
||||||
|
perl::array array = FetchArray();
|
||||||
|
return array.size() == 0 ? perl::reference() : perl::reference(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
perl::reference Perl_MySQLPreparedStmt::FetchHashRef()
|
||||||
|
{
|
||||||
|
auto row = m_stmt ? m_stmt->Fetch() : mysql::StmtRow();
|
||||||
|
if (!row)
|
||||||
|
{
|
||||||
|
return perl::reference();
|
||||||
|
}
|
||||||
|
|
||||||
|
// perf: bypass perlbind operator[] and use cache to limit SV allocs
|
||||||
|
dTHX;
|
||||||
|
HV* hv = static_cast<HV*>(m_row_hash);
|
||||||
|
for (const mysql::StmtColumn& col : row)
|
||||||
|
{
|
||||||
|
SV** sv = hv_fetch(hv, col.Name().c_str(), static_cast<I32>(col.Name().size()), true);
|
||||||
|
PushValue(my_perl, *sv, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
SvREFCNT_inc(hv); // return a ref to our cache (no copy)
|
||||||
|
return perl::reference(std::move(hv));
|
||||||
|
}
|
||||||
|
|
||||||
|
int Perl_MySQLPreparedStmt::ColumnCount()
|
||||||
|
{
|
||||||
|
return m_res.ColumnCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Perl_MySQLPreparedStmt::LastInsertID()
|
||||||
|
{
|
||||||
|
return m_res.LastInsertID();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Perl_MySQLPreparedStmt::RowCount()
|
||||||
|
{
|
||||||
|
return m_res.RowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Perl_MySQLPreparedStmt::RowsAffected()
|
||||||
|
{
|
||||||
|
return m_res.RowsAffected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void perl_register_database()
|
||||||
|
{
|
||||||
|
perl::interpreter perl(PERL_GET_THX);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto package = perl.new_class<Perl_Database>("Database");
|
||||||
|
package.add_const("Default", static_cast<int>(QuestDB::Connection::Default));
|
||||||
|
package.add_const("Content", static_cast<int>(QuestDB::Connection::Content));
|
||||||
|
package.add("DESTROY", &Perl_Database::Destroy);
|
||||||
|
package.add("new", static_cast<Perl_Database*(*)()>(&Perl_Database::Connect));
|
||||||
|
package.add("new", static_cast<Perl_Database*(*)(QuestDB::Connection)>(&Perl_Database::Connect));
|
||||||
|
package.add("new", static_cast<Perl_Database*(*)(QuestDB::Connection, bool)>(&Perl_Database::Connect));
|
||||||
|
package.add("new", static_cast<Perl_Database*(*)(const char*, const char*, const char*, const char*, uint32_t)>(&Perl_Database::Connect));
|
||||||
|
package.add("close", &Perl_Database::Close);
|
||||||
|
package.add("prepare", &Perl_Database::Prepare);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto package = perl.new_class<Perl_MySQLPreparedStmt>("MySQLPreparedStmt");
|
||||||
|
package.add("DESTROY", &Perl_MySQLPreparedStmt::Destroy);
|
||||||
|
package.add("close", &Perl_MySQLPreparedStmt::Close);
|
||||||
|
package.add("execute", static_cast<void(Perl_MySQLPreparedStmt::*)()>(&Perl_MySQLPreparedStmt::Execute));
|
||||||
|
package.add("execute", static_cast<void(Perl_MySQLPreparedStmt::*)(perl::array)>(&Perl_MySQLPreparedStmt::Execute));
|
||||||
|
package.add("fetch", &Perl_MySQLPreparedStmt::FetchArray);
|
||||||
|
package.add("fetch_array", &Perl_MySQLPreparedStmt::FetchArray);
|
||||||
|
package.add("fetch_arrayref", &Perl_MySQLPreparedStmt::FetchArrayRef);
|
||||||
|
package.add("fetch_hashref", &Perl_MySQLPreparedStmt::FetchHashRef);
|
||||||
|
package.add("insert_id", &Perl_MySQLPreparedStmt::LastInsertID);
|
||||||
|
package.add("num_fields", &Perl_MySQLPreparedStmt::ColumnCount);
|
||||||
|
package.add("num_rows", &Perl_MySQLPreparedStmt::RowCount);
|
||||||
|
package.add("rows_affected", &Perl_MySQLPreparedStmt::RowsAffected);
|
||||||
|
package.add("set_options", &Perl_MySQLPreparedStmt::SetOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // EMBPERL_XS_CLASSES
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "quest_db.h"
|
||||||
|
#include "../common/mysql_stmt.h"
|
||||||
|
|
||||||
|
class Perl_MySQLPreparedStmt;
|
||||||
|
|
||||||
|
class Perl_Database : public QuestDB
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using QuestDB::QuestDB;
|
||||||
|
|
||||||
|
static void Destroy(Perl_Database* ptr);
|
||||||
|
static Perl_Database* Connect();
|
||||||
|
static Perl_Database* Connect(Connection type);
|
||||||
|
static Perl_Database* Connect(Connection type, bool connect);
|
||||||
|
static Perl_Database* Connect(const char* host, const char* user, const char* pass, const char* db, uint32_t port);
|
||||||
|
|
||||||
|
void Close();
|
||||||
|
Perl_MySQLPreparedStmt* Prepare(std::string query);
|
||||||
|
};
|
||||||
|
|
||||||
|
class Perl_MySQLPreparedStmt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Perl_MySQLPreparedStmt(mysql::PreparedStmt&& stmt)
|
||||||
|
: m_stmt(std::make_unique<mysql::PreparedStmt>(std::move(stmt))) {}
|
||||||
|
|
||||||
|
static void Destroy(Perl_MySQLPreparedStmt* ptr);
|
||||||
|
|
||||||
|
void Close();
|
||||||
|
void Execute();
|
||||||
|
void Execute(perl::array args);
|
||||||
|
void SetOptions(perl::hash hash_opts);
|
||||||
|
perl::array FetchArray();
|
||||||
|
perl::reference FetchArrayRef();
|
||||||
|
perl::reference FetchHashRef();
|
||||||
|
|
||||||
|
// StmtResult functions accessible through this class to simplify api
|
||||||
|
int ColumnCount();
|
||||||
|
uint64_t LastInsertID();
|
||||||
|
uint64_t RowCount();
|
||||||
|
uint64_t RowsAffected();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<mysql::PreparedStmt> m_stmt;
|
||||||
|
mysql::StmtResult m_res = {};
|
||||||
|
perl::array m_row_array; // perf: cache for fetches
|
||||||
|
perl::hash m_row_hash;
|
||||||
|
};
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#include "quest_db.h"
|
||||||
|
#include "zonedb.h"
|
||||||
|
#include "zone_config.h"
|
||||||
|
|
||||||
|
// New connections avoid concurrency issues and allow use of unbuffered results
|
||||||
|
// with prepared statements. Using zone connections w/o buffering would cause
|
||||||
|
// "Commands out of sync" errors if any queries occur before results consumed.
|
||||||
|
QuestDB::QuestDB(Connection type, bool connect)
|
||||||
|
{
|
||||||
|
if (connect)
|
||||||
|
{
|
||||||
|
m_db = std::unique_ptr<Database, Deleter>(new Database(), Deleter(true));
|
||||||
|
|
||||||
|
const auto config = EQEmuConfig::get();
|
||||||
|
|
||||||
|
if (type == Connection::Default || type == Connection::Content && config->ContentDbHost.empty())
|
||||||
|
{
|
||||||
|
m_db->Connect(config->DatabaseHost, config->DatabaseUsername, config->DatabasePassword,
|
||||||
|
config->DatabaseDB, config->DatabasePort, "questdb");
|
||||||
|
}
|
||||||
|
else if (type == Connection::Content)
|
||||||
|
{
|
||||||
|
m_db->Connect(config->ContentDbHost, config->ContentDbUsername, config->ContentDbPassword,
|
||||||
|
config->ContentDbName, config->ContentDbPort, "questdb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == Connection::Default)
|
||||||
|
{
|
||||||
|
m_db = std::unique_ptr<Database, Deleter>(&database, Deleter(false));
|
||||||
|
}
|
||||||
|
else if (type == Connection::Content)
|
||||||
|
{
|
||||||
|
m_db = std::unique_ptr<Database, Deleter>(&content_db, Deleter(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_db || (connect && m_db->GetStatus() != DBcore::Connected))
|
||||||
|
{
|
||||||
|
throw std::runtime_error(fmt::format("Failed to connect to db type [{}]", static_cast<int>(type)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QuestDB::QuestDB(const char* host, const char* user, const char* pass, const char* db, uint32_t port)
|
||||||
|
: m_db(new Database(), Deleter(true))
|
||||||
|
{
|
||||||
|
if (!m_db->Connect(host, user, pass, db, port, "questdb"))
|
||||||
|
{
|
||||||
|
throw std::runtime_error(fmt::format("Failed to connect to db [{}:{}]", host, port));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuestDB::Deleter::operator()(Database* ptr) noexcept
|
||||||
|
{
|
||||||
|
if (owner)
|
||||||
|
{
|
||||||
|
delete ptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
class Database;
|
||||||
|
|
||||||
|
// Base class for quest apis to manage connection to a MySQL database
|
||||||
|
class QuestDB
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum class Connection { Default = 0, Content };
|
||||||
|
|
||||||
|
// Throws std::runtime_error on connection failure
|
||||||
|
QuestDB() : QuestDB(Connection::Default) {}
|
||||||
|
QuestDB(Connection type) : QuestDB(type, false) {}
|
||||||
|
QuestDB(Connection type, bool connect);
|
||||||
|
QuestDB(const char* host, const char* user, const char* pass, const char* db, uint32_t port);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// allow optional ownership of pointer to support using zone db connections
|
||||||
|
struct Deleter
|
||||||
|
{
|
||||||
|
Deleter() : owner(true) {}
|
||||||
|
Deleter(bool owner_) : owner(owner_) {}
|
||||||
|
bool owner = true;
|
||||||
|
void operator()(Database* ptr) noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<Database, Deleter> m_db;
|
||||||
|
};
|
||||||
@@ -4623,3 +4623,78 @@ bool QuestManager::SetAutoLoginCharacterNameByAccountID(uint32 account_id, const
|
|||||||
{
|
{
|
||||||
return AccountRepository::SetAutoLoginCharacterNameByAccountID(database, account_id, character_name);
|
return AccountRepository::SetAutoLoginCharacterNameByAccountID(database, account_id, character_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuestManager::SpawnCircle(uint32 npc_id, glm::vec4 position, float radius, uint32 points)
|
||||||
|
{
|
||||||
|
const NPCType* t = content_db.LoadNPCTypesData(npc_id);
|
||||||
|
if (!t) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec4 npc_position = position;
|
||||||
|
|
||||||
|
for (uint32 i = 0; i < points; i++) {
|
||||||
|
float angle = 2 * M_PI * i / points;
|
||||||
|
|
||||||
|
npc_position.x = position.x + radius * std::cos(angle);
|
||||||
|
npc_position.y = position.y + radius * std::sin(angle);
|
||||||
|
|
||||||
|
NPC* n = new NPC(t, nullptr, npc_position, GravityBehavior::Water);
|
||||||
|
|
||||||
|
n->FixZ();
|
||||||
|
|
||||||
|
n->AddLootTable();
|
||||||
|
|
||||||
|
if (n->DropsGlobalLoot()) {
|
||||||
|
n->CheckGlobalLootTables();
|
||||||
|
}
|
||||||
|
|
||||||
|
entity_list.AddNPC(n, true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuestManager::SpawnGrid(uint32 npc_id, glm::vec4 position, float spacing, uint32 spawn_count)
|
||||||
|
{
|
||||||
|
const NPCType* t = content_db.LoadNPCTypesData(npc_id);
|
||||||
|
if (!t) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec4 npc_position = position;
|
||||||
|
|
||||||
|
uint32 columns = std::ceil(std::sqrt(spawn_count));
|
||||||
|
uint32 rows = std::ceil(spawn_count / columns);
|
||||||
|
|
||||||
|
float total_width = ((columns - 1) * spacing);
|
||||||
|
float total_height = ((rows - 1) * spacing);
|
||||||
|
|
||||||
|
float start_x = position.x - total_width / 2;
|
||||||
|
float start_y = position.y - total_height / 2;
|
||||||
|
|
||||||
|
uint32 spawned = 0;
|
||||||
|
|
||||||
|
for (uint32 row = 0; row < rows; row++) {
|
||||||
|
for (uint32 column = 0; column < columns; column++) {
|
||||||
|
if (spawned >= spawn_count) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
npc_position.x = start_x + column * spacing;
|
||||||
|
npc_position.y = start_y + row * spacing;
|
||||||
|
|
||||||
|
NPC* n = new NPC(t, nullptr, npc_position, GravityBehavior::Water);
|
||||||
|
|
||||||
|
n->FixZ();
|
||||||
|
|
||||||
|
n->AddLootTable();
|
||||||
|
|
||||||
|
if (n->DropsGlobalLoot()) {
|
||||||
|
n->CheckGlobalLootTables();
|
||||||
|
}
|
||||||
|
|
||||||
|
entity_list.AddNPC(n, true, true);
|
||||||
|
|
||||||
|
spawned++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -357,6 +357,8 @@ public:
|
|||||||
void SendChannelMessage(Client* from, const char* to, uint8 channel_number, uint32 guild_id, uint8 language_id, uint8 language_skill, const char* message);
|
void SendChannelMessage(Client* from, const char* to, uint8 channel_number, uint32 guild_id, uint8 language_id, uint8 language_skill, const char* message);
|
||||||
std::string GetAutoLoginCharacterNameByAccountID(uint32 account_id);
|
std::string GetAutoLoginCharacterNameByAccountID(uint32 account_id);
|
||||||
bool SetAutoLoginCharacterNameByAccountID(uint32 account_id, const std::string& character_name);
|
bool SetAutoLoginCharacterNameByAccountID(uint32 account_id, const std::string& character_name);
|
||||||
|
void SpawnCircle(uint32 npc_id, glm::vec4 position, float radius, uint32 points);
|
||||||
|
void SpawnGrid(uint32 npc_id, glm::vec4 position, float spacing, uint32 spawn_count);
|
||||||
|
|
||||||
Bot *GetBot() const;
|
Bot *GetBot() const;
|
||||||
Client *GetInitiator() const;
|
Client *GetInitiator() const;
|
||||||
|
|||||||
@@ -2416,15 +2416,17 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16 focus = RuleB(Spells, AllowFocusOnSkillDamageSpells) ? caster->GetMeleeDamageMod_SE(spells[spell_id].skill) : 0;
|
||||||
|
|
||||||
switch(spells[spell_id].skill) {
|
switch(spells[spell_id].skill) {
|
||||||
case EQ::skills::SkillThrowing:
|
case EQ::skills::SkillThrowing:
|
||||||
caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base_value[i],spells[spell_id].limit_value[i], 0, ReuseTime, 0, 0, 4.0f, true);
|
caster->DoThrowingAttackDmg(this, nullptr, nullptr, spells[spell_id].base_value[i],spells[spell_id].limit_value[i], focus, ReuseTime, 0, 0, 4.0f, true);
|
||||||
break;
|
break;
|
||||||
case EQ::skills::SkillArchery:
|
case EQ::skills::SkillArchery:
|
||||||
caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base_value[i],spells[spell_id].limit_value[i], 0, ReuseTime, 0, 0, nullptr, 0, 4.0f, true);
|
caster->DoArcheryAttackDmg(this, nullptr, nullptr, spells[spell_id].base_value[i],spells[spell_id].limit_value[i], focus, ReuseTime, 0, 0, nullptr, 0, 4.0f, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base_value[i], spells[spell_id].skill, spells[spell_id].limit_value[i], 0, false, ReuseTime);
|
caster->DoMeleeSkillAttackDmg(this, spells[spell_id].base_value[i], spells[spell_id].skill, spells[spell_id].limit_value[i], focus, false, ReuseTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
+18
-3
@@ -777,6 +777,8 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
|
|||||||
tradingWith->SayString(TRADE_BACK, GetCleanName());
|
tradingWith->SayString(TRADE_BACK, GetCleanName());
|
||||||
PushItemOnCursor(*inst, true);
|
PushItemOnCursor(*inst, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
items.clear();
|
||||||
}
|
}
|
||||||
// Only enforce trade rules if the NPC doesn't have an EVENT_TRADE
|
// Only enforce trade rules if the NPC doesn't have an EVENT_TRADE
|
||||||
// subroutine. That overrides all.
|
// subroutine. That overrides all.
|
||||||
@@ -2606,6 +2608,7 @@ void Client::SellToBuyer(const EQApplicationPacket *app)
|
|||||||
data->zone_id = GetZoneID();
|
data->zone_id = GetZoneID();
|
||||||
data->slot = sell_line.slot;
|
data->slot = sell_line.slot;
|
||||||
data->seller_quantity = sell_line.seller_quantity;
|
data->seller_quantity = sell_line.seller_quantity;
|
||||||
|
data->purchase_method = sell_line.purchase_method;
|
||||||
strn0cpy(data->item_name, sell_line.item_name, sizeof(data->item_name));
|
strn0cpy(data->item_name, sell_line.item_name, sizeof(data->item_name));
|
||||||
strn0cpy(data->buyer_name, sell_line.buyer_name.c_str(), sizeof(data->buyer_name));
|
strn0cpy(data->buyer_name, sell_line.buyer_name.c_str(), sizeof(data->buyer_name));
|
||||||
strn0cpy(data->seller_name, GetCleanName(), sizeof(data->seller_name));
|
strn0cpy(data->seller_name, GetCleanName(), sizeof(data->seller_name));
|
||||||
@@ -2916,6 +2919,7 @@ void Client::SendBecomeTraderToWorld(Client *trader, BazaarTraderBarterActions a
|
|||||||
data->entity_id = trader->GetID();
|
data->entity_id = trader->GetID();
|
||||||
data->trader_id = trader->CharacterID();
|
data->trader_id = trader->CharacterID();
|
||||||
data->zone_id = trader->GetZoneID();
|
data->zone_id = trader->GetZoneID();
|
||||||
|
data->instance_id = trader->GetInstanceID();
|
||||||
strn0cpy(data->trader_name, trader->GetName(), sizeof(data->trader_name));
|
strn0cpy(data->trader_name, trader->GetName(), sizeof(data->trader_name));
|
||||||
|
|
||||||
worldserver.SendPacket(outapp);
|
worldserver.SendPacket(outapp);
|
||||||
@@ -3234,7 +3238,10 @@ void Client::SendBulkBazaarTraders()
|
|||||||
|
|
||||||
void Client::DoBazaarInspect(const BazaarInspect_Struct &in)
|
void Client::DoBazaarInspect(const BazaarInspect_Struct &in)
|
||||||
{
|
{
|
||||||
auto items = TraderRepository::GetWhere(database, fmt::format("item_sn = {}", in.serial_number));
|
auto items = TraderRepository::GetWhere(
|
||||||
|
database, fmt::format("`char_id` = '{}' AND `item_sn` = '{}'", in.trader_id, in.serial_number)
|
||||||
|
);
|
||||||
|
|
||||||
if (items.empty()) {
|
if (items.empty()) {
|
||||||
LogInfo("Failed to find item with serial number [{}]", in.serial_number);
|
LogInfo("Failed to find item with serial number [{}]", in.serial_number);
|
||||||
return;
|
return;
|
||||||
@@ -3303,7 +3310,7 @@ std::string Client::DetermineMoneyString(uint64 cp)
|
|||||||
void Client::BuyTraderItemOutsideBazaar(TraderBuy_Struct *tbs, const EQApplicationPacket *app)
|
void Client::BuyTraderItemOutsideBazaar(TraderBuy_Struct *tbs, const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
auto in = (TraderBuy_Struct *) app->pBuffer;
|
auto in = (TraderBuy_Struct *) app->pBuffer;
|
||||||
auto trader_item = TraderRepository::GetItemBySerialNumber(database, tbs->serial_number);
|
auto trader_item = TraderRepository::GetItemBySerialNumber(database, tbs->serial_number, tbs->trader_id);
|
||||||
if (!trader_item.id) {
|
if (!trader_item.id) {
|
||||||
LogTrading("Attempt to purchase an item outside of the Bazaar trader_id <red>[{}] item serial_number "
|
LogTrading("Attempt to purchase an item outside of the Bazaar trader_id <red>[{}] item serial_number "
|
||||||
"<red>[{}] The Traders data was outdated.",
|
"<red>[{}] The Traders data was outdated.",
|
||||||
@@ -3497,7 +3504,7 @@ void Client::BuyTraderItemOutsideBazaar(TraderBuy_Struct *tbs, const EQApplicati
|
|||||||
ps.item_slot = parcel_out.slot_id;
|
ps.item_slot = parcel_out.slot_id;
|
||||||
strn0cpy(ps.send_to, GetCleanName(), sizeof(ps.send_to));
|
strn0cpy(ps.send_to, GetCleanName(), sizeof(ps.send_to));
|
||||||
|
|
||||||
if (trader_item.item_charges <= static_cast<int32>(tbs->quantity)) {
|
if (trader_item.item_charges <= static_cast<int32>(tbs->quantity) || !buy_item->IsStackable()) {
|
||||||
TraderRepository::DeleteOne(database, trader_item.id);
|
TraderRepository::DeleteOne(database, trader_item.id);
|
||||||
} else {
|
} else {
|
||||||
TraderRepository::UpdateQuantity(
|
TraderRepository::UpdateQuantity(
|
||||||
@@ -4252,6 +4259,14 @@ bool Client::DoBarterSellerChecks(BuyerLineSellItem_Struct &sell_line)
|
|||||||
Message(Chat::Red, "The item that you are trying to sell is augmented. Please remove augments first");
|
Message(Chat::Red, "The item that you are trying to sell is augmented. Please remove augments first");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sell_item && !sell_item->IsDroppable()) {
|
||||||
|
seller_error = true;
|
||||||
|
LogTradingDetail("Seller item <red>[{}] is non-tradeable therefore cannot be sold.",
|
||||||
|
sell_line.item_name
|
||||||
|
);
|
||||||
|
Message(Chat::Red, "The item that you are trying to sell is non-tradeable and therefore cannot be sold.");
|
||||||
|
}
|
||||||
|
|
||||||
if (seller_error) {
|
if (seller_error) {
|
||||||
LogTradingDetail("Seller Error <red>[{}] Barter Sell/Buy Transaction Failed.", seller_error);
|
LogTradingDetail("Seller Error <red>[{}] Barter Sell/Buy Transaction Failed.", seller_error);
|
||||||
SendBarterBuyerClientMessage(sell_line, Barter_SellerTransactionComplete, Barter_Failure, Barter_Failure);
|
SendBarterBuyerClientMessage(sell_line, Barter_SellerTransactionComplete, Barter_Failure, Barter_Failure);
|
||||||
|
|||||||
@@ -3942,7 +3942,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
c.second->QueuePacket(outapp);
|
c.second->QueuePacket(outapp);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
if (zone && zone->GetZoneID() == Zones::BAZAAR) {
|
if (zone && zone->GetZoneID() == Zones::BAZAAR && in->instance_id == zone->GetInstanceID()) {
|
||||||
if (in->action == TraderOn) {
|
if (in->action == TraderOn) {
|
||||||
c.second->SendBecomeTrader(TraderOn, in->entity_id);
|
c.second->SendBecomeTrader(TraderOn, in->entity_id);
|
||||||
}
|
}
|
||||||
@@ -4044,6 +4044,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
sell_line.buyer_name = in->buyer_name;
|
sell_line.buyer_name = in->buyer_name;
|
||||||
sell_line.seller_quantity = in->seller_quantity;
|
sell_line.seller_quantity = in->seller_quantity;
|
||||||
sell_line.slot = in->slot;
|
sell_line.slot = in->slot;
|
||||||
|
sell_line.purchase_method = in->purchase_method;
|
||||||
strn0cpy(sell_line.item_name, in->item_name, sizeof(sell_line.item_name));
|
strn0cpy(sell_line.item_name, in->item_name, sizeof(sell_line.item_name));
|
||||||
|
|
||||||
uint64 total_cost = (uint64) sell_line.item_cost * (uint64) sell_line.seller_quantity;
|
uint64 total_cost = (uint64) sell_line.item_cost * (uint64) sell_line.seller_quantity;
|
||||||
|
|||||||
+1
-1
@@ -737,7 +737,7 @@ void Client::ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y,
|
|||||||
ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm);
|
ZonePC(zoneID, instance_id, x, y, z, heading, ignorerestrictions, zm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogError("Client::ProcessMovePC received a reguest to perform an unsupported client zone operation");
|
LogError("Received a request to perform an unsupported client zone operation");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user