mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-26 07:17:16 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cdd95e3023 | |||
| 032cf4f71e | |||
| 1354f73771 | |||
| 17e922b026 | |||
| d9c17511fd | |||
| fe9df46a24 | |||
| 3d7cf4235c | |||
| 187ee10218 | |||
| 6bd758b3dd | |||
| 9938755517 | |||
| 630da0eee6 | |||
| 3158386aa3 | |||
| 12ada57ee8 | |||
| 7a841c11c5 | |||
| a49d1446b7 | |||
| b2d0fa6a2f | |||
| 62ac015fff | |||
| 4977a7c2e0 | |||
| 9967384ab8 | |||
| d3da2e5501 | |||
| 33f5c4c6a7 |
@@ -1,3 +1,37 @@
|
|||||||
|
## [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
|
## [22.59.1] 11/13/2024
|
||||||
|
|
||||||
### Hotfix
|
### Hotfix
|
||||||
|
|||||||
+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},
|
||||||
|
|||||||
@@ -465,6 +465,7 @@ N(OP_SendAAStats),
|
|||||||
N(OP_SendAATable),
|
N(OP_SendAATable),
|
||||||
N(OP_SendCharInfo),
|
N(OP_SendCharInfo),
|
||||||
N(OP_SendExpZonein),
|
N(OP_SendExpZonein),
|
||||||
|
N(OP_SendFindableLocations),
|
||||||
N(OP_SendFindableNPCs),
|
N(OP_SendFindableNPCs),
|
||||||
N(OP_SendGuildTributes),
|
N(OP_SendGuildTributes),
|
||||||
N(OP_SendLoginInfo),
|
N(OP_SendLoginInfo),
|
||||||
|
|||||||
@@ -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 {
|
||||||
@@ -4399,11 +4400,6 @@ struct FindPerson_Point {
|
|||||||
float z;
|
float z;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FindPersonRequest_Struct {
|
|
||||||
uint32 npc_id;
|
|
||||||
FindPerson_Point client_pos;
|
|
||||||
};
|
|
||||||
|
|
||||||
//variable length packet of points
|
//variable length packet of points
|
||||||
struct FindPersonResult_Struct {
|
struct FindPersonResult_Struct {
|
||||||
FindPerson_Point dest;
|
FindPerson_Point dest;
|
||||||
@@ -6435,6 +6431,38 @@ struct BuylineItemDetails_Struct {
|
|||||||
uint32 item_quantity;
|
uint32 item_quantity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Taken from libeq */
|
||||||
|
enum FindLocationType : uint32 {
|
||||||
|
LocationUnknown,
|
||||||
|
LocationPlayer,
|
||||||
|
LocationPOI,
|
||||||
|
LocationRealEstateItem,
|
||||||
|
LocationRealEstatePlot,
|
||||||
|
LocationMapPoint,
|
||||||
|
LocationSwitch,
|
||||||
|
LocationLocation
|
||||||
|
};
|
||||||
|
|
||||||
|
//For reference
|
||||||
|
struct FindableLocation_Struct {
|
||||||
|
/*00*/ FindLocationType type;
|
||||||
|
/*04*/ int32 id;
|
||||||
|
/*08*/ int32 sub_id;
|
||||||
|
/*12*/ int32 zone_id;
|
||||||
|
/*16*/ int32 zone_point_identifier;
|
||||||
|
/*20*/ float y;
|
||||||
|
/*24*/ float x;
|
||||||
|
/*28*/ float z;
|
||||||
|
/*32*/
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FindPersonRequest_Struct {
|
||||||
|
FindLocationType type;
|
||||||
|
int32 id;
|
||||||
|
FindPerson_Point client_pos;
|
||||||
|
FindPerson_Point target_pos;
|
||||||
|
};
|
||||||
|
|
||||||
// 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();
|
||||||
|
|||||||
@@ -414,6 +414,12 @@ static uint64_t MakeBits(std::span<const uint8_t> data)
|
|||||||
return bits;
|
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>
|
template <typename T>
|
||||||
static T FromString(std::string_view sv)
|
static T FromString(std::string_view sv)
|
||||||
{
|
{
|
||||||
@@ -422,6 +428,14 @@ static T FromString(std::string_view sv)
|
|||||||
// return false for empty (zero-length) strings
|
// return false for empty (zero-length) strings
|
||||||
return !sv.empty();
|
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
|
else
|
||||||
{
|
{
|
||||||
// non numbers return a zero initialized T (could return nullopt instead)
|
// non numbers return a zero initialized T (could return nullopt instead)
|
||||||
|
|||||||
@@ -4538,10 +4538,14 @@ namespace RoF
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
IN(type)
|
||||||
|
IN(id);
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
IN(target_pos.x);
|
||||||
|
IN(target_pos.y);
|
||||||
|
IN(target_pos.z);
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5517,10 +5517,14 @@ namespace RoF2
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
IN(type)
|
||||||
|
IN(id);
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
IN(target_pos.x);
|
||||||
|
IN(target_pos.y);
|
||||||
|
IN(target_pos.z);
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4016,14 +4016,13 @@ struct FindPerson_Point {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FindPersonRequest_Struct {
|
struct FindPersonRequest_Struct {
|
||||||
/*00*/ uint32 unknown00;
|
/*00*/ FindLocationType type;
|
||||||
/*04*/ uint32 npc_id;
|
/*04*/ int32 id;
|
||||||
/*08*/ uint32 unknown08;
|
/*08*/ int32 unknown08;
|
||||||
/*12*/ uint32 unknown12;
|
/*12*/ int32 unknown12;
|
||||||
/*16*/ FindPerson_Point client_pos;
|
/*16*/ FindPerson_Point client_pos;
|
||||||
/*28*/ uint32 unknown28;
|
/*28*/ FindPerson_Point target_pos;
|
||||||
/*32*/ uint32 unknown32;
|
/*40*/
|
||||||
/*36*/ uint32 unknown36;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//variable length packet of points
|
//variable length packet of points
|
||||||
|
|||||||
@@ -3779,14 +3779,13 @@ struct FindPerson_Point {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FindPersonRequest_Struct {
|
struct FindPersonRequest_Struct {
|
||||||
/*00*/ uint32 unknown00;
|
/*00*/ FindLocationType type;
|
||||||
/*04*/ uint32 npc_id;
|
/*04*/ int32 id;
|
||||||
/*08*/ uint32 unknown08;
|
/*08*/ int32 unknown08;
|
||||||
/*12*/ uint32 unknown12;
|
/*12*/ int32 unknown12;
|
||||||
/*16*/ FindPerson_Point client_pos;
|
/*16*/ FindPerson_Point client_pos;
|
||||||
/*28*/ uint32 unknown28;
|
/*28*/ FindPerson_Point target_pos;
|
||||||
/*32*/ uint32 unknown32;
|
/*40*/
|
||||||
/*36*/ uint32 unknown36;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//variable length packet of points
|
//variable length packet of points
|
||||||
|
|||||||
@@ -3150,7 +3150,8 @@ namespace SoD
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
|||||||
@@ -2605,7 +2605,8 @@ namespace SoF
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
|||||||
@@ -3327,6 +3327,20 @@ namespace Titanium
|
|||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECODE(OP_FindPersonRequest)
|
||||||
|
{
|
||||||
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
|
IN(client_pos.x);
|
||||||
|
IN(client_pos.y);
|
||||||
|
IN(client_pos.z);
|
||||||
|
|
||||||
|
FINISH_DIRECT_DECODE();
|
||||||
|
}
|
||||||
|
|
||||||
// file scope helper methods
|
// file scope helper methods
|
||||||
void SerializeItem(EQ::OutBuffer& ob, const EQ::ItemInstance *inst, int16 slot_id_in, uint8 depth) {
|
void SerializeItem(EQ::OutBuffer& ob, const EQ::ItemInstance *inst, int16 slot_id_in, uint8 depth) {
|
||||||
const char *protection = "\\\\\\\\\\";
|
const char *protection = "\\\\\\\\\\";
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ D(OP_TradeSkillCombine)
|
|||||||
D(OP_TributeItem)
|
D(OP_TributeItem)
|
||||||
D(OP_WearChange)
|
D(OP_WearChange)
|
||||||
D(OP_WhoAllRequest)
|
D(OP_WhoAllRequest)
|
||||||
|
D(OP_FindPersonRequest)
|
||||||
|
|
||||||
#undef E
|
#undef E
|
||||||
#undef D
|
#undef D
|
||||||
|
|||||||
@@ -3982,7 +3982,8 @@ namespace UF
|
|||||||
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
DECODE_LENGTH_EXACT(structs::FindPersonRequest_Struct);
|
||||||
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
SETUP_DIRECT_DECODE(FindPersonRequest_Struct, structs::FindPersonRequest_Struct);
|
||||||
|
|
||||||
IN(npc_id);
|
emu->type = FindLocationType::LocationPlayer;
|
||||||
|
emu->id = eq->npc_id;
|
||||||
IN(client_pos.x);
|
IN(client_pos.x);
|
||||||
IN(client_pos.y);
|
IN(client_pos.y);
|
||||||
IN(client_pos.z);
|
IN(client_pos.z);
|
||||||
|
|||||||
@@ -0,0 +1,547 @@
|
|||||||
|
/**
|
||||||
|
* DO NOT MODIFY THIS FILE
|
||||||
|
*
|
||||||
|
* This repository was automatically generated and is NOT to be modified directly.
|
||||||
|
* Any repository modifications are meant to be made to the repository extending the base.
|
||||||
|
* Any modifications to base repositories are to be made by the generator only
|
||||||
|
*
|
||||||
|
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||||
|
* @docs https://docs.eqemu.io/developer/repositories
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EQEMU_BASE_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
|
#define EQEMU_BASE_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
|
|
||||||
|
#include "../../database.h"
|
||||||
|
#include "../../strings.h"
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
class BaseFindableLocationRepository {
|
||||||
|
public:
|
||||||
|
struct FindableLocation {
|
||||||
|
uint32_t id;
|
||||||
|
std::string zone;
|
||||||
|
int32_t version;
|
||||||
|
int32_t findable_id;
|
||||||
|
int32_t findable_sub_id;
|
||||||
|
int32_t type;
|
||||||
|
int32_t zone_id;
|
||||||
|
int32_t zone_id_index;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
int8_t min_expansion;
|
||||||
|
int8_t max_expansion;
|
||||||
|
std::string content_flags;
|
||||||
|
std::string content_flags_disabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::string PrimaryKey()
|
||||||
|
{
|
||||||
|
return std::string("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<std::string> Columns()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"id",
|
||||||
|
"zone",
|
||||||
|
"version",
|
||||||
|
"findable_id",
|
||||||
|
"findable_sub_id",
|
||||||
|
"type",
|
||||||
|
"zone_id",
|
||||||
|
"zone_id_index",
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"z",
|
||||||
|
"min_expansion",
|
||||||
|
"max_expansion",
|
||||||
|
"content_flags",
|
||||||
|
"content_flags_disabled",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<std::string> SelectColumns()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"id",
|
||||||
|
"zone",
|
||||||
|
"version",
|
||||||
|
"findable_id",
|
||||||
|
"findable_sub_id",
|
||||||
|
"type",
|
||||||
|
"zone_id",
|
||||||
|
"zone_id_index",
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"z",
|
||||||
|
"min_expansion",
|
||||||
|
"max_expansion",
|
||||||
|
"content_flags",
|
||||||
|
"content_flags_disabled",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string ColumnsRaw()
|
||||||
|
{
|
||||||
|
return std::string(Strings::Implode(", ", Columns()));
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string SelectColumnsRaw()
|
||||||
|
{
|
||||||
|
return std::string(Strings::Implode(", ", SelectColumns()));
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string TableName()
|
||||||
|
{
|
||||||
|
return std::string("findable_location");
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string BaseSelect()
|
||||||
|
{
|
||||||
|
return fmt::format(
|
||||||
|
"SELECT {} FROM {}",
|
||||||
|
SelectColumnsRaw(),
|
||||||
|
TableName()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string BaseInsert()
|
||||||
|
{
|
||||||
|
return fmt::format(
|
||||||
|
"INSERT INTO {} ({}) ",
|
||||||
|
TableName(),
|
||||||
|
ColumnsRaw()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation NewEntity()
|
||||||
|
{
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = 0;
|
||||||
|
e.zone = "";
|
||||||
|
e.version = 0;
|
||||||
|
e.findable_id = 0;
|
||||||
|
e.findable_sub_id = 0;
|
||||||
|
e.type = 0;
|
||||||
|
e.zone_id = 0;
|
||||||
|
e.zone_id_index = 0;
|
||||||
|
e.x = 0;
|
||||||
|
e.y = 0;
|
||||||
|
e.z = 0;
|
||||||
|
e.min_expansion = -1;
|
||||||
|
e.max_expansion = -1;
|
||||||
|
e.content_flags = "";
|
||||||
|
e.content_flags_disabled = "";
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation GetFindableLocation(
|
||||||
|
const std::vector<FindableLocation> &findable_locations,
|
||||||
|
int findable_location_id
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (auto &findable_location : findable_locations) {
|
||||||
|
if (findable_location.id == findable_location_id) {
|
||||||
|
return findable_location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation FindOne(
|
||||||
|
Database& db,
|
||||||
|
int findable_location_id
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} WHERE {} = {} LIMIT 1",
|
||||||
|
BaseSelect(),
|
||||||
|
PrimaryKey(),
|
||||||
|
findable_location_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
if (results.RowCount() == 1) {
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
|
e.zone = row[1] ? row[1] : "";
|
||||||
|
e.version = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||||
|
e.findable_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
|
e.findable_sub_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
|
e.type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||||
|
e.zone_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||||
|
e.zone_id_index = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||||
|
e.x = row[8] ? strtof(row[8], nullptr) : 0;
|
||||||
|
e.y = row[9] ? strtof(row[9], nullptr) : 0;
|
||||||
|
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||||
|
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||||
|
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||||
|
e.content_flags = row[13] ? row[13] : "";
|
||||||
|
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
static int DeleteOne(
|
||||||
|
Database& db,
|
||||||
|
int findable_location_id
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"DELETE FROM {} WHERE {} = {}",
|
||||||
|
TableName(),
|
||||||
|
PrimaryKey(),
|
||||||
|
findable_location_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int UpdateOne(
|
||||||
|
Database& db,
|
||||||
|
const FindableLocation &e
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
auto columns = Columns();
|
||||||
|
|
||||||
|
v.push_back(columns[1] + " = '" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(columns[2] + " = " + std::to_string(e.version));
|
||||||
|
v.push_back(columns[3] + " = " + std::to_string(e.findable_id));
|
||||||
|
v.push_back(columns[4] + " = " + std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(columns[5] + " = " + std::to_string(e.type));
|
||||||
|
v.push_back(columns[6] + " = " + std::to_string(e.zone_id));
|
||||||
|
v.push_back(columns[7] + " = " + std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(columns[8] + " = " + std::to_string(e.x));
|
||||||
|
v.push_back(columns[9] + " = " + std::to_string(e.y));
|
||||||
|
v.push_back(columns[10] + " = " + std::to_string(e.z));
|
||||||
|
v.push_back(columns[11] + " = " + std::to_string(e.min_expansion));
|
||||||
|
v.push_back(columns[12] + " = " + std::to_string(e.max_expansion));
|
||||||
|
v.push_back(columns[13] + " = '" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back(columns[14] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"UPDATE {} SET {} WHERE {} = {}",
|
||||||
|
TableName(),
|
||||||
|
Strings::Implode(", ", v),
|
||||||
|
PrimaryKey(),
|
||||||
|
e.id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static FindableLocation InsertOne(
|
||||||
|
Database& db,
|
||||||
|
FindableLocation e
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} VALUES ({})",
|
||||||
|
BaseInsert(),
|
||||||
|
Strings::Implode(",", v)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (results.Success()) {
|
||||||
|
e.id = results.LastInsertedID();
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
e = NewEntity();
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int InsertMany(
|
||||||
|
Database& db,
|
||||||
|
const std::vector<FindableLocation> &entries
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> insert_chunks;
|
||||||
|
|
||||||
|
for (auto &e: entries) {
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} VALUES {}",
|
||||||
|
BaseInsert(),
|
||||||
|
Strings::Implode(",", insert_chunks)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<FindableLocation> All(Database& db)
|
||||||
|
{
|
||||||
|
std::vector<FindableLocation> all_entries;
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{}",
|
||||||
|
BaseSelect()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
|
e.zone = row[1] ? row[1] : "";
|
||||||
|
e.version = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||||
|
e.findable_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
|
e.findable_sub_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
|
e.type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||||
|
e.zone_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||||
|
e.zone_id_index = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||||
|
e.x = row[8] ? strtof(row[8], nullptr) : 0;
|
||||||
|
e.y = row[9] ? strtof(row[9], nullptr) : 0;
|
||||||
|
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||||
|
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||||
|
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||||
|
e.content_flags = row[13] ? row[13] : "";
|
||||||
|
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||||
|
|
||||||
|
all_entries.push_back(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return all_entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<FindableLocation> GetWhere(Database& db, const std::string &where_filter)
|
||||||
|
{
|
||||||
|
std::vector<FindableLocation> all_entries;
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} WHERE {}",
|
||||||
|
BaseSelect(),
|
||||||
|
where_filter
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
all_entries.reserve(results.RowCount());
|
||||||
|
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
FindableLocation e{};
|
||||||
|
|
||||||
|
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||||
|
e.zone = row[1] ? row[1] : "";
|
||||||
|
e.version = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||||
|
e.findable_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||||
|
e.findable_sub_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||||
|
e.type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||||
|
e.zone_id = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||||
|
e.zone_id_index = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||||
|
e.x = row[8] ? strtof(row[8], nullptr) : 0;
|
||||||
|
e.y = row[9] ? strtof(row[9], nullptr) : 0;
|
||||||
|
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||||
|
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
|
||||||
|
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||||
|
e.content_flags = row[13] ? row[13] : "";
|
||||||
|
e.content_flags_disabled = row[14] ? row[14] : "";
|
||||||
|
|
||||||
|
all_entries.push_back(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return all_entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int DeleteWhere(Database& db, const std::string &where_filter)
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"DELETE FROM {} WHERE {}",
|
||||||
|
TableName(),
|
||||||
|
where_filter
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Truncate(Database& db)
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"TRUNCATE TABLE {}",
|
||||||
|
TableName()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int64 GetMaxId(Database& db)
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"SELECT COALESCE(MAX({}), 0) FROM {}",
|
||||||
|
PrimaryKey(),
|
||||||
|
TableName()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int64 Count(Database& db, const std::string &where_filter = "")
|
||||||
|
{
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"SELECT COUNT(*) FROM {} {}",
|
||||||
|
TableName(),
|
||||||
|
(where_filter.empty() ? "" : "WHERE " + where_filter)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string BaseReplace()
|
||||||
|
{
|
||||||
|
return fmt::format(
|
||||||
|
"REPLACE INTO {} ({}) ",
|
||||||
|
TableName(),
|
||||||
|
ColumnsRaw()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ReplaceOne(
|
||||||
|
Database& db,
|
||||||
|
const FindableLocation &e
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} VALUES ({})",
|
||||||
|
BaseReplace(),
|
||||||
|
Strings::Implode(",", v)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ReplaceMany(
|
||||||
|
Database& db,
|
||||||
|
const std::vector<FindableLocation> &entries
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::vector<std::string> insert_chunks;
|
||||||
|
|
||||||
|
for (auto &e: entries) {
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
v.push_back(std::to_string(e.id));
|
||||||
|
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||||
|
v.push_back(std::to_string(e.version));
|
||||||
|
v.push_back(std::to_string(e.findable_id));
|
||||||
|
v.push_back(std::to_string(e.findable_sub_id));
|
||||||
|
v.push_back(std::to_string(e.type));
|
||||||
|
v.push_back(std::to_string(e.zone_id));
|
||||||
|
v.push_back(std::to_string(e.zone_id_index));
|
||||||
|
v.push_back(std::to_string(e.x));
|
||||||
|
v.push_back(std::to_string(e.y));
|
||||||
|
v.push_back(std::to_string(e.z));
|
||||||
|
v.push_back(std::to_string(e.min_expansion));
|
||||||
|
v.push_back(std::to_string(e.max_expansion));
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||||
|
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||||
|
|
||||||
|
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> v;
|
||||||
|
|
||||||
|
auto results = db.QueryDatabase(
|
||||||
|
fmt::format(
|
||||||
|
"{} VALUES {}",
|
||||||
|
BaseReplace(),
|
||||||
|
Strings::Implode(",", insert_chunks)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return (results.Success() ? results.RowsAffected() : 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //EQEMU_BASE_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#ifndef EQEMU_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
|
#define EQEMU_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
|
|
||||||
|
#include "../database.h"
|
||||||
|
#include "../strings.h"
|
||||||
|
#include "base/base_findable_location_repository.h"
|
||||||
|
|
||||||
|
class FindableLocationRepository: public BaseFindableLocationRepository {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file was auto generated and can be modified and extended upon
|
||||||
|
*
|
||||||
|
* Base repository methods are automatically
|
||||||
|
* generated in the "base" version of this repository. The base repository
|
||||||
|
* is immutable and to be left untouched, while methods in this class
|
||||||
|
* are used as extension methods for more specific persistence-layer
|
||||||
|
* accessors or mutators.
|
||||||
|
*
|
||||||
|
* Base Methods (Subject to be expanded upon in time)
|
||||||
|
*
|
||||||
|
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||||
|
*
|
||||||
|
* InsertOne
|
||||||
|
* UpdateOne
|
||||||
|
* DeleteOne
|
||||||
|
* FindOne
|
||||||
|
* GetWhere(std::string where_filter)
|
||||||
|
* DeleteWhere(std::string where_filter)
|
||||||
|
* InsertMany
|
||||||
|
* All
|
||||||
|
*
|
||||||
|
* Example custom methods in a repository
|
||||||
|
*
|
||||||
|
* FindableLocationRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||||
|
* FindableLocationRepository::GetWhereNeverExpires()
|
||||||
|
* FindableLocationRepository::GetWhereXAndY()
|
||||||
|
* FindableLocationRepository::DeleteWhereXAndY()
|
||||||
|
*
|
||||||
|
* Most of the above could be covered by base methods, but if you as a developer
|
||||||
|
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||||
|
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||||
|
* method and encapsulate filters there
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Custom extended repository methods here
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //EQEMU_FINDABLE_LOCATION_REPOSITORY_H
|
||||||
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -681,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)
|
||||||
|
|||||||
@@ -282,6 +282,7 @@
|
|||||||
#define ServerOP_ReloadBaseData 0x4128
|
#define ServerOP_ReloadBaseData 0x4128
|
||||||
#define ServerOP_ReloadSkillCaps 0x4129
|
#define ServerOP_ReloadSkillCaps 0x4129
|
||||||
#define ServerOP_ReloadNPCSpells 0x4130
|
#define ServerOP_ReloadNPCSpells 0x4130
|
||||||
|
#define ServerOP_ReloadFindableLocations 0x4131
|
||||||
|
|
||||||
#define ServerOP_CZDialogueWindow 0x4500
|
#define ServerOP_CZDialogueWindow 0x4500
|
||||||
#define ServerOP_CZLDoNUpdate 0x4501
|
#define ServerOP_CZLDoNUpdate 0x4501
|
||||||
@@ -1945,6 +1946,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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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.59.1-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__
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eqemu-server",
|
"name": "eqemu-server",
|
||||||
"version": "22.59.1",
|
"version": "22.60.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/EQEmu/Server.git"
|
"url": "https://github.com/EQEmu/Server.git"
|
||||||
|
|||||||
@@ -311,6 +311,7 @@ OP_SetGroupTarget=0x2814
|
|||||||
OP_Charm=0x5d92
|
OP_Charm=0x5d92
|
||||||
OP_Stun=0x36a4
|
OP_Stun=0x36a4
|
||||||
OP_SendFindableNPCs=0x4613
|
OP_SendFindableNPCs=0x4613
|
||||||
|
OP_SendFindableLocations=0x6a68
|
||||||
OP_FindPersonRequest=0x5cea
|
OP_FindPersonRequest=0x5cea
|
||||||
OP_FindPersonReply=0x7e58
|
OP_FindPersonReply=0x7e58
|
||||||
OP_Sound=0x1a30
|
OP_Sound=0x1a30
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
CREATE TABLE `findable_location` (
|
||||||
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`zone` VARCHAR(32) NOT NULL COLLATE 'utf8mb4_general_ci',
|
||||||
|
`version` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`findable_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`findable_sub_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`type` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`zone_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`zone_id_index` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`x` FLOAT NOT NULL DEFAULT '0',
|
||||||
|
`y` FLOAT NOT NULL DEFAULT '0',
|
||||||
|
`z` FLOAT NOT NULL DEFAULT '0',
|
||||||
|
`min_expansion` TINYINT(4) NOT NULL DEFAULT '-1',
|
||||||
|
`max_expansion` TINYINT(4) NOT NULL DEFAULT '-1',
|
||||||
|
`content_flags` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
|
||||||
|
`content_flags_disabled` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `zone_version` (`zone`, `version`) USING BTREE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 77, -1, 6, 202, 0, 484.484130859375, 183.69752502441406, 0.0020000000949949026);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 16, 0, 7, 45, 1, 342.86285400390625, 188.9244384765625, -181.92721557617188);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 17, 0, 7, 1, 1, -6.997137069702148, -174.92999267578125, 15.993850708007812);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 18, 0, 7, 1, 2, 356.8572692871094, -48.98040771484375, 15.993560791015625);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 19, 0, 7, 4, 1, 566.7733154296875, 1699.3203125, 54.97816467285156);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 19, 2, 7, 4, 2, 230.90762329101562, 1699.3203125, 59.97674560546875);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 20, 0, 7, 4, 3, 141.9432373046875, 1699.3203125, 20.986679077148438);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 21, 0, 7, 4, 4, -3.9984021186828613, 1699.3203125, 20.986663818359375);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 21, 3, 7, 4, 5, -333.866455078125, 1699.3203125, 59.97560119628906);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 22, 0, 7, 4, 6, 899.6401977539062, 1699.3203125, 54.97816467285156);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 23, 0, 7, 4, 7, -799.6800537109375, 1699.3203125, 54.97825622558594);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 53, 0, 7, 45, 2, 76.9692153930664, 174.9300537109375, -34.986000061035156);
|
||||||
|
INSERT INTO `findable_location` (zone, version, findable_id, findable_sub_id, type, zone_id, zone_id_index, x, y, z) VALUES ('qeynos2', 0, 54, 0, 7, 45, 3, -160.9356231689453, 300.879638671875, -139.94403076171875);
|
||||||
@@ -140,6 +140,7 @@ std::vector<Reload> reload_types = {
|
|||||||
Reload{.command = "aa", .opcode = ServerOP_ReloadAAData, .desc = "Alternate Advancement"},
|
Reload{.command = "aa", .opcode = ServerOP_ReloadAAData, .desc = "Alternate Advancement"},
|
||||||
Reload{.command = "alternate_currencies", .opcode = ServerOP_ReloadAlternateCurrencies, .desc = "Alternate Currencies"},
|
Reload{.command = "alternate_currencies", .opcode = ServerOP_ReloadAlternateCurrencies, .desc = "Alternate Currencies"},
|
||||||
Reload{.command = "base_data", .opcode = ServerOP_ReloadBaseData, .desc = "Base Data"},
|
Reload{.command = "base_data", .opcode = ServerOP_ReloadBaseData, .desc = "Base Data"},
|
||||||
|
Reload{.command = "finable_locations", .opcode = ServerOP_ReloadFindableLocations, .desc = "Findable Locations"},
|
||||||
Reload{.command = "blocked_spells", .opcode = ServerOP_ReloadBlockedSpells, .desc = "Blocked Spells"},
|
Reload{.command = "blocked_spells", .opcode = ServerOP_ReloadBlockedSpells, .desc = "Blocked Spells"},
|
||||||
Reload{.command = "commands", .opcode = ServerOP_ReloadCommands, .desc = "Commands"},
|
Reload{.command = "commands", .opcode = ServerOP_ReloadCommands, .desc = "Commands"},
|
||||||
Reload{.command = "content_flags", .opcode = ServerOP_ReloadContentFlags, .desc = "Content Flags"},
|
Reload{.command = "content_flags", .opcode = ServerOP_ReloadContentFlags, .desc = "Content Flags"},
|
||||||
|
|||||||
+16
-3
@@ -1401,6 +1401,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
|||||||
case ServerOP_ReloadAAData:
|
case ServerOP_ReloadAAData:
|
||||||
case ServerOP_ReloadAlternateCurrencies:
|
case ServerOP_ReloadAlternateCurrencies:
|
||||||
case ServerOP_ReloadBaseData:
|
case ServerOP_ReloadBaseData:
|
||||||
|
case ServerOP_ReloadFindableLocations:
|
||||||
case ServerOP_ReloadBlockedSpells:
|
case ServerOP_ReloadBlockedSpells:
|
||||||
case ServerOP_ReloadCommands:
|
case ServerOP_ReloadCommands:
|
||||||
case ServerOP_ReloadDoors:
|
case ServerOP_ReloadDoors:
|
||||||
@@ -1755,7 +1756,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 +1780,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:
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ SET(zone_sources
|
|||||||
zonedb.cpp
|
zonedb.cpp
|
||||||
zone_base_data.cpp
|
zone_base_data.cpp
|
||||||
zone_event_scheduler.cpp
|
zone_event_scheduler.cpp
|
||||||
|
zone_finable_locations.cpp
|
||||||
zone_npc_factions.cpp
|
zone_npc_factions.cpp
|
||||||
zone_reload.cpp
|
zone_reload.cpp
|
||||||
zoning.cpp
|
zoning.cpp
|
||||||
|
|||||||
+18
-29
@@ -11995,15 +11995,13 @@ void Client::MaxSkills()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::SendPath(Mob* target)
|
void Client::SendPath(Mob* target) {
|
||||||
{
|
|
||||||
if (!target) {
|
if (!target) {
|
||||||
EQApplicationPacket outapp(OP_FindPersonReply, 0);
|
EQApplicationPacket outapp(OP_FindPersonReply, 0);
|
||||||
QueuePacket(&outapp);
|
QueuePacket(&outapp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!RuleB(Pathing, Find) &&
|
!RuleB(Pathing, Find) &&
|
||||||
RuleB(Bazaar, EnableWarpToTrader) &&
|
RuleB(Bazaar, EnableWarpToTrader) &&
|
||||||
@@ -12031,6 +12029,17 @@ void Client::SendPath(Mob* target)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 target_loc(
|
||||||
|
target->GetX(),
|
||||||
|
target->GetY(),
|
||||||
|
target->GetZ() + (target->GetSize() < 6.0 ? 6 : target->GetSize()) * HEAD_POSITION
|
||||||
|
);
|
||||||
|
|
||||||
|
SendPath(target_loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Client::SendPath(const glm::vec3& loc)
|
||||||
|
{
|
||||||
std::vector<FindPerson_Point> points;
|
std::vector<FindPerson_Point> points;
|
||||||
|
|
||||||
if (!RuleB(Pathing, Find) || !zone->pathing) {
|
if (!RuleB(Pathing, Find) || !zone->pathing) {
|
||||||
@@ -12041,9 +12050,9 @@ void Client::SendPath(Mob* target)
|
|||||||
a.x = GetX();
|
a.x = GetX();
|
||||||
a.y = GetY();
|
a.y = GetY();
|
||||||
a.z = GetZ();
|
a.z = GetZ();
|
||||||
b.x = target->GetX();
|
b.x = loc.x;
|
||||||
b.y = target->GetY();
|
b.y = loc.y;
|
||||||
b.z = target->GetZ();
|
b.z = loc.z;
|
||||||
|
|
||||||
points.push_back(a);
|
points.push_back(a);
|
||||||
points.push_back(b);
|
points.push_back(b);
|
||||||
@@ -12056,9 +12065,9 @@ void Client::SendPath(Mob* target)
|
|||||||
);
|
);
|
||||||
|
|
||||||
glm::vec3 path_end(
|
glm::vec3 path_end(
|
||||||
target->GetX(),
|
loc.x,
|
||||||
target->GetY(),
|
loc.y,
|
||||||
target->GetZ() + (target->GetSize() < 6.0 ? 6 : target->GetSize()) * HEAD_POSITION
|
loc.z
|
||||||
);
|
);
|
||||||
|
|
||||||
bool partial = false;
|
bool partial = false;
|
||||||
@@ -12081,18 +12090,6 @@ void Client::SendPath(Mob* target)
|
|||||||
|
|
||||||
bool leads_to_teleporter = false;
|
bool leads_to_teleporter = false;
|
||||||
|
|
||||||
auto v = path_list.back();
|
|
||||||
|
|
||||||
p.x = v.pos.x;
|
|
||||||
p.y = v.pos.y;
|
|
||||||
p.z = v.pos.z;
|
|
||||||
points.push_back(p);
|
|
||||||
|
|
||||||
p.x = GetX();
|
|
||||||
p.y = GetY();
|
|
||||||
p.z = GetZ();
|
|
||||||
points.push_back(p);
|
|
||||||
|
|
||||||
for (const auto &n: path_list) {
|
for (const auto &n: path_list) {
|
||||||
if (n.teleport) {
|
if (n.teleport) {
|
||||||
leads_to_teleporter = true;
|
leads_to_teleporter = true;
|
||||||
@@ -12108,14 +12105,6 @@ void Client::SendPath(Mob* target)
|
|||||||
|
|
||||||
++point_number;
|
++point_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!leads_to_teleporter) {
|
|
||||||
p.x = target->GetX();
|
|
||||||
p.y = target->GetY();
|
|
||||||
p.z = target->GetZ();
|
|
||||||
|
|
||||||
points.push_back(p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SendPathPacket(points);
|
SendPathPacket(points);
|
||||||
|
|||||||
@@ -869,6 +869,7 @@ public:
|
|||||||
int GetAccountAge();
|
int GetAccountAge();
|
||||||
|
|
||||||
void SendPath(Mob* target);
|
void SendPath(Mob* target);
|
||||||
|
void SendPath(const glm::vec3 &loc);
|
||||||
|
|
||||||
bool IsDiscovered(uint32 itemid);
|
bool IsDiscovered(uint32 itemid);
|
||||||
void DiscoverItem(uint32 itemid);
|
void DiscoverItem(uint32 itemid);
|
||||||
|
|||||||
+36
-2
@@ -858,6 +858,9 @@ void Client::CompleteConnect()
|
|||||||
if (ClientVersion() >= EQ::versions::ClientVersion::SoD)
|
if (ClientVersion() >= EQ::versions::ClientVersion::SoD)
|
||||||
entity_list.SendFindableNPCList(this);
|
entity_list.SendFindableNPCList(this);
|
||||||
|
|
||||||
|
if (ClientVersion() >= EQ::versions::ClientVersion::RoF2)
|
||||||
|
zone->SendFindableLocations(this);
|
||||||
|
|
||||||
if (IsInAGuild()) {
|
if (IsInAGuild()) {
|
||||||
if (firstlogon == 1) {
|
if (firstlogon == 1) {
|
||||||
guild_mgr.UpdateDbMemberOnline(CharacterID(), true);
|
guild_mgr.UpdateDbMemberOnline(CharacterID(), true);
|
||||||
@@ -6474,9 +6477,40 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
|
|||||||
else {
|
else {
|
||||||
auto* t = (FindPersonRequest_Struct*)app->pBuffer;
|
auto* t = (FindPersonRequest_Struct*)app->pBuffer;
|
||||||
|
|
||||||
auto* m = entity_list.GetMob(t->npc_id);
|
switch (t->type) {
|
||||||
|
case FindLocationType::LocationPlayer: {
|
||||||
|
auto* m = entity_list.GetMob(t->id);
|
||||||
SendPath(m);
|
SendPath(m);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FindLocationType::LocationSwitch:
|
||||||
|
{
|
||||||
|
auto *d = entity_list.GetDoorsByDoorID(t->id);
|
||||||
|
if (d == nullptr) {
|
||||||
|
Message(Chat::Red, "Switch for find not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec3 door_loc;
|
||||||
|
door_loc.x = d->GetX();
|
||||||
|
door_loc.y = d->GetY();
|
||||||
|
door_loc.z = d->GetZ();
|
||||||
|
SendPath(door_loc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FindLocationType::LocationLocation:
|
||||||
|
{
|
||||||
|
glm::vec3 target_pos;
|
||||||
|
target_pos.x = t->target_pos.x;
|
||||||
|
target_pos.y = t->target_pos.y;
|
||||||
|
target_pos.z = t->target_pos.z;
|
||||||
|
|
||||||
|
SendPath(target_pos);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1736,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -839,6 +839,7 @@ luabind::scope lua_register_packet_opcodes() {
|
|||||||
luabind::value("GroupLeaderChange", static_cast<int>(OP_GroupLeaderChange)),
|
luabind::value("GroupLeaderChange", static_cast<int>(OP_GroupLeaderChange)),
|
||||||
luabind::value("GroupLeadershipAAUpdate", static_cast<int>(OP_GroupLeadershipAAUpdate)),
|
luabind::value("GroupLeadershipAAUpdate", static_cast<int>(OP_GroupLeadershipAAUpdate)),
|
||||||
luabind::value("GroupRoles", static_cast<int>(OP_GroupRoles)),
|
luabind::value("GroupRoles", static_cast<int>(OP_GroupRoles)),
|
||||||
|
luabind::value("OP_SendFindableLocations", static_cast<int>(OP_SendFindableLocations)),
|
||||||
luabind::value("SendFindableNPCs", static_cast<int>(OP_SendFindableNPCs)),
|
luabind::value("SendFindableNPCs", static_cast<int>(OP_SendFindableNPCs)),
|
||||||
luabind::value("HideCorpse", static_cast<int>(OP_HideCorpse)),
|
luabind::value("HideCorpse", static_cast<int>(OP_HideCorpse)),
|
||||||
luabind::value("TargetBuffs", static_cast<int>(OP_TargetBuffs)),
|
luabind::value("TargetBuffs", static_cast<int>(OP_TargetBuffs)),
|
||||||
|
|||||||
+24
-26
@@ -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;
|
||||||
|
|||||||
+11
-3
@@ -1815,12 +1815,18 @@ void Mob::AI_Event_NoLongerEngaged() {
|
|||||||
StopNavigation();
|
StopNavigation();
|
||||||
ClearRampage();
|
ClearRampage();
|
||||||
|
|
||||||
parse->EventBotMercNPC(EVENT_COMBAT, this, nullptr, [&]() { return "0"; });
|
|
||||||
|
|
||||||
if (IsNPC()) {
|
if (IsNPC()) {
|
||||||
SetPrimaryAggro(false);
|
SetPrimaryAggro(false);
|
||||||
SetAssistAggro(false);
|
SetAssistAggro(false);
|
||||||
if (CastToNPC()->GetCombatEvent() && GetHP() > 0) {
|
if (
|
||||||
|
CastToNPC()->GetCombatEvent() &&
|
||||||
|
GetHP() > 0 &&
|
||||||
|
entity_list.GetNPCByID(GetID())
|
||||||
|
) {
|
||||||
|
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_COMBAT)) {
|
||||||
|
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
|
||||||
|
}
|
||||||
|
|
||||||
const uint32 emote_id = CastToNPC()->GetEmoteID();
|
const uint32 emote_id = CastToNPC()->GetEmoteID();
|
||||||
if (emote_id) {
|
if (emote_id) {
|
||||||
CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::LeaveCombat, emote_id);
|
CastToNPC()->DoNPCEmote(EQ::constants::EmoteEventTypes::LeaveCombat, emote_id);
|
||||||
@@ -1829,6 +1835,8 @@ void Mob::AI_Event_NoLongerEngaged() {
|
|||||||
m_combat_record.Stop();
|
m_combat_record.Stop();
|
||||||
CastToNPC()->SetCombatEvent(false);
|
CastToNPC()->SetCombatEvent(false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
parse->EventBotMerc(EVENT_COMBAT, this, nullptr, [&]() { return "0"; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+35
-8
@@ -2156,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)
|
||||||
@@ -3296,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)
|
||||||
@@ -4237,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();
|
||||||
|
|||||||
+9
-12
@@ -72,22 +72,19 @@ void Client::SendPathPacket(const std::vector<FindPerson_Point> &points) {
|
|||||||
Message(Chat::System, "Total points %u", points.size());
|
Message(Chat::System, "Total points %u", points.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = sizeof(FindPersonResult_Struct) + (points.size() + 1) * sizeof(FindPerson_Point);
|
int len = (points.size() + 1) * sizeof(FindPerson_Point);
|
||||||
auto outapp = new EQApplicationPacket(OP_FindPersonReply, len);
|
auto outapp = new EQApplicationPacket(OP_FindPersonReply, len);
|
||||||
FindPersonResult_Struct* fpr = (FindPersonResult_Struct*)outapp->pBuffer;
|
|
||||||
|
|
||||||
std::vector<FindPerson_Point>::iterator cur, end;
|
auto& last = points.back();
|
||||||
cur = points.begin();
|
outapp->WriteFloat(last.y);
|
||||||
end = points.end();
|
outapp->WriteFloat(last.x);
|
||||||
unsigned int r;
|
outapp->WriteFloat(last.z);
|
||||||
for (r = 0; cur != end; ++cur, r++) {
|
|
||||||
fpr->path[r] = *cur;
|
|
||||||
|
|
||||||
|
for (auto& p : points) {
|
||||||
|
outapp->WriteFloat(p.y);
|
||||||
|
outapp->WriteFloat(p.x);
|
||||||
|
outapp->WriteFloat(p.z);
|
||||||
}
|
}
|
||||||
//put the last element into the destination field
|
|
||||||
--cur;
|
|
||||||
fpr->path[r] = *cur;
|
|
||||||
fpr->dest = *cur;
|
|
||||||
|
|
||||||
FastQueuePacket(&outapp);
|
FastQueuePacket(&outapp);
|
||||||
})
|
})
|
||||||
|
|||||||
+17
-2
@@ -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.",
|
||||||
@@ -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);
|
||||||
|
|||||||
+11
-1
@@ -2005,6 +2005,15 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ServerOP_ReloadFindableLocations:
|
||||||
|
{
|
||||||
|
if (zone && zone->IsLoaded()) {
|
||||||
|
zone->SendReloadMessage("Findable Locations");
|
||||||
|
zone->ReloadFindableLocations();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ServerOP_ReloadBlockedSpells:
|
case ServerOP_ReloadBlockedSpells:
|
||||||
{
|
{
|
||||||
if (zone && zone->IsLoaded()) {
|
if (zone && zone->IsLoaded()) {
|
||||||
@@ -3942,7 +3951,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 +4053,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;
|
||||||
|
|||||||
@@ -1200,6 +1200,7 @@ bool Zone::Init(bool is_static) {
|
|||||||
LoadNPCEmotes(&npc_emote_list);
|
LoadNPCEmotes(&npc_emote_list);
|
||||||
LoadAlternateAdvancement();
|
LoadAlternateAdvancement();
|
||||||
LoadBaseData();
|
LoadBaseData();
|
||||||
|
LoadFindableLocations();
|
||||||
LoadMerchants();
|
LoadMerchants();
|
||||||
LoadTempMerchantData();
|
LoadTempMerchantData();
|
||||||
|
|
||||||
|
|||||||
+10
@@ -47,6 +47,7 @@
|
|||||||
#include "../common/repositories/lootdrop_entries_repository.h"
|
#include "../common/repositories/lootdrop_entries_repository.h"
|
||||||
#include "../common/repositories/base_data_repository.h"
|
#include "../common/repositories/base_data_repository.h"
|
||||||
#include "../common/repositories/skill_caps_repository.h"
|
#include "../common/repositories/skill_caps_repository.h"
|
||||||
|
#include "../common/repositories/findable_location_repository.h"
|
||||||
|
|
||||||
struct EXPModifier
|
struct EXPModifier
|
||||||
{
|
{
|
||||||
@@ -454,6 +455,12 @@ public:
|
|||||||
void LoadBaseData();
|
void LoadBaseData();
|
||||||
void ReloadBaseData();
|
void ReloadBaseData();
|
||||||
|
|
||||||
|
// Findable Locations
|
||||||
|
void LoadFindableLocations();
|
||||||
|
void ReloadFindableLocations();
|
||||||
|
void ClearFindableLocations();
|
||||||
|
void SendFindableLocations(Client* client = nullptr);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool allow_mercs;
|
bool allow_mercs;
|
||||||
@@ -518,6 +525,9 @@ private:
|
|||||||
|
|
||||||
// Base Data
|
// Base Data
|
||||||
std::vector<BaseDataRepository::BaseData> m_base_data = { };
|
std::vector<BaseDataRepository::BaseData> m_base_data = { };
|
||||||
|
|
||||||
|
// Findable Locations
|
||||||
|
std::vector<FindableLocationRepository::FindableLocation> m_findable_locations = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#include "zone.h"
|
||||||
|
|
||||||
|
void Zone::LoadFindableLocations() {
|
||||||
|
m_findable_locations = content_db.LoadFindableLocations(GetShortName(), GetInstanceVersion());
|
||||||
|
if (m_findable_locations.empty()) {
|
||||||
|
LogInfo("No findable loacations loaded");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Zone::ReloadFindableLocations() {
|
||||||
|
ClearFindableLocations();
|
||||||
|
LoadFindableLocations();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Zone::ClearFindableLocations() {
|
||||||
|
m_findable_locations.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Zone::SendFindableLocations(Client* client) {
|
||||||
|
if (m_findable_locations.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t size = sizeof(uint32) + (m_findable_locations.size() * sizeof(FindableLocation_Struct));
|
||||||
|
auto outapp = new EQApplicationPacket(OP_SendFindableLocations, size);
|
||||||
|
|
||||||
|
outapp->WriteUInt32(m_findable_locations.size());
|
||||||
|
|
||||||
|
for (auto& location : m_findable_locations) {
|
||||||
|
outapp->WriteUInt32(location.type);
|
||||||
|
outapp->WriteSInt32(location.findable_id);
|
||||||
|
outapp->WriteSInt32(location.findable_sub_id);
|
||||||
|
outapp->WriteSInt32(location.zone_id);
|
||||||
|
outapp->WriteSInt32(location.zone_id_index);
|
||||||
|
outapp->WriteFloat(location.y);
|
||||||
|
outapp->WriteFloat(location.x);
|
||||||
|
outapp->WriteFloat(location.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
client->FastQueuePacket(&outapp);
|
||||||
|
}
|
||||||
+10
-2
@@ -50,9 +50,8 @@
|
|||||||
#include "../common/repositories/character_corpses_repository.h"
|
#include "../common/repositories/character_corpses_repository.h"
|
||||||
#include "../common/repositories/character_corpse_items_repository.h"
|
#include "../common/repositories/character_corpse_items_repository.h"
|
||||||
#include "../common/repositories/zone_repository.h"
|
#include "../common/repositories/zone_repository.h"
|
||||||
|
|
||||||
#include "../common/repositories/trader_repository.h"
|
#include "../common/repositories/trader_repository.h"
|
||||||
|
#include "../common/repositories/findable_location_repository.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -2875,6 +2874,15 @@ void ZoneDatabase::UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, ui
|
|||||||
CharacterAltCurrencyRepository::ReplaceOne(*this, e);
|
CharacterAltCurrencyRepository::ReplaceOne(*this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<FindableLocationRepository::FindableLocation> ZoneDatabase::LoadFindableLocations(const std::string& zone_name, int16 version) {
|
||||||
|
auto findable_locations = FindableLocationRepository::GetWhere(
|
||||||
|
*this, fmt::format(
|
||||||
|
"zone = '{}' AND (version = {} OR version = -1) {} ORDER BY id ASC",
|
||||||
|
zone_name, version, ContentFilterCriteria::apply()));
|
||||||
|
|
||||||
|
return findable_locations;
|
||||||
|
}
|
||||||
|
|
||||||
void ZoneDatabase::SaveBuffs(Client *client)
|
void ZoneDatabase::SaveBuffs(Client *client)
|
||||||
{
|
{
|
||||||
CharacterBuffsRepository::DeleteWhere(
|
CharacterBuffsRepository::DeleteWhere(
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "../common/repositories/doors_repository.h"
|
#include "../common/repositories/doors_repository.h"
|
||||||
#include "../common/races.h"
|
#include "../common/races.h"
|
||||||
#include "../common/repositories/npc_faction_entries_repository.h"
|
#include "../common/repositories/npc_faction_entries_repository.h"
|
||||||
|
#include "../common/repositories/findable_location_repository.h"
|
||||||
|
|
||||||
#include "bot_database.h"
|
#include "bot_database.h"
|
||||||
|
|
||||||
@@ -638,6 +639,9 @@ public:
|
|||||||
void LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> ¤cy);
|
void LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> ¤cy);
|
||||||
void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value);
|
void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value);
|
||||||
|
|
||||||
|
/* Findable Locations */
|
||||||
|
std::vector<FindableLocationRepository::FindableLocation> LoadFindableLocations(const std::string& zone_name, int16 version);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Misc stuff.
|
* Misc stuff.
|
||||||
* PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD
|
* PLEASE DO NOT ADD TO THIS COLLECTION OF CRAP UNLESS YOUR METHOD
|
||||||
|
|||||||
Reference in New Issue
Block a user