Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d6d5dcc94 | ||
|
|
61f451694f | ||
|
|
c681f0bd82 | ||
|
|
cbc0b2707e | ||
|
|
36d0f8a2a0 | ||
|
|
301f65ce16 | ||
|
|
f1b95fe45e | ||
|
|
3091d747e6 | ||
|
|
f4062e5ebb | ||
|
|
a8807f1ef0 | ||
|
|
10945927c1 | ||
|
|
ab25f698da | ||
|
|
b30e03ffb3 | ||
|
|
82157c7bd1 |
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Cosmic JAR creation stage
|
# Cosmic JAR creation stage
|
||||||
#
|
#
|
||||||
FROM maven:3.8.4-openjdk-17 AS jar
|
FROM maven:3.9.1-eclipse-temurin-17 AS jar
|
||||||
|
|
||||||
# Build in a separated location which won't have permissions issues.
|
# Build in a separated location which won't have permissions issues.
|
||||||
WORKDIR /opt/cosmic
|
WORKDIR /opt/cosmic
|
||||||
@@ -21,7 +21,7 @@ RUN mvn -f ./pom.xml clean package -Dmaven.test.skip -T 1C
|
|||||||
#
|
#
|
||||||
# Server creation stage
|
# Server creation stage
|
||||||
#
|
#
|
||||||
FROM openjdk:17.0.2
|
FROM eclipse-temurin:17.0.6_10-jre
|
||||||
|
|
||||||
# Host the server in a location that won't have permissions issues.
|
# Host the server in a location that won't have permissions issues.
|
||||||
WORKDIR /opt/server
|
WORKDIR /opt/server
|
||||||
|
|||||||
28
pom.xml
28
pom.xml
@@ -19,22 +19,22 @@
|
|||||||
<mainClass>net.server.Server</mainClass>
|
<mainClass>net.server.Server</mainClass>
|
||||||
|
|
||||||
<!-- Maven plugins -->
|
<!-- Maven plugins -->
|
||||||
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version> <!-- For running unit tests -->
|
<maven-surefire-plugin.version>3.0.0-M9</maven-surefire-plugin.version> <!-- For running unit tests -->
|
||||||
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version> <!-- Disabled. (for building thin jar) -->
|
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version> <!-- Disabled. (for building thin jar) -->
|
||||||
<maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version> <!-- For packaging the executable fat jar -->
|
<maven-assembly-plugin.version>3.5.0</maven-assembly-plugin.version> <!-- For packaging the executable fat jar -->
|
||||||
|
|
||||||
<!-- Dependencies -->
|
<!-- Dependencies -->
|
||||||
<slf4j-api.version>1.7.36</slf4j-api.version> <!-- Logging facade -->
|
<slf4j-api.version>1.7.36</slf4j-api.version> <!-- Logging facade -->
|
||||||
<log4j.version>2.18.0</log4j.version> <!-- Slf4j implementation -->
|
<log4j.version>2.20.0</log4j.version> <!-- Slf4j implementation -->
|
||||||
<graalvm.version>22.2.0</graalvm.version> <!-- ScriptEngine implementation -->
|
<graalvm.version>22.3.1</graalvm.version> <!-- ScriptEngine implementation -->
|
||||||
<netty.version>4.1.79.Final</netty.version> <!-- Networking -->
|
<netty.version>4.1.89.Final</netty.version> <!-- Networking -->
|
||||||
<yamlbeans.version>1.15</yamlbeans.version> <!-- Config file -->
|
<yamlbeans.version>1.15</yamlbeans.version> <!-- Config file -->
|
||||||
<jcip-annotations.version>1.0</jcip-annotations.version> <!-- Annotations for concurrency documentation -->
|
<jcip-annotations.version>1.0</jcip-annotations.version> <!-- Annotations for concurrency documentation -->
|
||||||
<HikariCP.version>5.0.1</HikariCP.version> <!-- Database connection pool -->
|
<HikariCP.version>5.0.1</HikariCP.version> <!-- Database connection pool -->
|
||||||
<mysql-connector-java.version>8.0.30</mysql-connector-java.version> <!-- MySQL JDBC driver -->
|
<mysql-connector-j.version>8.0.32</mysql-connector-j.version> <!-- MySQL JDBC driver -->
|
||||||
<jdbi-version>3.35.0</jdbi-version> <!-- Convenience wrapper around JDBC -->
|
<jdbi-version>3.37.1</jdbi-version> <!-- Convenience wrapper around JDBC -->
|
||||||
<junit.version>5.9.0</junit.version> <!-- Unit test -->
|
<junit.version>5.9.2</junit.version> <!-- Unit test -->
|
||||||
<mockito.version>4.7.0</mockito.version> <!-- Unit test -->
|
<mockito.version>5.1.1</mockito.version> <!-- Unit test -->
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -56,9 +56,9 @@
|
|||||||
<version>${HikariCP.version}</version>
|
<version>${HikariCP.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
<version>${mysql-connector-java.version}</version>
|
<version>${mysql-connector-j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jdbi</groupId>
|
<groupId>org.jdbi</groupId>
|
||||||
@@ -204,4 +204,4 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -285,6 +285,12 @@ public class DueyProcessor {
|
|||||||
if (c.tryacquireClient()) {
|
if (c.tryacquireClient()) {
|
||||||
try {
|
try {
|
||||||
int fee = Trade.getFee(sendMesos);
|
int fee = Trade.getFee(sendMesos);
|
||||||
|
if (sendMessage != null && sendMessage.length() > 100) {
|
||||||
|
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with Quick Delivery on duey.");
|
||||||
|
log.warn("Chr {} tried to use duey with too long of a text", c.getPlayer().getName());
|
||||||
|
c.disconnect(true, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!quick) {
|
if (!quick) {
|
||||||
fee += 5000;
|
fee += 5000;
|
||||||
} else if (!c.getPlayer().haveItem(ItemId.QUICK_DELIVERY_TICKET)) {
|
} else if (!c.getPlayer().haveItem(ItemId.QUICK_DELIVERY_TICKET)) {
|
||||||
|
|||||||
@@ -71,8 +71,9 @@ public class ByteBufOutPacket implements OutPacket {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeString(String value) {
|
public void writeString(String value) {
|
||||||
writeShort((short) value.length());
|
byte[] bytes = value.getBytes(CharsetConstants.CHARSET);
|
||||||
writeBytes(value.getBytes(CharsetConstants.CHARSET));
|
writeShort(bytes.length);
|
||||||
|
writeBytes(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -58,126 +58,137 @@ public final class ChangeMapHandler extends AbstractPacketHandler {
|
|||||||
if (chr.getTrade() != null) {
|
if (chr.getTrade() != null) {
|
||||||
Trade.cancelTrade(chr, Trade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP);
|
Trade.cancelTrade(chr, Trade.TradeResult.UNSUCCESSFUL_ANOTHER_MAP);
|
||||||
}
|
}
|
||||||
if (p.available() == 0) { //Cash Shop :)
|
|
||||||
if (!chr.getCashShop().isOpened()) {
|
boolean enteringMapFromCashShop = p.available() == 0;
|
||||||
c.disconnect(false, false);
|
if (enteringMapFromCashShop) {
|
||||||
return;
|
enterFromCashShop(c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chr.getCashShop().isOpened()) {
|
||||||
|
c.disconnect(false, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
p.readByte(); // 1 = from dying 0 = regular portals
|
||||||
|
int targetMapId = p.readInt();
|
||||||
|
String portalName = p.readString();
|
||||||
|
Portal portal = chr.getMap().getPortal(portalName);
|
||||||
|
p.readByte();
|
||||||
|
boolean wheel = p.readByte() > 0;
|
||||||
|
|
||||||
|
boolean chasing = p.readByte() == 1 && chr.isGM() && p.available() == 2 * Integer.BYTES;
|
||||||
|
if (chasing) {
|
||||||
|
chr.setChasing(true);
|
||||||
|
chr.setPosition(new Point(p.readInt(), p.readInt()));
|
||||||
}
|
}
|
||||||
String[] socket = c.getChannelServer().getIP().split(":");
|
|
||||||
chr.getCashShop().open(false);
|
|
||||||
|
|
||||||
chr.setSessionTransitionState();
|
if (targetMapId != -1) {
|
||||||
try {
|
if (!chr.isAlive()) {
|
||||||
c.sendPacket(PacketCreator.getChannelChange(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1])));
|
MapleMap map = chr.getMap();
|
||||||
} catch (UnknownHostException ex) {
|
if (wheel && chr.haveItemWithId(ItemId.WHEEL_OF_FORTUNE, false)) {
|
||||||
ex.printStackTrace();
|
// thanks lucasziron (lziron) for showing revivePlayer() triggering by Wheel
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (chr.getCashShop().isOpened()) {
|
|
||||||
c.disconnect(false, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
p.readByte(); // 1 = from dying 0 = regular portals
|
|
||||||
int targetid = p.readInt();
|
|
||||||
String startwp = p.readString();
|
|
||||||
Portal portal = chr.getMap().getPortal(startwp);
|
|
||||||
p.readByte();
|
|
||||||
boolean wheel = p.readByte() > 0;
|
|
||||||
|
|
||||||
boolean chasing = p.readByte() == 1 && chr.isGM();
|
InventoryManipulator.removeById(c, InventoryType.CASH, ItemId.WHEEL_OF_FORTUNE, 1, true, false);
|
||||||
if (chasing) {
|
chr.sendPacket(PacketCreator.showWheelsLeft(chr.getItemQuantity(ItemId.WHEEL_OF_FORTUNE, false)));
|
||||||
chr.setChasing(true);
|
|
||||||
chr.setPosition(new Point(p.readInt(), p.readInt()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetid != -1) {
|
chr.updateHp(50);
|
||||||
if (!chr.isAlive()) {
|
chr.changeMap(map, map.findClosestPlayerSpawnpoint(chr.getPosition()));
|
||||||
MapleMap map = chr.getMap();
|
} else {
|
||||||
if (wheel && chr.haveItemWithId(ItemId.WHEEL_OF_FORTUNE, false)) {
|
boolean executeStandardPath = true;
|
||||||
// thanks lucasziron (lziron) for showing revivePlayer() triggering by Wheel
|
if (chr.getEventInstance() != null) {
|
||||||
|
executeStandardPath = chr.getEventInstance().revivePlayer(chr);
|
||||||
InventoryManipulator.removeById(c, InventoryType.CASH, ItemId.WHEEL_OF_FORTUNE, 1, true, false);
|
}
|
||||||
chr.sendPacket(PacketCreator.showWheelsLeft(chr.getItemQuantity(ItemId.WHEEL_OF_FORTUNE, false)));
|
if (executeStandardPath) {
|
||||||
|
chr.respawn(map.getReturnMapId());
|
||||||
chr.updateHp(50);
|
}
|
||||||
chr.changeMap(map, map.findClosestPlayerSpawnpoint(chr.getPosition()));
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean executeStandardPath = true;
|
if (chr.isGM()) {
|
||||||
if (chr.getEventInstance() != null) {
|
MapleMap to = chr.getWarpMap(targetMapId);
|
||||||
executeStandardPath = chr.getEventInstance().revivePlayer(chr);
|
chr.changeMap(to, to.getPortal(0));
|
||||||
|
} else {
|
||||||
|
final int divi = chr.getMapId() / 100;
|
||||||
|
boolean warp = false;
|
||||||
|
if (divi == 0) {
|
||||||
|
if (targetMapId == 10000) {
|
||||||
|
warp = true;
|
||||||
}
|
}
|
||||||
if (executeStandardPath) {
|
} else if (divi == 20100) {
|
||||||
chr.respawn(map.getReturnMapId());
|
if (targetMapId == MapId.LITH_HARBOUR) {
|
||||||
|
c.sendPacket(PacketCreator.lockUI(false));
|
||||||
|
c.sendPacket(PacketCreator.disableUI(false));
|
||||||
|
warp = true;
|
||||||
|
}
|
||||||
|
} else if (divi == 9130401) { // Only allow warp if player is already in Intro map, or else = hack
|
||||||
|
if (targetMapId == MapId.EREVE || targetMapId / 100 == 9130401) { // Cygnus introduction
|
||||||
|
warp = true;
|
||||||
|
}
|
||||||
|
} else if (divi == 9140900) { // Aran Introduction
|
||||||
|
if (targetMapId == MapId.ARAN_TUTO_2 || targetMapId == MapId.ARAN_TUTO_3 || targetMapId == MapId.ARAN_TUTO_4 || targetMapId == MapId.ARAN_INTRO) {
|
||||||
|
warp = true;
|
||||||
|
}
|
||||||
|
} else if (divi / 10 == 1020) { // Adventurer movie clip Intro
|
||||||
|
if (targetMapId == 1020000) {
|
||||||
|
warp = true;
|
||||||
|
}
|
||||||
|
} else if (divi / 10 >= 980040 && divi / 10 <= 980045) {
|
||||||
|
if (targetMapId == MapId.WITCH_TOWER_ENTRANCE) {
|
||||||
|
warp = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
if (warp) {
|
||||||
if (chr.isGM()) {
|
final MapleMap to = chr.getWarpMap(targetMapId);
|
||||||
MapleMap to = chr.getWarpMap(targetid);
|
|
||||||
chr.changeMap(to, to.getPortal(0));
|
chr.changeMap(to, to.getPortal(0));
|
||||||
} else {
|
|
||||||
final int divi = chr.getMapId() / 100;
|
|
||||||
boolean warp = false;
|
|
||||||
if (divi == 0) {
|
|
||||||
if (targetid == 10000) {
|
|
||||||
warp = true;
|
|
||||||
}
|
|
||||||
} else if (divi == 20100) {
|
|
||||||
if (targetid == MapId.LITH_HARBOUR) {
|
|
||||||
c.sendPacket(PacketCreator.lockUI(false));
|
|
||||||
c.sendPacket(PacketCreator.disableUI(false));
|
|
||||||
warp = true;
|
|
||||||
}
|
|
||||||
} else if (divi == 9130401) { // Only allow warp if player is already in Intro map, or else = hack
|
|
||||||
if (targetid == MapId.EREVE || targetid / 100 == 9130401) { // Cygnus introduction
|
|
||||||
warp = true;
|
|
||||||
}
|
|
||||||
} else if (divi == 9140900) { // Aran Introduction
|
|
||||||
if (targetid == MapId.ARAN_TUTO_2 || targetid == MapId.ARAN_TUTO_3 || targetid == MapId.ARAN_TUTO_4 || targetid == MapId.ARAN_INTRO) {
|
|
||||||
warp = true;
|
|
||||||
}
|
|
||||||
} else if (divi / 10 == 1020) { // Adventurer movie clip Intro
|
|
||||||
if (targetid == 1020000) {
|
|
||||||
warp = true;
|
|
||||||
}
|
|
||||||
} else if (divi / 10 >= 980040 && divi / 10 <= 980045) {
|
|
||||||
if (targetid == MapId.WITCH_TOWER_ENTRANCE) {
|
|
||||||
warp = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (warp) {
|
|
||||||
final MapleMap to = chr.getWarpMap(targetid);
|
|
||||||
chr.changeMap(to, to.getPortal(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (portal != null && !portal.getPortalStatus()) {
|
if (portal != null && !portal.getPortalStatus()) {
|
||||||
c.sendPacket(PacketCreator.blockedMessage(1));
|
c.sendPacket(PacketCreator.blockedMessage(1));
|
||||||
|
c.sendPacket(PacketCreator.enableActions());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chr.getMapId() == MapId.FITNESS_EVENT_LAST) {
|
||||||
|
chr.getFitness().resetTimes();
|
||||||
|
} else if (chr.getMapId() == MapId.OLA_EVENT_LAST_1 || chr.getMapId() == MapId.OLA_EVENT_LAST_2) {
|
||||||
|
chr.getOla().resetTimes();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (portal != null) {
|
||||||
|
if (portal.getPosition().distanceSq(chr.getPosition()) > 400000) {
|
||||||
c.sendPacket(PacketCreator.enableActions());
|
c.sendPacket(PacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chr.getMapId() == MapId.FITNESS_EVENT_LAST) {
|
portal.enterPortal(c);
|
||||||
chr.getFitness().resetTimes();
|
} else {
|
||||||
} else if (chr.getMapId() == MapId.OLA_EVENT_LAST_1 || chr.getMapId() == MapId.OLA_EVENT_LAST_2) {
|
c.sendPacket(PacketCreator.enableActions());
|
||||||
chr.getOla().resetTimes();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (portal != null) {
|
|
||||||
if (portal.getPosition().distanceSq(chr.getPosition()) > 400000) {
|
|
||||||
c.sendPacket(PacketCreator.enableActions());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
portal.enterPortal(c);
|
|
||||||
} else {
|
|
||||||
c.sendPacket(PacketCreator.enableActions());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enterFromCashShop(Client c) {
|
||||||
|
final Character chr = c.getPlayer();
|
||||||
|
|
||||||
|
if (!chr.getCashShop().isOpened()) {
|
||||||
|
c.disconnect(false, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] socket = c.getChannelServer().getIP().split(":");
|
||||||
|
chr.getCashShop().open(false);
|
||||||
|
|
||||||
|
chr.setSessionTransitionState();
|
||||||
|
try {
|
||||||
|
c.sendPacket(PacketCreator.getChannelChange(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1])));
|
||||||
|
} catch (UnknownHostException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
|||||||
if (!item.isUntradeable()) {
|
if (!item.isUntradeable()) {
|
||||||
if (itemid == item.getItemId() && quantity <= item.getQuantity()) {
|
if (itemid == item.getItemId() && quantity <= item.getQuantity()) {
|
||||||
newItem = item.copy();
|
newItem = item.copy();
|
||||||
|
newItem.setQuantity(quantity);
|
||||||
marriage.addGiftItem(groomWishlist, newItem);
|
marriage.addGiftItem(groomWishlist, newItem);
|
||||||
InventoryManipulator.removeFromSlot(c, type, slot, quantity, false, false);
|
InventoryManipulator.removeFromSlot(c, type, slot, quantity, false, false);
|
||||||
|
|
||||||
@@ -161,4 +161,4 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user