mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-10 13:23:52 +00:00
Added support for merchant item filtering by class
Added column classes_required to merchantlist to allow the merchant to only sell items to specified classes Ex. (only example I know from live) To only allow poison supplies to be sell able to only rogues, you would set classes_required to 256. classes_required defaults to 65535 (all/any class) Remember to run the new SQL!
This commit is contained in:
parent
30e8eac46e
commit
13fcccefd5
@ -1,5 +1,8 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 12/26/2013 ==
|
||||
demonstar55: Added classes_required to merchantlist (same bitmask as items)
|
||||
|
||||
== 12/24/2013 ==
|
||||
Secrets (Akkadius): Perl $client->SilentMessage("Message"); addition, this is a pre-req for a Perl plugin I've shared with EQEmu. This function essentially mimics a player speaking with an NPC - which is used in popup window responses
|
||||
Secrets: Added functionality to Perl for $client->PlayMP3("name of file").
|
||||
|
||||
@ -3428,15 +3428,18 @@ struct LevelAppearance_Struct { //Sends a little graphic on level up
|
||||
uint32 value5b;
|
||||
/*64*/
|
||||
};
|
||||
struct MerchantList{
|
||||
|
||||
struct MerchantList {
|
||||
uint32 id;
|
||||
uint32 slot;
|
||||
uint32 item;
|
||||
int16 faction_required;
|
||||
int8 level_required;
|
||||
uint16 alt_currency_cost;
|
||||
uint32 classes_required;
|
||||
};
|
||||
struct TempMerchantList{
|
||||
|
||||
struct TempMerchantList {
|
||||
uint32 npcid;
|
||||
uint32 slot;
|
||||
uint32 item;
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
ALTER TABLE `merchantlist` ADD COLUMN `classes_required` INT(11) NOT NULL DEFAULT '65535';
|
||||
|
||||
@ -984,6 +984,9 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(ml.classes_required & (1 << (GetClass() - 1))))
|
||||
continue;
|
||||
|
||||
int32 fac = merch ? merch->GetPrimaryFaction() : 0;
|
||||
if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) {
|
||||
continue;
|
||||
|
||||
@ -483,7 +483,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
std::list<MerchantList> merlist;
|
||||
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT item, slot, faction_required, level_required, alt_currency_cost FROM merchantlist WHERE merchantid=%d", merchantid), errbuf, &result)) {
|
||||
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT item, slot, faction_required, level_required, alt_currency_cost, classes_required FROM merchantlist WHERE merchantid=%d", merchantid), errbuf, &result)) {
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
MerchantList ml;
|
||||
ml.id = merchantid;
|
||||
@ -492,6 +492,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
ml.faction_required = atoul(row[2]);
|
||||
ml.level_required = atoul(row[3]);
|
||||
ml.alt_currency_cost = atoul(row[3]);
|
||||
ml.classes_required = atoul(row[4]);
|
||||
merlist.push_back(ml);
|
||||
}
|
||||
merchanttable[merchantid] = merlist;
|
||||
@ -538,6 +539,7 @@ void Zone::LoadMerchantData_result(MYSQL_RES* result) {
|
||||
ml.faction_required = atoul(row[3]);
|
||||
ml.level_required = atoul(row[4]);
|
||||
ml.alt_currency_cost = atoul(row[5]);
|
||||
ml.classes_required = atoul(row[6]);
|
||||
cur->second.push_back(ml);
|
||||
}
|
||||
}
|
||||
@ -551,7 +553,7 @@ void Zone::GetMerchantDataForZoneLoad(){
|
||||
workpt.b1() = DBA_b1_Zone_MerchantLists;
|
||||
DBAsyncWork* dbaw = new DBAsyncWork(&database, &MTdbafq, workpt, DBAsync::Read);
|
||||
dbaw->AddQuery(1, &query, MakeAnyLenString(&query,
|
||||
"select ml.merchantid,ml.slot,ml.item,ml.faction_required,ml.level_required,ml.alt_currency_cost "
|
||||
"select ml.merchantid,ml.slot,ml.item,ml.faction_required,ml.level_required,ml.alt_currency_cost,ml.classes_required "
|
||||
"from merchantlist ml, npc_types nt, spawnentry se, spawn2 s2 "
|
||||
"where nt.merchant_id=ml.merchantid and nt.id=se.npcid "
|
||||
"and se.spawngroupid=s2.spawngroupid and s2.zone='%s' and s2.version=%u "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user