The great MCPQ Merge offensive
Fulfilled the lovely pull request #427 from @dragoso, which added in backing code content to HeavenMS. Implemented structural changes for the Marriage wishlist, in order to receive, maintain and distribute gifts to spouses. Added untradeable check on wishlist gift handler. Adjusted CPQ drops to actually load from DB rathe than hard-coded. Fixed CPQ "random disease to player/party" functionality not applying properly. Adjusted how CPQ maps are generated. It directly loads a new area from WZ (this process should at least removes the player's spawned mobs) rather than reset the cache at every MCPQ creation.
This commit is contained in:
@@ -68,6 +68,7 @@ import scripting.event.EventInstanceManager;
|
||||
import server.CashShop;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MapleItemInformationProvider.ScriptedItem;
|
||||
import server.MapleMarriage;
|
||||
import server.MaplePortal;
|
||||
import server.MapleShop;
|
||||
import server.MapleStatEffect;
|
||||
@@ -130,7 +131,7 @@ import client.processor.FredrickProcessor;
|
||||
import constants.ExpTable;
|
||||
import constants.GameConstants;
|
||||
import constants.ItemConstants;
|
||||
import constants.LinguaConstants;
|
||||
import constants.LanguageConstants;
|
||||
import constants.ServerConstants;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Beginner;
|
||||
@@ -166,6 +167,7 @@ import server.life.MobSkillFactory;
|
||||
import server.maps.MapleMapItem;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
import scripting.AbstractPlayerInteraction;
|
||||
|
||||
public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private static final MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
@@ -277,7 +279,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private ScheduledFuture<?> extraRecoveryTask = null;
|
||||
private ScheduledFuture<?> chairRecoveryTask = null;
|
||||
private ScheduledFuture<?> pendantOfSpirit = null; //1122017
|
||||
public ScheduledFuture<?> timer;
|
||||
private ScheduledFuture<?> cpqSchedule = null;
|
||||
private Lock chrLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_CHR, true);
|
||||
private Lock evtLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_EVT, true);
|
||||
private Lock petLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHARACTER_PET, true);
|
||||
@@ -4383,6 +4385,16 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
evtLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public MapleMarriage getMarriageInstance() {
|
||||
EventInstanceManager eim = getEventInstance();
|
||||
|
||||
if (eim != null || !(eim instanceof MapleMarriage)) {
|
||||
return (MapleMarriage) eim;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetExcluded(int petId) {
|
||||
chrLock.lock();
|
||||
@@ -9848,6 +9860,15 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
this.partyQuest = pq;
|
||||
}
|
||||
|
||||
public void setCpqTimer(ScheduledFuture timer) {
|
||||
this.cpqSchedule = timer;
|
||||
}
|
||||
|
||||
public void clearCpqTimer() {
|
||||
if (cpqSchedule != null) { cpqSchedule.cancel(true); }
|
||||
cpqSchedule = null;
|
||||
}
|
||||
|
||||
public final void empty(final boolean remove) {
|
||||
if (dragonBloodSchedule != null) { dragonBloodSchedule.cancel(true); }
|
||||
dragonBloodSchedule = null;
|
||||
@@ -9886,8 +9907,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
if (pendantOfSpirit != null) { pendantOfSpirit.cancel(true); }
|
||||
pendantOfSpirit = null;
|
||||
|
||||
if (timer != null) { timer.cancel(true); }
|
||||
timer = null;
|
||||
clearCpqTimer();
|
||||
|
||||
evtLock.lock();
|
||||
try {
|
||||
@@ -10130,9 +10150,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private MapleFitness fitness;
|
||||
private MapleOla ola;
|
||||
private long snowballattack;
|
||||
public static final List<String> itens = new ArrayList();
|
||||
public static final List<Item> item = new ArrayList();
|
||||
|
||||
|
||||
public byte getTeam() {
|
||||
return team;
|
||||
}
|
||||
@@ -10289,38 +10307,5 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
public int getLingua() {
|
||||
return getClient().getLingua();
|
||||
}
|
||||
|
||||
public void setItens(String item) {
|
||||
if (!itens.contains(item)) {
|
||||
this.itens.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getItens() {
|
||||
return itens;
|
||||
}
|
||||
|
||||
public void setEquips(Item item) {
|
||||
this.item.add(item);
|
||||
}
|
||||
|
||||
public static List<Item> getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public Item getItemid(int numb) {
|
||||
return this.item.get(numb);
|
||||
}
|
||||
|
||||
public void removeItem(Item item) {
|
||||
if (this.item.contains(item)) {
|
||||
this.item.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void obterItens() {
|
||||
for (Item item : getItem()) {
|
||||
getClient().getAbstractPlayerInteraction().gainItem(item.getItemId(), item.getQuantity());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
package client;
|
||||
|
||||
import tools.Randomizer;
|
||||
import constants.GameConstants;
|
||||
|
||||
public enum MapleDisease {
|
||||
NULL(0x0),
|
||||
@@ -39,16 +39,20 @@ public enum MapleDisease {
|
||||
|
||||
private long i;
|
||||
private boolean first;
|
||||
private int disease;
|
||||
private int mobskill;
|
||||
|
||||
private MapleDisease(long i) {
|
||||
this.i = i;
|
||||
this.first = false;
|
||||
this(i, false, 0);
|
||||
}
|
||||
|
||||
private MapleDisease(long i, int disease) {
|
||||
private MapleDisease(long i, int skill) {
|
||||
this(i, false, skill);
|
||||
}
|
||||
|
||||
private MapleDisease(long i, boolean first, int skill) {
|
||||
this.i = i;
|
||||
this.disease = disease;
|
||||
this.first = first;
|
||||
this.mobskill = skill;
|
||||
}
|
||||
|
||||
public long getValue() {
|
||||
@@ -56,11 +60,11 @@ public enum MapleDisease {
|
||||
}
|
||||
|
||||
public boolean isFirst() {
|
||||
return first;
|
||||
return first;
|
||||
}
|
||||
|
||||
|
||||
public int getDisease() {
|
||||
return disease;
|
||||
return mobskill;
|
||||
}
|
||||
|
||||
public static MapleDisease ordinal(int ord) {
|
||||
@@ -72,13 +76,8 @@ public enum MapleDisease {
|
||||
}
|
||||
|
||||
public static final MapleDisease getRandom() {
|
||||
while (true) {
|
||||
for (MapleDisease dis : MapleDisease.values()) {
|
||||
if (Randomizer.nextInt(MapleDisease.values().length) == 0) {
|
||||
return dis;
|
||||
}
|
||||
}
|
||||
}
|
||||
MapleDisease[] diseases = GameConstants.CPQ_DISEASES;
|
||||
return diseases[(int) (Math.random() * diseases.length)];
|
||||
}
|
||||
|
||||
public static final MapleDisease getBySkill(final int skill) {
|
||||
@@ -90,4 +89,4 @@ public enum MapleDisease {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,8 @@ public enum ItemFactory {
|
||||
CASH_CYGNUS(4, true),
|
||||
CASH_ARAN(5, true),
|
||||
MERCHANT(6, false),
|
||||
CASH_OVERALL(7, true);
|
||||
CASH_OVERALL(7, true),
|
||||
MARRIAGE_GIFTS(8, false);
|
||||
private final int value;
|
||||
private final boolean account;
|
||||
private static final Lock locks[] = new Lock[200]; // thanks Masterrulax for pointing out a bottleneck issue here
|
||||
|
||||
@@ -436,7 +436,16 @@ public class MapleInventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
public static boolean checkSpot(MapleCharacter chr, Item item) { // thanks Vcoc for noticing pshops not checking item stacks when taking item back
|
||||
return checkSpotsAndOwnership(chr, Collections.singletonList(new Pair<>(item, item.getInventoryType())));
|
||||
return checkSpot(chr, Collections.singletonList(item));
|
||||
}
|
||||
|
||||
public static boolean checkSpot(MapleCharacter chr, List<Item> items) {
|
||||
List<Pair<Item, MapleInventoryType>> listItems = new LinkedList<>();
|
||||
for (Item item : items) {
|
||||
listItems.add(new Pair<>(item, item.getInventoryType()));
|
||||
}
|
||||
|
||||
return checkSpotsAndOwnership(chr, listItems);
|
||||
}
|
||||
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items) {
|
||||
|
||||
Reference in New Issue
Block a user