/// <summary> /// Our new Shopkeeper skill rewards the Shopkeeper with ShopkeeperPoints for sales and normal vendor /// charges. This may seem broken and strange, but we cannot reward for vendor income via sales as /// this is too easily exploited (and costs the Shopkeeper nothing.) The only reasonable way to award /// points is through cost to the shop owner as this will most accurately reflect both commitment and /// success. One cost we do not credit the Shopkeeper with is restocking charges. This is certainly /// not 'professional behavior' and should not be rewarded; however, we DO penalize the Shopkeeper /// by removing points of the restock caused the vendor to die because there were insufficient funds. /// -- /// because we cap vendor inventory near 100,000,000, the highest one-time charge would be /// that of commission type sales, and today that would be 7% or 7,000,000 resulting in a /// worst case scenario of a 70,000,000 penalty. /// </summary> /// <param name="pay"></param> /// <param name="penalty"></param> public void ProcessAwards(int pay, ChargeReason reason) { // only award points to shopkeepers (ones that have purchased the book) PlayerMobile pm = (Owner as PlayerMobile); if (reason == PlayerVendor.ChargeReason.Commission && this.PricingModel != PricingModel.Commission) return; if (pm == null) return; // punish the lame or cheater (includes penalty charges) // do not share the punishment with the 'shop owner' if ((this.BankAccount + this.HoldGold) < pay) { // no matter what the reason, if the vendor does not have enough gold to handle the chargs, pass the penalty on to the owner ApplyAwards(pm, -(pay * 10)); } else { // reward the hard working, but do not credit penalty charges if (reason == ChargeReason.Wage || reason == ChargeReason.Commission) { if (this is RentedVendor) { // if the owner of the shop is a 'shopkeeper', then we must share our shopkeeper points with her. // give the shop owner of a rented vendor 25% of the profit ApplyAwards((this as RentedVendor).Landlord as PlayerMobile, pay * .25); // give the owner of a rented vendor 75% of the profit ApplyAwards(pm, pay * .75); } else { // 100% of the points go to owners of regular vendors ApplyAwards(pm, pay); } } else if (reason == ChargeReason.Restock) // If the shopkeeper is paying a penalty, charge them reverse points, fame and karma ApplyAwards(pm, -pay); } }
/*public void Charge(int pay) { Charge(pay, false); }*/ public void Charge(int pay, ChargeReason reason) { //if we're an admin-owned vendor, then don't charge! if (this.StaffOwned) return; // award skill points for sales ProcessAwards(pay, reason); if (this.BankAccount < pay) { pay -= this.BankAccount; this.BankAccount = 0; if (this.HoldGold < pay) { this.Say(503235); // I regret nothing!postal this.Destroying = true; this.Blessed = false; this.Kill(); } else { this.HoldGold -= pay; } } else { this.BankAccount -= pay; } }