Heal & Summons atk limit + Skills on change job + Java8 scripting fix

Adjusted reactor drops, now performing spray-like for any reactor.
Revised usage of synchronized statements in several methods in the source.
Fixed a quest from the Aran questline using "password" system unpredictedly.
Fixed column name in table "reports".
Fixed commands "startquest" and "completequest" not using the quest's NPC in the talk window.
Fixed HP regen bonuses such as sauna robes and from Endure skill, when applied in maps with improved regen, leading to false-positives (with the heal on the player).
Fixed a recent typo on a property from HenesysPQ.
Fixed "Combat Step" effect showing twice for other players.
Fixed type-cast issues within some script-hubbing methods in some Java classes.
Reactivated an unused flag that ignores level difference when applying EXP gains to party players.
Fixed Gaviota not disappearing after attack, as defined in the description of the skill.
Fixed CPQ1 field 3 & 4 not allowing players to use summons/protectors.
Fixed exped leaders still receiving exped creation packets even though it was dismissed due to failure on starting (daily entry limit, other fail cases).
Fixed a locking issue that would show up due to a infinite loop case within the procedure that makes disappear items immediately if there were already many items on map.
Fixed several summon skills not using buff icons.
Fixed max damage calculation for summons getting extremely low values when either a player doesn't equip a weapon or attack value is too low.
Fixed explosive loots not taking effect at all, although loot drop-types were already implemented.
Fixed NPE cases when trying to update position of summons/dragons server-side.
Reviewed reactor reset of reactors that disappears for a while. They are now supposed to return immediately once issued a reset.
This commit is contained in:
ronancpl
2019-07-28 17:34:52 -03:00
parent 442d45bef2
commit 85812ba489
52 changed files with 475 additions and 283 deletions

View File

@@ -236,25 +236,43 @@ public class AbstractPlayerInteraction {
return canHoldAllAfterRemoving(Collections.singletonList(itemid), Collections.singletonList(quantity), Collections.singletonList(removeItemid), Collections.singletonList(removeQuantity));
}
private List<Integer> convertToIntegerArray(List<Double> list) {
List<Integer> intList = new LinkedList<>();
for(Double d: list) {
intList.add(d.intValue());
private List<Integer> convertToIntegerArray(List<Object> list) {
List<Integer> intList = new ArrayList<>(); // JAVA 7 Rhino script engine. Thanks Bruno, felipepm10 for noticing a typecast issue here.
if (ServerConstants.JAVA_8) {
for (Object d: list) {
intList.add(((Integer) d).intValue());
}
} else {
for (Object d: list) {
intList.add(((Double) d).intValue());
}
}
return intList;
}
public boolean canHoldAll(List<Double> itemids) {
List<Double> quantity = new LinkedList<>();
for (int i = 0; i < itemids.size(); i++) {
quantity.add(1.0);
public boolean canHoldAll(List<Object> itemids) {
List<Object> quantity = new LinkedList<>();
if (ServerConstants.JAVA_8) {
Integer intOne = 1;
for (int i = 0; i < itemids.size(); i++) {
quantity.add(intOne);
}
} else {
Double doubleOne = 1.0;
for (int i = 0; i < itemids.size(); i++) {
quantity.add(doubleOne);
}
}
return canHoldAll(itemids, quantity);
}
public boolean canHoldAll(List<Double> itemids, List<Double> quantity) {
public boolean canHoldAll(List<Object> itemids, List<Object> quantity) {
return canHoldAll(convertToIntegerArray(itemids), convertToIntegerArray(quantity), true);
}

View File

@@ -911,24 +911,28 @@ public class EventInstanceManager {
return(MapleLifeFactory.getMonster(mid));
}
private List<Integer> convertToIntegerArray(List<Double> list) {
List<Integer> intList;
if(ServerConstants.JAVA_8)
intList=new ArrayList<Integer> (new ArrayList(java.util.Arrays.asList(list.toArray())));
else
{
intList = new ArrayList<>();
for(Double d: list) intList.add(d.intValue());
private List<Integer> convertToIntegerArray(List<Object> list) {
List<Integer> intList = new ArrayList<>();
if (ServerConstants.JAVA_8) {
for (Object d: list) {
intList.add(((Integer) d).intValue());
}
} else {
for (Object d: list) {
intList.add(((Double) d).intValue());
}
}
return intList;
return intList;
}
public void setEventClearStageExp(List<Double> gain) {
public void setEventClearStageExp(List<Object> gain) {
onMapClearExp.clear();
onMapClearExp.addAll(convertToIntegerArray(gain));
}
public void setEventClearStageMeso(List<Double> gain) {
public void setEventClearStageMeso(List<Object> gain) {
onMapClearMeso.clear();
onMapClearMeso.addAll(convertToIntegerArray(gain));
}
@@ -959,7 +963,7 @@ public class EventInstanceManager {
}
}
public final void setExclusiveItems(List<Double> items) {
public final void setExclusiveItems(List<Object> items) {
List<Integer> exclusive = convertToIntegerArray(items);
wL.lock();
@@ -972,19 +976,19 @@ public class EventInstanceManager {
}
}
public final void setEventRewards(List<Double> rwds, List<Double> qtys, int expGiven) {
public final void setEventRewards(List<Object> rwds, List<Object> qtys, int expGiven) {
setEventRewards(1, rwds, qtys, expGiven);
}
public final void setEventRewards(List<Double> rwds, List<Double> qtys) {
public final void setEventRewards(List<Object> rwds, List<Object> qtys) {
setEventRewards(1, rwds, qtys);
}
public final void setEventRewards(int eventLevel, List<Double> rwds, List<Double> qtys) {
public final void setEventRewards(int eventLevel, List<Object> rwds, List<Object> qtys) {
setEventRewards(eventLevel, rwds, qtys, 0);
}
public final void setEventRewards(int eventLevel, List<Double> rwds, List<Double> qtys, int expGiven) {
public final void setEventRewards(int eventLevel, List<Object> rwds, List<Object> qtys, int expGiven) {
// fixed EXP will be rewarded at the same time the random item is given
if(eventLevel <= 0 || eventLevel > ServerConstants.MAX_EVENT_LEVELS) return;

View File

@@ -167,10 +167,19 @@ public class EventManager {
startLock = startLock.dispose();
}
private List<Integer> convertToIntegerArray(List<Double> list) {
private List<Integer> convertToIntegerArray(List<Object> list) {
List<Integer> intList = new ArrayList<>();
for(Double d: list) intList.add(d.intValue());
if (ServerConstants.JAVA_8) {
for (Object d: list) {
intList.add(((Integer) d).intValue());
}
} else {
for (Object d: list) {
intList.add(((Double) d).intValue());
}
}
return intList;
}
@@ -181,7 +190,7 @@ public class EventManager {
private List<Integer> getLobbyRange() {
try {
if (!ServerConstants.JAVA_8) {
return convertToIntegerArray((List<Double>)iv.invokeFunction("setLobbyRange", (Object) null));
return convertToIntegerArray((List<Object>)iv.invokeFunction("setLobbyRange", (Object) null));
} else { // java 8 support here thanks to MedicOP
ScriptObjectMirror object = (ScriptObjectMirror) iv.invokeFunction("setLobbyRange", (Object) null);
int[] to = object.to(int[].class);

View File

@@ -35,6 +35,7 @@ import provider.MapleDataProviderFactory;
import scripting.AbstractPlayerInteraction;
import server.MapleItemInformationProvider;
import server.MapleStatEffect;
import server.MapleShop;
import server.MapleShopFactory;
import server.events.gm.MapleEvent;
import server.gachapon.MapleGachapon;
@@ -83,6 +84,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import tools.FilePrinter;
/**
*
@@ -400,7 +402,14 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
}
public void openShopNPC(int id) {
MapleShopFactory.getInstance().getShop(id).sendShop(c);
MapleShop shop = MapleShopFactory.getInstance().getShop(id);
if (shop != null) {
shop.sendShop(c);
} else { // check for missing shopids thanks to resinate
FilePrinter.printError(FilePrinter.NPC_UNCODED, "Shop ID: " + id + " is missing from database.");
MapleShopFactory.getInstance().getShop(11000).sendShop(c);
}
}
public void maxMastery() {

View File

@@ -105,7 +105,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction {
}
public void dropItems(int posX, int posY, boolean meso, int mesoChance, int minMeso, int maxMeso, int minItems) {
dropItems(false, posX, posY, meso, mesoChance, minMeso, maxMeso, minItems);
dropItems(true, posX, posY, meso, mesoChance, minMeso, maxMeso, minItems); // all reactors actually drop items sequentially... thanks inhyuk for pointing this out!
}
public void dropItems(boolean delayed, int posX, int posY, boolean meso, int mesoChance, final int minMeso, final int maxMeso, int minItems) {

View File

@@ -114,7 +114,7 @@ public class ReactorScriptManager extends AbstractScriptManager {
touching(c, reactor, false);
}
public synchronized void touching(MapleClient c, MapleReactor reactor, boolean touching) {
private void touching(MapleClient c, MapleReactor reactor, boolean touching) {
try {
Invocable iv = getInvocable("reactor/" + reactor.getId() + ".js", c);
if (iv == null) return;