[Java] 纯文本查看 复制代码
int[][] reward = null;
switch (item.getItemId()) {
case 5222000:
reward = NpcSetConstants.XMAXS_SURPRISE;
break;
case 5222004:
reward = NpcSetConstants.XMAXS_SURPRISE_2;
break;
case 5222005:
reward = NpcSetConstants.XMAXS_SURPRISE_3;
break;
case 5222006:
reward = NpcSetConstants.XMAXS_SURPRISE_4;
break;
}
final int RewardIemId = RandomRewards.getInstance().getXmasreward();
//final CashItem rewardItem = c.isnewcs() ? CashItemFactoryNew.getInstance().getItemId(RewardIemId) : CashItemFactory.getInstance().getItemId(RewardIemId);
List<CashItem> rewardItems = CashItemFactory.getInstance().getAllItems();
IItem itemz = null;
CashItem rewardItem = null;
if (reward.length > 0) {
int Maternal = 0;
int A = 0;
for (var i = 0; i < reward.length; i++) {
Maternal += reward[i][1];
}
int choose = Randomizer.rand(1, Maternal);
int index = -1;
for (var i = 0; i < reward.length; i++) {
int B = A;
A += reward[i][1];
if (choose >= B && choose <= A) {
index = i;
break;
}
}
int itemid = reward[index][0];
if (MapleItemInformationProvider.getInstance().itemExists(itemid)) {
itemz = (GameConstants.getInventoryType(itemid) == MapleInventoryType.EQUIP) ? MapleItemInformationProvider.getInstance().getEquipById(itemid) : new Item(itemid, (short) 0, (short) 1, (byte) 0);
}
}