Added rule Merchant: EnableAltCurrencySell - defaults to true, allows servers to disable the ability to resell items to alternate currency merchants.

This commit is contained in:
Siroro 2014-02-27 09:41:57 +00:00
parent 489a6ffd16
commit 0f60fb06e3
2 changed files with 35 additions and 23 deletions

View File

@ -466,6 +466,8 @@ RULE_INT ( Merchant, PriceBonusPct, 4) // Determines maximum price bonus from ha
RULE_INT ( Merchant, PricePenaltyPct, 4) // Determines maximum price penalty from having bad faction/CHA. Value is a percent. RULE_INT ( Merchant, PricePenaltyPct, 4) // Determines maximum price penalty from having bad faction/CHA. Value is a percent.
RULE_REAL( Merchant, ChaBonusMod, 3.45) // Determines CHA cap, from 104 CHA. 3.45 is 132 CHA at apprehensive. 0.34 is 400 CHA at apprehensive. RULE_REAL( Merchant, ChaBonusMod, 3.45) // Determines CHA cap, from 104 CHA. 3.45 is 132 CHA at apprehensive. 0.34 is 400 CHA at apprehensive.
RULE_REAL ( Merchant, ChaPenaltyMod, 1.52) // Determines CHA bottom, up to 102 CHA. 1.52 is 37 CHA at apprehensive. 0.98 is 0 CHA at apprehensive. RULE_REAL ( Merchant, ChaPenaltyMod, 1.52) // Determines CHA bottom, up to 102 CHA. 1.52 is 37 CHA at apprehensive. 0.98 is 0 CHA at apprehensive.
RULE_BOOL ( Merchant, EnableAltCurrencySell, true) // Enables the ability to resell items to alternate currency merchants
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY ( Bazaar ) RULE_CATEGORY ( Bazaar )

View File

@ -12627,32 +12627,38 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app)
uint32 cost = 0; uint32 cost = 0;
uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id);
uint32 merchant_id = tar->MerchantType; uint32 merchant_id = tar->MerchantType;
bool found = false;
std::list<MerchantList> merlist = zone->merchanttable[merchant_id]; if (RuleB(Merchant, EnableAltCurrencySell)) {
std::list<MerchantList>::const_iterator itr; bool found = false;
for(itr = merlist.begin(); itr != merlist.end(); ++itr) { std::list<MerchantList> merlist = zone->merchanttable[merchant_id];
MerchantList ml = *itr; std::list<MerchantList>::const_iterator itr;
if(GetLevel() < ml.level_required) { for (itr = merlist.begin(); itr != merlist.end(); ++itr) {
continue; MerchantList ml = *itr;
if (GetLevel() < ml.level_required) {
continue;
}
int32 fac = tar->GetPrimaryFaction();
if (fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) {
continue;
}
item = database.GetItem(ml.item);
if (!item)
continue;
if (item->ID == inst->GetItem()->ID) {
cost = ml.alt_currency_cost;
found = true;
break;
}
} }
int32 fac = tar->GetPrimaryFaction(); if (!found) {
if(fac != 0 && GetModCharacterFactionLevel(fac) < ml.faction_required) { cost = 0;
continue;
}
item = database.GetItem(ml.item);
if(!item)
continue;
if(item->ID == inst->GetItem()->ID) {
cost = ml.alt_currency_cost;
found = true;
break;
} }
} }
else {
if(!found) {
cost = 0; cost = 0;
} }
@ -12802,6 +12808,10 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) {
return; return;
} }
if (!RuleB(Merchant, EnableAltCurrencySell)) {
return;
}
const Item_Struct* item = nullptr; const Item_Struct* item = nullptr;
uint32 cost = 0; uint32 cost = 0;
uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id);
@ -12824,7 +12834,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) {
if(!item) if(!item)
continue; continue;
if(item->ID == inst->GetItem()->ID) { if(item->ID == inst->GetItem()->ID) {
cost = ml.alt_currency_cost; cost = ml.alt_currency_cost;
found = true; found = true;
break; break;