Script clean-up Patch
Fixed bugs in some scripts, minor game patches.
This commit is contained in:
@@ -852,16 +852,21 @@ public class MapleClient {
|
||||
FilePrinter.printError(FilePrinter.ACCOUNT_STUCK, e);
|
||||
} finally {
|
||||
getChannelServer().removePlayer(player);
|
||||
if (!this.serverTransition) {
|
||||
|
||||
if (!this.serverTransition) {
|
||||
worlda.removePlayer(player);
|
||||
|
||||
player.saveCooldowns();
|
||||
player.saveToDB();
|
||||
if (player != null) {//no idea, occur :(
|
||||
player.empty(false);
|
||||
}
|
||||
player.logOff();
|
||||
}
|
||||
|
||||
player.saveCooldowns();
|
||||
player.saveToDB();
|
||||
else {
|
||||
player.saveCooldowns();
|
||||
player.saveToDB();
|
||||
}
|
||||
player = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
|
||||
MapleInventory useInventory = c.getPlayer().getInventory(MapleInventoryType.USE);
|
||||
Item scroll = useInventory.getItem(slot);
|
||||
Item wscroll = null;
|
||||
|
||||
if (((Equip) toScroll).getUpgradeSlots() < 1 && !isCleanSlate(scroll.getItemId())) {
|
||||
c.announce(MaplePacketCreator.getInventoryFull());
|
||||
return;
|
||||
@@ -82,6 +83,7 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
|
||||
whiteScroll = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isChaosScroll(scroll.getItemId()) && !isCleanSlate(scroll.getItemId())) {
|
||||
if (!canScroll(scroll.getItemId(), toScroll.getItemId())) {
|
||||
return;
|
||||
@@ -130,6 +132,14 @@ public final class ScrollHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
|
||||
public boolean canScroll(int scrollid, int itemid) {
|
||||
return (scrollid / 100) % 100 == (itemid / 10000) % 100;
|
||||
int sid = scrollid / 100;
|
||||
|
||||
switch(sid) {
|
||||
case 20492: //scroll for accessory (pendant, belt, ring)
|
||||
return canScroll(2041100, itemid) || canScroll(2041200, itemid) || canScroll(2041300, itemid);
|
||||
|
||||
default:
|
||||
return (scrollid / 100) % 100 == (itemid / 10000) % 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,6 +304,11 @@ public class AbstractPlayerInteraction {
|
||||
return gainItem(id, quantity, randomStats, showMessage, expires, null);
|
||||
}
|
||||
|
||||
private boolean isAccessory(int id) {
|
||||
int val = id / 10000;
|
||||
return(val >= 111 && val <= 113);
|
||||
}
|
||||
|
||||
public Item gainItem(int id, short quantity, boolean randomStats, boolean showMessage, long expires, MaplePet from) {
|
||||
Item item = null;
|
||||
MaplePet evolved = null;
|
||||
@@ -336,6 +341,11 @@ public class AbstractPlayerInteraction {
|
||||
if (ii.getInventoryType(id).equals(MapleInventoryType.EQUIP)) {
|
||||
item = ii.getEquipById(id);
|
||||
|
||||
if(item != null) {
|
||||
Equip it = (Equip)item;
|
||||
if(isAccessory(item.getItemId()) && it.getUpgradeSlots() <= 0) it.setUpgradeSlots(3);
|
||||
}
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CRAFTING == true && c.getPlayer().getCS() == true)
|
||||
item = MapleItemInformationProvider.getInstance().scrollEquipWithId(item, 2049100, true, c.getPlayer().isGM());
|
||||
} else {
|
||||
|
||||
@@ -59,6 +59,9 @@ public class EventInstanceManager {
|
||||
private long timeStarted = 0;
|
||||
private long eventTime = 0;
|
||||
private MapleExpedition expedition = null;
|
||||
private List<Integer> mapIds = new LinkedList<Integer>();
|
||||
private List<Boolean> isInstanced = new LinkedList<Boolean>();
|
||||
private boolean disposed = false;
|
||||
|
||||
public EventInstanceManager(EventManager em, String name) {
|
||||
this.em = em;
|
||||
@@ -322,4 +325,13 @@ public class EventInstanceManager {
|
||||
public boolean isLeader(MapleCharacter chr) {
|
||||
return (chr.getParty().getLeader().getId() == chr.getId());
|
||||
}
|
||||
|
||||
public final MapleMap setInstanceMap(final int mapid) { //gets instance map from the channelserv
|
||||
if (disposed) {
|
||||
return this.getMapFactory().getMap(mapid);
|
||||
}
|
||||
mapIds.add(mapid);
|
||||
isInstanced.add(false);
|
||||
return this.getMapFactory().getMap(mapid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,12 @@ public class MapleItemInformationProvider {
|
||||
if (pData == null) {
|
||||
return -1;
|
||||
}
|
||||
pEntry = (double) MapleDataTool.getInt(pData);
|
||||
try {
|
||||
pEntry = (double) MapleDataTool.getInt(pData);
|
||||
} catch(Exception e) {
|
||||
priceCache.put(itemId, 0.0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
priceCache.put(itemId, pEntry);
|
||||
return pEntry;
|
||||
@@ -522,11 +527,12 @@ public class MapleItemInformationProvider {
|
||||
public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, boolean isGM) {
|
||||
if (equip instanceof Equip) {
|
||||
Equip nEquip = (Equip) equip;
|
||||
|
||||
Map<String, Integer> stats = this.getEquipStats(scrollId);
|
||||
Map<String, Integer> eqstats = this.getEquipStats(equip.getItemId());
|
||||
|
||||
System.out.println("GM: " + isGM + "\tWS: " + usingWhiteScroll + "\tITEM: " + scrollId);
|
||||
if (((nEquip.getUpgradeSlots() > 0 || isCleanSlate(scrollId))) || isGM) {
|
||||
System.out.println("GM: " + isGM + "\tWS: " + usingWhiteScroll + "\tITEM: " + scrollId);
|
||||
|
||||
if(isGM || testYourLuck() <= stats.get("success")) {
|
||||
short flag = nEquip.getFlag();
|
||||
switch (scrollId) {
|
||||
@@ -552,181 +558,183 @@ public class MapleItemInformationProvider {
|
||||
int inc, i;
|
||||
|
||||
if(ServerConstants.SCROLL_CHANCE_RATE > 0) {
|
||||
//int tempStr, tempDex, tempInt, tempLuk, tempWatk, tempWdef, tempMatk, tempMdef, tempAcc, tempAvoid, tempSpeed, tempJump, tempHp, tempMp;
|
||||
int temp;
|
||||
int mdStr = nEquip.getStr(), mdDex = nEquip.getDex(), mdInt = nEquip.getInt(), mdLuk = nEquip.getLuk(), mdWatk = nEquip.getWatk(), mdWdef = nEquip.getWdef(), mdMatk = nEquip.getMatk(), mdMdef = nEquip.getMdef(), mdAcc = nEquip.getAcc(), mdAvoid = nEquip.getAvoid(), mdSpeed = nEquip.getSpeed(), mdJump = nEquip.getJump(), mdHp = nEquip.getHp(), mdMp = nEquip.getMp();
|
||||
|
||||
inc = 1;
|
||||
if (Randomizer.nextInt(2) == 0) {
|
||||
inc = -1;
|
||||
}
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) inc = 1;
|
||||
|
||||
for(i = 0; i < ServerConstants.SCROLL_CHANCE_RATE; i++) {
|
||||
inc = 1;
|
||||
|
||||
if (Randomizer.nextInt(2) == 0) {
|
||||
inc = -1;
|
||||
}
|
||||
if (nEquip.getStr() > 0) {
|
||||
temp = (nEquip.getStr() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setStr((short) Math.max(mdStr, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdStr = nEquip.getStr();
|
||||
}
|
||||
else {
|
||||
temp = (mdStr + temp) / 2;
|
||||
if(temp > 0) mdStr = temp;
|
||||
if(temp > mdStr) mdStr = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getDex() > 0) {
|
||||
temp = (nEquip.getDex() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setDex((short) Math.max(mdDex, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdDex = nEquip.getDex();
|
||||
}
|
||||
else {
|
||||
temp = (mdDex + temp) / 2;
|
||||
if(temp > 0) mdDex = temp;
|
||||
if(temp > mdDex) mdDex = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getInt() > 0) {
|
||||
temp = (nEquip.getInt() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setInt((short) Math.max(mdInt, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdInt = nEquip.getInt();
|
||||
}
|
||||
else {
|
||||
temp = (mdInt + temp) / 2;
|
||||
if(temp > 0) mdInt = temp;
|
||||
if(temp > mdInt) mdInt = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getLuk() > 0) {
|
||||
temp = (nEquip.getLuk() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setLuk((short) Math.max(mdLuk, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdLuk = nEquip.getLuk();
|
||||
}
|
||||
else {
|
||||
temp = (mdLuk + temp) / 2;
|
||||
if(temp > 0) mdLuk = temp;
|
||||
if(temp > mdLuk) mdLuk = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getWatk() > 0) {
|
||||
temp = (nEquip.getWatk() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setWatk((short) Math.max(mdWatk, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdWatk = nEquip.getWatk();
|
||||
}
|
||||
else {
|
||||
temp = (mdWatk + temp) / 2;
|
||||
if(temp > 0) mdWatk = temp;
|
||||
if(temp > mdWatk) mdWatk = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getWdef() > 0) {
|
||||
temp = (nEquip.getWdef() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setWdef((short) Math.max(mdWdef, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdWdef = nEquip.getWdef();
|
||||
}
|
||||
else {
|
||||
temp = (mdWdef + temp) / 2;
|
||||
if(temp > 0) mdWdef = temp;
|
||||
if(temp > mdWdef) mdWdef = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getMatk() > 0) {
|
||||
temp = (nEquip.getMatk() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setMatk((short) Math.max(mdMatk, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdMatk = nEquip.getMatk();
|
||||
}
|
||||
else {
|
||||
temp = (mdMatk + temp) / 2;
|
||||
if(temp > 0) mdMatk = temp;
|
||||
if(temp > mdMatk) mdMatk = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getMdef() > 0) {
|
||||
temp = (nEquip.getMdef() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setMdef((short) Math.max(mdMdef, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdMdef = nEquip.getMdef();
|
||||
}
|
||||
else {
|
||||
temp = (mdMdef + temp) / 2;
|
||||
if(temp > 0) mdMdef = temp;
|
||||
if(temp > mdMdef) mdMdef = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getAcc() > 0) {
|
||||
temp = (nEquip.getAcc() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setAcc((short) Math.max(mdAcc, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdAcc = nEquip.getAcc();
|
||||
}
|
||||
else {
|
||||
temp = (mdAcc + temp) / 2;
|
||||
if(temp > 0) mdAcc = temp;
|
||||
if(temp > mdAcc) mdAcc = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getAvoid() > 0) {
|
||||
temp = (nEquip.getAvoid() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setAvoid((short) Math.max(mdAvoid, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdAvoid = nEquip.getAvoid();
|
||||
}
|
||||
else {
|
||||
temp = (mdAvoid + temp) / 2;
|
||||
if(temp > 0) mdAvoid = temp;
|
||||
if(temp > mdAvoid) mdAvoid = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getSpeed() > 0) {
|
||||
temp = (nEquip.getSpeed() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setSpeed((short) Math.max(mdSpeed, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdSpeed = nEquip.getSpeed();
|
||||
}
|
||||
else {
|
||||
temp = (mdSpeed + temp) / 2;
|
||||
if(temp > 0) mdSpeed = temp;
|
||||
if(temp > mdSpeed) mdSpeed = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getJump() > 0) {
|
||||
temp = (nEquip.getJump() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setJump((short) Math.max(mdJump, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdJump = nEquip.getJump();
|
||||
}
|
||||
else {
|
||||
temp = (mdJump + temp) / 2;
|
||||
if(temp > 0) mdJump = temp;
|
||||
if(temp > mdJump) mdJump = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getHp() > 0) {
|
||||
temp = (nEquip.getHp() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setHp((short) Math.max(mdHp, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdHp = nEquip.getHp();
|
||||
}
|
||||
else {
|
||||
temp = (mdHp + temp) / 2;
|
||||
if(temp > 0) mdHp = temp;
|
||||
if(temp > mdHp) mdHp = temp;
|
||||
}
|
||||
}
|
||||
if (nEquip.getMp() > 0) {
|
||||
temp = (nEquip.getMp() + Randomizer.nextInt(6) * inc);
|
||||
nEquip.setMp((short) Math.max(mdMp, temp));
|
||||
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == false) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) {
|
||||
mdMp = nEquip.getMp();
|
||||
}
|
||||
else {
|
||||
temp = (mdMp + temp) / 2;
|
||||
if(temp > 0) mdMp = temp;
|
||||
if(temp > mdMp) mdMp = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -738,6 +746,8 @@ public class MapleItemInformationProvider {
|
||||
if (Randomizer.nextInt(2) == 0) {
|
||||
inc = -1;
|
||||
}
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) inc = 1;
|
||||
|
||||
if (nEquip.getStr() > 0) {
|
||||
if(ServerConstants.USE_ENHANCED_CHSCROLL == true) nEquip.setStr((short) Math.max(nEquip.getStr(), (nEquip.getStr() + Randomizer.nextInt(6) * inc)));
|
||||
else nEquip.setStr((short) Math.max(0, (nEquip.getStr() + Randomizer.nextInt(6) * inc)));
|
||||
|
||||
Reference in New Issue
Block a user