diff --git a/changelog.txt b/changelog.txt index ccbf7a95e..0c395d3f1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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"). diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 63387ef35..0959ed348 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -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; diff --git a/utils/sql/git/required/2013_12_26_MerchantList_Class_Required.sql b/utils/sql/git/required/2013_12_26_MerchantList_Class_Required.sql new file mode 100644 index 000000000..ab1bbe68d --- /dev/null +++ b/utils/sql/git/required/2013_12_26_MerchantList_Class_Required.sql @@ -0,0 +1,2 @@ + ALTER TABLE `merchantlist` ADD COLUMN `classes_required` INT(11) NOT NULL DEFAULT '65535'; + diff --git a/zone/client_process.cpp b/zone/client_process.cpp index f4b287991..0f6b4b5cf 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -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; diff --git a/zone/zone.cpp b/zone/zone.cpp index dfddf22ff..7a48621c9 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -483,7 +483,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){ MYSQL_RES *result; MYSQL_ROW row; std::list 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 "