|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.util.SimpleDataRecord<EventOutcomeRecord>
org.starhope.appius.user.events.EventOutcomeRecord
public class EventOutcomeRecord
Event outcomes are the rules that determine what results come from ending an event.
Each event type is associated with a single outcome. That outcome can reward the player for an event, or do nothing.
For events such as minigames and in-world games, outcomes will general give the player some kind of reward.
The reward scalar scales the reward. It is used for selection of items, as well as currency rewards.
The reward scalar can be chosen randomly from within a given range of values. (A minimum and maximum value can be set.)
The reward scalar can also be taken from points earned playing a game or minigame, multiplied by a scaling factor. For example, in a game in which the score could range from 0 to 1000, but a reward item is to be chosen in the range from 0 to 9, the scaling factor would be .001 with limits of 0 and 9. This would ensure that the score of 1000 × .001 = 10 would be limited instead to 9.
Issuing a reward of currency is the simplest option. For this, the unit of currency (for example, Tootsville™ Peanuts) must be chosen, and the reward scalar is translated directly into currency.
For example, for a game with a score ranging from 0 to 1000, for which you wish to reward from 0 to 50 currency units, a scaling factor of .05 would give the correct results. (50 ÷ 1000 = .05; 1000 × .05 = 50).
Players can be rewarded with items based on the outcome of a game or minigame. The reward item can be a specific item, an item from a collection, or any item in the game's entire item database.
In the case of an item collection, the reward scalar is first determined. Then, the scalar is taken modulo the size of the collection. The item in the collection, in sequence, with the index of the reward scalar is the chosen item. Note that the index and scalar both begin counting with 0.
In other words, for a set of ten items, the items are numbered 0 through 9. The scalar is limited to the range of 0 to 9 (thus, 18 becomes 8). The first item is item 0; the next is item 1; and so forth.
Likewise, for “all items,” the actual item rewarded is taken from the item scalar. This is generally worthless, unless the scalar is random.
Furthermore, however, the item rewarded can be restricted based upon its rarity. Both a minimum and maximum rarity rating can be specified. (These ratings are inclusive.) This allows, for example, rewarding a random item from a collection, but not the rarest item in that collection. It can also be combined with random scalars against all items.
Note that applying a random scalar within a range does not imply even distribution of random values. There will be an uneven distribution based upon various factors, so the total set of all items rewarded “randomly” will favour certain items mathematically. However, this effect should generally be negligible.
To figure out the scaling factor to give a scalar in the range from 0 to x, with a points-score in the range from 0 to y. simply take x÷y. (That's the maximum scalar desired divided by the maximum possible score.)
Field Summary | |
---|---|
private MedalType |
giveMedal
WRITEME: Document this brpocock@star-hope.org |
private int |
id
event outcome ID |
private RarityRating |
maxRarity
WRITEME: Document this brpocock@star-hope.org |
private BigDecimal |
maxReward
WRITEME: Document this brpocock@star-hope.org |
private RarityRating |
minRarity
WRITEME: Document this brpocock@star-hope.org |
private BigDecimal |
minReward
WRITEME: Document this brpocock@star-hope.org |
private boolean |
permitDuplicateReward
WRITEME: Document this brpocock@star-hope.org |
private boolean |
retryDuplicateReward
WRITEME: Document this brpocock@star-hope.org |
private boolean |
rewardByPoints
WRITEME: Document this brpocock@star-hope.org |
private int |
rewardCollectionID
WRITEME: Document this brpocock@star-hope.org |
private Currency |
rewardCurrency
WRITEME: Document this brpocock@star-hope.org |
private int |
rewardItemID
WRITEME: Document this brpocock@star-hope.org |
private RewardItemType |
rewardItemType
the type of method of selection of an item reward |
private BigDecimal |
rewardMax
WRITEME: Document this brpocock@star-hope.org |
private BigDecimal |
rewardMin
WRITEME: Document this brpocock@star-hope.org |
private boolean |
rewardRandom
WRITEME: Document this brpocock@star-hope.org |
private BigDecimal |
rewardRatio
WRITEME: Document this brpocock@star-hope.org |
private static long |
serialVersionUID
WRITEME: Document this brpocock@star-hope.org |
Fields inherited from class org.starhope.appius.util.SimpleDataRecord |
---|
myLoader, timeLastChanged, timeLastSaved |
Constructor Summary | |
---|---|
EventOutcomeRecord()
WRITEME: Document this constructor brpocock@star-hope.org |
|
EventOutcomeRecord(RecordLoader<EventOutcomeRecord> loader)
WRITEME: Document this constructor brpocock@star-hope.org |
Method Summary | |
---|---|
int |
getCacheableID()
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier (
DataRecord.getCacheableIdent() or both. |
String |
getCacheableIdent()
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier (
DataRecord.getCacheableIdent() or both. |
MedalType |
getGiveMedal()
|
int |
getID()
|
RarityRating |
getMaxRarity()
|
BigDecimal |
getMaxReward()
|
RarityRating |
getMinRarity()
|
BigDecimal |
getMinReward()
|
int |
getRewardCollectionID()
|
Currency |
getRewardCurrency()
|
int |
getRewardItemID()
|
RewardItemType |
getRewardItemType()
|
BigDecimal |
getRewardMax()
|
BigDecimal |
getRewardMin()
|
BigDecimal |
getRewardRatio()
|
String |
getSubversionRevision()
Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence. |
boolean |
isPermitDuplicateReward()
|
boolean |
isRetryDuplicateReward()
|
boolean |
isRewardByPoints()
|
boolean |
isRewardRandom()
|
void |
setGiveMedal(MedalType medalToGive)
|
void |
setID(int newID)
|
void |
setMaxRarity(RarityRating newMaxRarity)
|
void |
setMaxReward(BigDecimal newMaxReward)
|
void |
setMinRarity(RarityRating newMinRarity)
|
void |
setMinReward(BigDecimal newMinReward)
|
void |
setPermitDuplicateReward(boolean whetherToPermitDuplicateRewards)
|
void |
setRetryDuplicateReward(boolean whetherToRetryOnDuplicateRewards)
|
void |
setRewardByPoints(boolean whetherToRewardByPoints)
|
void |
setRewardCollectionID(int newRewardCollectionID)
|
void |
setRewardCurrency(Currency currency)
|
void |
setRewardItemID(int newRewardItemID)
|
void |
setRewardItemType(RewardItemType newType)
WRITEME: Document this method brpocock@star-hope.org |
void |
setRewardMax(BigDecimal bigDecimal)
|
void |
setRewardMin(BigDecimal bigDecimal)
|
void |
setRewardRandom(boolean equals)
|
void |
setRewardRatio(BigDecimal newRewardRatio)
|
Methods inherited from class org.starhope.appius.util.SimpleDataRecord |
---|
changed, checkStale, compareTo, equals, finalize, getRecordLoader, getTimeLastChanged, getTimeLastSaved, hashCode, isBeingLoaded, markAsLoaded, markAsSaved, markForReload, onRemove, onRetrieve, onStore, save, setRecordLoader, toString |
Methods inherited from class java.lang.Object |
---|
clone, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private MedalType giveMedal
private int id
private RarityRating maxRarity
private BigDecimal maxReward
private RarityRating minRarity
private BigDecimal minReward
private boolean permitDuplicateReward
private boolean retryDuplicateReward
private boolean rewardByPoints
private int rewardCollectionID
private Currency rewardCurrency
private int rewardItemID
private BigDecimal rewardRatio
private boolean rewardRandom
private BigDecimal rewardMin
private BigDecimal rewardMax
private RewardItemType rewardItemType
Constructor Detail |
---|
public EventOutcomeRecord()
public EventOutcomeRecord(RecordLoader<EventOutcomeRecord> loader)
loader
- WRITEMEMethod Detail |
---|
public int getCacheableID() throws NotFoundException
DataRecord
DataRecord.getCacheableID()
or a string identifier (
DataRecord.getCacheableIdent()
or both.
NotFoundException
- if the item doesn't have a distinct
numeric IDDataRecord.getCacheableID()
public String getCacheableIdent()
DataRecord
DataRecord.getCacheableID()
or a string identifier (
DataRecord.getCacheableIdent()
or both.
DataRecord.getCacheableIdent()
public MedalType getGiveMedal()
public int getID()
public RarityRating getMaxRarity()
public BigDecimal getMaxReward()
public RarityRating getMinRarity()
public BigDecimal getMinReward()
public int getRewardCollectionID()
public Currency getRewardCurrency()
public int getRewardItemID()
public RewardItemType getRewardItemType()
public BigDecimal getRewardMax()
public BigDecimal getRewardMin()
public BigDecimal getRewardRatio()
public String getSubversionRevision()
HasSubversionRevision
Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
As an example,the Subversion revision string for this file is "$Rev: 1968 $"
@Override public String getSubversionRevision () { return "$Rev: "; }
HasSubversionRevision.getSubversionRevision()
public boolean isPermitDuplicateReward()
public boolean isRetryDuplicateReward()
public boolean isRewardByPoints()
public boolean isRewardRandom()
public void setGiveMedal(MedalType medalToGive)
medalToGive
- the giveMedal to setpublic void setID(int newID)
newID
- the id to setpublic void setMaxRarity(RarityRating newMaxRarity)
newMaxRarity
- the maxRarity to setpublic void setMaxReward(BigDecimal newMaxReward)
newMaxReward
- the maxReward to setpublic void setMinRarity(RarityRating newMinRarity)
newMinRarity
- the minRarity to setpublic void setMinReward(BigDecimal newMinReward)
newMinReward
- the minReward to setpublic void setPermitDuplicateReward(boolean whetherToPermitDuplicateRewards)
whetherToPermitDuplicateRewards
- the permitDuplicateReward
to setpublic void setRetryDuplicateReward(boolean whetherToRetryOnDuplicateRewards)
whetherToRetryOnDuplicateRewards
- the retryDuplicateReward
to setpublic void setRewardByPoints(boolean whetherToRewardByPoints)
whetherToRewardByPoints
- the rewardByPoints to setpublic void setRewardCollectionID(int newRewardCollectionID)
newRewardCollectionID
- the rewardCollectionID to setpublic void setRewardCurrency(Currency currency)
currency
- the rewardCurrency to setpublic void setRewardItemID(int newRewardItemID)
newRewardItemID
- the rewardItemID to setpublic void setRewardItemType(RewardItemType newType)
newType
- WRITEMEpublic void setRewardMax(BigDecimal bigDecimal)
bigDecimal
- the maximum reward scalarpublic void setRewardMin(BigDecimal bigDecimal)
bigDecimal
- the minimum amount for the reward scalarpublic void setRewardRandom(boolean equals)
equals
- whether the reward scalar is determined randomlypublic void setRewardRatio(BigDecimal newRewardRatio)
newRewardRatio
- the rewardRatio to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |