use of server.life.MonsterGlobalDropEntry in project HeavenMS by ronancpl.
the class MapleMap method dropFromMonster.
private void dropFromMonster(final MapleCharacter chr, final MapleMonster mob, final boolean useBaseRate) {
if (mob.dropsDisabled() || !dropsOn) {
return;
}
final byte droptype = (byte) (mob.getStats().isExplosiveReward() ? 3 : mob.getStats().isFfaLoot() ? 2 : chr.getParty() != null ? 1 : 0);
final int mobpos = mob.getPosition().x;
int chRate = chr.getDropRate();
byte d = 1;
Point pos = new Point(0, mob.getPosition().y);
MonsterStatusEffect stati = mob.getStati(MonsterStatus.SHOWDOWN);
if (stati != null) {
chRate *= (stati.getStati().get(MonsterStatus.SHOWDOWN).doubleValue() / 100.0 + 1.0);
}
if (useBaseRate)
chRate = 1;
final MapleMonsterInformationProvider mi = MapleMonsterInformationProvider.getInstance();
final List<MonsterDropEntry> dropEntry = new ArrayList<>();
final List<MonsterDropEntry> questEntry = new ArrayList<>();
sortDropEntries(mi.retrieveEffectiveDrop(mob.getId()), dropEntry, questEntry);
// Normal Drops
d = dropItemsFromMonsterOnMap(dropEntry, pos, d, chRate, droptype, mobpos, chr, mob);
// Global Drops
final List<MonsterGlobalDropEntry> globalEntry = mi.getGlobalDrop();
d = dropGlobalItemsFromMonsterOnMap(globalEntry, pos, d, droptype, mobpos, chr, mob);
// Quest Drops
dropItemsFromMonsterOnMap(questEntry, pos, d, chRate, droptype, mobpos, chr, mob);
}
use of server.life.MonsterGlobalDropEntry in project HeavenMS by ronancpl.
the class MapleMap method dropGlobalItemsFromMonsterOnMap.
private byte dropGlobalItemsFromMonsterOnMap(List<MonsterGlobalDropEntry> globalEntry, Point pos, byte d, byte droptype, int mobpos, MapleCharacter chr, MapleMonster mob) {
Collections.shuffle(globalEntry);
Item idrop;
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
for (final MonsterGlobalDropEntry de : globalEntry) {
if (Randomizer.nextInt(999999) < de.chance) {
if (droptype == 3) {
pos.x = (int) (mobpos + (d % 2 == 0 ? (40 * (d + 1) / 2) : -(40 * (d / 2))));
} else {
pos.x = (int) (mobpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2))));
}
if (de.itemId != 0) {
if (ItemConstants.getInventoryType(de.itemId) == MapleInventoryType.EQUIP) {
idrop = ii.randomizeStats((Equip) ii.getEquipById(de.itemId));
} else {
idrop = new Item(de.itemId, (short) 0, (short) (de.Maximum != 1 ? Randomizer.nextInt(de.Maximum - de.Minimum) + de.Minimum : 1));
}
spawnDrop(idrop, calcDropPos(pos, mob.getPosition()), mob, chr, droptype, de.questid);
d++;
}
}
}
return d;
}
Aggregations