Would you like to react to this message? Create an account in a few clicks or log in to continue.

ドロップ倍率システム

Go down

ドロップ倍率システム Empty ドロップ倍率システム

投稿 by 構築さん 2014-05-30, 15:26

MapleMonsterInformationProvider.java

Code:
public List<DropEntry> retrieveDropChances(int monsterId) {
if (drops.containsKey(monsterId)) {
return drops.get(monsterId);
}
List<DropEntry> ret = new LinkedList<DropEntry>();
if (monsterId > 9300183 && monsterId < 9300216) {
for (int i = 2022359; i <2022367> 9300215 && monsterId < 9300269) {
for (int i = 2022430; i < 2022434; i++) {
ret.add(new DropEntry(i, 3333));
}
drops.put(monsterId, ret);
return ret;
}
try {
PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT itemid, chance FROM monsterdrops WHERE (monsterid = ? AND chance >= 0) OR (monsterid <= 0)");
ps.setInt(1, monsterId);
ResultSet rs = ps.executeQuery();
MapleMonster theMonster = MapleLifeFactory.getMonster(monsterId);
while (rs.next()) {
int chance = rs.getInt("chance");
chance = (int) ((double) (1 / chance) * 10000);
if (theMonster != null) {
chance += theMonster.getLevel();
}
ret.add(new DropEntry(rs.getInt("itemid"), chance));
}
rs.close();
ps.close();
} catch (SQLException e) {
}
drops.put(monsterId, ret);
return ret;
}

MapleMonster.java

Code:
public int getDrop(int droprate) {
MapleMonsterInformationProvider mi = MapleMonsterInformationProvider.getInstance();
int lastAssigned = -1;
int maxchance = 10000;
List<DropEntry> dl = mi.retrieveDropChances(getId());
for (DropEntry d : dl) {
d.assignedRangeStart = lastAssigned + 1;
d.assignedRangeLength = d.chance * (isBoss() ? 1 : droprate);
lastAssigned += d.assignedRangeLength;
}
if (lastAssigned > maxchance) {
maxchance = lastAssigned;
}
int c = Randomizer.getInstance().nextInt(maxchance);
for (DropEntry d : dl) {
if (c >= d.assignedRangeStart && c < (d.assignedRangeStart + d.assignedRangeLength)) {
if (stolenItems.contains(d.itemId)) {
return -1;
}
return d.itemId;
}
}

[color=#0000FF]MapleMap.java[/color]


protected final void dropFromMonster(MapleCharacter dropOwner, MapleMonster monster) {
if (monster.dropsDisabled() || dropOwner.getDropRate() <1> 9300183 && monster.getId() <9300216> 9300215 && monster.getId() < 9300271) {
maxDrops = 2;
}
List<Integer> toDrop = new ArrayList<Integer>();
for (int i = 0; i < maxDrops; i++) {
toDrop.add(monster.getDrop(dropOwner.getDropRate()));
}
Set<Integer> alreadyDropped = new HashSet<Integer>();
int htpendants = 0;
int htstones = 0;
int mesos = 0;
int mesoschance = Randomizer.getInstance().nextInt(3);
for (int i = 0; i < toDrop.size(); i++) {
if (toDrop.get(i) == -1) {
if (alreadyDropped.contains(-1)) {
if (!isBoss) {
toDrop.remove(i);
i--;
} else if (mesos <7> 8810000 && monster.getId() < 8810018) && monster.getId() != 8810018 && monster.getId() != 8810026) {
if (alreadyDropped.contains(-1)) {
if (!isBoss) {
toDrop.remove(i);
i--;
} else if (mesos <7> -1) {
if (mesoschance <2>= 0) {
toDrop.remove(i);
toDrop.add(-1);
i--;
continue;
} else {
mesoschance = -1;
toDrop.remove(i);
i--;
}
} else {
mesoschance = -1;
toDrop.remove(i);
i--;
}
}
} else {
if (toDrop.get(i) == 2041200) {// stone
if (htstones > 2) {
toDrop.remove(i);
toDrop.add(monster.getDrop(dropOwner.getDropRate()));
i--;
continue;
} else {
htstones++;
}
} else if (toDrop.get(i) == 1122000) {// pendant
if (htstones > 2) {
toDrop.remove(i);
toDrop.add(monster.getDrop(dropOwner.getDropRate()));
i--;
continue;
} else {
htpendants++;
}
}
alreadyDropped.add(toDrop.get(i));
}
}
if (toDrop.size() > maxDrops) {
toDrop = toDrop.subList(0, maxDrops);
}
if (mesos < 7 && isBoss) {
for (int i = mesos; i < 7; i++) {
toDrop.add(-1);
}
}
Point[] toPoint = new Point[toDrop.size()];
int shiftDirection = 0;
int shiftCount = 0;
int curX = Math.min(Math.max(monster.getPosition().x - 25 * (toDrop.size() / 2), footholds.getMinDropX() + 25), footholds.getMaxDropX() - toDrop.size() * 25);
int curY = Math.max(monster.getPosition().y, footholds.getY1());
while (shiftDirection < 3 && shiftCount < 1000) {
if (shiftDirection == 1) {
curX += 25;
} else if (shiftDirection == 2) {
curX -= 25;
}
for (int i = 0; i < toDrop.size(); i++) {
MapleFoothold wall = footholds.findWall(new Point(curX, curY), new Point(curX + toDrop.size() * 25, curY));
if (wall != null) {
if (wall.getX1() <curX> 1.0) {
mesoDecrease = 1.0;
}
int tempmeso = Math.min(50000, (int) (mesoDecrease * (monster.getExp()) * (1.0 + new Random().nextInt(20)) / 10.0));
if (dropOwner.getBuffedValue(MapleBuffStat.MESOUP) != null) {
tempmeso = (int) (tempmeso * dropOwner.getBuffedValue(MapleBuffStat.MESOUP).doubleValue() / 100.0);
}
final int meso = tempmeso * dropOwner.getMesoRate();
if (meso > 0 && (mapid <925020000> 925030000)) {
if (dropOwner.getAutoLoot()) {
if (dropOwner.getParty() != null) {
ChannelServer cserv = dropOwner.getClient().getChannelServer();
int partynum = 0;
for (MaplePartyCharacter partymem : dropOwner.getParty().getMembers()) {
if (partymem.isOnline() && partymem.getMapid() == dropOwner.getMap().getId() && partymem.getChannel() == dropOwner.getClient().getChannel()) {
partynum++;
}
}
int mesosgain = meso / partynum;
for (MaplePartyCharacter partymem : dropOwner.getParty().getMembers()) {
if (partymem.isOnline() && partymem.getMapid() == dropOwner.getMap().getId()) {
MapleCharacter somecharacter = cserv.getPlayerStorage().getCharacterById(partymem.getId());
if (somecharacter != null) {
somecharacter.gainMeso(mesosgain, true);
}
}
}
} else {
dropOwner.gainMeso(mesos, true);
}
} else {
final MapleMonster dropMonster = monster;
final MapleCharacter dropChar = dropOwner;
TimerManager.getInstance().schedule(new Runnable() {

public void run() {
spawnMesoDrop(meso, meso, dropPos, dropMonster, dropChar, isBoss);
}
}, monster.getAnimationTime("die1"));
}
}
} else {
IItem idrop;
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
if (ii.getInventoryType(drop).equals(MapleInventoryType.EQUIP)) {
idrop = ii.randomizeStats((Equip) ii.getEquipById(drop));
} else {
idrop = new Item(drop, (byte) 0, (short) 1);
if (InventoryConstants.isArrowForBow(drop) || InventoryConstants.isArrowForCrossBow(drop)) {
idrop.setQuantity((short) (1 + Randomizer.getInstance().nextInt(101)));
} else if (InventoryConstants.isRechargable(drop)) {
idrop.setQuantity((short) (1));
}
}
final MapleMapItem mdrop = new MapleMapItem(idrop, dropPos, monster, dropOwner);
final MapleMapObject dropMonster = monster;
final MapleCharacter dropChar = dropOwner;
final TimerManager tMan = TimerManager.getInstance();
tMan.schedule(new Runnable() {

public void run() {
spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {

public void sendPackets(MapleClient c) {
c.getSession().write(MaplePacketCreator.dropItemFromMapObject(drop, mdrop.getObjectId(), dropMonster.getObjectId(), isBoss ? 0 : dropChar.getId(), dropMonster.getPosition(), dropPos, (byte) 1));
}
});
tMan.schedule(new ExpireMapItemJob(mdrop), dropLife);
}
}, monster.getAnimationTime("die1"));
}
}
}
}
return -1;
}


AbstractDealDamageHandler.java


Code:
monster.getDrop();


とこれを追加

Code:
monster.getDrop(player.getDropRate());
構築さん
構築さん
Admin

Posts : 193
Join date : 2014/05/29

https://maplescience.forumjap.com

トップに戻る Go down

トップに戻る


 
Permissions in this forum:
返信投稿: 不可