[Merchants] Add Merchant Data Bucket capability. (#2160)

* [Merchants] Add Merchant Data Bucket capability.
- Allows server operators to limit merchant items based on data bucket values and comparisons.
- Adds 3 columns, bucket_name, bucket_value, and bucket_comparison to merchantlist table.
- Bucket is checked based on GetBucketKey()-bucket_name.
- Buckets are mass loaded when using the merchant so it's not a database call per item, just a grouping of all their buckets from the start.
- This is a nearly year old pull request redone for master.
- bucket_comparison Values are as follows:
        - bucket_comparison 0: bucket_name == bucket_value
        - bucket_comparison 1: bucket_name != bucket_value
        - bucket_comparison 2: bucket_name >= bucket_value
        - bucket_comparison 3: bucket_name <= bucket_value
        - bucket_comparison 4: bucket_name > bucket_value
        - bucket_comparison 5: bucket_name < bucket_value
        - bucket_comparison 6: bucket_name is any of  pipe(|)-separated bucket_value
        - bucket_comparison 7: bucket_name is not any of  pipe(|)-separated bucket_value
        - bucket_comparison 8: bucket_name is between first and second value of pipe(|)-separated bucket_value
        - bucket_comparison 9: bucket_name is not between first and second value of pipe(|)-separated  bucket_value

* Revert query change.
This commit is contained in:
Kinglykrab
2022-05-09 21:36:51 -04:00
committed by GitHub
parent 6e0d101457
commit 763fc82379
9 changed files with 379 additions and 169 deletions
+13
View File
@@ -431,4 +431,17 @@ enum ReloadWorld : uint8 {
ForceRepop
};
enum MerchantBucketComparison : uint8 {
BucketEqualTo = 0,
BucketNotEqualTo,
BucketGreaterThanOrEqualTo,
BucketLesserThanOrEqualTo,
BucketGreaterThan,
BucketLesserThan,
BucketIsAny,
BucketIsNotAny,
BucketIsBetween,
BucketIsNotBetween
};
#endif /*COMMON_EMU_CONSTANTS_H*/
+11 -8
View File
@@ -3621,14 +3621,17 @@ struct LevelAppearance_Struct { //Sends a little graphic on level up
};
struct MerchantList {
uint32 id;
uint32 slot;
uint32 item;
int16 faction_required;
int8 level_required;
uint16 alt_currency_cost;
uint32 classes_required;
uint8 probability;
uint32 id;
uint32 slot;
uint32 item;
int16 faction_required;
int8 level_required;
uint16 alt_currency_cost;
uint32 classes_required;
uint8 probability;
std::string bucket_name;
std::string bucket_value;
uint8 bucket_comparison;
};
struct TempMerchantList {
+1 -1
View File
@@ -34,7 +34,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9182
#define CURRENT_BINARY_DATABASE_VERSION 9183
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9028