Merge pull request #121 from Siroro/master

Added rule Merchant:EnableAltCurrencySell
This commit is contained in:
Michael Cook 2014-02-27 13:11:40 -05:00
commit c18e9d9503
3 changed files with 49 additions and 33 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

@ -4093,20 +4093,24 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on
float APC = ProcChance * (100.0f + // Proc chance for this aug float APC = ProcChance * (100.0f + // Proc chance for this aug
static_cast<float>(aug->ProcRate)) / 100.0f; static_cast<float>(aug->ProcRate)) / 100.0f;
if (MakeRandomFloat(0, 1) <= APC) { if (MakeRandomFloat(0, 1) <= APC) {
if (aug->Proc.Level > ourlevel) {
if (IsPet()) { if (IsPet()) {
Mob *own = GetOwner(); Mob *own = GetOwner();
if (own) if (own)
own->Message_StringID(13, PROC_PETTOOLOW); own->Message_StringID(13, PROC_PETTOOLOW);
} else { }
else {
Message_StringID(13, PROC_TOOLOW); Message_StringID(13, PROC_TOOLOW);
} }
} else { }
else {
ExecWeaponProc(aug_i, aug->Proc.Effect, on); ExecWeaponProc(aug_i, aug->Proc.Effect, on);
break; break;
} }
} }
} }
} }
}
// TODO: Powersource procs // TODO: Powersource procs
if (HasSkillProcs()) if (HasSkillProcs())
TrySkillProc(on, skillinuse, ProcChance); TrySkillProc(on, skillinuse, ProcChance);

View File

@ -12627,6 +12627,8 @@ 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;
if (RuleB(Merchant, EnableAltCurrencySell)) {
bool found = false; bool found = false;
std::list<MerchantList> merlist = zone->merchanttable[merchant_id]; std::list<MerchantList> merlist = zone->merchanttable[merchant_id];
std::list<MerchantList>::const_iterator itr; std::list<MerchantList>::const_iterator itr;
@ -12655,6 +12657,10 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app)
if (!found) { if (!found) {
cost = 0; cost = 0;
} }
}
else {
cost = 0;
}
EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrencySellSelection, sizeof(AltCurrencySelectItemReply_Struct)); EQApplicationPacket* outapp = new EQApplicationPacket(OP_AltCurrencySellSelection, sizeof(AltCurrencySelectItemReply_Struct));
AltCurrencySelectItemReply_Struct *reply = (AltCurrencySelectItemReply_Struct*)outapp->pBuffer; AltCurrencySelectItemReply_Struct *reply = (AltCurrencySelectItemReply_Struct*)outapp->pBuffer;
@ -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);