From 83e436bbd2e39314c308532a0ac02a51d2b3308b Mon Sep 17 00:00:00 2001 From: pleb Date: Thu, 27 Jul 2023 09:03:39 -0500 Subject: [PATCH 1/7] Changes an incorrect Orange Potion ID to the correct one Thorr in Mushroom Kingdom sold an untradable "Orange Potion for Beginners" instead of a "Orange Potion". This fixes that. --- database/sql/3-db_shopupdate.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/sql/3-db_shopupdate.sql b/database/sql/3-db_shopupdate.sql index 57f37dda51..f11b84e1cd 100644 --- a/database/sql/3-db_shopupdate.sql +++ b/database/sql/3-db_shopupdate.sql @@ -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 From 396447519d1cd3000223e91a6e3ba8337f4cf272 Mon Sep 17 00:00:00 2001 From: noampfeifel Date: Sun, 13 Aug 2023 17:33:25 +0300 Subject: [PATCH 2/7] fixing compose port and config string for db --- config.yaml | 4 ++-- docker-compose.yml | 7 ++++++- mysql.cnf | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 mysql.cnf diff --git a/config.yaml b/config.yaml index 3fae109d3c..3964764163 100644 --- a/config.yaml +++ b/config.yaml @@ -159,11 +159,11 @@ worlds: server: #Database Configuration - DB_URL_FORMAT: "jdbc:mysql://%s:3306/cosmic" + DB_URL_FORMAT: "jdbc:mysql://%s:3307/cosmic" DB_HOST: "localhost" DB_USER: "cosmic_server" DB_PASS: "snailshell" - INIT_CONNECTION_POOL_TIMEOUT: 90 # Seconds + INIT_CONNECTION_POOL_TIMEOUT: 50 # Seconds #Login Configuration WORLDS: 1 #Initial number of worlds on the server. diff --git a/docker-compose.yml b/docker-compose.yml index e6861b0004..e1ba3d3ab8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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, this one is optional. db: image: mysql:8.0.23 @@ -27,6 +27,11 @@ services: MYSQL_DATABASE: "cosmic" MYSQL_USER: "cosmic_server" MYSQL_PASSWORD: "snailshell" + cap_add: + - SYS_NICE + ports: + - "3307:3307" volumes: - ./database/docker-db-data:/var/lib/mysql - ./database/sql:/docker-entrypoint-initdb.d + - ./mysql.cnf:/etc/mysql/conf.d/mysql.cnf ## conf file for mysql internal container, relevant only if mysql host is not 'db' as mentioned above diff --git a/mysql.cnf b/mysql.cnf new file mode 100644 index 0000000000..00b720d62e --- /dev/null +++ b/mysql.cnf @@ -0,0 +1,3 @@ +[mysqld] +port=3307 + From 26dbe36a15c2f26e050e4fe470ee32b6d29448b8 Mon Sep 17 00:00:00 2001 From: noampfeifel Date: Tue, 15 Aug 2023 19:06:05 +0300 Subject: [PATCH 3/7] fixed ports to simple setup, added notes about DB_HOST --- config.yaml | 4 ++-- docker-compose.yml | 5 ++--- mysql.cnf | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 mysql.cnf diff --git a/config.yaml b/config.yaml index 3964764163..c7366a64da 100644 --- a/config.yaml +++ b/config.yaml @@ -159,8 +159,8 @@ worlds: server: #Database Configuration - DB_URL_FORMAT: "jdbc:mysql://%s:3307/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: 50 # Seconds diff --git a/docker-compose.yml b/docker-compose.yml index e1ba3d3ab8..27cc604767 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,7 @@ services: - ./scripts:/opt/server/scripts - ./wz:/opt/server/wz environment: - DB_HOST: "db" ## Remember if this is present it will OVERRIDE the host in the config.yaml, this one is optional. + 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 @@ -30,8 +30,7 @@ services: cap_add: - SYS_NICE ports: - - "3307:3307" + - "3307:3306" volumes: - ./database/docker-db-data:/var/lib/mysql - ./database/sql:/docker-entrypoint-initdb.d - - ./mysql.cnf:/etc/mysql/conf.d/mysql.cnf ## conf file for mysql internal container, relevant only if mysql host is not 'db' as mentioned above diff --git a/mysql.cnf b/mysql.cnf deleted file mode 100644 index 00b720d62e..0000000000 --- a/mysql.cnf +++ /dev/null @@ -1,3 +0,0 @@ -[mysqld] -port=3307 - From b8a360917e47467acdfcded6b12af2d2a2e998af Mon Sep 17 00:00:00 2001 From: noampfeifel Date: Tue, 15 Aug 2023 19:07:34 +0300 Subject: [PATCH 4/7] final fixes --- config.yaml | 2 +- docker-compose.yml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index c7366a64da..c34d9848f0 100644 --- a/config.yaml +++ b/config.yaml @@ -163,7 +163,7 @@ server: DB_HOST: "localhost" DB_USER: "cosmic_server" DB_PASS: "snailshell" - INIT_CONNECTION_POOL_TIMEOUT: 50 # Seconds + INIT_CONNECTION_POOL_TIMEOUT: 90 # Seconds #Login Configuration WORLDS: 1 #Initial number of worlds on the server. diff --git a/docker-compose.yml b/docker-compose.yml index 27cc604767..90bbb04fc0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,8 +27,6 @@ services: MYSQL_DATABASE: "cosmic" MYSQL_USER: "cosmic_server" MYSQL_PASSWORD: "snailshell" - cap_add: - - SYS_NICE ports: - "3307:3306" volumes: From 7adb25888f8b43b4be53efb5db2646819315becb Mon Sep 17 00:00:00 2001 From: Arnah Date: Wed, 16 Aug 2023 00:53:40 -0600 Subject: [PATCH 5/7] Stop masking ip address when connecting locally --- src/main/java/client/Client.java | 6 +----- src/main/java/net/netty/ServerChannelInitializer.java | 6 +----- .../net/server/coordinator/session/IpAddresses.java | 10 ---------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/main/java/client/Client.java b/src/main/java/client/Client.java index b929ff035a..edeea33ba8 100644 --- a/src/main/java/client/Client.java +++ b/src/main/java/client/Client.java @@ -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); } diff --git a/src/main/java/net/netty/ServerChannelInitializer.java b/src/main/java/net/netty/ServerChannelInitializer.java index 874e84d1a6..4ecc65a592 100644 --- a/src/main/java/net/netty/ServerChannelInitializer.java +++ b/src/main/java/net/netty/ServerChannelInitializer.java @@ -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 Date: Wed, 16 Aug 2023 16:19:16 -0600 Subject: [PATCH 6/7] Fix cashshop exiting not using proper ip --- .../java/net/server/channel/handlers/ChangeMapHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/server/channel/handlers/ChangeMapHandler.java b/src/main/java/net/server/channel/handlers/ChangeMapHandler.java index 9a8648735a..29778a9fb3 100644 --- a/src/main/java/net/server/channel/handlers/ChangeMapHandler.java +++ b/src/main/java/net/server/channel/handlers/ChangeMapHandler.java @@ -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(); From 8cd5211b8b2bc086f1a1d6c3793bfdeff89e8b4f Mon Sep 17 00:00:00 2001 From: Zihao Yu Date: Sun, 20 Aug 2023 22:55:43 +0800 Subject: [PATCH 7/7] fix the dropper of Cat's Eye * it was previously dropped from Scorpion, which is wrong --- database/sql/2-db_drops.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/sql/2-db_drops.sql b/database/sql/2-db_drops.sql index 91e6ea2b1b..07fd684c45 100644 --- a/database/sql/2-db_drops.sql +++ b/database/sql/2-db_drops.sql @@ -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),