Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f2c2dc08f | ||
|
|
cad10c4d5c | ||
|
|
aa3686ed0b | ||
|
|
3850b63cec | ||
|
|
a7df8a4f49 | ||
|
|
7071b13e41 | ||
|
|
2324ae7f9e | ||
|
|
402163c33d | ||
|
|
3356e42e71 | ||
|
|
205e263255 |
@@ -71,7 +71,7 @@ You will start by installing the database server and client, and then run some s
|
||||
You will start by cloning the repository, then configure the database properties and lastly start the server.
|
||||
|
||||
#### Prerequisites
|
||||
* Java 21+ (I recommend [Amazon Corretto](https://aws.amazon.com/corretto))
|
||||
* Java 21 (I recommend [Amazon Corretto](https://aws.amazon.com/corretto))
|
||||
* IDE (I recommend [IntelliJ IDEA](https://www.jetbrains.com/idea/))
|
||||
|
||||
#### Steps
|
||||
@@ -107,7 +107,7 @@ You will start by installing the game with the old installer, then overwrite som
|
||||
1. Download _MapleGlobal-v83-setup.exe_ from my [Google Drive](https://drive.google.com/drive/folders/1hgnb92MGL6xqEp9szEMBh0K9pSJcJ6IT). This is the official installer from back then.
|
||||
2. Install it in a directory of your choice.
|
||||
3. Delete the following files from the installation directory: _HShield_ (entire directory), _ASPLnchr.exe_, _MapleStory.exe_, and _Patcher.exe_.
|
||||
4. Download _CosmicWZ-2024-05-21-v0.13.0.zip_ from my [Google Drive](https://drive.google.com/drive/folders/1hgnb92MGL6xqEp9szEMBh0K9pSJcJ6IT).
|
||||
4. Download _CosmicWZ-2024-07-17-v0.14.0.zip_ from my [Google Drive](https://drive.google.com/drive/folders/1hgnb92MGL6xqEp9szEMBh0K9pSJcJ6IT).
|
||||
5. Unzip it and copy all .wz-files into the installation directory. Replace the existing ones.
|
||||
6. Download _HeavenMS-localhost-WINDOW.exe_ from [hostr.co](https://hostr.co/amuX5SLeeVZx). This is a client modified to connect to your localhost instead of Nexon's server (along with some fixes and custom changes).
|
||||
- Your antivirus will likely detect the file as a trojan or similar and automatically delete it. To prevent this from happening, add your _Downloads_ directory and the installation directory as exclusions in your antivirus software. On W11, this is under "Virus & threat protection settings" -> "Add or remove exclusions".
|
||||
|
||||
@@ -257,10 +257,8 @@ 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_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_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_CHAT_LOG: false #Write in-game chat to log
|
||||
USE_REBIRTH_SYSTEM: false #Flag to enable/disable rebirth system
|
||||
USE_MAP_OWNERSHIP_SYSTEM: false #Flag to enable/disable map ownership system
|
||||
USE_FISHING_SYSTEM: false #Flag to enable/disable custom fishing system
|
||||
USE_NPCS_SCRIPTABLE: true #Flag to enable/disable serverside predefined script NPCs.
|
||||
@@ -318,7 +316,6 @@ server:
|
||||
NAME_CHANGE_COOLDOWN: 2592000000 # (30*24*60*60*1000) Cooldown for name changes, default (GMS) is 30 days.
|
||||
WORLD_TRANSFER_COOLDOWN: 2592000000 # (30*24*60*60*1000) Cooldown for world tranfers, default is same as name change (30 days).
|
||||
INSTANT_NAME_CHANGE: false #Whether or not to wait for server restart to apply name changes. Does on reconnect otherwise (requires queries on every login).
|
||||
REBIRTH_NPC_ID: 9010021 #ID of the NPC that should be replaced with the rebirth mechanic, if enabled.
|
||||
|
||||
#Dangling Items/Locks Configuration
|
||||
ITEM_EXPIRE_TIME: 180000 # (3 * 60 * 1000) Time before items start disappearing. Recommended to be set up to 3 minutes.
|
||||
@@ -395,7 +392,6 @@ server:
|
||||
USE_EQUIPMNT_LVLUP_SLOTS: false #Equips can upgrade slots at level up.
|
||||
USE_EQUIPMNT_LVLUP_POWER: false #Enable more powerful stat upgrades at equip level up.
|
||||
USE_EQUIPMNT_LVLUP_CASH: false #Enable equip leveling up on cash equipments as well.
|
||||
USE_SPIKES_AVOID_BANISH: false #Shoes equipped with spikes prevents mobs from banishing wearer.
|
||||
MAX_EQUIPMNT_LVLUP_STAT_UP: 10000 #Max stat upgrade an equipment can have on a levelup.
|
||||
MAX_EQUIPMNT_STAT: 32767 #Max stat on an equipment by leveling up.
|
||||
USE_EQUIPMNT_LVLUP: 1 #All equips lvlup at max level of N, set 1 to disable.
|
||||
|
||||
@@ -131,39 +131,6 @@ INSERT IGNORE INTO `shopitems` (`shopid`, `itemid`, `price`, `pitch`, `position`
|
||||
(9201101, 2012008, 4200000, 0, 164),
|
||||
(9201101, 2022251, 3800000, 0, 168);
|
||||
|
||||
# adding antibanish scrolls
|
||||
INSERT IGNORE INTO `shopitems` (`shopid`, `itemid`, `price`, `pitch`, `position`) VALUES
|
||||
(1001100, 2030100, 450, 0, 130),
|
||||
(1011100, 2030100, 450, 0, 142),
|
||||
(1021100, 2030100, 450, 0, 142),
|
||||
(1031100, 2030100, 450, 0, 146),
|
||||
(1051002, 2030100, 450, 0, 142),
|
||||
(1052116, 2030100, 450, 0, 118),
|
||||
(1061001, 2030100, 450, 0, 126),
|
||||
(1061002, 2030100, 450, 0, 130),
|
||||
(1091002, 2030100, 450, 0, 130),
|
||||
(1100002, 2030100, 450, 0, 138),
|
||||
(2012005, 2030100, 450, 0, 126),
|
||||
(2022001, 2030100, 450, 0, 126),
|
||||
(2030009, 2030100, 450, 0, 126),
|
||||
(2040051, 2030100, 450, 0, 102),
|
||||
(2041006, 2030100, 450, 0, 134),
|
||||
(2051000, 2030100, 450, 0, 134),
|
||||
(2060004, 2030100, 450, 0, 134),
|
||||
(2070001, 2030100, 450, 0, 134),
|
||||
(2080001, 2030100, 450, 0, 134),
|
||||
(2090003, 2030100, 450, 0, 126),
|
||||
(2093002, 2030100, 450, 0, 126),
|
||||
(2100004, 2030100, 450, 0, 130),
|
||||
(2110001, 2030100, 450, 0, 130),
|
||||
(2130000, 2030100, 450, 0, 126),
|
||||
(9201060, 2030100, 450, 0, 114),
|
||||
(9270021, 2030100, 450, 0, 118),
|
||||
(9270022, 2030100, 450, 0, 114), -- Thanks Rednor for finding duplicate item on NPC
|
||||
(1338, 2030100, 450, 0, 114),
|
||||
(9270057, 2030100, 450, 0, 4),
|
||||
(9270065, 2030100, 450, 0, 3);
|
||||
|
||||
-- Thanks to Vcoc
|
||||
-- GMShop: Sacks, GmEquip, Cheese & Onyx, Utils,
|
||||
-- Arrows, Bullets, Throwings and Capsules,
|
||||
@@ -301,7 +268,6 @@ INSERT INTO `shopitems` ( `shopid`, `itemid`, `price`, `pitch`, `position`) VALU
|
||||
(1200002, 2070000, 500, 0, 108),
|
||||
(1200002, 2061000, 1, 0, 120),
|
||||
(1200002, 2060000, 1, 0, 124),
|
||||
(1200002, 2030100, 400, 0, 128),
|
||||
(1200002, 2030000, 400, 0, 132),
|
||||
(1200002, 2020028, 3000, 0, 136),
|
||||
(1200002, 2010004, 310, 0, 140),
|
||||
@@ -323,7 +289,6 @@ INSERT INTO `shopitems` ( `shopid`, `itemid`, `price`, `pitch`, `position`) VALU
|
||||
(1301000, 2070000, 500, 0, 108),
|
||||
(1301000, 2061000, 1, 0, 112),
|
||||
(1301000, 2060000, 1, 0, 116),
|
||||
(1301000, 2030100, 400, 0, 120),
|
||||
(1301000, 2030000, 400, 0, 124),
|
||||
(1301000, 2022000, 1650, 0, 128),
|
||||
(1301000, 2022003, 1100, 0, 132),
|
||||
@@ -348,4 +313,4 @@ INSERT INTO `shopitems` ( `shopid`, `itemid`, `price`, `pitch`, `position`) VALU
|
||||
(9270019, 1482004, 75000, 0, 100),
|
||||
(9270020, 1052113, 120000, 0, 92),
|
||||
(9270020, 1052110, 100000, 0, 96),
|
||||
(9270020, 1002625, 75000, 0, 100);
|
||||
(9270020, 1002625, 75000, 0, 100);
|
||||
|
||||
13
database/sql/migration/README.md
Normal file
13
database/sql/migration/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Migrations
|
||||
The files contained in this directory are intended to be run manually when transitioning from an earlier version of Cosmic to a more recent one.
|
||||
|
||||
Not every version comes with an associated migration script. Only those with breaking changes such as removal of custom assets that would otherwise crash the client.
|
||||
|
||||
This is a temporary solution until automatic database migrations are in place.
|
||||
|
||||
## How to
|
||||
Each script is only intended to be run __once__.
|
||||
|
||||
When a new migration is available, simply run the SQL script in HeidiSQL (or other SQL client of choice).
|
||||
|
||||
If there are multiple new migrations that you haven't run, run them in order starting with the lowest version and ending with the highest version.
|
||||
2
database/sql/migration/v0.14.0.sql
Normal file
2
database/sql/migration/v0.14.0.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
DELETE FROM shopitems
|
||||
WHERE itemid = 2030100; # Return Scroll - Banished Area (a custom item added in HeavenMS)
|
||||
@@ -385,7 +385,6 @@
|
||||
2030016 - Phyllia's Warp Powder - Warp powder made by fairy Phyllia. Teleports you to Magatia when used inside the Nihal desert region.
|
||||
2030019 - Return Scroll to Nautilus - This scroll enables you to return to the Pirate village, Nautilus. This is a one use item and will disappear after use.
|
||||
2030020 - Return Scroll to New Leaf City - Use this scroll to venture back to New Leaf City whenever you want!
|
||||
2030100 - Return Scroll - Banished Area - Returns you to the map where you were last banished. Requires immediate use and have changed neither maps nor channels.
|
||||
2031000 - Masked Man's Invitation - An invitation from the Masked Man to the Halloween Party at the Haunted Mansion. Double-click to move straight to the mansion.
|
||||
2031001 - Studio Invitation - An invitation to the studio for the event "For Guild Only".
|
||||
2040000 - Scroll for Helmet for DEF - Improves the helmet's weapon def.\nSuccess rate:100%, weapon def. +1
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Rebirth NPC
|
||||
@author Ronan
|
||||
@author wejrox
|
||||
*/
|
||||
var status;
|
||||
var jobId = 0;
|
||||
|
||||
function start() {
|
||||
status = -1;
|
||||
const YamlConfig = Java.type('config.YamlConfig');
|
||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
cm.sendOk("Rebirths aren't enabled on this server, how did you get here?");
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
action(1, 0, 0);
|
||||
}
|
||||
|
||||
function action(mode, type, selection) {
|
||||
if (mode === 1) {
|
||||
status++;
|
||||
} else {
|
||||
cm.dispose();
|
||||
return;
|
||||
}
|
||||
if (status === 0) {
|
||||
cm.sendNext("Come to me when you want to be reborn again. You currently have a total of #r" + cm.getChar().getReborns() + " #krebirths.");
|
||||
} else if (status === 1) {
|
||||
cm.sendSimple("What do you want me to do today: \r\n \r\n #L0##bI want to be reborn!#l \r\n #L1##bNothing for now...#k#l");
|
||||
} else if (status === 2) {
|
||||
if (selection === 0) {
|
||||
if (cm.getChar().getLevel() === cm.getChar().getMaxClassLevel()) {
|
||||
cm.sendSimple("I see... and which path would you like to take? \r\n\r\n #L0##bExplorer (Beginner)#l \r\n #L1##bCygnus Knight (Noblesse)#l \r\n #L2##bAran (Legend)#l");
|
||||
} else {
|
||||
cm.sendOk("It looks like your journey has not yet ended... come back when you're level " + cm.getChar().getMaxClassLevel());
|
||||
cm.dispose();
|
||||
}
|
||||
} else if (selection === 1) {
|
||||
cm.sendOk("See you soon!")
|
||||
cm.dispose();
|
||||
}
|
||||
} else if (status === 3) {
|
||||
// 0 => beginner, 1000 => noblesse, 2000 => legend
|
||||
// makes this very easy :-)
|
||||
jobId = selection * 1000;
|
||||
|
||||
var job = "";
|
||||
if (selection === 0) job = "Beginner";
|
||||
else if (selection === 1) job = "Noblesse";
|
||||
else if (selection === 2) job = "Legend";
|
||||
cm.sendYesNo("Are you sure you want to be reborn as a " + job + "?");
|
||||
}
|
||||
else if (status === 4 && type === 1) {
|
||||
cm.getChar().executeRebornAsId(jobId);
|
||||
cm.sendOk("You have now been reborn. That's a total of #r" + cm.getChar().getReborns() + "#k rebirths");
|
||||
cm.dispose();
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,7 @@ import server.events.Events;
|
||||
import server.events.RescueGaga;
|
||||
import server.events.gm.Fitness;
|
||||
import server.events.gm.Ola;
|
||||
import server.life.BanishInfo;
|
||||
import server.life.MobSkill;
|
||||
import server.life.MobSkillFactory;
|
||||
import server.life.MobSkillId;
|
||||
@@ -153,7 +154,6 @@ import tools.LongTool;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
import tools.Randomizer;
|
||||
import tools.exceptions.NotEnabledException;
|
||||
import tools.packets.WeddingPackets;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -352,9 +352,6 @@ public class Character extends AbstractCharacterObject {
|
||||
private int targetHpBarHash = 0;
|
||||
private long targetHpBarTime = 0;
|
||||
private long nextWarningTime = 0;
|
||||
private int banishMap = -1;
|
||||
private int banishSp = -1;
|
||||
private long banishTime = 0;
|
||||
private long lastExpGainTime;
|
||||
private boolean pendingNameChange; //only used to change name on logout, not to be relied upon elsewhere
|
||||
private long loginTime;
|
||||
@@ -1356,48 +1353,14 @@ 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) {
|
||||
if (YamlConfig.config.server.USE_SPIKES_AVOID_BANISH) {
|
||||
for (Item it : this.getInventory(InventoryType.EQUIPPED).list()) {
|
||||
if ((it.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int banMap = this.getMapId();
|
||||
int banSp = this.getMap().findClosestPlayerSpawnpoint(this.getPosition()).getId();
|
||||
long banTime = System.currentTimeMillis();
|
||||
|
||||
if (msg != null) {
|
||||
dropMessage(5, msg);
|
||||
public void changeMapBanish(BanishInfo banishInfo) {
|
||||
if (banishInfo.msg() != null) {
|
||||
dropMessage(5, banishInfo.msg());
|
||||
}
|
||||
|
||||
MapleMap map_ = getWarpMap(mapid);
|
||||
Portal portal_ = map_.getPortal(portal);
|
||||
Portal portal_ = map_.getPortal(banishInfo.portal());
|
||||
changeMap(map_, portal_ != null ? portal_ : map_.getRandomPlayerSpawnpoint());
|
||||
|
||||
setBanishPlayerData(banMap, banSp, banTime);
|
||||
}
|
||||
|
||||
public void changeMap(int map) {
|
||||
@@ -1780,7 +1743,6 @@ public class Character extends AbstractCharacterObject {
|
||||
this.mapTransitioning.set(true);
|
||||
|
||||
this.unregisterChairBuff();
|
||||
this.clearBanishPlayerData();
|
||||
Trade.cancelTrade(this, Trade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP);
|
||||
this.closePlayerInteractions();
|
||||
|
||||
@@ -10999,70 +10961,6 @@ public class Character extends AbstractCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void setReborns(int value) {
|
||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
yellowMessage("Rebirth system is not enabled!");
|
||||
throw new NotEnabledException();
|
||||
}
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reborns=? WHERE id=?;")) {
|
||||
ps.setInt(1, value);
|
||||
ps.setInt(2, id);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void addReborns() {
|
||||
setReborns(getReborns() + 1);
|
||||
}
|
||||
|
||||
public int getReborns() {
|
||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
yellowMessage("Rebirth system is not enabled!");
|
||||
throw new NotEnabledException();
|
||||
}
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT reborns FROM characters WHERE id=?;")) {
|
||||
ps.setInt(1, id);
|
||||
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
rs.next();
|
||||
return rs.getInt(1);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public void executeReborn() {
|
||||
// default to beginner: job id = 0
|
||||
// this prevents a breaking change
|
||||
executeRebornAs(Job.BEGINNER);
|
||||
}
|
||||
|
||||
public void executeRebornAsId(int jobId) {
|
||||
executeRebornAs(Job.getById(jobId));
|
||||
}
|
||||
|
||||
public void executeRebornAs(Job job) {
|
||||
if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
yellowMessage("Rebirth system is not enabled!");
|
||||
throw new NotEnabledException();
|
||||
}
|
||||
if (getLevel() != getMaxClassLevel()) {
|
||||
return;
|
||||
}
|
||||
addReborns();
|
||||
changeJob(job);
|
||||
setLevel(0);
|
||||
levelUp(true);
|
||||
}
|
||||
|
||||
//EVENTS
|
||||
private byte team = 0;
|
||||
private Fitness fitness;
|
||||
|
||||
@@ -1518,7 +1518,6 @@ public class Client extends ChannelInboundHandlerAdapter {
|
||||
|
||||
player.getInventory(InventoryType.EQUIPPED).checked(false); //test
|
||||
player.getMap().removePlayer(player);
|
||||
player.clearBanishPlayerData();
|
||||
player.getClient().getChannelServer().removePlayer(player);
|
||||
|
||||
player.saveCharToDB();
|
||||
|
||||
@@ -105,10 +105,8 @@ public class ServerConfig {
|
||||
public boolean USE_BUFF_MOST_SIGNIFICANT;
|
||||
public boolean USE_BUFF_EVERLASTING;
|
||||
public boolean USE_MULTIPLE_SAME_EQUIP_DROP;
|
||||
public boolean USE_BANISHABLE_TOWN_SCROLL;
|
||||
public boolean USE_ENABLE_FULL_RESPAWN;
|
||||
public boolean USE_ENABLE_CHAT_LOG;
|
||||
public boolean USE_REBIRTH_SYSTEM;
|
||||
public boolean USE_MAP_OWNERSHIP_SYSTEM;
|
||||
public boolean USE_FISHING_SYSTEM;
|
||||
public boolean USE_NPCS_SCRIPTABLE;
|
||||
@@ -166,7 +164,6 @@ public class ServerConfig {
|
||||
public long NAME_CHANGE_COOLDOWN;
|
||||
public long WORLD_TRANSFER_COOLDOWN = NAME_CHANGE_COOLDOWN;//Cooldown for world tranfers, default is same as name change (30 days).
|
||||
public boolean INSTANT_NAME_CHANGE;
|
||||
public int REBIRTH_NPC_ID;
|
||||
|
||||
//Dangling Items/Locks Configuration
|
||||
public int ITEM_EXPIRE_TIME;
|
||||
@@ -243,7 +240,6 @@ public class ServerConfig {
|
||||
public boolean USE_EQUIPMNT_LVLUP_SLOTS;
|
||||
public boolean USE_EQUIPMNT_LVLUP_POWER;
|
||||
public boolean USE_EQUIPMNT_LVLUP_CASH;
|
||||
public boolean USE_SPIKES_AVOID_BANISH;
|
||||
public int MAX_EQUIPMNT_LVLUP_STAT_UP;
|
||||
public int MAX_EQUIPMNT_STAT;
|
||||
public int USE_EQUIPMNT_LVLUP;
|
||||
|
||||
@@ -165,7 +165,6 @@ public class ItemId {
|
||||
public static final int EYEDROP = 2050001;
|
||||
public static final int TONIC = 2050002;
|
||||
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 CARNIVAL_PARTY_ALL_CURE = 2022163;
|
||||
public static final int WHITE_ELIXIR = 2022544;
|
||||
|
||||
@@ -134,11 +134,7 @@ public final class ItemConstants {
|
||||
}
|
||||
|
||||
public static boolean isTownScroll(int itemId) {
|
||||
return itemId >= 2030000 && itemId < ItemId.ANTI_BANISH_SCROLL;
|
||||
}
|
||||
|
||||
public static boolean isAntibanishScroll(int itemId) {
|
||||
return itemId == ItemId.ANTI_BANISH_SCROLL;
|
||||
return itemId >= 2030000;
|
||||
}
|
||||
|
||||
public static boolean isCleanSlate(int scrollId) {
|
||||
|
||||
@@ -23,23 +23,25 @@ import client.Character;
|
||||
import client.Client;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import server.life.LifeFactory.BanishInfo;
|
||||
import server.life.BanishInfo;
|
||||
import server.life.Monster;
|
||||
|
||||
public final class MobBanishPlayerHandler extends AbstractPacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(InPacket p, Client c) {
|
||||
int mobid = p.readInt(); // mob banish handling detected thanks to MedicOP
|
||||
public void handlePacket(InPacket p, Client c) {
|
||||
int mobId = p.readInt(); // mob banish handling detected thanks to MedicOP
|
||||
|
||||
Character chr = c.getPlayer();
|
||||
Monster mob = chr.getMap().getMonsterById(mobid);
|
||||
|
||||
if (mob != null) {
|
||||
BanishInfo banishInfo = mob.getBanish();
|
||||
if (banishInfo != null) {
|
||||
chr.changeMapBanish(banishInfo.getMap(), banishInfo.getPortal(), banishInfo.getMsg());
|
||||
}
|
||||
Monster mob = chr.getMap().getMonsterById(mobId);
|
||||
if (mob == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
BanishInfo banishInfo = mob.getBanish();
|
||||
if (banishInfo == null) {
|
||||
return;
|
||||
}
|
||||
chr.changeMapBanish(banishInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public final class MoveLifeHandler extends AbstractMovementPacketHandler {
|
||||
|
||||
if (banishPlayers != null) {
|
||||
for (Character chr : banishPlayers) {
|
||||
chr.changeMapBanish(monster.getBanish().getMap(), monster.getBanish().getPortal(), monster.getBanish().getMsg());
|
||||
chr.changeMapBanish(monster.getBanish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,6 @@ public final class NPCTalkHandler extends AbstractPacketHandler {
|
||||
NPCScriptManager.getInstance().start(c, npc.getId(), "gachapon", null);
|
||||
} else if (npc.getName().endsWith("Maple TV")) {
|
||||
NPCScriptManager.getInstance().start(c, npc.getId(), "mapleTV", null);
|
||||
} else if (YamlConfig.config.server.USE_REBIRTH_SYSTEM && npc.getId() == YamlConfig.config.server.REBIRTH_NPC_ID) {
|
||||
NPCScriptManager.getInstance().start(c, npc.getId(), "rebirth", null);
|
||||
} else {
|
||||
boolean hasNpcScript = NPCScriptManager.getInstance().start(c, npc.getId(), oid, null);
|
||||
if (!hasNpcScript) {
|
||||
@@ -97,4 +95,4 @@ public final class NPCTalkHandler extends AbstractPacketHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,11 +448,6 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
||||
Entry::getValue
|
||||
));
|
||||
|
||||
// Any npc be specified as the rebirth npc. Allow the npc to use custom scripts explicitly.
|
||||
if (YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
|
||||
npcsIds.put(YamlConfig.config.server.REBIRTH_NPC_ID, "Rebirth");
|
||||
}
|
||||
|
||||
c.sendPacket(PacketCreator.setNPCScriptable(npcsIds));
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ public final class TakeDamageHandler extends AbstractPacketHandler {
|
||||
}
|
||||
|
||||
for (Character player : banishPlayers) { // chill, if this list ever gets non-empty an attacker does exist, trust me :)
|
||||
player.changeMapBanish(attacker.getBanish().getMap(), attacker.getBanish().getPortal(), attacker.getBanish().getMsg());
|
||||
player.changeMapBanish(attacker.getBanish());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import client.Disease;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.id.ItemId;
|
||||
import constants.inventory.ItemConstants;
|
||||
import net.AbstractPacketHandler;
|
||||
@@ -73,23 +72,8 @@ public final class UseItemHandler extends AbstractPacketHandler {
|
||||
remove(c, slot);
|
||||
return;
|
||||
} 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)) {
|
||||
remove(c, slot);
|
||||
} else {
|
||||
chr.dropMessage(5, "You cannot recover from a banish state at the moment.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -977,18 +977,8 @@ public class StatEffect {
|
||||
Portal pt;
|
||||
|
||||
if (moveTo == MapId.NONE) {
|
||||
if (sourceid != ItemId.ANTI_BANISH_SCROLL) {
|
||||
target = applyto.getMap().getReturnMap();
|
||||
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());
|
||||
}
|
||||
target = applyto.getMap().getReturnMap();
|
||||
pt = target.getRandomPlayerSpawnpoint();
|
||||
} else {
|
||||
target = applyto.getClient().getWorldServer().getChannel(applyto.getClient().getChannel()).getMapFactory().getMap(moveTo);
|
||||
int targetid = target.getId() / 10000000;
|
||||
|
||||
9
src/main/java/server/life/BanishInfo.java
Normal file
9
src/main/java/server/life/BanishInfo.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package server.life;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record BanishInfo(int map, String portal, String msg) {
|
||||
public BanishInfo {
|
||||
Objects.requireNonNull(portal, "BanishInfo portal");
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,10 @@ public class LifeFactory {
|
||||
|
||||
Data banishData = monsterInfoData.getChildByPath("ban");
|
||||
if (banishData != null) {
|
||||
stats.setBanishInfo(new BanishInfo(DataTool.getString("banMsg", banishData), DataTool.getInt("banMap/0/field", banishData, -1), DataTool.getString("banMap/0/portal", banishData, "sp")));
|
||||
int map = DataTool.getInt("banMap/0/field", banishData, -1);
|
||||
String portal = DataTool.getString("banMap/0/portal", banishData, "sp");
|
||||
String msg = DataTool.getString("banMsg", banishData);
|
||||
stats.setBanishInfo(new BanishInfo(map, portal, msg));
|
||||
}
|
||||
|
||||
int noFlip = DataTool.getInt("noFlip", monsterInfoData, 0);
|
||||
@@ -296,31 +299,6 @@ public class LifeFactory {
|
||||
return DataTool.getString(nid + "/d0", npcStringData, "(...)");
|
||||
}
|
||||
|
||||
public static class BanishInfo {
|
||||
|
||||
private final int map;
|
||||
private final String portal;
|
||||
private final String msg;
|
||||
|
||||
public BanishInfo(String msg, int map, String portal) {
|
||||
this.msg = msg;
|
||||
this.map = map;
|
||||
this.portal = portal;
|
||||
}
|
||||
|
||||
public int getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getPortal() {
|
||||
return portal;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
public static class loseItem {
|
||||
|
||||
private final int id;
|
||||
|
||||
@@ -56,7 +56,6 @@ import org.slf4j.LoggerFactory;
|
||||
import scripting.event.EventInstanceManager;
|
||||
import server.StatEffect;
|
||||
import server.TimerManager;
|
||||
import server.life.LifeFactory.BanishInfo;
|
||||
import server.loot.LootManager;
|
||||
import server.maps.AbstractAnimatedMapObject;
|
||||
import server.maps.MapObjectType;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
package server.life;
|
||||
|
||||
import server.life.LifeFactory.BanishInfo;
|
||||
import server.life.LifeFactory.loseItem;
|
||||
import server.life.LifeFactory.selfDestruction;
|
||||
import tools.Pair;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package tools.exceptions;
|
||||
|
||||
public class NotEnabledException extends RuntimeException {
|
||||
|
||||
public NotEnabledException() {
|
||||
super("Feature not enabled, please enable the feature in ServerConstant");
|
||||
}
|
||||
|
||||
public NotEnabledException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import provider.DataProviderFactory;
|
||||
import provider.DataTool;
|
||||
import provider.wz.DataType;
|
||||
import provider.wz.WZFiles;
|
||||
import server.life.BanishInfo;
|
||||
import server.life.Element;
|
||||
import server.life.ElementalEffectiveness;
|
||||
import server.life.LifeFactory.BanishInfo;
|
||||
import server.life.LifeFactory.loseItem;
|
||||
import server.life.LifeFactory.selfDestruction;
|
||||
import server.life.MobSkillId;
|
||||
@@ -134,7 +134,10 @@ public class MonsterStatFetcher {
|
||||
}
|
||||
Data banishData = monsterInfoData.getChildByPath("ban");
|
||||
if (banishData != null) {
|
||||
stats.setBanishInfo(new BanishInfo(DataTool.getString("banMsg", banishData), DataTool.getInt("banMap/0/field", banishData, -1), DataTool.getString("banMap/0/portal", banishData, "sp")));
|
||||
int map = DataTool.getInt("banMap/0/field", banishData, -1);
|
||||
String portal = DataTool.getString("banMap/0/portal", banishData, "sp");
|
||||
String msg = DataTool.getString("banMsg", banishData);
|
||||
stats.setBanishInfo(new BanishInfo(map, portal, msg));
|
||||
}
|
||||
|
||||
monsterStats.put(mid, stats);
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
<int name="id" value="4000001"/>
|
||||
<int name="count" value="100"/>
|
||||
</imgdir>
|
||||
<imgdir name="1">
|
||||
<int name="id" value="2030100"/>
|
||||
<int name="count" value="12"/>
|
||||
</imgdir>
|
||||
</imgdir>
|
||||
</imgdir>
|
||||
<imgdir name="1">
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
<int name="moveTo" value="120000000"/>
|
||||
</imgdir>
|
||||
</imgdir>
|
||||
<imgdir name="02030100">
|
||||
<imgdir name="02030020">
|
||||
<imgdir name="info">
|
||||
<canvas name="icon" width="32" height="30">
|
||||
<vector name="origin" x="0" y="29"/>
|
||||
@@ -218,10 +218,10 @@
|
||||
<canvas name="iconRaw" width="32" height="28">
|
||||
<vector name="origin" x="0" y="29"/>
|
||||
</canvas>
|
||||
<int name="price" value="225"/>
|
||||
<int name="price" value="250"/>
|
||||
</imgdir>
|
||||
<imgdir name="spec">
|
||||
<int name="moveTo" value="999999999"/>
|
||||
<int name="moveTo" value="600000000"/>
|
||||
</imgdir>
|
||||
</imgdir>
|
||||
<imgdir name="02031000">
|
||||
@@ -380,18 +380,4 @@
|
||||
<int name="randomMoveInFieldSet" value="1"/>
|
||||
</imgdir>
|
||||
</imgdir>
|
||||
<imgdir name="02030020">
|
||||
<imgdir name="info">
|
||||
<canvas name="icon" width="32" height="30">
|
||||
<vector name="origin" x="0" y="29"/>
|
||||
</canvas>
|
||||
<canvas name="iconRaw" width="32" height="28">
|
||||
<vector name="origin" x="0" y="29"/>
|
||||
</canvas>
|
||||
<int name="price" value="250"/>
|
||||
</imgdir>
|
||||
<imgdir name="spec">
|
||||
<int name="moveTo" value="600000000"/>
|
||||
</imgdir>
|
||||
</imgdir>
|
||||
</imgdir>
|
||||
|
||||
@@ -1499,10 +1499,6 @@
|
||||
<string name="name" value="Return Scroll to Nautilus"/>
|
||||
<string name="desc" value="This scroll enables you to return to the Pirate village, Nautilus. This is a one-use item and will disappear after use."/>
|
||||
</imgdir>
|
||||
<imgdir name="2030100">
|
||||
<string name="name" value="Return Scroll - Banished Area"/>
|
||||
<string name="desc" value="Returns you to the map where you were last banished. Requires immediate use and have changed neither maps nor channels."/>
|
||||
</imgdir>
|
||||
<imgdir name="2031000">
|
||||
<string name="name" value="Masked Man's Invitation"/>
|
||||
<string name="desc" value="An invitation from the Masked Man to the Halloween Party at the Haunted Mansion. Double-click to move straight to the mansion."/>
|
||||
|
||||
Reference in New Issue
Block a user