mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Establish default order for merchantlist items.
Allow merchants to use 80th slot.
This commit is contained in:
parent
c328829610
commit
ea4c23efcf
@ -983,7 +983,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
|
||||
|
||||
uint32 i = 1;
|
||||
uint8 handychance = 0;
|
||||
for (itr = merlist.begin(); itr != merlist.end() && i < numItemSlots; ++itr) {
|
||||
for (itr = merlist.begin(); itr != merlist.end() && i <= numItemSlots; ++itr) {
|
||||
MerchantList ml = *itr;
|
||||
if (merch->CastToNPC()->GetMerchantProbability() > ml.probability)
|
||||
continue;
|
||||
@ -1028,12 +1028,15 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) {
|
||||
}
|
||||
}
|
||||
// Account for merchant lists with gaps.
|
||||
if(ml.slot >= i)
|
||||
if (ml.slot >= i) {
|
||||
if (ml.slot > i)
|
||||
LogFile->write(EQEMuLog::Debug, "(WARNING) Merchantlist contains gap at slot %d. Merchant: %d, NPC: %d", i, merchant_id, npcid);
|
||||
i = ml.slot + 1;
|
||||
}
|
||||
}
|
||||
std::list<TempMerchantList> origtmp_merlist = zone->tmpmerchanttable[npcid];
|
||||
tmp_merlist.clear();
|
||||
for(tmp_itr = origtmp_merlist.begin();tmp_itr != origtmp_merlist.end() && i<numItemSlots;++tmp_itr){
|
||||
for (tmp_itr = origtmp_merlist.begin(); tmp_itr != origtmp_merlist.end() && i <= numItemSlots; ++tmp_itr) {
|
||||
TempMerchantList ml = *tmp_itr;
|
||||
item = database.GetItem(ml.item);
|
||||
ml.slot = i;
|
||||
|
||||
@ -320,7 +320,6 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg
|
||||
// Account for merchant lists with gaps in them.
|
||||
if (ml.slot >= i)
|
||||
i = ml.slot + 1;
|
||||
|
||||
}
|
||||
std::list<TempMerchantList> tmp_merlist = tmpmerchanttable[npcid];
|
||||
std::list<TempMerchantList>::const_iterator tmp_itr;
|
||||
@ -412,7 +411,8 @@ void Zone::LoadTempMerchantData(){
|
||||
"WHERE "
|
||||
"ml.npcid = se.npcid "
|
||||
"AND se.spawngroupid = s2.spawngroupid "
|
||||
"AND s2.zone = '%s' AND s2.version = %i", GetShortName(), GetInstanceVersion());
|
||||
"AND s2.zone = '%s' AND s2.version = %i"
|
||||
"ORDER BY ml.slot ", GetShortName(), GetInstanceVersion());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
@ -445,7 +445,7 @@ void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
|
||||
std::list<MerchantList> merlist;
|
||||
std::string query = StringFormat("SELECT item, slot, faction_required, level_required, alt_currency_cost, "
|
||||
"classes_required FROM merchantlist WHERE merchantid=%d", merchantid);
|
||||
"classes_required FROM merchantlist WHERE merchantid=%d ORDER BY slot", merchantid);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadNewMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
@ -485,11 +485,15 @@ void Zone::GetMerchantDataForZoneLoad(){
|
||||
"spawnentry AS se, "
|
||||
"spawn2 AS s2 "
|
||||
"WHERE nt.merchant_id = ml.merchantid AND nt.id = se.npcid "
|
||||
"AND se.spawngroupid = s2.spawngroupid AND s2.zone = '%s' AND s2.version = %i ", GetShortName(), GetInstanceVersion());
|
||||
"AND se.spawngroupid = s2.spawngroupid AND s2.zone = '%s' AND s2.version = %i "
|
||||
"ORDER BY ml.slot ", GetShortName(), GetInstanceVersion());
|
||||
auto results = database.QueryDatabase(query);
|
||||
std::map<uint32, std::list<MerchantList> >::iterator cur;
|
||||
uint32 npcid = 0;
|
||||
if (results.RowCount() == 0){ LogFile->write(EQEMuLog::Error, "Error in loading Merchant Data for zone"); return; }
|
||||
if (results.RowCount() == 0) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in loading Merchant Data for zone");
|
||||
return;
|
||||
}
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MerchantList ml;
|
||||
ml.id = atoul(row[0]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user