Autoassigner update + Multi-equip drop
Fixed spawn effect not working properly after the HT spawn sequence patch. Fixed autoassigner not distributing AP properly for brawlers. More than one of the same equipment can now be dropped by mobs. Feature uses the minimum/maximum quantity fields from the drop data to determine how many of the same will be dropped each instance.
This commit is contained in:
@@ -338,8 +338,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
petLootCd = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public MapleJob getJobStyle() {
|
||||
int jobtype = this.getJob().getId() / 100;
|
||||
private static MapleJob getJobStyleInternal(int jobid, byte opt) {
|
||||
int jobtype = jobid / 100;
|
||||
|
||||
if(jobtype == MapleJob.WARRIOR.getId() / 100 || jobtype == MapleJob.DAWNWARRIOR1.getId() / 100 || jobtype == MapleJob.ARAN1.getId() / 100) {
|
||||
return(MapleJob.WARRIOR);
|
||||
@@ -350,7 +350,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
else if(jobtype == MapleJob.BOWMAN.getId() / 100 || jobtype == MapleJob.WINDARCHER1.getId() / 100) {
|
||||
if(this.getJob().getId() / 10 == MapleJob.CROSSBOWMAN.getId() / 10) return(MapleJob.CROSSBOWMAN);
|
||||
if(jobid / 10 == MapleJob.CROSSBOWMAN.getId() / 10) return(MapleJob.CROSSBOWMAN);
|
||||
else return(MapleJob.BOWMAN);
|
||||
}
|
||||
|
||||
@@ -359,12 +359,20 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
else if(jobtype == MapleJob.PIRATE.getId() / 100 || jobtype == MapleJob.THUNDERBREAKER1.getId() / 100) {
|
||||
if(this.getStr() > this.getDex()) return(MapleJob.BRAWLER);
|
||||
if(opt == (byte) 0x80) return(MapleJob.BRAWLER);
|
||||
else return(MapleJob.GUNSLINGER);
|
||||
}
|
||||
|
||||
return(MapleJob.BEGINNER);
|
||||
}
|
||||
|
||||
public MapleJob getJobStyle(byte opt) {
|
||||
return getJobStyleInternal(this.getJob().getId(), opt);
|
||||
}
|
||||
|
||||
public MapleJob getJobStyle() {
|
||||
return getJobStyle((byte) ((this.getStr() > this.getDex()) ? 0x80 : 0x40));
|
||||
}
|
||||
|
||||
public static MapleCharacter getDefault(MapleClient c) {
|
||||
MapleCharacter ret = new MapleCharacter();
|
||||
@@ -846,8 +854,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
getMap().broadcastMessage(this, MaplePacketCreator.removePlayerFromMap(getId()), false);
|
||||
}
|
||||
getMap().broadcastGMMessage(this, MaplePacketCreator.spawnPlayerMapObject(this), false);
|
||||
List<Pair<MapleBuffStat, Integer>> dsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
|
||||
getMap().broadcastGMMessage(this, MaplePacketCreator.giveForeignBuff(id, dsstat), false);
|
||||
List<Pair<MapleBuffStat, Integer>> ldsstat = Collections.singletonList(new Pair<MapleBuffStat, Integer>(MapleBuffStat.DARKSIGHT, 0));
|
||||
getMap().broadcastGMMessage(this, MaplePacketCreator.giveForeignBuff(id, ldsstat), false);
|
||||
for (MapleMonster mon : this.getControlledMonsters()) {
|
||||
mon.setController(null);
|
||||
mon.setControllerHasAggro(false);
|
||||
@@ -1678,7 +1686,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
nextPendingRequest(client);
|
||||
}
|
||||
|
||||
public static boolean deleteCharFromDB(MapleCharacter player) {
|
||||
public static boolean deleteCharFromDB(MapleCharacter player, int senderAccId) {
|
||||
int cid = player.getId(), accId = -1, world = 0;
|
||||
|
||||
Connection con = null;
|
||||
@@ -1696,6 +1704,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
if(senderAccId != accId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement("SELECT buddyid FROM buddies WHERE characterid = ?")) {
|
||||
ps.setInt(1, cid);
|
||||
|
||||
@@ -2180,9 +2192,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
try {
|
||||
long curTime = System.currentTimeMillis();
|
||||
|
||||
for(Entry<MapleDisease, Long> d : diseaseExpires.entrySet()) {
|
||||
if(d.getValue() < curTime) {
|
||||
toExpire.add(d.getKey());
|
||||
for(Entry<MapleDisease, Long> de : diseaseExpires.entrySet()) {
|
||||
if(de.getValue() < curTime) {
|
||||
toExpire.add(de.getKey());
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -2972,8 +2984,8 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
|
||||
Map<Integer, Pair<MapleStatEffect, Long>> bestEffects = new LinkedHashMap<>();
|
||||
for(Entry<MapleBuffStat, Pair<Integer, Integer>> lmse: maxStatups.entrySet()) {
|
||||
Integer srcid = lmse.getValue().getLeft();
|
||||
for(Entry<MapleBuffStat, Pair<Integer, Integer>> lmsee: maxStatups.entrySet()) {
|
||||
Integer srcid = lmsee.getValue().getLeft();
|
||||
if(!bestEffects.containsKey(srcid)) {
|
||||
bestEffects.put(srcid, retrievedEffects.get(srcid));
|
||||
}
|
||||
@@ -3156,16 +3168,16 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
Map<MapleBuffStat, MapleBuffStatValueHolder> minStatBuffs = new LinkedHashMap<>();
|
||||
|
||||
for(Entry<Integer, Map<MapleBuffStat, MapleBuffStatValueHolder>> mbsvhi : buffEffects.entrySet()) {
|
||||
for(Entry<MapleBuffStat, MapleBuffStatValueHolder> mbsvh : mbsvhi.getValue().entrySet()) {
|
||||
MapleBuffStat mbs = mbsvh.getKey();
|
||||
Byte it = stats.get(mbs);
|
||||
for(Entry<MapleBuffStat, MapleBuffStatValueHolder> mbsvhe : mbsvhi.getValue().entrySet()) {
|
||||
MapleBuffStat mbs = mbsvhe.getKey();
|
||||
Byte b = stats.get(mbs);
|
||||
|
||||
if(it != null) {
|
||||
stats.put(mbs, (byte) (it + 1));
|
||||
if(mbsvh.getValue().value < minStatBuffs.get(mbs).value) minStatBuffs.put(mbs, mbsvh.getValue());
|
||||
if(b != null) {
|
||||
stats.put(mbs, (byte) (b + 1));
|
||||
if(mbsvhe.getValue().value < minStatBuffs.get(mbs).value) minStatBuffs.put(mbs, mbsvhe.getValue());
|
||||
} else {
|
||||
stats.put(mbs, (byte) 1);
|
||||
minStatBuffs.put(mbs, mbsvh.getValue());
|
||||
minStatBuffs.put(mbs, mbsvhe.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,38 +965,9 @@ public class MapleClient {
|
||||
return Server.getInstance().getChannel(world, channel);
|
||||
}
|
||||
|
||||
private boolean hasCharacter(int cid) throws SQLException {
|
||||
Connection con = null;
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
public boolean deleteCharacter(int cid, int senderAccId) {
|
||||
try {
|
||||
con = DatabaseConnection.getConnection();
|
||||
ps = con.prepareStatement("SELECT id FROM characters WHERE accountid = ?");
|
||||
ps.setInt(1, getAccID());
|
||||
|
||||
rs = ps.executeQuery();
|
||||
while (rs.next()) {
|
||||
if (rs.getInt("id") == cid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if(rs != null && !rs.isClosed()) rs.close();
|
||||
if(ps != null && !ps.isClosed()) ps.close();
|
||||
if(con != null && !con.isClosed()) con.close();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean deleteCharacter(int cid) {
|
||||
try {
|
||||
if(!hasCharacter(cid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return MapleCharacter.deleteCharFromDB(MapleCharacter.loadCharFromDB(cid, this, false));
|
||||
return MapleCharacter.deleteCharFromDB(MapleCharacter.loadCharFromDB(cid, this, false), senderAccId);
|
||||
} catch(SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
|
||||
@@ -1447,13 +1447,25 @@ public class Commands {
|
||||
|
||||
case "job":
|
||||
if (sub.length == 2) {
|
||||
player.changeJob(MapleJob.getById(Integer.parseInt(sub[1])));
|
||||
int jobid = Integer.parseInt(sub[1]);
|
||||
if(jobid < 0 || jobid >= 2200) {
|
||||
player.message("Jobid " + jobid + " is not available.");
|
||||
break;
|
||||
}
|
||||
|
||||
player.changeJob(MapleJob.getById(jobid));
|
||||
player.equipChanged();
|
||||
} else if (sub.length == 3) {
|
||||
victim = c.getChannelServer().getPlayerStorage().getCharacterByName(sub[1]);
|
||||
|
||||
if(victim != null) {
|
||||
victim.changeJob(MapleJob.getById(Integer.parseInt(sub[2])));
|
||||
int jobid = Integer.parseInt(sub[2]);
|
||||
if(jobid < 0 || jobid >= 2200) {
|
||||
player.message("Jobid " + jobid + " is not available.");
|
||||
break;
|
||||
}
|
||||
|
||||
victim.changeJob(MapleJob.getById(jobid));
|
||||
player.equipChanged();
|
||||
} else {
|
||||
player.message("Player '" + sub[1] + "' could not be found on this channel.");
|
||||
@@ -1581,9 +1593,9 @@ public class Commands {
|
||||
MapleMap newMap = c.getChannelServer().getMapFactory().resetMap(player.getMapId());
|
||||
int callerid = c.getPlayer().getId();
|
||||
|
||||
for (MapleCharacter ch : oldMap.getCharacters()) {
|
||||
ch.changeMap(newMap);
|
||||
if(ch.getId() != callerid) ch.dropMessage("You have been relocated due to map reloading. Sorry for the inconvenience.");
|
||||
for (MapleCharacter chr : oldMap.getCharacters()) {
|
||||
chr.changeMap(newMap);
|
||||
if(chr.getId() != callerid) chr.dropMessage("You have been relocated due to map reloading. Sorry for the inconvenience.");
|
||||
}
|
||||
newMap.respawn();
|
||||
break;
|
||||
|
||||
@@ -340,7 +340,7 @@ public class Equip extends Item {
|
||||
List<Pair<String, Integer>> elementalStats = MapleItemInformationProvider.getInstance().getItemLevelupStats(getItemId(), itemLevel);
|
||||
|
||||
for(Pair<String, Integer> p: elementalStats) {
|
||||
if(p.getRight() > 0) stats.add(new Pair(StatUpgrade.valueOf(p.getLeft()), p.getRight()));
|
||||
if(p.getRight() > 0) stats.add(new Pair<>(StatUpgrade.valueOf(p.getLeft()), p.getRight()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user