Class GashaponReward
java.lang.Object
server.gashapon.GashaponReward
單筆轉蛋獎勵的不可變資料模型,對應資料表
gashapon_items 的一列。
由 Gashapon.reloadItems() 自 SQL 載入後封裝為本物件,並包進
tools.Pair<Long, GashaponReward>(left 為累積機率上界)放入機台的累積機率清單。
抽中後由腳本(cm.getGashapon().generateReward())讀取本物件的欄位自行發放道具。
欄位語意:
itemId——獎勵道具編號。chance——相對權重(非百分比),數值越大抽中機率越高。min/max——抽中後發放的隨機數量區間(含兩端)。showMsg——中獎是否以全頻喇叭廣播。
-
Constructor Summary
ConstructorsConstructorDescriptionGashaponReward(int itemId, int chance, int min, int max, boolean showMsg) 建構一筆轉蛋獎勵。 -
Method Summary
-
Constructor Details
-
GashaponReward
public GashaponReward(int itemId, int chance, int min, int max, boolean showMsg) 建構一筆轉蛋獎勵。- Parameters:
itemId- 獎勵道具編號chance- 相對權重(非百分比)min- 發放數量下界(含)max- 發放數量上界(含)showMsg- 中獎是否全頻廣播
-
-
Method Details
-
getItemId
public int getItemId()- Returns:
- 獎勵道具編號。
-
getChance
public int getChance()- Returns:
- 相對權重(非百分比)。
-
getMin
public int getMin()- Returns:
- 發放數量下界(含)。
-
getMax
public int getMax()- Returns:
- 發放數量上界(含)。
-
isShowMsg
public boolean isShowMsg()- Returns:
- 中獎是否以全頻喇叭廣播。
-