Update of "Discount"

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: a2f586c09fbbe1769d4d1f8ab5edff7bd844d6c7
Page Name:Discount
Date: 2017-02-18 03:40:52
Original User: Entomy
Content

Purpose

Sometimes, it is desirable to discount menu item costs for certain people. This makes the fanclub into a loyalty program of sorts, and can be a way of "paying" moderators for their volunteered assistance.

Use

Two properties fanclub and moderator are the respective discounts. This should be treated as a discount percentage between 0~1. So for a discount of 10%, use 0.1.

To calculate the discounted price, pass into apply() both the item to apply, and a relevant object which contains user properties. It is important to understand this function returns only the price after discount, not a whole Menu Item object. This is a performance consideration, as creating that many new objects every time someone tips rapidly overworks a garbage collector, which will present itself as delays in response time, stalled timers, and more.

Requirements