From 0f60fb06e37fbf7d6d0183214b237fb8014799e1 Mon Sep 17 00:00:00 2001 From: Siroro Date: Thu, 27 Feb 2014 09:41:57 +0000 Subject: [PATCH 1/2] Added rule Merchant: EnableAltCurrencySell - defaults to true, allows servers to disable the ability to resell items to alternate currency merchants. --- common/ruletypes.h | 2 ++ zone/client_packet.cpp | 56 +++++++++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 3f9e74546..dcfeafbaf 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -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_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_BOOL ( Merchant, EnableAltCurrencySell, true) // Enables the ability to resell items to alternate currency merchants + RULE_CATEGORY_END() RULE_CATEGORY ( Bazaar ) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d304715e4..1b3485ec8 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12627,32 +12627,38 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); uint32 merchant_id = tar->MerchantType; - bool found = false; - std::list merlist = zone->merchanttable[merchant_id]; - std::list::const_iterator itr; - for(itr = merlist.begin(); itr != merlist.end(); ++itr) { - MerchantList ml = *itr; - if(GetLevel() < ml.level_required) { - continue; + + if (RuleB(Merchant, EnableAltCurrencySell)) { + bool found = false; + std::list merlist = zone->merchanttable[merchant_id]; + std::list::const_iterator itr; + for (itr = merlist.begin(); itr != merlist.end(); ++itr) { + 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(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; + if (!found) { + cost = 0; } } - - if(!found) { + else { cost = 0; } @@ -12802,6 +12808,10 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) { return; } + if (!RuleB(Merchant, EnableAltCurrencySell)) { + return; + } + const Item_Struct* item = nullptr; uint32 cost = 0; uint32 current_currency = GetAlternateCurrencyValue(alt_cur_id); @@ -12824,7 +12834,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) { if(!item) continue; - if(item->ID == inst->GetItem()->ID) { + if(item->ID == inst->GetItem()->ID) { cost = ml.alt_currency_cost; found = true; break; From a490b2ff222b7587b5c4b42fb1b1230b5698ad52 Mon Sep 17 00:00:00 2001 From: Siroro Date: Thu, 27 Feb 2014 12:00:06 +0000 Subject: [PATCH 2/2] Fixed augs having 100% proc rate --- zone/attack.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index b658ba655..db8e5bf6c 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4091,18 +4091,22 @@ void Mob::TryWeaponProc(const ItemInst *inst, const Item_Struct *weapon, Mob *on if (aug->Proc.Type == ET_CombatProc) { float APC = ProcChance * (100.0f + // Proc chance for this aug - static_cast(aug->ProcRate)) / 100.0f; + static_cast(aug->ProcRate)) / 100.0f; if (MakeRandomFloat(0, 1) <= APC) { - if (IsPet()) { - Mob *own = GetOwner(); - if (own) - own->Message_StringID(13, PROC_PETTOOLOW); - } else { - Message_StringID(13, PROC_TOOLOW); + if (aug->Proc.Level > ourlevel) { + if (IsPet()) { + Mob *own = GetOwner(); + if (own) + own->Message_StringID(13, PROC_PETTOOLOW); + } + else { + Message_StringID(13, PROC_TOOLOW); + } + } + else { + ExecWeaponProc(aug_i, aug->Proc.Effect, on); + break; } - } else { - ExecWeaponProc(aug_i, aug->Proc.Effect, on); - break; } } }