Enhanced map bounds + HolidayPQ + Battleship
Fixed Abdula not showing book info for Arans. Fixed map bounds, now it hopefully doesn't let items pass through the walkable area anymore. Implemented HolidayPQ. Added a custom item sandbox system, to be used with items generated by the "drop" command. Added the whole-map buff when using the Happy Birthday item. Fixed several battleship issues: - Battleship now shows HP properly at the buff icon. - Cleared some inconsistencies on battleship when interacting with the enhanced buff system. - Battleship now hands out defensive buffs properly.
This commit is contained in:
@@ -65,7 +65,6 @@ public enum MapleBuffStat {
|
||||
SPARK(0x20000000L),
|
||||
MAP_CHAIR(0x40000000L),
|
||||
FINALATTACK(0x80000000L),
|
||||
BATTLESHIP(0xA00000040L), // weird one
|
||||
WATK(0x100000000L),
|
||||
WDEF(0x200000000L),
|
||||
MATK(0x400000000L),
|
||||
|
||||
@@ -200,7 +200,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
private int owlSearch;
|
||||
private long lastfametime, lastUsedCashItem, lastHealed, lastBuyback, lastDeathtime, lastMesoDrop = -1, jailExpiration = -1;
|
||||
private transient int localmaxhp, localmaxmp, localstr, localdex, localluk, localint_, magic, watk;
|
||||
private boolean hidden, canDoor = true, berserk, hasMerchant, whiteChat = false;
|
||||
private boolean hidden, canDoor = true, berserk, hasMerchant, hasSandboxItem = false, whiteChat = false;
|
||||
private int linkedLevel = 0;
|
||||
private String linkedName = null;
|
||||
private boolean finishedDojoTutorial;
|
||||
@@ -479,9 +479,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
try {
|
||||
if (this.coolDowns.containsKey(Integer.valueOf(skillId))) {
|
||||
this.coolDowns.remove(Integer.valueOf(skillId));
|
||||
}
|
||||
this.coolDowns.put(Integer.valueOf(skillId), new MapleCoolDownValueHolder(skillId, startTime, length));
|
||||
} finally {
|
||||
chrLock.unlock();
|
||||
@@ -961,6 +958,33 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
public boolean canDoor() {
|
||||
return canDoor;
|
||||
}
|
||||
|
||||
public void setHasSandboxItem() {
|
||||
hasSandboxItem = true;
|
||||
}
|
||||
|
||||
public void removeSandboxItems() { // sandbox idea thanks to Morty
|
||||
if(!hasSandboxItem) return;
|
||||
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
for(MapleInventoryType invType : MapleInventoryType.values()) {
|
||||
MapleInventory inv = this.getInventory(invType);
|
||||
|
||||
inv.lockInventory();
|
||||
try {
|
||||
for(Item item : new ArrayList<>(inv.list())) {
|
||||
if(MapleInventoryManipulator.isSandboxItem(item)) {
|
||||
MapleInventoryManipulator.removeFromSlot(client, invType, item.getPosition(), item.getQuantity(), false);
|
||||
dropMessage(5, "[" + ii.getName(item.getItemId()) + "] has passed its trial conditions and will be removed from your inventory.");
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
}
|
||||
|
||||
hasSandboxItem = false;
|
||||
}
|
||||
|
||||
public FameStatus canGiveFame(MapleCharacter from) {
|
||||
if (gmLevel > 0) {
|
||||
@@ -1789,10 +1813,18 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
return getInventory(ItemConstants.getInventoryType(itemid)).getNextFreeSlot() > -1;
|
||||
}
|
||||
|
||||
public boolean isRidingBattleship() {
|
||||
Integer bv = getBuffedValue(MapleBuffStat.MONSTER_RIDING);
|
||||
return bv != null && bv.equals(Corsair.BATTLE_SHIP);
|
||||
}
|
||||
|
||||
public void announceBattleshipHp() {
|
||||
announce(MaplePacketCreator.skillCooldown(5221999, battleshipHp));
|
||||
}
|
||||
|
||||
public void decreaseBattleshipHp(int decrease) {
|
||||
this.battleshipHp -= decrease;
|
||||
if (battleshipHp <= 0) {
|
||||
this.battleshipHp = 0;
|
||||
Skill battleship = SkillFactory.getSkill(Corsair.BATTLE_SHIP);
|
||||
int cooldown = battleship.getEffect(getSkillLevel(battleship)).getCooldown();
|
||||
announce(MaplePacketCreator.skillCooldown(Corsair.BATTLE_SHIP, cooldown));
|
||||
@@ -1800,7 +1832,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
removeCooldown(5221999);
|
||||
cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING);
|
||||
} else {
|
||||
announce(MaplePacketCreator.skillCooldown(5221999, battleshipHp / 10)); //:D
|
||||
announceBattleshipHp();
|
||||
addCooldown(5221999, 0, Long.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
@@ -2575,8 +2607,9 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
Pair<Integer, String> replace = ii.getReplaceOnExpire(item.getItemId());
|
||||
if (replace.left > 0) {
|
||||
toadd.add(replace.left);
|
||||
if (replace.right != null)
|
||||
if (!replace.right.isEmpty()) {
|
||||
dropMessage(replace.right);
|
||||
}
|
||||
}
|
||||
for (Integer itemid : toadd) {
|
||||
MapleInventoryManipulator.addById(client, itemid, (short) 1);
|
||||
@@ -3032,7 +3065,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
private void debugListAllBuffs() {
|
||||
public void debugListAllBuffs() {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
try {
|
||||
@@ -3057,7 +3090,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
private void debugListAllBuffsCount() {
|
||||
public void debugListAllBuffsCount() {
|
||||
effLock.lock();
|
||||
chrLock.lock();
|
||||
try {
|
||||
@@ -3568,6 +3601,13 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
Pair<MapleStatEffect, Long> msel = lmse.getRight();
|
||||
msel.getLeft().updateBuffEffect(this, getActiveStatupsFromSourceid(lmse.getLeft()), msel.getRight());
|
||||
}
|
||||
|
||||
if (this.isRidingBattleship()) {
|
||||
List<Pair<MapleBuffStat, Integer>> statups = new ArrayList<>(1);
|
||||
statups.add(new Pair<>(MapleBuffStat.MONSTER_RIDING, 0));
|
||||
this.announce(MaplePacketCreator.giveBuff(1932000, 5221006, statups));
|
||||
this.announceBattleshipHp();
|
||||
}
|
||||
}
|
||||
|
||||
private static MapleBuffStat getSingletonStatupFromEffect(MapleStatEffect mse) {
|
||||
@@ -5805,6 +5845,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
ret.getInventory(MapleInventoryType.SETUP).setSlotLimit(rs.getByte("setupslots"));
|
||||
ret.getInventory(MapleInventoryType.ETC).setSlotLimit(rs.getByte("etcslots"));
|
||||
for (Pair<Item, MapleInventoryType> item : ItemFactory.INVENTORY.loadItems(ret.id, !channelserver)) {
|
||||
if(MapleInventoryManipulator.isSandboxItem(item.getLeft())) {
|
||||
ret.setHasSandboxItem();
|
||||
}
|
||||
|
||||
ret.getInventory(item.getRight()).addFromDB(item.getLeft());
|
||||
Item itemz = item.getLeft();
|
||||
if (itemz.getPetId() > -1) {
|
||||
@@ -6015,12 +6059,6 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for(MapleQuestStatus mqs : loadedQuestStatus.values()) {
|
||||
mqs.resetUpdated();
|
||||
}
|
||||
*/
|
||||
|
||||
loadedQuestStatus.clear();
|
||||
|
||||
ps = con.prepareStatement("SELECT skillid,skilllevel,masterlevel,expiration FROM skills WHERE characterid = ?");
|
||||
@@ -6550,11 +6588,11 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject {
|
||||
statup.add(new Pair<>(MapleStat.LUK, tluk));
|
||||
announce(MaplePacketCreator.updatePlayerStats(statup, this));
|
||||
}
|
||||
|
||||
|
||||
public void resetBattleshipHp() {
|
||||
this.battleshipHp = 4000 * getSkillLevel(SkillFactory.getSkill(Corsair.BATTLE_SHIP)) + ((getLevel() - 120) * 2000);
|
||||
this.battleshipHp = 400 * getSkillLevel(SkillFactory.getSkill(Corsair.BATTLE_SHIP)) + ((getLevel() - 120) * 200);
|
||||
}
|
||||
|
||||
|
||||
public void resetEnteredScript() {
|
||||
if (entered.containsKey(map.getId())) {
|
||||
entered.remove(map.getId());
|
||||
|
||||
@@ -64,6 +64,7 @@ import client.inventory.MapleInventoryType;
|
||||
import constants.GameConstants;
|
||||
import constants.ServerConstants;
|
||||
import scripting.AbstractPlayerInteraction;
|
||||
import scripting.event.EventInstanceManager;
|
||||
import scripting.event.EventManager;
|
||||
import scripting.npc.NPCConversationManager;
|
||||
import scripting.npc.NPCScriptManager;
|
||||
@@ -798,8 +799,9 @@ public class MapleClient {
|
||||
player.closePlayerInteractions();
|
||||
QuestScriptManager.getInstance().dispose(this);
|
||||
|
||||
if (player.getEventInstance() != null) {
|
||||
player.getEventInstance().playerDisconnected(player);
|
||||
EventInstanceManager eim = player.getEventInstance();
|
||||
if (eim != null) {
|
||||
eim.playerDisconnected(player);
|
||||
}
|
||||
if (player.getMap() != null) {
|
||||
int mapId = player.getMapId();
|
||||
|
||||
@@ -1285,8 +1285,10 @@ public class Commands {
|
||||
byte b = toDrop.getFlag();
|
||||
b |= ItemConstants.ACCOUNT_SHARING;
|
||||
b |= ItemConstants.UNTRADEABLE;
|
||||
b |= ItemConstants.SANDBOX;
|
||||
|
||||
toDrop.setFlag(b);
|
||||
toDrop.setOwner("TRIAL-MODE");
|
||||
}
|
||||
|
||||
c.getPlayer().getMap().spawnItemDrop(c.getPlayer(), c.getPlayer(), toDrop, c.getPlayer().getPosition(), true, true);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class MapleInventoryManipulator {
|
||||
if (i.hasNext()) {
|
||||
Item eItem = (Item) i.next();
|
||||
short oldQ = eItem.getQuantity();
|
||||
if (oldQ < slotMax && (eItem.getOwner().equals(owner) || owner == null)) {
|
||||
if (oldQ < slotMax && ((eItem.getOwner().equals(owner) || owner == null) && eItem.getFlag() == flag)) {
|
||||
short newQ = (short) Math.min(oldQ + quantity, slotMax);
|
||||
quantity -= (newQ - oldQ);
|
||||
eItem.setQuantity(newQ);
|
||||
@@ -89,6 +89,7 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean sandboxItem = (flag & ItemConstants.SANDBOX) == ItemConstants.SANDBOX;
|
||||
while (quantity > 0 || ItemConstants.isRechargeable(itemId)) {
|
||||
short newQ = (short) Math.min(quantity, slotMax);
|
||||
if (newQ != 0) {
|
||||
@@ -106,6 +107,7 @@ public class MapleInventoryManipulator {
|
||||
nItem.setOwner(owner);
|
||||
}
|
||||
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if(sandboxItem) c.getPlayer().setHasSandboxItem();
|
||||
if ((ItemConstants.isRechargeable(itemId)) && quantity == 0) {
|
||||
break;
|
||||
}
|
||||
@@ -125,6 +127,7 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if(MapleInventoryManipulator.isSandboxItem(nItem)) c.getPlayer().setHasSandboxItem();
|
||||
}
|
||||
} else if (quantity == 1) {
|
||||
Item nEquip = ii.getEquipById(itemId);
|
||||
@@ -140,6 +143,7 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nEquip))));
|
||||
if(MapleInventoryManipulator.isSandboxItem(nEquip)) c.getPlayer().setHasSandboxItem();
|
||||
} else {
|
||||
throw new RuntimeException("Trying to create equip with non-one quantity");
|
||||
}
|
||||
@@ -173,7 +177,7 @@ public class MapleInventoryManipulator {
|
||||
if (i.hasNext()) {
|
||||
Item eItem = (Item) i.next();
|
||||
short oldQ = eItem.getQuantity();
|
||||
if (oldQ < slotMax && item.getOwner().equals(eItem.getOwner())) {
|
||||
if (oldQ < slotMax && item.getFlag() == eItem.getFlag() && item.getOwner().equals(eItem.getOwner())) {
|
||||
short newQ = (short) Math.min(oldQ + quantity, slotMax);
|
||||
quantity -= (newQ - oldQ);
|
||||
eItem.setQuantity(newQ);
|
||||
@@ -199,10 +203,12 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if(MapleInventoryManipulator.isSandboxItem(nItem)) c.getPlayer().setHasSandboxItem();
|
||||
}
|
||||
} else {
|
||||
Item nItem = new Item(item.getItemId(), (short) 0, quantity, petId);
|
||||
nItem.setExpiration(item.getExpiration());
|
||||
nItem.setFlag(item.getFlag());
|
||||
|
||||
short newSlot = c.getPlayer().getInventory(type).addItem(nItem);
|
||||
if (newSlot == -1) {
|
||||
@@ -211,6 +217,7 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if(MapleInventoryManipulator.isSandboxItem(nItem)) c.getPlayer().setHasSandboxItem();
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
} else if (quantity == 1) {
|
||||
@@ -221,6 +228,7 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, item))));
|
||||
if(MapleInventoryManipulator.isSandboxItem(item)) c.getPlayer().setHasSandboxItem();
|
||||
} else {
|
||||
FilePrinter.printError(FilePrinter.ITEM, "Tried to pickup Equip id " + item.getItemId() + " containing more than 1 quantity --> " + quantity);
|
||||
c.announce(MaplePacketCreator.getInventoryFull());
|
||||
@@ -625,4 +633,8 @@ public class MapleInventoryManipulator {
|
||||
private static boolean isDroppedItemRestricted(Item it) {
|
||||
return ServerConstants.USE_ERASE_UNTRADEABLE_DROP && ((it.getFlag() & ItemConstants.UNTRADEABLE) == ItemConstants.UNTRADEABLE);
|
||||
}
|
||||
|
||||
public static boolean isSandboxItem(Item it) {
|
||||
return (it.getFlag() & ItemConstants.SANDBOX) == ItemConstants.SANDBOX;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user