- Joined
- Jun 8, 2007
- Messages
- 165
- Reaction score
- 8
Might be a bit confusing title, but it lets you set a min/max meso drop for a monster id in the database, so the monster drops an amount between min/max. Useful for e.g. leprechauns. Uses the normal formula if the monsterid isn't found in the database.
First, execute this query:
In MapleMap.java, replace this:
by this:
Replace:
by:
Add these imports on top:
Now, add any monster id with the min/max to the database you like! =)
Note: be aware of the meso rate, which is still in effect.
First, execute this query:
Code:
CREATE TABLE `mesodrops` (
`id` INT NOT NULL AUTO_INCREMENT ,
`monsterid` INT DEFAULT '0' NOT NULL ,
`min` INT DEFAULT '0' NOT NULL ,
`max` INT DEFAULT '0' NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = innodb;
Code:
if (drop == -1) { // meso
final int mesoRate = ChannelServer.getInstance(dropOwner.getClient().getChannel()).getMesoRate();
Random r = new Random();
double mesoDecrease = Math.pow(0.93, monster.getExp() / 300.0);
if (mesoDecrease > 1.0) {
mesoDecrease = 1.0;
}
int tempmeso = Math.min(30000, (int) (mesoDecrease * (monster.getExp()) *
(1.0 + r.nextInt(20)) / 10.0));
if(dropOwner.getBuffedValue(MapleBuffStat.MESOUP) != null) {
tempmeso = (int) (tempmeso * dropOwner.getBuffedValue(MapleBuffStat.MESOUP).doubleValue() / 100.0);
}
final int meso = tempmeso;
Code:
if (drop == -1) { // meso
boolean dbmeso = false;
int meso = 0;
Random r = new Random();
try{
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT min, max FROM mesodrops WHERE monsterid = ?");
ps.setInt(1, monster.getId());
ResultSet rs = ps.executeQuery();
while(rs.next()){
int min = rs.getInt("min");
int max = rs.getInt("max");
meso = r.nextInt(max-min)+min;
dbmeso = true;
}
}catch(Exception e){
log.error("error in retrieving mesos dropped from db.", e);
}
if(!dbmeso){
double mesoDecrease = Math.pow(0.93, monster.getExp() / 300.0);
if (mesoDecrease > 1.0) {
mesoDecrease = 1.0;
}
int tempmeso = Math.min(30000, (int) (mesoDecrease * (monster.getExp()) *
(1.0 + r.nextInt(20)) / 10.0));
if(dropOwner.getBuffedValue(MapleBuffStat.MESOUP) != null) {
tempmeso = (int) (tempmeso * dropOwner.getBuffedValue(MapleBuffStat.MESOUP).doubleValue() / 100.0);
}
meso = tempmeso;
}
final int mesoRate = ChannelServer.getInstance(dropOwner.getClient().getChannel()).getMesoRate();
final int finalmeso = meso;
Code:
spawnMesoDrop(meso * mesoRate, meso, dropPos, dropMonster, dropChar, isBoss);
Code:
spawnMesoDrop(finalmeso * mesoRate, finalmeso, dropPos, dropMonster, dropChar, isBoss);
Code:
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.PreparedStatement;
import net.sf.odinms.database.DatabaseConnection;
Note: be aware of the meso rate, which is still in effect.
Last edited: