Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
754e5e61f2 | ||
|
|
afba85827a | ||
|
|
8cd5211b8b | ||
|
|
2d7525f2b4 | ||
|
|
7adb25888f | ||
|
|
b46912afcb | ||
|
|
ed3d4823b2 | ||
|
|
b8a360917e | ||
|
|
26dbe36a15 | ||
|
|
396447519d | ||
|
|
83e436bbd2 | ||
|
|
d307eff71f | ||
|
|
b935725096 | ||
|
|
12248acd7b | ||
|
|
07eb0f5e8e | ||
|
|
cfb5fc25c3 | ||
|
|
3816e1c5bd |
@@ -159,8 +159,8 @@ worlds:
|
||||
|
||||
server:
|
||||
#Database Configuration
|
||||
DB_URL_FORMAT: "jdbc:mysql://%s:3306/cosmic"
|
||||
DB_HOST: "localhost"
|
||||
DB_URL_FORMAT: "jdbc:mysql://%s:3306/cosmic" # If the docker ENV for DB_HOST is anything but "db", this string format should be changed from 3306 to 3307 (or whichever port it was changed to in docker)
|
||||
DB_HOST: "localhost"
|
||||
DB_USER: "cosmic_server"
|
||||
DB_PASS: "snailshell"
|
||||
INIT_CONNECTION_POOL_TIMEOUT: 90 # Seconds
|
||||
|
||||
@@ -19993,7 +19993,7 @@ USE `cosmic`;
|
||||
(8220015, 1452015, 1, 1, 0, 22000),
|
||||
(8220015, 1472031, 1, 1, 0, 22000),
|
||||
(8220015, 1482010, 1, 1, 0, 22000),
|
||||
(2110301, 4031568, 1, 1, 3911, 80000),
|
||||
(2100108, 4031568, 1, 1, 3911, 80000),
|
||||
(9300150, 4031774, 1, 1, 3361, 100000),
|
||||
(9300150, 4031796, 1, 1, 3362, 100000),
|
||||
(9300105, 4001118, 1, 1, 3814, 200000),
|
||||
|
||||
@@ -335,7 +335,7 @@ INSERT INTO `shopitems` ( `shopid`, `itemid`, `price`, `pitch`, `position`) VALU
|
||||
(1301000, 2000006, 620, 0, 156),
|
||||
(1301000, 2000003, 200, 0, 160),
|
||||
(1301000, 2000002, 320, 0, 164),
|
||||
(1301000, 2000015, 160, 0, 168),
|
||||
(1301000, 2000001, 160, 0, 168),
|
||||
(1301000, 2000000, 50, 0, 172);
|
||||
|
||||
# adding missing pirate items at Singapore npc's
|
||||
|
||||
@@ -18,7 +18,7 @@ services:
|
||||
- ./scripts:/opt/server/scripts
|
||||
- ./wz:/opt/server/wz
|
||||
environment:
|
||||
DB_HOST: "db"
|
||||
DB_HOST: "db" ## Remember if this is present it will OVERRIDE the host in the config.yaml, if you put here anything other than db, you'll need to change the config.yaml jdbc string to port 3307, and not port 3306
|
||||
|
||||
db:
|
||||
image: mysql:8.0.23
|
||||
@@ -27,6 +27,8 @@ services:
|
||||
MYSQL_DATABASE: "cosmic"
|
||||
MYSQL_USER: "cosmic_server"
|
||||
MYSQL_PASSWORD: "snailshell"
|
||||
ports:
|
||||
- "3307:3306"
|
||||
volumes:
|
||||
- ./database/docker-db-data:/var/lib/mysql
|
||||
- ./database/sql:/docker-entrypoint-initdb.d
|
||||
|
||||
@@ -39,7 +39,6 @@ import net.server.Server;
|
||||
import net.server.channel.Channel;
|
||||
import net.server.coordinator.login.LoginBypassCoordinator;
|
||||
import net.server.coordinator.session.Hwid;
|
||||
import net.server.coordinator.session.IpAddresses;
|
||||
import net.server.coordinator.session.SessionCoordinator;
|
||||
import net.server.coordinator.session.SessionCoordinator.AntiMulticlientResult;
|
||||
import net.server.guild.Guild;
|
||||
@@ -176,10 +175,7 @@ public class Client extends ChannelInboundHandlerAdapter {
|
||||
private static String getRemoteAddress(io.netty.channel.Channel channel) {
|
||||
String remoteAddress = "null";
|
||||
try {
|
||||
String hostAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
|
||||
if (hostAddress != null) {
|
||||
remoteAddress = IpAddresses.evaluateRemoteAddress(hostAddress); // thanks dyz for noticing Local/LAN/WAN connections not interacting properly
|
||||
}
|
||||
remoteAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
|
||||
} catch (NullPointerException npe) {
|
||||
log.warn("Unable to get remote address for client", npe);
|
||||
}
|
||||
|
||||
@@ -92,14 +92,15 @@ public class DueyProcessor {
|
||||
}
|
||||
|
||||
private static Pair<Integer, Integer> getAccountCharacterIdFromCNAME(String name) {
|
||||
Pair<Integer, Integer> ids = null;
|
||||
Pair<Integer, Integer> ids = new Pair<>(-1, -1);
|
||||
try (Connection con = DatabaseConnection.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT id,accountid FROM characters WHERE name = ?")) {
|
||||
ps.setString(1, name);
|
||||
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
ids = new Pair<>(rs.getInt("accountid"), rs.getInt("id"));
|
||||
ids.left = rs.getInt("accountid");
|
||||
ids.right = rs.getInt("id");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@@ -315,30 +316,25 @@ public class DueyProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
Pair<Integer, Integer> accIdCid;
|
||||
if (c.getPlayer().getMeso() >= finalcost) {
|
||||
accIdCid = getAccountCharacterIdFromCNAME(recipient);
|
||||
int recipientAccId = accIdCid.getLeft();
|
||||
if (recipientAccId != -1) {
|
||||
if (recipientAccId == c.getAccID()) {
|
||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SAMEACC_ERROR.getCode()));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if(c.getPlayer().getMeso() < finalcost) {
|
||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NOT_ENOUGH_MESOS.getCode()));
|
||||
return;
|
||||
}
|
||||
|
||||
int recipientCid = accIdCid.getRight();
|
||||
if (recipientCid == -1) {
|
||||
var accIdCid = getAccountCharacterIdFromCNAME(recipient);
|
||||
var recipientAccId = accIdCid.getLeft();
|
||||
var recipientCid = accIdCid.getRight();
|
||||
|
||||
if (recipientAccId == -1 || recipientCid == -1) {
|
||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (recipientAccId == c.getAccID()) {
|
||||
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SAMEACC_ERROR.getCode()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (quick) {
|
||||
InventoryManipulator.removeById(c, InventoryType.CASH, ItemId.QUICK_DELIVERY_TICKET, (short) 1, false, false);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import net.encryption.InitializationVector;
|
||||
import net.encryption.PacketCodec;
|
||||
import net.packet.logging.InPacketLogger;
|
||||
import net.packet.logging.OutPacketLogger;
|
||||
import net.server.coordinator.session.IpAddresses;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import tools.PacketCreator;
|
||||
@@ -35,10 +34,7 @@ public abstract class ServerChannelInitializer extends ChannelInitializer<Socket
|
||||
String getRemoteAddress(Channel channel) {
|
||||
String remoteAddress = "null";
|
||||
try {
|
||||
String hostAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
|
||||
if (hostAddress != null) {
|
||||
remoteAddress = IpAddresses.evaluateRemoteAddress(hostAddress); // thanks dyz for noticing Local/LAN/WAN connections not interacting properly
|
||||
}
|
||||
remoteAddress = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
|
||||
} catch (NullPointerException npe) {
|
||||
log.warn("Unable to get remote address from netty Channel: {}", channel, npe);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import constants.id.ItemId;
|
||||
import constants.id.MapId;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import net.server.Server;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import server.Trade;
|
||||
@@ -181,7 +182,11 @@ public final class ChangeMapHandler extends AbstractPacketHandler {
|
||||
c.disconnect(false, false);
|
||||
return;
|
||||
}
|
||||
String[] socket = c.getChannelServer().getIP().split(":");
|
||||
String[] socket = Server.getInstance().getInetSocket(c, c.getWorld(), c.getChannel());
|
||||
if (socket == null) {
|
||||
c.enableCSActions();
|
||||
return;
|
||||
}
|
||||
chr.getCashShop().open(false);
|
||||
|
||||
chr.setSessionTransitionState();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package net.server.coordinator.session;
|
||||
|
||||
import config.YamlConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -16,14 +14,6 @@ public class IpAddresses {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static String evaluateRemoteAddress(String inetAddress) {
|
||||
if (isLocalAddress(inetAddress) || isLanAddress(inetAddress)) {
|
||||
return YamlConfig.config.server.HOST;
|
||||
} else {
|
||||
return inetAddress;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLocalAddress(String inetAddress) {
|
||||
return inetAddress.startsWith("127.");
|
||||
}
|
||||
|
||||
@@ -133,6 +133,23 @@ public class AbstractPlayerInteraction {
|
||||
warpParty(id, portalId, mapid, mapid);
|
||||
}
|
||||
|
||||
public void warpParty(int map, String portalName) {
|
||||
|
||||
int mapid = getMapId();
|
||||
var warpMap = c.getChannelServer().getMapFactory().getMap(map);
|
||||
|
||||
var portal = warpMap.getPortal(portalName);
|
||||
|
||||
if (portal == null) {
|
||||
portal = warpMap.getPortal(0);
|
||||
}
|
||||
|
||||
var portalId = portal.getId();
|
||||
|
||||
warpParty(map, portalId, mapid, mapid);
|
||||
|
||||
}
|
||||
|
||||
public void warpParty(int id, int fromMinId, int fromMaxId) {
|
||||
warpParty(id, 0, fromMinId, fromMaxId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user