Remove "banishable town scroll" feature

This commit is contained in:
P0nk
2024-07-17 17:45:38 +02:00
parent 3356e42e71
commit 402163c33d
9 changed files with 13 additions and 76 deletions

View File

@@ -257,7 +257,6 @@ server:
USE_BUFF_MOST_SIGNIFICANT: true #When applying buffs, the player will stick with the highest stat boost among the listed, rather than overwriting stats. USE_BUFF_MOST_SIGNIFICANT: true #When applying buffs, the player will stick with the highest stat boost among the listed, rather than overwriting stats.
USE_BUFF_EVERLASTING: false #Every applied buff on players holds expiration time so high it'd be considered permanent. Suggestion thanks to Vcoc. USE_BUFF_EVERLASTING: false #Every applied buff on players holds expiration time so high it'd be considered permanent. Suggestion thanks to Vcoc.
USE_MULTIPLE_SAME_EQUIP_DROP: true #Enables multiple drops by mobs of the same equipment, number of possible drops based on the quantities provided at the drop data. USE_MULTIPLE_SAME_EQUIP_DROP: true #Enables multiple drops by mobs of the same equipment, number of possible drops based on the quantities provided at the drop data.
USE_BANISHABLE_TOWN_SCROLL: false #Enables town scrolls to act as if it's a "player banish", rendering the antibanish scroll effect available.
USE_ENABLE_FULL_RESPAWN: false #At respawn task, always respawn missing mobs when they're available. Spawn count doesn't depend on how many players are currently there. USE_ENABLE_FULL_RESPAWN: false #At respawn task, always respawn missing mobs when they're available. Spawn count doesn't depend on how many players are currently there.
USE_ENABLE_CHAT_LOG: false #Write in-game chat to log USE_ENABLE_CHAT_LOG: false #Write in-game chat to log
USE_REBIRTH_SYSTEM: false #Flag to enable/disable rebirth system USE_REBIRTH_SYSTEM: false #Flag to enable/disable rebirth system

View File

@@ -352,9 +352,6 @@ public class Character extends AbstractCharacterObject {
private int targetHpBarHash = 0; private int targetHpBarHash = 0;
private long targetHpBarTime = 0; private long targetHpBarTime = 0;
private long nextWarningTime = 0; private long nextWarningTime = 0;
private int banishMap = -1;
private int banishSp = -1;
private long banishTime = 0;
private long lastExpGainTime; private long lastExpGainTime;
private boolean pendingNameChange; //only used to change name on logout, not to be relied upon elsewhere private boolean pendingNameChange; //only used to change name on logout, not to be relied upon elsewhere
private long loginTime; private long loginTime;
@@ -1356,31 +1353,7 @@ public class Character extends AbstractCharacterObject {
} }
} }
public boolean canRecoverLastBanish() {
return System.currentTimeMillis() - this.banishTime < MINUTES.toMillis(5);
}
public Pair<Integer, Integer> getLastBanishData() {
return new Pair<>(this.banishMap, this.banishSp);
}
public void clearBanishPlayerData() {
this.banishMap = -1;
this.banishSp = -1;
this.banishTime = 0;
}
public void setBanishPlayerData(int banishMap, int banishSp, long banishTime) {
this.banishMap = banishMap;
this.banishSp = banishSp;
this.banishTime = banishTime;
}
public void changeMapBanish(int mapid, String portal, String msg) { public void changeMapBanish(int mapid, String portal, String msg) {
int banMap = this.getMapId();
int banSp = this.getMap().findClosestPlayerSpawnpoint(this.getPosition()).getId();
long banTime = System.currentTimeMillis();
if (msg != null) { if (msg != null) {
dropMessage(5, msg); dropMessage(5, msg);
} }
@@ -1388,8 +1361,6 @@ public class Character extends AbstractCharacterObject {
MapleMap map_ = getWarpMap(mapid); MapleMap map_ = getWarpMap(mapid);
Portal portal_ = map_.getPortal(portal); Portal portal_ = map_.getPortal(portal);
changeMap(map_, portal_ != null ? portal_ : map_.getRandomPlayerSpawnpoint()); changeMap(map_, portal_ != null ? portal_ : map_.getRandomPlayerSpawnpoint());
setBanishPlayerData(banMap, banSp, banTime);
} }
public void changeMap(int map) { public void changeMap(int map) {
@@ -1772,7 +1743,6 @@ public class Character extends AbstractCharacterObject {
this.mapTransitioning.set(true); this.mapTransitioning.set(true);
this.unregisterChairBuff(); this.unregisterChairBuff();
this.clearBanishPlayerData();
Trade.cancelTrade(this, Trade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP); Trade.cancelTrade(this, Trade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP);
this.closePlayerInteractions(); this.closePlayerInteractions();

View File

@@ -1518,7 +1518,6 @@ public class Client extends ChannelInboundHandlerAdapter {
player.getInventory(InventoryType.EQUIPPED).checked(false); //test player.getInventory(InventoryType.EQUIPPED).checked(false); //test
player.getMap().removePlayer(player); player.getMap().removePlayer(player);
player.clearBanishPlayerData();
player.getClient().getChannelServer().removePlayer(player); player.getClient().getChannelServer().removePlayer(player);
player.saveCharToDB(); player.saveCharToDB();

View File

@@ -105,7 +105,6 @@ public class ServerConfig {
public boolean USE_BUFF_MOST_SIGNIFICANT; public boolean USE_BUFF_MOST_SIGNIFICANT;
public boolean USE_BUFF_EVERLASTING; public boolean USE_BUFF_EVERLASTING;
public boolean USE_MULTIPLE_SAME_EQUIP_DROP; public boolean USE_MULTIPLE_SAME_EQUIP_DROP;
public boolean USE_BANISHABLE_TOWN_SCROLL;
public boolean USE_ENABLE_FULL_RESPAWN; public boolean USE_ENABLE_FULL_RESPAWN;
public boolean USE_ENABLE_CHAT_LOG; public boolean USE_ENABLE_CHAT_LOG;
public boolean USE_REBIRTH_SYSTEM; public boolean USE_REBIRTH_SYSTEM;

View File

@@ -165,7 +165,6 @@ public class ItemId {
public static final int EYEDROP = 2050001; public static final int EYEDROP = 2050001;
public static final int TONIC = 2050002; public static final int TONIC = 2050002;
public static final int HOLY_WATER = 2050003; public static final int HOLY_WATER = 2050003;
public static final int ANTI_BANISH_SCROLL = 2030100;
private static final int DOJO_PARTY_ALL_CURE = 2022433; private static final int DOJO_PARTY_ALL_CURE = 2022433;
private static final int CARNIVAL_PARTY_ALL_CURE = 2022163; private static final int CARNIVAL_PARTY_ALL_CURE = 2022163;
public static final int WHITE_ELIXIR = 2022544; public static final int WHITE_ELIXIR = 2022544;

View File

@@ -134,11 +134,7 @@ public final class ItemConstants {
} }
public static boolean isTownScroll(int itemId) { public static boolean isTownScroll(int itemId) {
return itemId >= 2030000 && itemId < ItemId.ANTI_BANISH_SCROLL; return itemId >= 2030000;
}
public static boolean isAntibanishScroll(int itemId) {
return itemId == ItemId.ANTI_BANISH_SCROLL;
} }
public static boolean isCleanSlate(int scrollId) { public static boolean isCleanSlate(int scrollId) {

View File

@@ -29,17 +29,18 @@ import server.life.Monster;
public final class MobBanishPlayerHandler extends AbstractPacketHandler { public final class MobBanishPlayerHandler extends AbstractPacketHandler {
@Override @Override
public final void handlePacket(InPacket p, Client c) { public void handlePacket(InPacket p, Client c) {
int mobid = p.readInt(); // mob banish handling detected thanks to MedicOP int mobId = p.readInt(); // mob banish handling detected thanks to MedicOP
Character chr = c.getPlayer(); Character chr = c.getPlayer();
Monster mob = chr.getMap().getMonsterById(mobid); Monster mob = chr.getMap().getMonsterById(mobId);
if (mob == null) {
return;
}
if (mob != null) { BanishInfo banishInfo = mob.getBanish();
BanishInfo banishInfo = mob.getBanish(); if (banishInfo != null) {
if (banishInfo != null) { chr.changeMapBanish(banishInfo.getMap(), banishInfo.getPortal(), banishInfo.getMsg());
chr.changeMapBanish(banishInfo.getMap(), banishInfo.getPortal(), banishInfo.getMsg());
}
} }
} }
} }

View File

@@ -27,7 +27,6 @@ import client.Disease;
import client.inventory.InventoryType; import client.inventory.InventoryType;
import client.inventory.Item; import client.inventory.Item;
import client.inventory.manipulator.InventoryManipulator; import client.inventory.manipulator.InventoryManipulator;
import config.YamlConfig;
import constants.id.ItemId; import constants.id.ItemId;
import constants.inventory.ItemConstants; import constants.inventory.ItemConstants;
import net.AbstractPacketHandler; import net.AbstractPacketHandler;
@@ -73,23 +72,8 @@ public final class UseItemHandler extends AbstractPacketHandler {
remove(c, slot); remove(c, slot);
return; return;
} else if (ItemConstants.isTownScroll(itemId)) { } else if (ItemConstants.isTownScroll(itemId)) {
int banMap = chr.getMapId();
int banSp = chr.getMap().findClosestPlayerSpawnpoint(chr.getPosition()).getId();
long banTime = currentServerTime();
if (ii.getItemEffect(toUse.getItemId()).applyTo(chr)) {
if (YamlConfig.config.server.USE_BANISHABLE_TOWN_SCROLL) {
chr.setBanishPlayerData(banMap, banSp, banTime);
}
remove(c, slot);
}
return;
} else if (ItemConstants.isAntibanishScroll(itemId)) {
if (ii.getItemEffect(toUse.getItemId()).applyTo(chr)) { if (ii.getItemEffect(toUse.getItemId()).applyTo(chr)) {
remove(c, slot); remove(c, slot);
} else {
chr.dropMessage(5, "You cannot recover from a banish state at the moment.");
} }
return; return;
} }

View File

@@ -977,18 +977,8 @@ public class StatEffect {
Portal pt; Portal pt;
if (moveTo == MapId.NONE) { if (moveTo == MapId.NONE) {
if (sourceid != ItemId.ANTI_BANISH_SCROLL) { target = applyto.getMap().getReturnMap();
target = applyto.getMap().getReturnMap(); pt = target.getRandomPlayerSpawnpoint();
pt = target.getRandomPlayerSpawnpoint();
} else {
if (!applyto.canRecoverLastBanish()) {
return false;
}
Pair<Integer, Integer> lastBanishInfo = applyto.getLastBanishData();
target = applyto.getWarpMap(lastBanishInfo.getLeft());
pt = target.getPortal(lastBanishInfo.getRight());
}
} else { } else {
target = applyto.getClient().getWorldServer().getChannel(applyto.getClient().getChannel()).getMapFactory().getMap(moveTo); target = applyto.getClient().getWorldServer().getChannel(applyto.getClient().getChannel()).getMapFactory().getMap(moveTo);
int targetid = target.getId() / 10000000; int targetid = target.getId() / 10000000;