Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 892174ffe1 | |||
| 536ccc2143 | |||
| 2ced2f75af | |||
| 63248ef577 | |||
| 72412a98dd | |||
| a664c8790e | |||
| 9663d87088 | |||
| 4e642b0f42 | |||
| f9fafe90d5 | |||
| 3181c465cb | |||
| 9b8be777f1 | |||
| 343bfd1003 | |||
| c4446736a6 | |||
| d482265994 | |||
| 4621b657e4 | |||
| d7159758a1 | |||
| d3dd190a69 | |||
| 7236ed918a | |||
| 7e9df52c11 | |||
| 9e531b0b8f | |||
| 9615f85f0d | |||
| b4720a2db5 | |||
| 25e9f28746 | |||
| 8dc51fa2f8 | |||
| 21989da97c | |||
| 44f38b9ac3 | |||
| 34efa3dd65 | |||
| f94648c5dd | |||
| c426a84db0 | |||
| 1b5738f9b3 | |||
| d502a889a6 | |||
| 1ee8851fe0 | |||
| 72dea668f9 | |||
| 7fe5f8b5ac | |||
| a54612a947 | |||
| 92293ebed1 | |||
| f5200abf61 | |||
| 60b7cab0fe | |||
| 7a3f824816 | |||
| aca0ff52d6 | |||
| 7203d66ace | |||
| 3e50782979 | |||
| fc15e9310d | |||
| 6aff5307c7 | |||
| d45b55d97b | |||
| 17ddd7d1ff | |||
| 25b508a101 | |||
| 2166a0a440 | |||
| 19d43cbcb0 | |||
| e473aa5f08 | |||
| 016919675a | |||
| bb433f6f4a | |||
| a8ccf0c67c | |||
| 45e9311822 | |||
| c81c910019 | |||
| b6ac5735c6 | |||
| 9aa89a544c | |||
| 19cbbd7176 | |||
| 40443a82a7 | |||
| 24a58db3a9 | |||
| bdb901afce | |||
| 7e54426c95 | |||
| 7236c9369a | |||
| 12ee06e128 | |||
| 6e22ff53d7 | |||
| 77c32f9081 | |||
| 2e36c01537 | |||
| 4229999848 | |||
| a2c7fd2404 | |||
| 67af6f8c18 | |||
| e128f60519 | |||
| d57e5df356 | |||
| f002de704b | |||
| c63c5e6896 | |||
| d7c7491746 | |||
| 8cf1f1e60b | |||
| 6cc6713650 | |||
| bf1182dd2c | |||
| 51e0098aa0 | |||
| 66d5752ca9 | |||
| 136c8c4756 |
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
@@ -70,7 +70,7 @@ public class Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateAccountStatus(String discordAccountID, mbEnums.AccountStatus accountStatus) {
|
public boolean updateAccountStatus(String discordAccountID, Enum.AccountStatus accountStatus) {
|
||||||
|
|
||||||
try (Connection connection = DriverManager.getConnection(sqlURI, ConfigManager.MB_DATABASE_USER.getValue(),
|
try (Connection connection = DriverManager.getConnection(sqlURI, ConfigManager.MB_DATABASE_USER.getValue(),
|
||||||
ConfigManager.MB_DATABASE_PASS.getValue());
|
ConfigManager.MB_DATABASE_PASS.getValue());
|
||||||
@@ -131,7 +131,7 @@ public class Database {
|
|||||||
discordAccount = new DiscordAccount();
|
discordAccount = new DiscordAccount();
|
||||||
discordAccount.discordAccount = rs.getString("discordAccount");
|
discordAccount.discordAccount = rs.getString("discordAccount");
|
||||||
discordAccount.gameAccountName = rs.getString("acct_uname");
|
discordAccount.gameAccountName = rs.getString("acct_uname");
|
||||||
discordAccount.status = mbEnums.AccountStatus.valueOf(rs.getString("status"));
|
discordAccount.status = Enum.AccountStatus.valueOf(rs.getString("status"));
|
||||||
discordAccount.isDiscordAdmin = rs.getByte("discordAdmin"); // Registration date cannot be null
|
discordAccount.isDiscordAdmin = rs.getByte("discordAdmin"); // Registration date cannot be null
|
||||||
|
|
||||||
Timestamp registrationDate = rs.getTimestamp("registrationDate");
|
Timestamp registrationDate = rs.getTimestamp("registrationDate");
|
||||||
@@ -328,7 +328,7 @@ public class Database {
|
|||||||
discordAccount = new DiscordAccount();
|
discordAccount = new DiscordAccount();
|
||||||
discordAccount.discordAccount = rs.getString("discordAccount");
|
discordAccount.discordAccount = rs.getString("discordAccount");
|
||||||
discordAccount.gameAccountName = rs.getString("acct_uname");
|
discordAccount.gameAccountName = rs.getString("acct_uname");
|
||||||
discordAccount.status = mbEnums.AccountStatus.valueOf(rs.getString("status"));
|
discordAccount.status = Enum.AccountStatus.valueOf(rs.getString("status"));
|
||||||
|
|
||||||
// Registration date cannot be null
|
// Registration date cannot be null
|
||||||
|
|
||||||
|
|||||||
@@ -3,19 +3,19 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|
||||||
import engine.mbEnums;
|
import engine.Enum;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
public class DiscordAccount {
|
public class DiscordAccount {
|
||||||
public String discordAccount;
|
public String discordAccount;
|
||||||
public String gameAccountName;
|
public String gameAccountName;
|
||||||
public mbEnums.AccountStatus status;
|
public Enum.AccountStatus status;
|
||||||
public LocalDateTime registrationDate;
|
public LocalDateTime registrationDate;
|
||||||
public LocalDateTime lastUpdateRequest;
|
public LocalDateTime lastUpdateRequest;
|
||||||
public byte isDiscordAdmin;
|
public byte isDiscordAdmin;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord;
|
package discord;
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
import discord.Database;
|
import discord.Database;
|
||||||
import discord.DiscordAccount;
|
import discord.DiscordAccount;
|
||||||
import discord.MagicBot;
|
import discord.MagicBot;
|
||||||
import engine.mbEnums;
|
import engine.Enum;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -21,7 +21,7 @@ public class AccountInfoRequest {
|
|||||||
public static void handleRequest(MessageReceivedEvent event) {
|
public static void handleRequest(MessageReceivedEvent event) {
|
||||||
|
|
||||||
String discordAccountID = event.getAuthor().getId();
|
String discordAccountID = event.getAuthor().getId();
|
||||||
mbEnums.AccountStatus accountStatus;
|
Enum.AccountStatus accountStatus;
|
||||||
|
|
||||||
if (Database.online == false) {
|
if (Database.online == false) {
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
import discord.DiscordAccount;
|
import discord.DiscordAccount;
|
||||||
import discord.MagicBot;
|
import discord.MagicBot;
|
||||||
import discord.RobotSpeak;
|
import discord.RobotSpeak;
|
||||||
import engine.mbEnums;
|
import engine.Enum;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -23,7 +23,7 @@ public class BanToggleHandler {
|
|||||||
public static void handleRequest(MessageReceivedEvent event, String[] args) {
|
public static void handleRequest(MessageReceivedEvent event, String[] args) {
|
||||||
|
|
||||||
String discordAccountID;
|
String discordAccountID;
|
||||||
mbEnums.AccountStatus accountStatus;
|
Enum.AccountStatus accountStatus;
|
||||||
|
|
||||||
// Early exit if database unavailable or is not an admin
|
// Early exit if database unavailable or is not an admin
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ public class BanToggleHandler {
|
|||||||
|
|
||||||
// toggle ban status
|
// toggle ban status
|
||||||
|
|
||||||
if (discordAccounts.get(0).status.equals(mbEnums.AccountStatus.BANNED))
|
if (discordAccounts.get(0).status.equals(Enum.AccountStatus.BANNED))
|
||||||
accountStatus = mbEnums.AccountStatus.ACTIVE;
|
accountStatus = Enum.AccountStatus.ACTIVE;
|
||||||
else
|
else
|
||||||
accountStatus = mbEnums.AccountStatus.BANNED;
|
accountStatus = Enum.AccountStatus.BANNED;
|
||||||
|
|
||||||
// We have a valid discord ID at this point. Banstick?
|
// We have a valid discord ID at this point. Banstick?
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ public class BanToggleHandler {
|
|||||||
|
|
||||||
// If we're toggling status to active we're done here.
|
// If we're toggling status to active we're done here.
|
||||||
|
|
||||||
if (accountStatus.equals(mbEnums.AccountStatus.ACTIVE))
|
if (accountStatus.equals(Enum.AccountStatus.ACTIVE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Set users role to noob
|
// Set users role to noob
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
import discord.Database;
|
import discord.Database;
|
||||||
import discord.DiscordAccount;
|
import discord.DiscordAccount;
|
||||||
import discord.MagicBot;
|
import discord.MagicBot;
|
||||||
import engine.mbEnums;
|
import engine.Enum;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ public class PasswordChangeHandler {
|
|||||||
|
|
||||||
// Banned or suspended user's get no love.
|
// Banned or suspended user's get no love.
|
||||||
|
|
||||||
if (discordAccount.status.equals(mbEnums.AccountStatus.BANNED)) {
|
if (discordAccount.status.equals(Enum.AccountStatus.BANNED)) {
|
||||||
MagicBot.sendResponse(event,
|
MagicBot.sendResponse(event,
|
||||||
"Sorry but that is too much work. \n" +
|
"Sorry but that is too much work. \n" +
|
||||||
"Your account detailings cannot for to log into game!");
|
"Your account detailings cannot for to log into game!");
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package discord.handlers;
|
package discord.handlers;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,21 +3,21 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package engine.InterestManagement;
|
package engine.InterestManagement;
|
||||||
|
|
||||||
import engine.gameManager.DispatchManager;
|
import engine.Enum;
|
||||||
|
import engine.Enum.DispatchChannel;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.GroupManager;
|
import engine.gameManager.GroupManager;
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.job.JobScheduler;
|
import engine.job.JobScheduler;
|
||||||
import engine.jobs.RefreshGroupJob;
|
import engine.jobs.RefreshGroupJob;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.DispatchChannel;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.net.AbstractNetMsg;
|
import engine.net.AbstractNetMsg;
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.LoadCharacterMsg;
|
import engine.net.client.msg.LoadCharacterMsg;
|
||||||
import engine.net.client.msg.LoadStructureMsg;
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
@@ -88,7 +88,7 @@ public enum InterestManager implements Runnable {
|
|||||||
if (send) {
|
if (send) {
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ public enum InterestManager implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadedStaticObjects.removeAll(toRemove);
|
loadedStaticObjects.removeAll(toRemove);
|
||||||
@@ -292,7 +292,7 @@ public enum InterestManager implements Runnable {
|
|||||||
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
|
||||||
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
|
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
|
||||||
NPC npc = (NPC) awo;
|
NPC npc = (NPC) awo;
|
||||||
@@ -304,13 +304,13 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (lsm.getStructureList().size() > 0) {
|
if (lsm.getStructureList().size() > 0) {
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lsm);
|
Dispatch dispatch = Dispatch.borrow(player, lsm);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (LoadCharacterMsg lc : lcmList) {
|
for (LoadCharacterMsg lc : lcmList) {
|
||||||
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lc);
|
Dispatch dispatch = Dispatch.borrow(player, lc);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadedStaticObjects.addAll(toLoad);
|
loadedStaticObjects.addAll(toLoad);
|
||||||
@@ -414,7 +414,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (!uom.getObjectList().isEmpty()) {
|
if (!uom.getObjectList().isEmpty()) {
|
||||||
Dispatch dispatch = Dispatch.borrow(player, uom);
|
Dispatch dispatch = Dispatch.borrow(player, uom);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +482,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||||
|
|
||||||
if ((awonpc.agentType.equals(mbEnums.AIAgentType.MOBILE)))
|
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||||
((Mob) awonpc).setCombatTarget(null);
|
((Mob) awonpc).setCombatTarget(null);
|
||||||
|
|
||||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||||
@@ -492,7 +492,7 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
if (lcm != null) {
|
if (lcm != null) {
|
||||||
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
Dispatch dispatch = Dispatch.borrow(player, lcm);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,19 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package engine.InterestManagement;
|
package engine.InterestManagement;
|
||||||
|
|
||||||
import engine.gameManager.DispatchManager;
|
/* This class is the main interface for Magicbane's
|
||||||
|
* Interest management facilities.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.TerritoryChangeMessage;
|
import engine.net.client.msg.TerritoryChangeMessage;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -27,18 +31,11 @@ import static engine.objects.Realm.getRealm;
|
|||||||
|
|
||||||
public enum RealmMap {
|
public enum RealmMap {
|
||||||
|
|
||||||
// MB Dev Notes:
|
|
||||||
// This class loads and caches realm maps used by each
|
|
||||||
// map set for its realm overlay. The RealmMap loaded is
|
|
||||||
// controlled by config entry MB_WORLD_REALMMAP
|
|
||||||
//
|
|
||||||
// Unlike a Heightmap this is a just color lookup; identical to
|
|
||||||
// the old image maps used in 90s web technology.
|
|
||||||
//
|
|
||||||
// Realm Map images are stored on disk in /mb.data/realmmaps/
|
|
||||||
|
|
||||||
REALM_MAP;
|
REALM_MAP;
|
||||||
|
|
||||||
|
// Spatial hashmap. Used for determining which Realm
|
||||||
|
// a player is currently located within.
|
||||||
|
|
||||||
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
|
private static final HashMap<Color, Integer> _rgbToIDMap = new HashMap<>();
|
||||||
public static int[][] _realmImageMap;
|
public static int[][] _realmImageMap;
|
||||||
|
|
||||||
@@ -68,7 +65,7 @@ public enum RealmMap {
|
|||||||
|
|
||||||
public static Realm getRealmForCity(City city) {
|
public static Realm getRealmForCity(City city) {
|
||||||
Realm outRealm = null;
|
Realm outRealm = null;
|
||||||
outRealm = city.realm;
|
outRealm = city.getRealm();
|
||||||
return outRealm;
|
return outRealm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,17 +88,17 @@ public enum RealmMap {
|
|||||||
if (city != null) {
|
if (city != null) {
|
||||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
|
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||||
} else {
|
} else {
|
||||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
|
||||||
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
Dispatch dispatch = Dispatch.borrow(player, tcm);
|
||||||
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package engine.InterestManagement;
|
package engine.InterestManagement;
|
||||||
|
|
||||||
@@ -18,14 +18,6 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
import static java.lang.Math.PI;
|
import static java.lang.Math.PI;
|
||||||
|
|
||||||
|
|
||||||
// MB Dev Notes:
|
|
||||||
// The Terrain class handles lookups into the Heightmap data.
|
|
||||||
// It supports all current maps along with the differences in
|
|
||||||
// their parenting configuration.
|
|
||||||
//
|
|
||||||
// Heightmap images are stored on disk in /mb.data/heightmaps/
|
|
||||||
|
|
||||||
public class Terrain {
|
public class Terrain {
|
||||||
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
public static final HashMap<Integer, short[][]> _heightmap_pixel_cache = new HashMap<>();
|
||||||
public short[][] terrain_pixel_data;
|
public short[][] terrain_pixel_data;
|
||||||
@@ -120,7 +112,7 @@ public class Terrain {
|
|||||||
|
|
||||||
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
public static float getWorldHeight(Zone zone, Vector3fImmutable world_loc) {
|
||||||
|
|
||||||
// Retrieve the next zone up in the tree with a terrain defined.
|
// Retrieve the next zone with a terrain defined.
|
||||||
|
|
||||||
Zone terrainZone = getNextZoneWithTerrain(zone);
|
Zone terrainZone = getNextZoneWithTerrain(zone);
|
||||||
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
Zone parentZone = getNextZoneWithTerrain(zone.parent);
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package engine.InterestManagement;
|
package engine.InterestManagement;
|
||||||
|
|
||||||
import engine.gameManager.DispatchManager;
|
import engine.Enum.GridObjectType;
|
||||||
import engine.math.FastMath;
|
import engine.math.FastMath;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mbEnums.GridObjectType;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.LoadCharacterMsg;
|
import engine.net.client.msg.LoadCharacterMsg;
|
||||||
import engine.net.client.msg.LoadStructureMsg;
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
@@ -201,7 +201,7 @@ public class WorldGrid {
|
|||||||
|
|
||||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||||
uom.addObject(awo);
|
uom.addObject(awo);
|
||||||
DispatchManager.sendToAllInRange(awo, uom);
|
DispatchMessage.sendToAllInRange(awo, uom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadObject(AbstractWorldObject awo) {
|
public static void loadObject(AbstractWorldObject awo) {
|
||||||
@@ -213,15 +213,15 @@ public class WorldGrid {
|
|||||||
case Building:
|
case Building:
|
||||||
lsm = new LoadStructureMsg();
|
lsm = new LoadStructureMsg();
|
||||||
lsm.addObject((Building) awo);
|
lsm.addObject((Building) awo);
|
||||||
DispatchManager.sendToAllInRange(awo, lsm);
|
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||||
break;
|
break;
|
||||||
case NPC:
|
case NPC:
|
||||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||||
DispatchManager.sendToAllInRange(awo, lcm);
|
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||||
DispatchManager.sendToAllInRange(awo, lcm);
|
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// *** Refactor: Log error?
|
// *** Refactor: Log error?
|
||||||
@@ -239,19 +239,19 @@ public class WorldGrid {
|
|||||||
case Building:
|
case Building:
|
||||||
lsm = new LoadStructureMsg();
|
lsm = new LoadStructureMsg();
|
||||||
lsm.addObject((Building) awo);
|
lsm.addObject((Building) awo);
|
||||||
DispatchManager.sendToAllInRange(awo, lsm);
|
DispatchMessage.sendToAllInRange(awo, lsm);
|
||||||
break;
|
break;
|
||||||
case NPC:
|
case NPC:
|
||||||
lcm = new LoadCharacterMsg((NPC) awo, false);
|
lcm = new LoadCharacterMsg((NPC) awo, false);
|
||||||
DispatchManager.sendToAllInRange(awo, lcm);
|
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
lcm = new LoadCharacterMsg((Mob) awo, false);
|
lcm = new LoadCharacterMsg((Mob) awo, false);
|
||||||
DispatchManager.sendToAllInRange(awo, lcm);
|
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
case PlayerCharacter:
|
case PlayerCharacter:
|
||||||
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
|
||||||
DispatchManager.sendToAllInRange(awo, lcm);
|
DispatchMessage.sendToAllInRange(awo, lcm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// *** Refactor: Log error?
|
// *** Refactor: Log error?
|
||||||
@@ -263,7 +263,7 @@ public class WorldGrid {
|
|||||||
ClientConnection origin) {
|
ClientConnection origin) {
|
||||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||||
uom.addObject(awo);
|
uom.addObject(awo);
|
||||||
DispatchManager.sendToAllInRange(awo, uom);
|
DispatchMessage.sendToAllInRange(awo, uom);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.core;
|
package engine.core;
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Bane;
|
import engine.objects.Bane;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
@@ -21,7 +21,7 @@ import java.sql.*;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import static engine.mbEnums.RecordEventType;
|
import static engine.Enum.RecordEventType;
|
||||||
|
|
||||||
public class BaneRecord extends DataRecord {
|
public class BaneRecord extends DataRecord {
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
private DateTime baneDropTime;
|
private DateTime baneDropTime;
|
||||||
|
|
||||||
private BaneRecord(Bane bane) {
|
private BaneRecord(Bane bane) {
|
||||||
this.recordType = mbEnums.DataRecordType.BANE;
|
this.recordType = Enum.DataRecordType.BANE;
|
||||||
this.eventType = RecordEventType.PENDING;
|
this.eventType = RecordEventType.PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ public class BaneRecord extends DataRecord {
|
|||||||
baneRecord = new BaneRecord(bane);
|
baneRecord = new BaneRecord(bane);
|
||||||
baneRecord.eventType = eventType;
|
baneRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
baneRecord.recordType = mbEnums.DataRecordType.BANE;
|
baneRecord.recordType = Enum.DataRecordType.BANE;
|
||||||
baneRecord.eventType = eventType;
|
baneRecord.eventType = eventType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
@@ -33,7 +33,7 @@ public class CharacterRecord extends DataRecord {
|
|||||||
private PlayerCharacter player;
|
private PlayerCharacter player;
|
||||||
|
|
||||||
private CharacterRecord(PlayerCharacter player) {
|
private CharacterRecord(PlayerCharacter player) {
|
||||||
this.recordType = mbEnums.DataRecordType.CHARACTER;
|
this.recordType = Enum.DataRecordType.CHARACTER;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public class CharacterRecord extends DataRecord {
|
|||||||
if (characterRecord == null) {
|
if (characterRecord == null) {
|
||||||
characterRecord = new CharacterRecord(player);
|
characterRecord = new CharacterRecord(player);
|
||||||
} else {
|
} else {
|
||||||
characterRecord.recordType = mbEnums.DataRecordType.CHARACTER;
|
characterRecord.recordType = Enum.DataRecordType.CHARACTER;
|
||||||
characterRecord.player = player;
|
characterRecord.player = player;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
public class CityRecord extends DataRecord {
|
public class CityRecord extends DataRecord {
|
||||||
|
|
||||||
private static final LinkedBlockingQueue<CityRecord> recordPool = new LinkedBlockingQueue<>();
|
private static final LinkedBlockingQueue<CityRecord> recordPool = new LinkedBlockingQueue<>();
|
||||||
private mbEnums.RecordEventType eventType;
|
private Enum.RecordEventType eventType;
|
||||||
private City city;
|
private City city;
|
||||||
private String cityHash;
|
private String cityHash;
|
||||||
private String cityGuildHash;
|
private String cityGuildHash;
|
||||||
@@ -32,13 +32,13 @@ public class CityRecord extends DataRecord {
|
|||||||
private java.time.LocalDateTime establishedDatetime;
|
private java.time.LocalDateTime establishedDatetime;
|
||||||
|
|
||||||
private CityRecord(City city) {
|
private CityRecord(City city) {
|
||||||
this.recordType = mbEnums.DataRecordType.CITY;
|
this.recordType = Enum.DataRecordType.CITY;
|
||||||
this.city = city;
|
this.city = city;
|
||||||
this.eventType = mbEnums.RecordEventType.CREATE;
|
this.eventType = Enum.RecordEventType.CREATE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CityRecord borrow(City city, mbEnums.RecordEventType eventType) {
|
public static CityRecord borrow(City city, Enum.RecordEventType eventType) {
|
||||||
CityRecord cityRecord;
|
CityRecord cityRecord;
|
||||||
|
|
||||||
cityRecord = recordPool.poll();
|
cityRecord = recordPool.poll();
|
||||||
@@ -47,7 +47,7 @@ public class CityRecord extends DataRecord {
|
|||||||
cityRecord = new CityRecord(city);
|
cityRecord = new CityRecord(city);
|
||||||
cityRecord.eventType = eventType;
|
cityRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
cityRecord.recordType = mbEnums.DataRecordType.CITY;
|
cityRecord.recordType = Enum.DataRecordType.CITY;
|
||||||
cityRecord.eventType = eventType;
|
cityRecord.eventType = eventType;
|
||||||
cityRecord.city = city;
|
cityRecord.city = city;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class CityRecord extends DataRecord {
|
|||||||
|
|
||||||
cityRecord.zoneHash = cityRecord.city.getParent().hash;
|
cityRecord.zoneHash = cityRecord.city.getParent().hash;
|
||||||
|
|
||||||
if (cityRecord.eventType.equals(mbEnums.RecordEventType.CREATE))
|
if (cityRecord.eventType.equals(Enum.RecordEventType.CREATE))
|
||||||
cityRecord.establishedDatetime = cityRecord.city.established;
|
cityRecord.establishedDatetime = cityRecord.city.established;
|
||||||
else
|
else
|
||||||
cityRecord.establishedDatetime = java.time.LocalDateTime.now();
|
cityRecord.establishedDatetime = java.time.LocalDateTime.now();
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
import engine.mbEnums;
|
import engine.Enum;
|
||||||
|
|
||||||
class DataRecord {
|
class DataRecord {
|
||||||
|
|
||||||
public mbEnums.DataRecordType recordType;
|
public Enum.DataRecordType recordType;
|
||||||
|
|
||||||
DataRecord() {
|
DataRecord() {
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import static engine.mbEnums.DataRecordType;
|
import static engine.Enum.DataRecordType;
|
||||||
|
|
||||||
public class DataWarehouse implements Runnable {
|
public class DataWarehouse implements Runnable {
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.RecordEventType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.RecordEventType;
|
|
||||||
import engine.objects.Guild;
|
import engine.objects.Guild;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
public static HashMap<Integer, GuildRecord> GuildRecordCache = null;
|
public static HashMap<Integer, GuildRecord> GuildRecordCache = null;
|
||||||
public String guildHash;
|
public String guildHash;
|
||||||
public int guildID;
|
public int guildID;
|
||||||
private mbEnums.RecordEventType eventType;
|
private Enum.RecordEventType eventType;
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
private String guildName;
|
private String guildName;
|
||||||
private String charterName;
|
private String charterName;
|
||||||
@@ -44,9 +44,9 @@ public class GuildRecord extends DataRecord {
|
|||||||
private java.time.LocalDateTime eventDatetime;
|
private java.time.LocalDateTime eventDatetime;
|
||||||
|
|
||||||
private GuildRecord(Guild guild) {
|
private GuildRecord(Guild guild) {
|
||||||
this.recordType = mbEnums.DataRecordType.GUILD;
|
this.recordType = Enum.DataRecordType.GUILD;
|
||||||
this.guild = guild;
|
this.guild = guild;
|
||||||
this.eventType = mbEnums.RecordEventType.CREATE;
|
this.eventType = Enum.RecordEventType.CREATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static GuildRecord borrow(Guild guild, mbEnums.RecordEventType eventType) {
|
public static GuildRecord borrow(Guild guild, Enum.RecordEventType eventType) {
|
||||||
GuildRecord guildRecord;
|
GuildRecord guildRecord;
|
||||||
//add
|
//add
|
||||||
guildRecord = recordPool.poll();
|
guildRecord = recordPool.poll();
|
||||||
@@ -81,7 +81,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
guildRecord.eventType = eventType;
|
guildRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
guildRecord.guild = guild;
|
guildRecord.guild = guild;
|
||||||
guildRecord.recordType = mbEnums.DataRecordType.GUILD;
|
guildRecord.recordType = Enum.DataRecordType.GUILD;
|
||||||
guildRecord.eventType = eventType;
|
guildRecord.eventType = eventType;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -89,8 +89,7 @@ public class GuildRecord extends DataRecord {
|
|||||||
guildRecord.guildHash = guildRecord.guild.getHash();
|
guildRecord.guildHash = guildRecord.guild.getHash();
|
||||||
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
guildRecord.guildID = guildRecord.guild.getObjectUUID();
|
||||||
guildRecord.guildName = guildRecord.guild.getName();
|
guildRecord.guildName = guildRecord.guild.getName();
|
||||||
mbEnums.GuildCharterType guildCharterType = guild.charter;
|
guildRecord.charterName = Enum.GuildType.getGuildTypeFromInt(guildRecord.guild.getCharter()).getCharterName();
|
||||||
guildRecord.charterName = guildCharterType.name;
|
|
||||||
|
|
||||||
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
guildRecord.GLHash = DataWarehouse.hasher.encrypt(guildRecord.guild.getGuildLeaderUUID());
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -23,7 +23,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||||||
public class MineRecord extends DataRecord {
|
public class MineRecord extends DataRecord {
|
||||||
|
|
||||||
private static final LinkedBlockingQueue<MineRecord> recordPool = new LinkedBlockingQueue<>();
|
private static final LinkedBlockingQueue<MineRecord> recordPool = new LinkedBlockingQueue<>();
|
||||||
private mbEnums.RecordEventType eventType;
|
private Enum.RecordEventType eventType;
|
||||||
private String zoneHash;
|
private String zoneHash;
|
||||||
private String charHash;
|
private String charHash;
|
||||||
private String mineGuildHash;
|
private String mineGuildHash;
|
||||||
@@ -33,12 +33,12 @@ public class MineRecord extends DataRecord {
|
|||||||
private float locY;
|
private float locY;
|
||||||
|
|
||||||
private MineRecord() {
|
private MineRecord() {
|
||||||
this.recordType = mbEnums.DataRecordType.MINE;
|
this.recordType = Enum.DataRecordType.MINE;
|
||||||
this.eventType = mbEnums.RecordEventType.CAPTURE;
|
this.eventType = Enum.RecordEventType.CAPTURE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MineRecord borrow(Mine mine, AbstractCharacter character, mbEnums.RecordEventType eventType) {
|
public static MineRecord borrow(Mine mine, AbstractCharacter character, Enum.RecordEventType eventType) {
|
||||||
|
|
||||||
MineRecord mineRecord;
|
MineRecord mineRecord;
|
||||||
mineRecord = recordPool.poll();
|
mineRecord = recordPool.poll();
|
||||||
@@ -48,13 +48,13 @@ public class MineRecord extends DataRecord {
|
|||||||
mineRecord = new MineRecord();
|
mineRecord = new MineRecord();
|
||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
mineRecord.recordType = mbEnums.DataRecordType.MINE;
|
mineRecord.recordType = Enum.DataRecordType.MINE;
|
||||||
mineRecord.eventType = eventType;
|
mineRecord.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
mineRecord.zoneHash = mine.getParentZone().hash;
|
mineRecord.zoneHash = mine.getParentZone().hash;
|
||||||
|
|
||||||
if (character.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
if (character.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
player = (PlayerCharacter) character;
|
player = (PlayerCharacter) character;
|
||||||
mineRecord.charHash = player.getHash();
|
mineRecord.charHash = player.getHash();
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
@@ -23,8 +23,8 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
import static engine.mbEnums.DataRecordType;
|
import static engine.Enum.DataRecordType;
|
||||||
import static engine.mbEnums.PvpHistoryType;
|
import static engine.Enum.PvpHistoryType;
|
||||||
|
|
||||||
public class PvpRecord extends DataRecord {
|
public class PvpRecord extends DataRecord {
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.archive;
|
package engine.db.archive;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Realm;
|
import engine.objects.Realm;
|
||||||
import engine.workthreads.WarehousePushThread;
|
import engine.workthreads.WarehousePushThread;
|
||||||
|
|
||||||
@@ -23,20 +23,20 @@ public class RealmRecord extends DataRecord {
|
|||||||
private static final LinkedBlockingQueue<RealmRecord> recordPool = new LinkedBlockingQueue<>();
|
private static final LinkedBlockingQueue<RealmRecord> recordPool = new LinkedBlockingQueue<>();
|
||||||
|
|
||||||
private Realm realm;
|
private Realm realm;
|
||||||
private mbEnums.RecordEventType eventType;
|
private Enum.RecordEventType eventType;
|
||||||
private String cityHash;
|
private String cityHash;
|
||||||
private String guildHash;
|
private String guildHash;
|
||||||
private String charterType;
|
private String charterType;
|
||||||
private LocalDateTime eventDateTime;
|
private LocalDateTime eventDateTime;
|
||||||
|
|
||||||
private RealmRecord(Realm realm) {
|
private RealmRecord(Realm realm) {
|
||||||
this.recordType = mbEnums.DataRecordType.REALM;
|
this.recordType = Enum.DataRecordType.REALM;
|
||||||
this.realm = realm;
|
this.realm = realm;
|
||||||
this.eventType = mbEnums.RecordEventType.CAPTURE;
|
this.eventType = Enum.RecordEventType.CAPTURE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RealmRecord borrow(Realm realm, mbEnums.RecordEventType eventType) {
|
public static RealmRecord borrow(Realm realm, Enum.RecordEventType eventType) {
|
||||||
RealmRecord realmRecord;
|
RealmRecord realmRecord;
|
||||||
|
|
||||||
realmRecord = recordPool.poll();
|
realmRecord = recordPool.poll();
|
||||||
@@ -45,7 +45,7 @@ public class RealmRecord extends DataRecord {
|
|||||||
realmRecord = new RealmRecord(realm);
|
realmRecord = new RealmRecord(realm);
|
||||||
realmRecord.eventType = eventType;
|
realmRecord.eventType = eventType;
|
||||||
} else {
|
} else {
|
||||||
realmRecord.recordType = mbEnums.DataRecordType.REALM;
|
realmRecord.recordType = Enum.DataRecordType.REALM;
|
||||||
realmRecord.eventType = eventType;
|
realmRecord.eventType = eventType;
|
||||||
realmRecord.realm = realm;
|
realmRecord.realm = realm;
|
||||||
|
|
||||||
@@ -53,9 +53,9 @@ public class RealmRecord extends DataRecord {
|
|||||||
|
|
||||||
realmRecord.cityHash = realm.getRulingCity().getHash();
|
realmRecord.cityHash = realm.getRulingCity().getHash();
|
||||||
realmRecord.guildHash = realm.getRulingCity().getGuild().getHash();
|
realmRecord.guildHash = realm.getRulingCity().getGuild().getHash();
|
||||||
realmRecord.charterType = mbEnums.CharterType.getCharterTypeByID(realmRecord.realm.getCharterType()).name();
|
realmRecord.charterType = Enum.CharterType.getCharterTypeByID(realmRecord.realm.getCharterType()).name();
|
||||||
|
|
||||||
if (realmRecord.eventType.equals(mbEnums.RecordEventType.CAPTURE))
|
if (realmRecord.eventType.equals(Enum.RecordEventType.CAPTURE))
|
||||||
realmRecord.eventDateTime = realm.ruledSince;
|
realmRecord.eventDateTime = realm.ruledSince;
|
||||||
else
|
else
|
||||||
realmRecord.eventDateTime = LocalDateTime.now();
|
realmRecord.eventDateTime = LocalDateTime.now();
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -27,7 +27,7 @@ public class dbAccountHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbAccountHandler() {
|
public dbAccountHandler() {
|
||||||
this.localClass = Account.class;
|
this.localClass = Account.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account GET_ACCOUNT(int accountID) {
|
public Account GET_ACCOUNT(int accountID) {
|
||||||
@@ -204,7 +204,7 @@ public class dbAccountHandler extends dbHandlerBase {
|
|||||||
if (account != null) {
|
if (account != null) {
|
||||||
account.runAfterLoad();
|
account.runAfterLoad();
|
||||||
|
|
||||||
if (ConfigManager.serverType.equals(mbEnums.ServerType.LOGINSERVER))
|
if (ConfigManager.serverType.equals(Enum.ServerType.LOGINSERVER))
|
||||||
Account.AccountsMap.put(uname, account.getObjectUUID());
|
Account.AccountsMap.put(uname, account.getObjectUUID());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.BaseClass;
|
import engine.objects.BaseClass;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public class dbBaseClassHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbBaseClassHandler() {
|
public dbBaseClassHandler() {
|
||||||
this.localClass = BaseClass.class;
|
this.localClass = BaseClass.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.BaseClass;
|
this.localObjectType = Enum.GameObjectType.BaseClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseClass GET_BASE_CLASS(final int id) {
|
public BaseClass GET_BASE_CLASS(final int id) {
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.objects.Boon;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class dbBoonHandler extends dbHandlerBase {
|
||||||
|
|
||||||
|
public dbBoonHandler() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ArrayList<Boon> GET_BOON_AMOUNTS_FOR_ITEMBASE(int itemBaseUUID) {
|
||||||
|
|
||||||
|
ArrayList<Boon> boons = new ArrayList<>();
|
||||||
|
Boon thisBoon;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, itemBaseUUID);
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
thisBoon = new Boon(rs);
|
||||||
|
boons.add(thisBoon);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return boons;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,19 +3,20 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.DbObjectType;
|
||||||
|
import engine.Enum.ProtectionState;
|
||||||
|
import engine.Enum.TaxType;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.DbObjectType;
|
|
||||||
import engine.mbEnums.ProtectionState;
|
|
||||||
import engine.mbEnums.TaxType;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -34,7 +35,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbBuildingHandler() {
|
public dbBuildingHandler() {
|
||||||
this.localClass = Building.class;
|
this.localClass = Building.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
public Building CREATE_BUILDING(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||||
@@ -112,7 +113,7 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
if (uuid == 0)
|
if (uuid == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Building building = (Building) DbManager.getFromCache(mbEnums.GameObjectType.Building, uuid);
|
Building building = (Building) DbManager.getFromCache(Enum.GameObjectType.Building, uuid);
|
||||||
|
|
||||||
if (building != null)
|
if (building != null)
|
||||||
return building;
|
return building;
|
||||||
@@ -548,6 +549,87 @@ public class dbBuildingHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LOAD_SUBMESH_LOOKUP() {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_render_submesh`")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
int structureID = rs.getInt("propID");
|
||||||
|
int renderID = rs.getInt("meshID");
|
||||||
|
|
||||||
|
if (!BuildingManager._prop_subMeshes.containsKey(structureID))
|
||||||
|
BuildingManager._prop_subMeshes.put(structureID, new ArrayList<>());
|
||||||
|
|
||||||
|
BuildingManager._prop_subMeshes.get(structureID).add(renderID);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_CONVEX_HULLS() {
|
||||||
|
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_convex_hulls")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
int meshID = rs.getInt("meshID");
|
||||||
|
String[] vertStrings = rs.getString("convexHull").split(";");
|
||||||
|
ArrayList<Vector2f> vertArrayList = new ArrayList<>();
|
||||||
|
|
||||||
|
// Filter things that couldn't be wrapped
|
||||||
|
|
||||||
|
if (vertStrings.length < 3) {
|
||||||
|
Logger.error("Mesh : " + meshID + " has less than 3 vertices.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Vector2f> vectors = new ArrayList<>();
|
||||||
|
ArrayList<Float> floats = new ArrayList<>();
|
||||||
|
|
||||||
|
for(String read : vertStrings){
|
||||||
|
|
||||||
|
floats.add(Float.parseFloat(read));
|
||||||
|
|
||||||
|
if(floats.size() == 2) {
|
||||||
|
vectors.add(new Vector2f(floats.get(0), floats.get(1)));
|
||||||
|
floats.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<ArrayList<Vector2f>> meshList;
|
||||||
|
|
||||||
|
if (BuildingManager._hull_data.get(meshID) == null) {
|
||||||
|
meshList = new ArrayList<>();
|
||||||
|
meshList.add(vectors);
|
||||||
|
BuildingManager._hull_data.put(meshID, meshList);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
meshList = BuildingManager._hull_data.get(meshID);
|
||||||
|
meshList.add(vectors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + BuildingManager._hull_data.size());
|
||||||
|
}
|
||||||
|
|
||||||
public HashMap<Integer, ArrayList<BuildingRegions>> LOAD_BUILDING_REGIONS() {
|
public HashMap<Integer, ArrayList<BuildingRegions>> LOAD_BUILDING_REGIONS() {
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<BuildingRegions>> regionList = new HashMap<>();
|
HashMap<Integer, ArrayList<BuildingRegions>> regionList = new HashMap<>();
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.BuildingLocation;
|
import engine.objects.BuildingLocation;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ public class dbBuildingLocationHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbBuildingLocationHandler() {
|
public dbBuildingLocationHandler() {
|
||||||
this.localClass = BuildingLocation.class;
|
this.localClass = BuildingLocation.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<BuildingLocation> LOAD_BUILDING_LOCATIONS() {
|
public ArrayList<BuildingLocation> LOAD_BUILDING_LOCATIONS() {
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.session.CSSession;
|
import engine.session.CSSession;
|
||||||
@@ -27,7 +26,7 @@ public class dbCSSessionHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCSSessionHandler() {
|
public dbCSSessionHandler() {
|
||||||
this.localClass = CSSession.class;
|
this.localClass = CSSession.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ADD_CSSESSION(String secKey, Account acc, InetAddress inet, String machineID) {
|
public boolean ADD_CSSESSION(String secKey, Account acc, InetAddress inet, String machineID) {
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.CharacterPower;
|
import engine.objects.CharacterPower;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
@@ -23,7 +23,7 @@ public class dbCharacterPowerHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCharacterPowerHandler() {
|
public dbCharacterPowerHandler() {
|
||||||
this.localClass = CharacterPower.class;
|
this.localClass = CharacterPower.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterPower ADD_CHARACTER_POWER(CharacterPower toAdd) {
|
public CharacterPower ADD_CHARACTER_POWER(CharacterPower toAdd) {
|
||||||
@@ -74,7 +74,7 @@ public class dbCharacterPowerHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public CharacterPower GET_CHARACTER_POWER(int objectUUID) {
|
public CharacterPower GET_CHARACTER_POWER(int objectUUID) {
|
||||||
|
|
||||||
CharacterPower characterPower = (CharacterPower) DbManager.getFromCache(mbEnums.GameObjectType.CharacterPower, objectUUID);
|
CharacterPower characterPower = (CharacterPower) DbManager.getFromCache(Enum.GameObjectType.CharacterPower, objectUUID);
|
||||||
|
|
||||||
if (characterPower != null)
|
if (characterPower != null)
|
||||||
return characterPower;
|
return characterPower;
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.CharacterRune;
|
import engine.objects.CharacterRune;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ public class dbCharacterRuneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCharacterRuneHandler() {
|
public dbCharacterRuneHandler() {
|
||||||
this.localClass = CharacterRune.class;
|
this.localClass = CharacterRune.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterRune ADD_CHARACTER_RUNE(final CharacterRune toAdd) {
|
public CharacterRune ADD_CHARACTER_RUNE(final CharacterRune toAdd) {
|
||||||
@@ -49,7 +49,7 @@ public class dbCharacterRuneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public CharacterRune GET_CHARACTER_RUNE(int runeID) {
|
public CharacterRune GET_CHARACTER_RUNE(int runeID) {
|
||||||
|
|
||||||
CharacterRune characterRune = (CharacterRune) DbManager.getFromCache(mbEnums.GameObjectType.CharacterRune, runeID);
|
CharacterRune characterRune = (CharacterRune) DbManager.getFromCache(Enum.GameObjectType.CharacterRune, runeID);
|
||||||
|
|
||||||
if (characterRune != null)
|
if (characterRune != null)
|
||||||
return characterRune;
|
return characterRune;
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.CharacterSkill;
|
import engine.objects.CharacterSkill;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -24,7 +24,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCharacterSkillHandler() {
|
public dbCharacterSkillHandler() {
|
||||||
this.localClass = CharacterSkill.class;
|
this.localClass = CharacterSkill.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterSkill ADD_SKILL(CharacterSkill toAdd) {
|
public CharacterSkill ADD_SKILL(CharacterSkill toAdd) {
|
||||||
@@ -72,7 +72,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public CharacterSkill GET_SKILL(final int objectUUID) {
|
public CharacterSkill GET_SKILL(final int objectUUID) {
|
||||||
|
|
||||||
CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(mbEnums.GameObjectType.CharacterSkill, objectUUID);
|
CharacterSkill characterSkill = (CharacterSkill) DbManager.getFromCache(Enum.GameObjectType.CharacterSkill, objectUUID);
|
||||||
|
|
||||||
if (characterSkill != null)
|
if (characterSkill != null)
|
||||||
return characterSkill;
|
return characterSkill;
|
||||||
@@ -95,7 +95,7 @@ public class dbCharacterSkillHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
ConcurrentHashMap<String, CharacterSkill> characterSkills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
ConcurrentHashMap<String, CharacterSkill> characterSkills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
|
|
||||||
if (ac == null || (!(ac.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))))
|
if (ac == null || (!(ac.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))))
|
||||||
return characterSkills;
|
return characterSkills;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) ac;
|
PlayerCharacter playerCharacter = (PlayerCharacter) ac;
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
@@ -25,7 +25,7 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbCityHandler() {
|
public dbCityHandler() {
|
||||||
this.localClass = City.class;
|
this.localClass = City.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
||||||
@@ -34,42 +34,40 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
case "zone":
|
case "zone":
|
||||||
Zone zone = new Zone(rs);
|
Zone zone = new Zone(rs);
|
||||||
DbManager.addToCache(zone);
|
DbManager.addToCache(zone);
|
||||||
zone.runAfterLoad();
|
|
||||||
list.add(zone);
|
list.add(zone);
|
||||||
break;
|
break;
|
||||||
case "building":
|
case "building":
|
||||||
Building building = new Building(rs);
|
Building building = new Building(rs);
|
||||||
DbManager.addToCache(building);
|
DbManager.addToCache(building);
|
||||||
building.runAfterLoad();
|
|
||||||
list.add(building);
|
list.add(building);
|
||||||
break;
|
break;
|
||||||
case "city":
|
case "city":
|
||||||
City city = new City(rs);
|
City city = new City(rs);
|
||||||
DbManager.addToCache(city);
|
DbManager.addToCache(city);
|
||||||
city.runAfterLoad();
|
|
||||||
list.add(city);
|
list.add(city);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
public ArrayList<AbstractGameObject> CREATE_CITY(int ownerID, int parentZoneID, int realmID, float xCoord, float yCoord, float zCoord, float rotation, float W, String name, LocalDateTime established) {
|
||||||
|
|
||||||
LocalDateTime upgradeTime = LocalDateTime.now().plusHours(2);
|
LocalDateTime upgradeTime = LocalDateTime.now().plusHours(2);
|
||||||
ArrayList<AbstractGameObject> objectList = new ArrayList<>();
|
ArrayList<AbstractGameObject> objectList = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, ownerID); //objectUUID of owning player
|
preparedStatement.setLong(1, ownerID); //objectUUID of owning player
|
||||||
preparedStatement.setLong(2, parentZoneID); //objectUUID of parent (continent) zone
|
preparedStatement.setLong(2, parentZoneID); //objectUUID of parent (continent) zone
|
||||||
preparedStatement.setFloat(3, xCoord); //xOffset from parentZone center
|
preparedStatement.setLong(3, realmID); //objectUUID of realm city belongs in
|
||||||
preparedStatement.setFloat(4, yCoord); //yOffset from parentZone center
|
preparedStatement.setFloat(4, xCoord); //xOffset from parentZone center
|
||||||
preparedStatement.setFloat(5, zCoord); //zOffset from parentZone center
|
preparedStatement.setFloat(5, yCoord); //yOffset from parentZone center
|
||||||
preparedStatement.setString(6, name); //city name
|
preparedStatement.setFloat(6, zCoord); //zOffset from parentZone center
|
||||||
preparedStatement.setTimestamp(7, Timestamp.valueOf(established));
|
preparedStatement.setString(7, name); //city name
|
||||||
preparedStatement.setFloat(8, rotation);
|
preparedStatement.setTimestamp(8, Timestamp.valueOf(established));
|
||||||
preparedStatement.setFloat(9, W);
|
preparedStatement.setFloat(9, rotation);
|
||||||
preparedStatement.setTimestamp(10, Timestamp.valueOf(upgradeTime));
|
preparedStatement.setFloat(10, W);
|
||||||
|
preparedStatement.setTimestamp(11, Timestamp.valueOf(upgradeTime));
|
||||||
|
|
||||||
boolean work = preparedStatement.execute();
|
boolean work = preparedStatement.execute();
|
||||||
|
|
||||||
@@ -117,7 +115,7 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public City GET_CITY(final int cityId) {
|
public City GET_CITY(final int cityId) {
|
||||||
|
|
||||||
City city = (City) DbManager.getFromCache(mbEnums.GameObjectType.City, cityId);
|
City city = (City) DbManager.getFromCache(Enum.GameObjectType.City, cityId);
|
||||||
|
|
||||||
if (city != null)
|
if (city != null)
|
||||||
return city;
|
return city;
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ItemManager;
|
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Contract;
|
import engine.objects.Contract;
|
||||||
import engine.objects.Item;
|
import engine.objects.ItemBase;
|
||||||
|
import engine.objects.MobEquipment;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -25,12 +25,12 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbContractHandler() {
|
public dbContractHandler() {
|
||||||
this.localClass = Contract.class;
|
this.localClass = Contract.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Contract GET_CONTRACT(final int objectUUID) {
|
public Contract GET_CONTRACT(final int objectUUID) {
|
||||||
|
|
||||||
Contract contract = (Contract) DbManager.getFromCache(mbEnums.GameObjectType.Contract, objectUUID);
|
Contract contract = (Contract) DbManager.getFromCache(Enum.GameObjectType.Contract, objectUUID);
|
||||||
|
|
||||||
if (contract != null)
|
if (contract != null)
|
||||||
return contract;
|
return contract;
|
||||||
@@ -63,12 +63,33 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
int templateID = rs.getInt("templateID");
|
//handle item base
|
||||||
|
int itemBaseID = rs.getInt("itembaseID");
|
||||||
|
|
||||||
Item item = new Item(templateID);
|
ItemBase ib = ItemBase.getItemBase(itemBaseID);
|
||||||
item.objectUUID = ItemManager.lastNegativeID.decrementAndGet();
|
|
||||||
contract.getSellInventory().add(item);
|
|
||||||
|
|
||||||
|
if (ib != null) {
|
||||||
|
|
||||||
|
MobEquipment me = new MobEquipment(ib, 0, 0);
|
||||||
|
contract.getSellInventory().add(me);
|
||||||
|
|
||||||
|
//handle magic effects
|
||||||
|
String prefix = rs.getString("prefix");
|
||||||
|
int pRank = rs.getInt("pRank");
|
||||||
|
String suffix = rs.getString("suffix");
|
||||||
|
int sRank = rs.getInt("sRank");
|
||||||
|
|
||||||
|
if (prefix != null) {
|
||||||
|
me.setPrefix(prefix, pRank);
|
||||||
|
me.setIsID(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suffix != null) {
|
||||||
|
me.setSuffix(suffix, sRank);
|
||||||
|
me.setIsID(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
@@ -106,12 +127,12 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateAllowedBuildings(final Contract con) {
|
public boolean updateAllowedBuildings(final Contract con, final long slotbitvalue) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `slotInBuildings`=? WHERE `contractID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `allowedBuildingTypeID`=? WHERE `contractID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setString(1, mbEnums.asString(con.allowedBuildings));
|
preparedStatement.setLong(1, slotbitvalue);
|
||||||
preparedStatement.setInt(2, con.getContractID());
|
preparedStatement.setInt(2, con.getContractID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -126,7 +147,7 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, "
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, "
|
||||||
+ "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, slotInBuildings=? WHERE `ID`=?")) {
|
+ "`mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, allowedBuildingTypeID=? WHERE `ID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, con.getContractID());
|
preparedStatement.setInt(1, con.getContractID());
|
||||||
preparedStatement.setString(2, con.getName());
|
preparedStatement.setString(2, con.getName());
|
||||||
@@ -135,7 +156,7 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(5, (con.getVendorDialog() != null) ? con.getVendorDialog().getObjectUUID() : 0);
|
preparedStatement.setInt(5, (con.getVendorDialog() != null) ? con.getVendorDialog().getObjectUUID() : 0);
|
||||||
preparedStatement.setInt(6, con.getIconID());
|
preparedStatement.setInt(6, con.getIconID());
|
||||||
preparedStatement.setInt(8, con.getObjectUUID());
|
preparedStatement.setInt(8, con.getObjectUUID());
|
||||||
preparedStatement.setString(7, mbEnums.asString(con.allowedBuildings));
|
preparedStatement.setLong(7, con.getAllowedBuildings().toLong());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.effectmodifiers.*;
|
import engine.powers.effectmodifiers.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -63,7 +63,7 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
IDString = rs.getString("IDString");
|
IDString = rs.getString("IDString");
|
||||||
EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
|
EffectsBase effectBase = PowersManager.getEffectByIDString(IDString);
|
||||||
mbEnums.ModType modifier = mbEnums.ModType.GetModType(rs.getString("modType"));
|
Enum.ModType modifier = Enum.ModType.GetModType(rs.getString("modType"));
|
||||||
|
|
||||||
//combine item prefix and suffix effect modifiers
|
//combine item prefix and suffix effect modifiers
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, mbEnums.ModType modifier) throws SQLException {
|
private static AbstractEffectModifier getCombinedModifiers(AbstractEffectModifier abstractEffectModifier, ResultSet rs, EffectsBase effectBase, Enum.ModType modifier) throws SQLException {
|
||||||
switch (modifier) {
|
switch (modifier) {
|
||||||
case AdjustAboveDmgCap:
|
case AdjustAboveDmgCap:
|
||||||
abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
|
abstractEffectModifier = new AdjustAboveDmgCapEffectModifier(rs);
|
||||||
|
|||||||
@@ -3,56 +3,45 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.EffectsResourceCosts;
|
import engine.objects.EffectsResourceCosts;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
public class dbEffectsResourceCostHandler extends dbHandlerBase {
|
||||||
|
|
||||||
public dbEffectsResourceCostHandler() {
|
public dbEffectsResourceCostHandler() {
|
||||||
this.localClass = EffectsResourceCosts.class;
|
this.localClass = EffectsResourceCosts.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_ALL_COSTMAPS() {
|
public ArrayList<EffectsResourceCosts> GET_ALL_EFFECT_RESOURCES(String idString) {
|
||||||
|
|
||||||
|
ArrayList<EffectsResourceCosts> effectsResourceCosts = new ArrayList<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_effect_costmaps`")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_power_effectcost` WHERE `IDString` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setString(1, idString);
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
effectsResourceCosts = getObjectsFromRs(rs, 1000);
|
||||||
while (rs.next()) {
|
|
||||||
String effectID = rs.getString("effectID");
|
|
||||||
String costString = rs.getString("costmap");
|
|
||||||
JSONObject costJSON = new JSONObject(costString);
|
|
||||||
HashMap<mbEnums.ResourceType, Integer> costmap = new HashMap<>();
|
|
||||||
|
|
||||||
for (String key : costJSON.keySet()) {
|
|
||||||
int value = costJSON.getInt(key);
|
|
||||||
costmap.put(mbEnums.ResourceType.valueOf(key), value);
|
|
||||||
}
|
|
||||||
|
|
||||||
PowersManager._effect_costMaps.put(effectID, costmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
return effectsResourceCosts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.GuildHistoryType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GuildHistoryType;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
@@ -24,7 +24,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbGuildHandler() {
|
public dbGuildHandler() {
|
||||||
this.localClass = Guild.class;
|
this.localClass = Guild.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<PlayerCharacter> GET_GUILD_BANISHED(final int id) {
|
public static ArrayList<PlayerCharacter> GET_GUILD_BANISHED(final int id) {
|
||||||
@@ -276,7 +276,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public Guild GET_GUILD(int id) {
|
public Guild GET_GUILD(int id) {
|
||||||
|
|
||||||
Guild guild = (Guild) DbManager.getFromCache(mbEnums.GameObjectType.Guild, id);
|
Guild guild = (Guild) DbManager.getFromCache(Enum.GameObjectType.Guild, id);
|
||||||
|
|
||||||
if (guild != null)
|
if (guild != null)
|
||||||
return guild;
|
return guild;
|
||||||
@@ -427,7 +427,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(6, guildTag.symbolColor);
|
preparedStatement.setInt(6, guildTag.symbolColor);
|
||||||
preparedStatement.setInt(7, guildTag.backgroundDesign);
|
preparedStatement.setInt(7, guildTag.backgroundDesign);
|
||||||
preparedStatement.setInt(8, guildTag.symbol);
|
preparedStatement.setInt(8, guildTag.symbol);
|
||||||
preparedStatement.setInt(9, g.charter.templateID);
|
preparedStatement.setInt(9, g.getCharter());
|
||||||
preparedStatement.setString(10, g.getLeadershipType());
|
preparedStatement.setString(10, g.getLeadershipType());
|
||||||
preparedStatement.setString(11, g.getMotto());
|
preparedStatement.setString(11, g.getMotto());
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
|
preparedStatement.setInt(4, g.getGuildTag().symbolColor);
|
||||||
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
|
preparedStatement.setInt(5, g.getGuildTag().backgroundDesign);
|
||||||
preparedStatement.setInt(6, g.getGuildTag().symbol);
|
preparedStatement.setInt(6, g.getGuildTag().symbol);
|
||||||
preparedStatement.setInt(7, g.charter.templateID);
|
preparedStatement.setInt(7, g.getCharter());
|
||||||
preparedStatement.setString(8, g.getMOTD());
|
preparedStatement.setString(8, g.getMOTD());
|
||||||
preparedStatement.setString(9, g.getICMOTD());
|
preparedStatement.setString(9, g.getICMOTD());
|
||||||
preparedStatement.setString(10, "");
|
preparedStatement.setString(10, "");
|
||||||
@@ -695,4 +695,24 @@ public class dbGuildHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO uncomment this when finished with guild history warehouse integration
|
||||||
|
// public HashMap<Integer, GuildRecord> GET_WAREHOUSE_GUILD_HISTORY(){
|
||||||
|
//
|
||||||
|
// HashMap<Integer, GuildRecord> tempMap = new HashMap<>();
|
||||||
|
// prepareCallable("SELECT * FROM `warehouse_guildhistory` WHERE `eventType` = 'CREATE'");
|
||||||
|
// try {
|
||||||
|
// ResultSet rs = executeQuery();
|
||||||
|
//
|
||||||
|
// while (rs.next()) {
|
||||||
|
// GuildRecord guildRecord = new GuildRecord(rs);
|
||||||
|
// tempMap.put(guildRecord.guildID, guildRecord);
|
||||||
|
// }
|
||||||
|
// }catch (Exception e){
|
||||||
|
// Logger.error(e);
|
||||||
|
// }
|
||||||
|
// return tempMap;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.AbstractWorldObject;
|
import engine.objects.AbstractWorldObject;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -42,7 +42,7 @@ public abstract class dbHandlerBase {
|
|||||||
// Only call runAfterLoad() for objects instanced on the world server
|
// Only call runAfterLoad() for objects instanced on the world server
|
||||||
|
|
||||||
if ((abstractGameObject != null && abstractGameObject instanceof AbstractWorldObject) &&
|
if ((abstractGameObject != null && abstractGameObject instanceof AbstractWorldObject) &&
|
||||||
(ConfigManager.serverType.equals(mbEnums.ServerType.WORLDSERVER) ||
|
(ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER) ||
|
||||||
(abstractGameObject.getObjectType() == GameObjectType.Guild)))
|
(abstractGameObject.getObjectType() == GameObjectType.Guild)))
|
||||||
((AbstractWorldObject) abstractGameObject).runAfterLoad();
|
((AbstractWorldObject) abstractGameObject).runAfterLoad();
|
||||||
|
|
||||||
@@ -58,9 +58,6 @@ public abstract class dbHandlerBase {
|
|||||||
|
|
||||||
int id = rs.getInt(1);
|
int id = rs.getInt(1);
|
||||||
|
|
||||||
if (id == 39052)
|
|
||||||
Logger.info(id);
|
|
||||||
|
|
||||||
if (DbManager.inCache(localObjectType, id)) {
|
if (DbManager.inCache(localObjectType, id)) {
|
||||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.objects.ItemBase;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class dbItemBaseHandler extends dbHandlerBase {
|
||||||
|
|
||||||
|
public dbItemBaseHandler() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, itemBase.getUUID());
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
if (rs.getBoolean("fromUse"))
|
||||||
|
itemBase.getUsedStats().put(rs.getInt("token"), rs.getInt("numTrains"));
|
||||||
|
else
|
||||||
|
itemBase.getBakedInStats().put(rs.getInt("token"), rs.getInt("numTrains"));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
||||||
|
|
||||||
|
ArrayList<Integer> tempList = new ArrayList<>();
|
||||||
|
ArrayList<Integer> tempListOff = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_itembase_animations` WHERE `itemBaseUUID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, itemBase.getUUID());
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
int animation = rs.getInt("animation");
|
||||||
|
boolean rightHand = rs.getBoolean("rightHand");
|
||||||
|
|
||||||
|
if (rightHand)
|
||||||
|
tempList.add(animation);
|
||||||
|
else
|
||||||
|
tempListOff.add(animation);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
itemBase.setAnimations(tempList);
|
||||||
|
itemBase.setOffHandAnimations(tempListOff);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_ALL_ITEMBASES() {
|
||||||
|
|
||||||
|
ItemBase itemBase;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_itembase")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
recordsRead++;
|
||||||
|
itemBase = new ItemBase(rs);
|
||||||
|
ItemBase.addToCache(itemBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||||
|
|
||||||
|
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
||||||
|
int runeSetID;
|
||||||
|
int runeBaseID;
|
||||||
|
int recordsRead = 0;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
|
||||||
|
recordsRead++;
|
||||||
|
|
||||||
|
runeSetID = rs.getInt("runeSet");
|
||||||
|
runeBaseID = rs.getInt("runeBase");
|
||||||
|
|
||||||
|
if (runeSets.get(runeSetID) == null) {
|
||||||
|
ArrayList<Integer> runeList = new ArrayList<>();
|
||||||
|
runeList.add(runeBaseID);
|
||||||
|
runeSets.put(runeSetID, runeList);
|
||||||
|
} else {
|
||||||
|
ArrayList<Integer> runeList = runeSets.get(runeSetID);
|
||||||
|
runeList.add(runeSetID);
|
||||||
|
runeSets.put(runeSetID, runeList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return runeSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
|
||||||
|
return runeSets;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,21 +3,18 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum.ItemContainerType;
|
||||||
|
import engine.Enum.ItemType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.ItemContainerType;
|
|
||||||
import engine.mbEnums.ItemType;
|
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.AbstractCharacter;
|
||||||
import engine.objects.CharacterItemManager;
|
import engine.objects.CharacterItemManager;
|
||||||
import engine.objects.Item;
|
import engine.objects.Item;
|
||||||
import engine.objects.ItemTemplate;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -25,7 +22,6 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,7 +29,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbItemHandler() {
|
public dbItemHandler() {
|
||||||
this.localClass = Item.class;
|
this.localClass = Item.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatTradeString(HashSet<Integer> list) {
|
private static String formatTradeString(HashSet<Integer> list) {
|
||||||
@@ -56,56 +52,46 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item PERSIST(Item toAdd) {
|
public Item ADD_ITEM(Item toAdd) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?,?);")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `item_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?,?);")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, toAdd.ownerID);
|
preparedStatement.setInt(1, toAdd.getOwnerID());
|
||||||
preparedStatement.setInt(2, toAdd.templateID);
|
preparedStatement.setInt(2, toAdd.getItemBaseID());
|
||||||
preparedStatement.setInt(3, (byte) toAdd.chargesRemaining);
|
preparedStatement.setInt(3, toAdd.getChargesRemaining());
|
||||||
preparedStatement.setInt(4, (short) toAdd.combat_health_current);
|
preparedStatement.setInt(4, toAdd.getDurabilityCurrent());
|
||||||
|
preparedStatement.setInt(5, toAdd.getDurabilityMax());
|
||||||
|
|
||||||
if (toAdd.getNumOfItems() < 1)
|
if (toAdd.getNumOfItems() < 1)
|
||||||
preparedStatement.setInt(5, 1);
|
preparedStatement.setInt(6, 1);
|
||||||
else
|
else
|
||||||
preparedStatement.setInt(5, toAdd.getNumOfItems());
|
preparedStatement.setInt(6, toAdd.getNumOfItems());
|
||||||
|
|
||||||
switch (toAdd.containerType) {
|
switch (toAdd.containerType) {
|
||||||
case INVENTORY:
|
case INVENTORY:
|
||||||
preparedStatement.setString(6, "inventory");
|
preparedStatement.setString(7, "inventory");
|
||||||
break;
|
break;
|
||||||
case EQUIPPED:
|
case EQUIPPED:
|
||||||
preparedStatement.setString(6, "equip");
|
preparedStatement.setString(7, "equip");
|
||||||
break;
|
break;
|
||||||
case BANK:
|
case BANK:
|
||||||
preparedStatement.setString(6, "bank");
|
preparedStatement.setString(7, "bank");
|
||||||
break;
|
break;
|
||||||
case VAULT:
|
case VAULT:
|
||||||
preparedStatement.setString(6, "vault");
|
preparedStatement.setString(7, "vault");
|
||||||
break;
|
break;
|
||||||
case FORGE:
|
case FORGE:
|
||||||
preparedStatement.setString(6, "forge");
|
preparedStatement.setString(7, "forge");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
preparedStatement.setString(6, "none"); //Shouldn't be here
|
preparedStatement.setString(7, "none"); //Shouldn't be here
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toAdd.equipSlot.equals(mbEnums.EquipSlotType.NONE))
|
preparedStatement.setByte(8, toAdd.getEquipSlot());
|
||||||
preparedStatement.setString(7, "");
|
preparedStatement.setInt(9, toAdd.getFlags());
|
||||||
else
|
preparedStatement.setString(10, toAdd.getCustomName());
|
||||||
preparedStatement.setString(7, toAdd.equipSlot.name());
|
|
||||||
|
|
||||||
String flagString = "";
|
|
||||||
|
|
||||||
for (mbEnums.ItemFlags itemflag : toAdd.flags)
|
|
||||||
flagString += itemflag.toString() + ";";
|
|
||||||
|
|
||||||
flagString = flagString.replaceAll(";$", "");
|
|
||||||
|
|
||||||
preparedStatement.setString(8, flagString);
|
|
||||||
preparedStatement.setString(9, toAdd.name);
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
@@ -162,7 +148,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
ArrayList<Item> itemList;
|
ArrayList<Item> itemList;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`container`='equip';")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_item`.*, `object`.`parent`, `object`.`type` FROM `object` INNER JOIN `obj_item` ON `object`.`UID` = `obj_item`.`UID` WHERE `object`.`parent`=? && `obj_item`.`item_container`='equip';")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, targetId);
|
preparedStatement.setLong(1, targetId);
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
@@ -177,49 +163,6 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return itemList;
|
return itemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_ITEM_TEMPLATES() {
|
|
||||||
|
|
||||||
HashMap<ItemType, Integer> templateTCountMap = new HashMap<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_templates`;");
|
|
||||||
ResultSet rs = preparedStatement.executeQuery()) {
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
int templateID = rs.getInt("id");
|
|
||||||
JSONObject jsonObject = new JSONObject(rs.getString("template"));
|
|
||||||
ItemTemplate itemTemplate = new ItemTemplate(jsonObject);
|
|
||||||
itemTemplate.template_id = templateID;
|
|
||||||
ItemTemplate.templates.put(templateID, itemTemplate);
|
|
||||||
|
|
||||||
templateTCountMap.merge(itemTemplate.item_type, 1, Integer::sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info(templateTCountMap.toString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_TEMPLATE_MODTABLES() {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_vendor_items`;");
|
|
||||||
ResultSet rs = preparedStatement.executeQuery()) {
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
int templateID = rs.getInt("templateID");
|
|
||||||
int modTable = rs.getInt("modTable");
|
|
||||||
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
|
||||||
template.modTable = modTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item GET_ITEM(final int itemUUID) {
|
public Item GET_ITEM(final int itemUUID) {
|
||||||
|
|
||||||
Item item;
|
Item item;
|
||||||
@@ -299,7 +242,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean MOVE_GOLD(final Item from, final Item to, final int amt) {
|
public boolean MOVE_GOLD(final Item from, final Item to, final int amt) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems` = CASE WHEN `UID`=? THEN ? WHEN `UID`=? THEN ? END WHERE `UID` IN (?, ?);")) {
|
||||||
|
|
||||||
int newFromAmt = from.getNumOfItems() - amt;
|
int newFromAmt = from.getNumOfItems() - amt;
|
||||||
int newToAmt = to.getNumOfItems() + amt;
|
int newToAmt = to.getNumOfItems() + amt;
|
||||||
@@ -325,11 +268,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
for (Item item : inventory) {
|
for (Item item : inventory) {
|
||||||
|
|
||||||
if (item.template.item_type.equals(ItemType.GOLD))
|
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`container`='none' WHERE `object`.`UID`=?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` LEFT JOIN `object` ON `object`.`UID` = `obj_item`.`UID` SET `object`.`parent`=NULL, `obj_item`.`item_container`='none' WHERE `object`.`UID`=?;")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, item.getObjectUUID());
|
preparedStatement.setLong(1, item.getObjectUUID());
|
||||||
worked = (preparedStatement.executeUpdate() > 0);
|
worked = (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -345,12 +288,12 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return worked;
|
return worked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<Integer> GET_VENDOR_CAN_ROLL_LIST(final int vendorID) {
|
public HashSet<Integer> GET_ITEMS_FOR_VENDOR(final int vendorID) {
|
||||||
|
|
||||||
HashSet<Integer> itemSet = new HashSet<>();
|
HashSet<Integer> itemSet = new HashSet<>();
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT templateID FROM static_vendor_items WHERE vendorType = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT ID FROM static_itembase WHERE vendorType = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, vendorID);
|
preparedStatement.setInt(1, vendorID);
|
||||||
|
|
||||||
@@ -368,8 +311,8 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Used to transfer a single item between owners or equip or vault or bank or inventory
|
//Used to transfer a single item between owners or equip or vault or bank or inventory
|
||||||
public boolean UPDATE_OWNER(final Item item, int newOwnerID,
|
public boolean UPDATE_OWNER(final Item item, int newOwnerID, boolean ownerNPC, boolean ownerPlayer,
|
||||||
ItemContainerType containerType, mbEnums.EquipSlotType slot) {
|
boolean ownerAccount, ItemContainerType containerType, int slot) {
|
||||||
|
|
||||||
boolean worked = false;
|
boolean worked = false;
|
||||||
|
|
||||||
@@ -403,12 +346,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setString(3, "none"); //Shouldn't be here
|
preparedStatement.setString(3, "none"); //Shouldn't be here
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
preparedStatement.setInt(4, slot);
|
||||||
if (slot.equals(mbEnums.EquipSlotType.NONE))
|
|
||||||
preparedStatement.setString(4, "");
|
|
||||||
else
|
|
||||||
preparedStatement.setString(4, slot.name());
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
@@ -424,11 +362,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean SET_DURABILITY(final Item item, int value) {
|
public boolean SET_DURABILITY(final Item item, int value) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `combat_health_current`=? WHERE `UID`=? AND `combat_health_current`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_durabilityCurrent`=? WHERE `UID`=? AND `item_durabilityCurrent`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, value);
|
preparedStatement.setInt(1, value);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
preparedStatement.setInt(3, (short) item.combat_health_current);
|
preparedStatement.setInt(3, item.getDurabilityCurrent());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
@@ -441,7 +379,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean UPDATE_FORGE_TO_INVENTORY(final Item item) {
|
public boolean UPDATE_FORGE_TO_INVENTORY(final Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `container` = ? WHERE `UID` = ? AND `container` = 'forge';")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_container` = ? WHERE `UID` = ? AND `item_container` = 'forge';")) {
|
||||||
|
|
||||||
preparedStatement.setString(1, "inventory");
|
preparedStatement.setString(1, "inventory");
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
@@ -474,11 +412,11 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
*/
|
*/
|
||||||
public boolean UPDATE_GOLD(final Item item, int newValue, int oldValue) {
|
public boolean UPDATE_GOLD(final Item item, int newValue, int oldValue) {
|
||||||
|
|
||||||
if (!item.template.item_type.equals(ItemType.GOLD))
|
if (!item.getItemBase().getType().equals(ItemType.GOLD))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, newValue);
|
preparedStatement.setInt(1, newValue);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
@@ -495,9 +433,9 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean UPDATE_REMAINING_CHARGES(final Item item) {
|
public boolean UPDATE_REMAINING_CHARGES(final Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `chargesRemaining` = ? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_chargesRemaining` = ? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, (byte) item.chargesRemaining);
|
preparedStatement.setInt(1, item.getChargesRemaining());
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -515,7 +453,7 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean ZERO_ITEM_STACK(Item item) {
|
public boolean ZERO_ITEM_STACK(Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `numberOfItems`=0 WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=0 WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setLong(1, item.getObjectUUID());
|
preparedStatement.setLong(1, item.getObjectUUID());
|
||||||
|
|
||||||
@@ -530,16 +468,9 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
public boolean UPDATE_FLAGS(Item item) {
|
public boolean UPDATE_FLAGS(Item item) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `flags`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_flags`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
String flagString = "";
|
preparedStatement.setInt(1, item.getFlags());
|
||||||
|
|
||||||
for (mbEnums.ItemFlags itemflag : item.flags)
|
|
||||||
flagString += itemflag.toString() + ";";
|
|
||||||
|
|
||||||
flagString = flagString.replaceAll(";$", "");
|
|
||||||
|
|
||||||
preparedStatement.setString(1, flagString);
|
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
@@ -552,13 +483,8 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public boolean UPDATE_VALUE(Item item, int value) {
|
public boolean UPDATE_VALUE(Item item, int value) {
|
||||||
|
|
||||||
// Write 0 if we will not modify the value from template
|
|
||||||
|
|
||||||
if (value == item.template.item_value)
|
|
||||||
value = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `value`=? WHERE `UID` = ?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_value`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
preparedStatement.setInt(1, value);
|
preparedStatement.setInt(1, value);
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
preparedStatement.setLong(2, item.getObjectUUID());
|
||||||
@@ -570,25 +496,4 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean UPDATE_EQUIP_SLOT(Item item) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `equipSlot`=? WHERE `UID` = ?")) {
|
|
||||||
|
|
||||||
if (item.equipSlot.equals(mbEnums.EquipSlotType.NONE))
|
|
||||||
preparedStatement.setString(1, "");
|
|
||||||
else
|
|
||||||
preparedStatement.setString(1, item.equipSlot.name());
|
|
||||||
|
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Kit;
|
import engine.objects.Kit;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ public class dbKitHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbKitHandler() {
|
public dbKitHandler() {
|
||||||
this.localClass = Kit.class;
|
this.localClass = Kit.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Kit> GET_ALL_KITS() {
|
public ArrayList<Kit> GET_ALL_KITS() {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.MenuOption;
|
import engine.objects.MenuOption;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ public class dbMenuHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMenuHandler() {
|
public dbMenuHandler() {
|
||||||
this.localClass = MenuOption.class;
|
this.localClass = MenuOption.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<MenuOption> GET_MENU_OPTIONS(final int id) {
|
public ArrayList<MenuOption> GET_MENU_OPTIONS(final int id) {
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.MineProduction;
|
import engine.objects.MineProduction;
|
||||||
|
import engine.objects.Resource;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -24,7 +25,7 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMineHandler() {
|
public dbMineHandler() {
|
||||||
this.localClass = Mine.class;
|
this.localClass = Mine.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mine GET_MINE(int id) {
|
public Mine GET_MINE(int id) {
|
||||||
@@ -32,7 +33,7 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
if (id == 0)
|
if (id == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Mine mine = (Mine) DbManager.getFromCache(mbEnums.GameObjectType.Mine, id);
|
Mine mine = (Mine) DbManager.getFromCache(Enum.GameObjectType.Mine, id);
|
||||||
|
|
||||||
if (mine != null)
|
if (mine != null)
|
||||||
return mine;
|
return mine;
|
||||||
@@ -83,7 +84,7 @@ public class dbMineHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean CHANGE_RESOURCE(Mine mine, mbEnums.ResourceType resource) {
|
public boolean CHANGE_RESOURCE(Mine mine, Resource resource) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?")) {
|
||||||
|
|||||||
@@ -3,15 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.MobBase;
|
import engine.objects.MobBase;
|
||||||
import engine.objects.MobBaseEffects;
|
import engine.objects.MobBaseEffects;
|
||||||
import engine.objects.MobBaseStats;
|
import engine.objects.MobBaseStats;
|
||||||
@@ -27,7 +26,7 @@ public class dbMobBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMobBaseHandler() {
|
public dbMobBaseHandler() {
|
||||||
this.localClass = MobBase.class;
|
this.localClass = MobBase.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MobBase GET_MOBBASE(int id) {
|
public MobBase GET_MOBBASE(int id) {
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -25,7 +24,7 @@ public class dbMobHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbMobHandler() {
|
public dbMobHandler() {
|
||||||
this.localClass = Mob.class;
|
this.localClass = Mob.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mob PERSIST(Mob toAdd) {
|
public Mob PERSIST(Mob toAdd) {
|
||||||
|
|||||||
@@ -3,18 +3,18 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum.ProfitType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.ProfitType;
|
|
||||||
import engine.objects.NPC;
|
import engine.objects.NPC;
|
||||||
import engine.objects.NPCProfits;
|
import engine.objects.NPCProfits;
|
||||||
|
import engine.objects.ProducedItem;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,52 +23,12 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class dbNPCHandler extends dbHandlerBase {
|
public class dbNPCHandler extends dbHandlerBase {
|
||||||
|
|
||||||
public dbNPCHandler() {
|
public dbNPCHandler() {
|
||||||
this.localClass = NPC.class;
|
this.localClass = NPC.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
|
||||||
int runeSetID;
|
|
||||||
int runeBaseID;
|
|
||||||
int recordsRead = 0;
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_npc_runeSet")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
|
|
||||||
recordsRead++;
|
|
||||||
|
|
||||||
runeSetID = rs.getInt("runeSet");
|
|
||||||
runeBaseID = rs.getInt("runeBase");
|
|
||||||
|
|
||||||
if (runeSets.get(runeSetID) == null) {
|
|
||||||
ArrayList<Integer> runeList = new ArrayList<>();
|
|
||||||
runeList.add(runeBaseID);
|
|
||||||
runeSets.put(runeSetID, runeList);
|
|
||||||
} else {
|
|
||||||
ArrayList<Integer> runeList = runeSets.get(runeSetID);
|
|
||||||
runeList.add(runeSetID);
|
|
||||||
runeSets.put(runeSetID, runeList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return runeSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
|
|
||||||
return runeSets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NPC PERSIST(NPC toAdd) {
|
public NPC PERSIST(NPC toAdd) {
|
||||||
@@ -310,22 +270,6 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean UPDATE_RACE(NPC npc, int value) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_npc` SET `npc_raceID`=? WHERE `UID`=?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, value);
|
|
||||||
preparedStatement.setLong(2, npc.getObjectUUID());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_PIRATE_NAMES() {
|
public void LOAD_PIRATE_NAMES() {
|
||||||
|
|
||||||
String pirateName;
|
String pirateName;
|
||||||
@@ -361,6 +305,117 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
+ NPC._pirateNames.size() + " mobBases");
|
+ NPC._pirateNames.size() + " mobBases");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean ADD_TO_PRODUCTION_LIST(final long ID, final long npcUID, final long itemBaseID, DateTime dateTime, String prefix, String suffix, String name, boolean isRandom, int playerID) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_npc_production` (`ID`,`npcUID`, `itemBaseID`,`dateToUpgrade`, `isRandom`, `prefix`, `suffix`, `name`,`playerID`) VALUES (?,?,?,?,?,?,?,?,?)")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, ID);
|
||||||
|
preparedStatement.setLong(2, npcUID);
|
||||||
|
preparedStatement.setLong(3, itemBaseID);
|
||||||
|
preparedStatement.setTimestamp(4, new java.sql.Timestamp(dateTime.getMillis()));
|
||||||
|
preparedStatement.setBoolean(5, isRandom);
|
||||||
|
preparedStatement.setString(6, prefix);
|
||||||
|
preparedStatement.setString(7, suffix);
|
||||||
|
preparedStatement.setString(8, name);
|
||||||
|
preparedStatement.setInt(9, playerID);
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean REMOVE_FROM_PRODUCTION_LIST(final long ID, final long npcUID) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_npc_production` WHERE `ID`=? AND `npcUID`=?;")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, ID);
|
||||||
|
preparedStatement.setLong(2, npcUID);
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean UPDATE_ITEM_TO_INVENTORY(final long ID, final long npcUID) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `inForge`=? WHERE `ID`=? AND `npcUID`=?;")) {
|
||||||
|
|
||||||
|
preparedStatement.setByte(1, (byte) 0);
|
||||||
|
preparedStatement.setLong(2, ID);
|
||||||
|
preparedStatement.setLong(3, npcUID);
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean UPDATE_ITEM_PRICE(final long ID, final long npcUID, int value) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `value`=? WHERE `ID`=? AND `npcUID`=?;")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, value);
|
||||||
|
preparedStatement.setLong(2, ID);
|
||||||
|
preparedStatement.setLong(3, npcUID);
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean UPDATE_ITEM_ID(final long ID, final long npcUID, final long value) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_npc_production` SET `ID`=? WHERE `ID`=? AND `npcUID`=? LIMIT 1;")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, value);
|
||||||
|
preparedStatement.setLong(2, ID);
|
||||||
|
preparedStatement.setLong(3, npcUID);
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LOAD_ALL_ITEMS_TO_PRODUCE(NPC npc) {
|
||||||
|
|
||||||
|
if (npc == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_npc_production` WHERE `npcUID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, npc.getObjectUUID());
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
ProducedItem producedItem = new ProducedItem(rs);
|
||||||
|
npc.forgedItems.add(producedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean UPDATE_PROFITS(NPC npc, ProfitType profitType, float value) {
|
public boolean UPDATE_PROFITS(NPC npc, ProfitType profitType, float value) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Petition;
|
import engine.objects.Petition;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@ public class dbPetitionHandler extends dbHandlerBase {
|
|||||||
" VALUES (?,?,?,?,?,?,?,?,?);")) {
|
" VALUES (?,?,?,?,?,?,?,?,?);")) {
|
||||||
|
|
||||||
preparedStatement.setTimestamp(1, new java.sql.Timestamp(System.currentTimeMillis()));
|
preparedStatement.setTimestamp(1, new java.sql.Timestamp(System.currentTimeMillis()));
|
||||||
preparedStatement.setString(2, mbEnums.PetitionType.values()[petition.primaryType].name());
|
preparedStatement.setString(2, Enum.PetitionType.values()[petition.primaryType].name());
|
||||||
preparedStatement.setString(3, mbEnums.PetitionSubType.values()[petition.subType].name());
|
preparedStatement.setString(3, Enum.PetitionSubType.values()[petition.subType].name());
|
||||||
preparedStatement.setInt(4, petition.reportAccount.getObjectUUID());
|
preparedStatement.setInt(4, petition.reportAccount.getObjectUUID());
|
||||||
preparedStatement.setString(5, petition.reportAccount.getUname());
|
preparedStatement.setString(5, petition.reportAccount.getUname());
|
||||||
preparedStatement.setInt(6, petition.reportPlayer.getObjectUUID());
|
preparedStatement.setInt(6, petition.reportPlayer.getObjectUUID());
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.AbstractWorldObject;
|
import engine.objects.AbstractWorldObject;
|
||||||
import engine.objects.Heraldry;
|
import engine.objects.Heraldry;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
@@ -29,7 +29,7 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbPlayerCharacterHandler() {
|
public dbPlayerCharacterHandler() {
|
||||||
this.localClass = PlayerCharacter.class;
|
this.localClass = PlayerCharacter.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerCharacter ADD_PLAYER_CHARACTER(final PlayerCharacter toAdd) {
|
public PlayerCharacter ADD_PLAYER_CHARACTER(final PlayerCharacter toAdd) {
|
||||||
@@ -45,8 +45,8 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
|
|||||||
preparedStatement.setLong(1, toAdd.getAccount().getObjectUUID());
|
preparedStatement.setLong(1, toAdd.getAccount().getObjectUUID());
|
||||||
preparedStatement.setString(2, toAdd.getFirstName());
|
preparedStatement.setString(2, toAdd.getFirstName());
|
||||||
preparedStatement.setString(3, toAdd.getLastName());
|
preparedStatement.setString(3, toAdd.getLastName());
|
||||||
preparedStatement.setInt(4, toAdd.race.getRaceRuneID());
|
preparedStatement.setInt(4, toAdd.getRace().getRaceRuneID());
|
||||||
preparedStatement.setInt(5, toAdd.baseClass.getObjectUUID());
|
preparedStatement.setInt(5, toAdd.getBaseClass().getObjectUUID());
|
||||||
preparedStatement.setInt(6, toAdd.getStrMod());
|
preparedStatement.setInt(6, toAdd.getStrMod());
|
||||||
preparedStatement.setInt(7, toAdd.getDexMod());
|
preparedStatement.setInt(7, toAdd.getDexMod());
|
||||||
preparedStatement.setInt(8, toAdd.getConMod());
|
preparedStatement.setInt(8, toAdd.getConMod());
|
||||||
@@ -176,7 +176,7 @@ public class dbPlayerCharacterHandler extends dbHandlerBase {
|
|||||||
if (objectUUID == 0)
|
if (objectUUID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(mbEnums.GameObjectType.PlayerCharacter, objectUUID);
|
PlayerCharacter playerCharacter = (PlayerCharacter) DbManager.getFromCache(Enum.GameObjectType.PlayerCharacter, objectUUID);
|
||||||
|
|
||||||
if (playerCharacter != null)
|
if (playerCharacter != null)
|
||||||
return playerCharacter;
|
return playerCharacter;
|
||||||
|
|||||||
@@ -3,21 +3,20 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.PreparedStatementShared;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
@@ -25,41 +24,41 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbPowerHandler() {
|
public dbPowerHandler() {
|
||||||
this.localClass = Mob.class;
|
this.localClass = Mob.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addAllSourceTypes() {
|
public static void addAllSourceTypes() {
|
||||||
|
PreparedStatementShared ps = null;
|
||||||
try (Connection connection = DbManager.getConnection();
|
try {
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_sourcetype")) {
|
ps = new PreparedStatementShared("SELECT * FROM static_power_sourcetype");
|
||||||
|
ResultSet rs = ps.executeQuery();
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
String IDString, source;
|
String IDString, source;
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
IDString = rs.getString("IDString");
|
IDString = rs.getString("IDString");
|
||||||
int token = DbManager.hasher.SBStringHash(IDString);
|
int token = DbManager.hasher.SBStringHash(IDString);
|
||||||
|
|
||||||
|
|
||||||
source = rs.getString("source").replace("-", "").trim();
|
source = rs.getString("source").replace("-", "").trim();
|
||||||
mbEnums.EffectSourceType effectSourceType = mbEnums.EffectSourceType.GetEffectSourceType(source);
|
Enum.EffectSourceType effectSourceType = Enum.EffectSourceType.GetEffectSourceType(source);
|
||||||
|
|
||||||
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
|
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
|
||||||
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
|
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
|
||||||
|
|
||||||
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
|
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
|
} finally {
|
||||||
|
ps.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addAllAnimationOverrides() {
|
public static void addAllAnimationOverrides() {
|
||||||
|
PreparedStatementShared ps = null;
|
||||||
try (Connection connection = DbManager.getConnection();
|
try {
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_animation_override")) {
|
ps = new PreparedStatementShared("SELECT * FROM static_power_animation_override");
|
||||||
|
ResultSet rs = ps.executeQuery();
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
String IDString;
|
String IDString;
|
||||||
int animation;
|
int animation;
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
@@ -73,10 +72,12 @@ public class dbPowerHandler extends dbHandlerBase {
|
|||||||
PowersManager.AnimationOverrides.put(IDString, animation);
|
PowersManager.AnimationOverrides.put(IDString, animation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
rs.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
} finally {
|
||||||
|
ps.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.PromotionClass;
|
import engine.objects.PromotionClass;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ public class dbPromotionClassHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbPromotionClassHandler() {
|
public dbPromotionClassHandler() {
|
||||||
this.localClass = PromotionClass.class;
|
this.localClass = PromotionClass.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> GET_ALLOWED_RUNES(final PromotionClass pc) {
|
public ArrayList<Integer> GET_ALLOWED_RUNES(final PromotionClass pc) {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.RuneBaseAttribute;
|
import engine.objects.RuneBaseAttribute;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ public class dbRuneBaseAttributeHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbRuneBaseAttributeHandler() {
|
public dbRuneBaseAttributeHandler() {
|
||||||
this.localClass = RuneBaseAttribute.class;
|
this.localClass = RuneBaseAttribute.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
|
public ArrayList<RuneBaseAttribute> GET_ATTRIBUTES_FOR_RUNEBASE() {
|
||||||
|
|||||||
@@ -3,15 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.RuneBaseEffect;
|
import engine.objects.RuneBaseEffect;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -27,7 +26,7 @@ public class dbRuneBaseEffectHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbRuneBaseEffectHandler() {
|
public dbRuneBaseEffectHandler() {
|
||||||
this.localClass = RuneBaseEffect.class;
|
this.localClass = RuneBaseEffect.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<RuneBaseEffect> GET_EFFECTS_FOR_RUNEBASE(int id) {
|
public ArrayList<RuneBaseEffect> GET_EFFECTS_FOR_RUNEBASE(int id) {
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.RuneBase;
|
import engine.objects.RuneBase;
|
||||||
import engine.powers.RunePowerEntry;
|
import engine.powers.RunePowerEntry;
|
||||||
import engine.powers.RuneSkillAdjustEntry;
|
import engine.powers.RuneSkillAdjustEntry;
|
||||||
@@ -27,7 +26,7 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbRuneBaseHandler() {
|
public dbRuneBaseHandler() {
|
||||||
this.localClass = RuneBase.class;
|
this.localClass = RuneBase.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
public static HashMap<Integer, ArrayList<RunePowerEntry>> LOAD_RUNE_POWERS() {
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Portal;
|
import engine.objects.Portal;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -49,7 +49,7 @@ public class dbRunegateHandler extends dbHandlerBase {
|
|||||||
public ArrayList<Portal> GET_PORTAL_LIST(int gateUID) {
|
public ArrayList<Portal> GET_PORTAL_LIST(int gateUID) {
|
||||||
|
|
||||||
ArrayList<Portal> portalList = new ArrayList<>();
|
ArrayList<Portal> portalList = new ArrayList<>();
|
||||||
Building sourceBuilding = (Building) DbManager.getObject(mbEnums.GameObjectType.Building, gateUID);
|
Building sourceBuilding = (Building) DbManager.getObject(Enum.GameObjectType.Building, gateUID);
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_runegate_portals` WHERE `sourceBuilding` = ?;")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_runegate_portals` WHERE `sourceBuilding` = ?;")) {
|
||||||
@@ -60,8 +60,8 @@ public class dbRunegateHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
int targetBuildingID = rs.getInt("targetBuilding");
|
int targetBuildingID = rs.getInt("targetBuilding");
|
||||||
Building targetBuilding = (Building) DbManager.getObject(mbEnums.GameObjectType.Building, targetBuildingID);
|
Building targetBuilding = (Building) DbManager.getObject(Enum.GameObjectType.Building, targetBuildingID);
|
||||||
mbEnums.PortalType portalType = mbEnums.PortalType.valueOf(rs.getString("portalType"));
|
Enum.PortalType portalType = Enum.PortalType.valueOf(rs.getString("portalType"));
|
||||||
Portal portal = new Portal(sourceBuilding, portalType, targetBuilding);
|
Portal portal = new Portal(sourceBuilding, portalType, targetBuilding);
|
||||||
portalList.add(portal);
|
portalList.add(portal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum.ProtectionState;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.ProtectionState;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Shrine;
|
import engine.objects.Shrine;
|
||||||
@@ -29,7 +28,7 @@ public class dbShrineHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbShrineHandler() {
|
public dbShrineHandler() {
|
||||||
this.localClass = Shrine.class;
|
this.localClass = Shrine.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.MaxSkills;
|
import engine.objects.MaxSkills;
|
||||||
import engine.objects.SkillsBase;
|
import engine.objects.SkillsBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -27,7 +27,7 @@ public class dbSkillBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbSkillBaseHandler() {
|
public dbSkillBaseHandler() {
|
||||||
this.localClass = SkillsBase.class;
|
this.localClass = SkillsBase.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkillsBase GET_BASE(final int objectUUID) {
|
public SkillsBase GET_BASE(final int objectUUID) {
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.SkillReq;
|
import engine.objects.SkillReq;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -26,7 +25,7 @@ public class dbSkillReqHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbSkillReqHandler() {
|
public dbSkillReqHandler() {
|
||||||
this.localClass = SkillReq.class;
|
this.localClass = SkillReq.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<PowersBase> getAllPowersBase() {
|
public static ArrayList<PowersBase> getAllPowersBase() {
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.VendorDialog;
|
import engine.objects.VendorDialog;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ public class dbVendorDialogHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbVendorDialogHandler() {
|
public dbVendorDialogHandler() {
|
||||||
this.localClass = VendorDialog.class;
|
this.localClass = VendorDialog.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public VendorDialog GET_VENDORDIALOG(final int objectUUID) {
|
public VendorDialog GET_VENDORDIALOG(final int objectUUID) {
|
||||||
|
|
||||||
VendorDialog vendorDialog = (VendorDialog) DbManager.getFromCache(mbEnums.GameObjectType.VendorDialog, objectUUID);
|
VendorDialog vendorDialog = (VendorDialog) DbManager.getFromCache(Enum.GameObjectType.VendorDialog, objectUUID);
|
||||||
|
|
||||||
if (vendorDialog != null)
|
if (vendorDialog != null)
|
||||||
return vendorDialog;
|
return vendorDialog;
|
||||||
|
|||||||
@@ -3,26 +3,20 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
|
import engine.Enum.ProtectionState;
|
||||||
|
import engine.Enum.TransactionType;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ForgeManager;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.loot.WorkOrder;
|
import engine.objects.*;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.mbEnums.TransactionType;
|
|
||||||
import engine.objects.Building;
|
|
||||||
import engine.objects.City;
|
|
||||||
import engine.objects.Transaction;
|
|
||||||
import engine.objects.Warehouse;
|
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -37,10 +31,463 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
private static final ConcurrentHashMap<Integer, String> columns = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
private static final ConcurrentHashMap<Integer, String> columns = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
|
|
||||||
public dbWarehouseHandler() {
|
public dbWarehouseHandler() {
|
||||||
|
this.localClass = Warehouse.class;
|
||||||
|
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, mbEnums.ResourceType resource, int amount, DateTime date) {
|
public static void addObject(ArrayList<AbstractGameObject> list, ResultSet rs) throws SQLException {
|
||||||
|
String type = rs.getString("type");
|
||||||
|
switch (type) {
|
||||||
|
case "building":
|
||||||
|
Building building = new Building(rs);
|
||||||
|
DbManager.addToCache(building);
|
||||||
|
list.add(building);
|
||||||
|
break;
|
||||||
|
case "warehouse":
|
||||||
|
Warehouse warehouse = new Warehouse(rs);
|
||||||
|
DbManager.addToCache(warehouse);
|
||||||
|
list.add(warehouse);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<AbstractGameObject> CREATE_WAREHOUSE(int parentZoneID, int OwnerUUID, String name, int meshUUID,
|
||||||
|
Vector3fImmutable location, float meshScale, int currentHP,
|
||||||
|
ProtectionState protectionState, int currentGold, int rank,
|
||||||
|
DateTime upgradeDate, int blueprintUUID, float w, float rotY) {
|
||||||
|
|
||||||
|
ArrayList<AbstractGameObject> warehouseList = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("CALL `WAREHOUSE_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? ,? ,?, ?);")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, parentZoneID);
|
||||||
|
preparedStatement.setInt(2, OwnerUUID);
|
||||||
|
preparedStatement.setString(3, name);
|
||||||
|
preparedStatement.setInt(4, meshUUID);
|
||||||
|
preparedStatement.setFloat(5, location.x);
|
||||||
|
preparedStatement.setFloat(6, location.y);
|
||||||
|
preparedStatement.setFloat(7, location.z);
|
||||||
|
preparedStatement.setFloat(8, meshScale);
|
||||||
|
preparedStatement.setInt(9, currentHP);
|
||||||
|
preparedStatement.setString(10, protectionState.name());
|
||||||
|
preparedStatement.setInt(11, currentGold);
|
||||||
|
preparedStatement.setInt(12, rank);
|
||||||
|
|
||||||
|
if (upgradeDate != null)
|
||||||
|
preparedStatement.setTimestamp(13, new java.sql.Timestamp(upgradeDate.getMillis()));
|
||||||
|
else
|
||||||
|
preparedStatement.setNull(13, java.sql.Types.DATE);
|
||||||
|
|
||||||
|
preparedStatement.setInt(14, blueprintUUID);
|
||||||
|
preparedStatement.setFloat(15, w);
|
||||||
|
preparedStatement.setFloat(16, rotY);
|
||||||
|
|
||||||
|
preparedStatement.execute();
|
||||||
|
ResultSet rs = preparedStatement.getResultSet();
|
||||||
|
|
||||||
|
while (rs.next())
|
||||||
|
addObject(warehouseList, rs);
|
||||||
|
|
||||||
|
while (preparedStatement.getMoreResults()) {
|
||||||
|
rs = preparedStatement.getResultSet();
|
||||||
|
|
||||||
|
while (rs.next())
|
||||||
|
addObject(warehouseList, rs);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return warehouseList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateLocks(final Warehouse wh, long locks) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_locks`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setLong(1, locks);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateGold(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_gold`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateStone(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_stone`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateTruesteel(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_truesteel`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateIron(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_iron`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateAdamant(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_adamant`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateLumber(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_lumber`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateOak(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_oak`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateBronzewood(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bronzewood`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateMandrake(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mandrake`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateCoal(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_coal`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateAgate(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_agate`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateDiamond(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_diamond`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateOnyx(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_onyx`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateAzoth(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_azoth`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateOrichalk(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_orichalk`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateAntimony(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_antimony`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateSulfur(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_sulfur`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateQuicksilver(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_quicksilver`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateGalvor(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_galvor`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateWormwood(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_wormwood`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateObsidian(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_obsidian`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateBloodstone(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_bloodstone`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateMithril(final Warehouse wh, int amount) {
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_warehouse` SET `warehouse_mithril`=? WHERE `UID` = ?")) {
|
||||||
|
|
||||||
|
preparedStatement.setInt(1, amount);
|
||||||
|
preparedStatement.setInt(2, wh.getUID());
|
||||||
|
|
||||||
|
return (preparedStatement.executeUpdate() > 0);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean CREATE_TRANSACTION(int warehouseBuildingID, GameObjectType targetType, int targetUUID, TransactionType transactionType, Resource resource, int amount, DateTime date) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse_transactions` (`warehouseUID`, `targetType`,`targetUID`, `type`,`resource`,`amount`,`date` ) VALUES (?,?,?,?,?,?,?)")) {
|
||||||
@@ -85,150 +532,24 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
return transactionsList;
|
return transactionsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DELETE_WAREHOUSE(Warehouse warehouse) {
|
public void LOAD_ALL_WAREHOUSES() {
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_warehouse` WHERE `cityUUID` = ?;")) {
|
|
||||||
preparedStatement.setInt(1, warehouse.city.getObjectUUID());
|
|
||||||
preparedStatement.executeUpdate();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
Warehouse warehouse;
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean UPDATE_WAREHOUSE(Warehouse warehouse) {
|
|
||||||
|
|
||||||
JSONObject warehouseJSON = new JSONObject();
|
|
||||||
|
|
||||||
JSONObject resources = new JSONObject(warehouse.resources);
|
|
||||||
warehouseJSON.put("resources", resources);
|
|
||||||
|
|
||||||
JSONArray locks = new JSONArray();
|
|
||||||
|
|
||||||
for (mbEnums.ResourceType resource : warehouse.locked)
|
|
||||||
locks.put(resource.name());
|
|
||||||
|
|
||||||
warehouseJSON.put("locked", locks);
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse` (`cityUUID`, `warehouse`) VALUES (?, ?) " +
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_warehouse`.*, `object`.`parent`, `object`.`type` FROM `object` LEFT JOIN `obj_warehouse` ON `object`.`UID` = `obj_warehouse`.`UID` WHERE `object`.`type` = 'warehouse';")) {
|
||||||
"ON DUPLICATE KEY UPDATE `warehouse` = VALUES(`warehouse`)")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, warehouse.city.getObjectUUID());
|
|
||||||
preparedStatement.setString(2, warehouseJSON.toString());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_WAREHOUSES() {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_warehouse`;");
|
|
||||||
ResultSet rs = preparedStatement.executeQuery()) {
|
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
int cityUID = rs.getInt("cityUUID");
|
warehouse = new Warehouse(rs);
|
||||||
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
|
warehouse.runAfterLoad();
|
||||||
City city = City.getCity(cityUID);
|
warehouse.loadAllTransactions();
|
||||||
|
|
||||||
if (city == null) {
|
|
||||||
Logger.error("No city " + cityUID + " for warehouse");
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
city.warehouse = new Warehouse(jsonObject);
|
|
||||||
city.warehouse.city = city;
|
|
||||||
|
|
||||||
// Locate warehouse building
|
|
||||||
for (Building building : city.parentZone.zoneBuildingSet) {
|
|
||||||
if (building.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.WAREHOUSE)) {
|
|
||||||
city.warehouse.building = building;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean WRITE_WORKORDER(WorkOrder workOrder) {
|
|
||||||
|
|
||||||
JSONObject warehouseJSON = WorkOrder.toJson(workOrder);
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_workorders` (`workorderID`, `workorder`) VALUES (?, ?) " +
|
|
||||||
"ON DUPLICATE KEY UPDATE `workorder` = VALUES(`workorder`)")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, workOrder.workOrderID);
|
|
||||||
preparedStatement.setString(2, warehouseJSON.toString());
|
|
||||||
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DELETE_WORKORDER(WorkOrder workOrder) {
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_workorders` WHERE `workorderID` = ?;")) {
|
|
||||||
preparedStatement.setInt(1, workOrder.workOrderID);
|
|
||||||
preparedStatement.executeUpdate();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_WORKORDERS() {
|
|
||||||
|
|
||||||
// Method loads NPC workOrders from disk at bootstrap.
|
|
||||||
// A workOrder will persist until completed or junked
|
|
||||||
// via the client interface.
|
|
||||||
|
|
||||||
ArrayList<WorkOrder> submitList = new ArrayList<>();
|
|
||||||
ArrayList<WorkOrder> orphanList = new ArrayList<>();
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_workorders`;");
|
|
||||||
ResultSet rs = preparedStatement.executeQuery()) {
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
JSONObject jsonObject = new JSONObject(rs.getString("workorder"));
|
|
||||||
WorkOrder workOrder = new WorkOrder(jsonObject);
|
|
||||||
submitList.add(workOrder);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Submit new workOrders to the ForgeManager
|
|
||||||
|
|
||||||
for (WorkOrder workOrder : submitList) {
|
|
||||||
|
|
||||||
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder);
|
|
||||||
|
|
||||||
// Delete but do not reconstitute orphan workOrders
|
|
||||||
|
|
||||||
if (workOrder.vendor == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
workOrder.workOrderID = ForgeManager.workOrderCounter.incrementAndGet();
|
|
||||||
DbManager.WarehouseQueries.WRITE_WORKORDER(workOrder);
|
|
||||||
ForgeManager.vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder);
|
|
||||||
ForgeManager.forge.add(workOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import engine.objects.ZoneTemplate;
|
import engine.objects.ZoneTemplate;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -26,7 +26,7 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public dbZoneHandler() {
|
public dbZoneHandler() {
|
||||||
this.localClass = Zone.class;
|
this.localClass = Zone.class;
|
||||||
this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName());
|
this.localObjectType = Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Zone> GET_ALL_ZONES() {
|
public ArrayList<Zone> GET_ALL_ZONES() {
|
||||||
@@ -48,7 +48,7 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public Zone GET_BY_UID(long ID) {
|
public Zone GET_BY_UID(long ID) {
|
||||||
|
|
||||||
Zone zone = (Zone) DbManager.getFromCache(mbEnums.GameObjectType.Zone, (int) ID);
|
Zone zone = (Zone) DbManager.getFromCache(Enum.GameObjectType.Zone, (int) ID);
|
||||||
|
|
||||||
if (zone != null)
|
if (zone != null)
|
||||||
return zone;
|
return zone;
|
||||||
@@ -90,8 +90,8 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
zoneTemplate.max_blend = 128;
|
zoneTemplate.max_blend = 128;
|
||||||
zoneTemplate.min_blend = 128;
|
zoneTemplate.min_blend = 128;
|
||||||
zoneTemplate.terrain_max_y = 5;
|
zoneTemplate.terrain_max_y = 5;
|
||||||
zoneTemplate.major_radius = (int) mbEnums.CityBoundsType.ZONE.halfExtents;
|
zoneTemplate.major_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
||||||
zoneTemplate.minor_radius = (int) mbEnums.CityBoundsType.ZONE.halfExtents;
|
zoneTemplate.minor_radius = (int) Enum.CityBoundsType.ZONE.halfExtents;
|
||||||
zoneTemplate.terrain_type = "PLANAR";
|
zoneTemplate.terrain_type = "PLANAR";
|
||||||
|
|
||||||
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
ZoneManager._zone_templates.put(zoneTemplate.templateID, zoneTemplate);
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd;
|
package engine.devcmd;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.ProtectionState;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
@@ -16,7 +17,6 @@ import engine.gameManager.DbManager;
|
|||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mbEnums.ProtectionState;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
@@ -32,7 +32,7 @@ public class AddGoldCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item gold = pc.charItemManager.getGoldInventory();
|
Item gold = pc.getCharItemManager().getGoldInventory();
|
||||||
int curAmt;
|
int curAmt;
|
||||||
if (gold == null)
|
if (gold == null)
|
||||||
curAmt = 0;
|
curAmt = 0;
|
||||||
@@ -54,13 +54,13 @@ public class AddGoldCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pc.charItemManager.addGoldToInventory(amt, true)) {
|
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
||||||
throwbackError(pc, "Failed to add gold to inventory");
|
throwbackError(pc, "Failed to add gold to inventory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
||||||
pc.charItemManager.updateInventory();
|
pc.getCharItemManager().updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,22 +3,25 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.mbEnums;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.*;
|
||||||
import engine.objects.Mob;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Zone;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eighty
|
||||||
|
*/
|
||||||
public class AddMobCmd extends AbstractDevCmd {
|
public class AddMobCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public AddMobCmd() {
|
public AddMobCmd() {
|
||||||
@@ -35,8 +38,27 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
int loadID;
|
if (words[0].equals("all")) {
|
||||||
|
|
||||||
|
for (AbstractGameObject mobbaseAGO : DbManager.getList(GameObjectType.MobBase)) {
|
||||||
|
MobBase mb = (MobBase) mobbaseAGO;
|
||||||
|
int loadID = mb.getObjectUUID();
|
||||||
|
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||||
|
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||||
|
if (mob != null) {
|
||||||
|
mob.updateDatabase();
|
||||||
|
this.setResult(String.valueOf(mob.getDBID()));
|
||||||
|
} else {
|
||||||
|
throwbackError(pc, "Failed to create mob of type " + loadID);
|
||||||
|
Logger.error("Failed to create mob of type "
|
||||||
|
+ loadID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int loadID;
|
||||||
try {
|
try {
|
||||||
loadID = Integer.parseInt(words[0]);
|
loadID = Integer.parseInt(words[0]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
@@ -50,6 +72,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (zone == null) {
|
if (zone == null) {
|
||||||
throwbackError(pc, "Failed to find zone to place mob in.");
|
throwbackError(pc, "Failed to find zone to place mob in.");
|
||||||
return;
|
return;
|
||||||
@@ -60,9 +83,9 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
|
||||||
null, zone, null, null, "", 1, mbEnums.AIAgentType.MOBILE);
|
|
||||||
|
|
||||||
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
|
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.PowerActionType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.mbEnums.PowerActionType;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.powers.ActionsBase;
|
import engine.powers.ActionsBase;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.ModType;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.net.ItemProductionManager;
|
||||||
|
import engine.objects.*;
|
||||||
|
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||||
|
import engine.powers.poweractions.AbstractPowerAction;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
public class AuditFailedItemsCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public AuditFailedItemsCmd() {
|
||||||
|
super("faileditems");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
|
||||||
|
if (ItemProductionManager.FailedItems.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Logger.info("Auditing Item production Failed Items");
|
||||||
|
|
||||||
|
String newLine = "\r\n";
|
||||||
|
String auditFailedItem = "Failed Item Name | Prefix | Suffix | NPC | Contract | Player | ";
|
||||||
|
|
||||||
|
for (ProducedItem failedItem : ItemProductionManager.FailedItems) {
|
||||||
|
|
||||||
|
String npcName = "";
|
||||||
|
String playerName = "";
|
||||||
|
String contractName = "";
|
||||||
|
|
||||||
|
String prefix = "";
|
||||||
|
String suffix = "";
|
||||||
|
String itemName = "";
|
||||||
|
NPC npc = NPC.getFromCache(failedItem.getNpcUID());
|
||||||
|
|
||||||
|
if (npc == null) {
|
||||||
|
npcName = "null";
|
||||||
|
contractName = "null";
|
||||||
|
} else {
|
||||||
|
npcName = npc.getName();
|
||||||
|
if (npc.getContract() != null)
|
||||||
|
contractName = npc.getContract().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerCharacter roller = PlayerCharacter.getFromCache(failedItem.getPlayerID());
|
||||||
|
|
||||||
|
if (roller == null)
|
||||||
|
playerName = "null";
|
||||||
|
else
|
||||||
|
playerName = roller.getName();
|
||||||
|
|
||||||
|
ItemBase ib = ItemBase.getItemBase(failedItem.getItemBaseID());
|
||||||
|
|
||||||
|
if (ib != null) {
|
||||||
|
itemName = ib.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failedItem.isRandom() == false) {
|
||||||
|
if (failedItem.getPrefix().isEmpty() == false) {
|
||||||
|
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getPrefix());
|
||||||
|
if (pa != null) {
|
||||||
|
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
|
||||||
|
if (aem.modType.equals(ModType.ItemName)) {
|
||||||
|
prefix = aem.getString1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failedItem.getSuffix().isEmpty() == false) {
|
||||||
|
AbstractPowerAction pa = PowersManager.getPowerActionByIDString(failedItem.getSuffix());
|
||||||
|
if (pa != null) {
|
||||||
|
for (AbstractEffectModifier aem : pa.getEffectsBase().getModifiers()) {
|
||||||
|
if (aem.modType.equals(ModType.ItemName)) {
|
||||||
|
suffix = aem.getString1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
prefix = "random";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
auditFailedItem += newLine;
|
||||||
|
auditFailedItem += itemName + " | " + prefix + " | " + suffix + " | " + failedItem.getNpcUID() + ":" + npcName + " | " + contractName + " | " + failedItem.getPlayerID() + ":" + playerName;
|
||||||
|
|
||||||
|
}
|
||||||
|
Logger.info(auditFailedItem);
|
||||||
|
ItemProductionManager.FailedItems.clear();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /bounds'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Audits all the mobs in a zone.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.Zone;
|
||||||
|
|
||||||
|
public class AuditMobsCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public AuditMobsCmd() {
|
||||||
|
super("auditmobs");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//get Zone to check mobs against
|
||||||
|
|
||||||
|
Zone zone;
|
||||||
|
|
||||||
|
if (words.length == 2) {
|
||||||
|
if (words[0].equals("all")) {
|
||||||
|
int plusplus = 0;
|
||||||
|
int count = Integer.parseInt(words[1]);
|
||||||
|
for (Zone zoneMicro : ZoneManager.getAllZones()) {
|
||||||
|
int size = zoneMicro.zoneMobSet.size();
|
||||||
|
|
||||||
|
if (size >= count) {
|
||||||
|
plusplus++;
|
||||||
|
throwbackInfo(pcSender, zoneMicro.zoneName + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
||||||
|
System.out.println(zoneMicro.zoneName + " at location " + zoneMicro.getLoc().toString() + " has " + size + " mobs. ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
throwbackInfo(pcSender, " there are " + plusplus + " zones with at least " + count + " mobs in each.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (words.length > 1) {
|
||||||
|
this.sendUsage(pcSender);
|
||||||
|
return;
|
||||||
|
} else if (words.length == 1) {
|
||||||
|
int uuid;
|
||||||
|
try {
|
||||||
|
uuid = Integer.parseInt(words[0]);
|
||||||
|
zone = ZoneManager.getZoneByUUID(uuid);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
zone = ZoneManager.findSmallestZone(pcSender.getLoc());
|
||||||
|
|
||||||
|
if (zone == null) {
|
||||||
|
throwbackError(pcSender, "Unable to find the zone");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get list of mobs for zone
|
||||||
|
|
||||||
|
if (zone.zoneMobSet.isEmpty()) {
|
||||||
|
throwbackError(pcSender, "No mobs found for this zone.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConcurrentHashMap<Integer, Mob> spawnMap = Mob.getSpawnMap();
|
||||||
|
//ConcurrentHashMap<Mob, Long> respawnMap = Mob.getRespawnMap();
|
||||||
|
// ConcurrentHashMap<Mob, Long> despawnMap = Mob.getDespawnMap();
|
||||||
|
|
||||||
|
throwbackInfo(pcSender, zone.zoneName + ", numMobs: " + zone.zoneMobSet.size());
|
||||||
|
throwbackInfo(pcSender, "UUID, dbID, inRespawnMap, isAlive, activeAI, Loc");
|
||||||
|
|
||||||
|
|
||||||
|
//mob not found in spawn map, check respawn
|
||||||
|
boolean inRespawn = false;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /auditmobs [zone.UUID]'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Audits all the mobs in a zone.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,14 +3,14 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.mbEnums.GameObjectType;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.gameManager.SessionManager;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.util.MiscUtils;
|
||||||
|
|
||||||
|
public class ChangeNameCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public ChangeNameCmd() {
|
||||||
|
super("changename");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
Vector3fImmutable loc = null;
|
||||||
|
|
||||||
|
// Arg Count Check
|
||||||
|
if (words.length < 2) {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String oldFirst = words[0];
|
||||||
|
String newFirst = words[1];
|
||||||
|
String newLast = "";
|
||||||
|
if (words.length > 2) {
|
||||||
|
newLast = words[2];
|
||||||
|
for (int i = 3; i < words.length; i++)
|
||||||
|
newLast += ' ' + words[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//verify new name length
|
||||||
|
if (newFirst.length() < 3) {
|
||||||
|
this.throwbackError(pc, "Error: First name is incorrect length. Must be between 3 and 15 characters");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//verify old name length
|
||||||
|
if (newLast.length() > 50) {
|
||||||
|
this.throwbackError(pc, "Error: Last name is incorrect length. Must be no more than 50 characters");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if firstname is valid
|
||||||
|
if (MiscUtils.checkIfFirstNameInvalid(newFirst)) {
|
||||||
|
this.throwbackError(pc, "Error: First name is not allowed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//get the world ID we're modifying for
|
||||||
|
|
||||||
|
//test if first name is unique, unless new and old first name are equal.
|
||||||
|
if (!(oldFirst.equals(newFirst))) {
|
||||||
|
if (!DbManager.PlayerCharacterQueries.IS_CHARACTER_NAME_UNIQUE(newFirst)) {
|
||||||
|
this.throwbackError(pc, "Error: First name is not unique.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//tests passed, update name in database
|
||||||
|
if (!DbManager.PlayerCharacterQueries.UPDATE_NAME(oldFirst, newFirst, newLast)) {
|
||||||
|
this.throwbackError(pc, "Error: Database failed to update the name.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Finally update player ingame
|
||||||
|
PlayerCharacter pcTar = null;
|
||||||
|
try {
|
||||||
|
pcTar = SessionManager
|
||||||
|
.getPlayerCharacterByLowerCaseName(words[0]);
|
||||||
|
pcTar.setFirstName(newFirst);
|
||||||
|
pcTar.setLastName(newLast);
|
||||||
|
this.setTarget(pcTar); //for logging
|
||||||
|
|
||||||
|
//specify if last name is ascii characters only
|
||||||
|
String lastAscii = newLast.replaceAll("[^\\p{ASCII}]", "");
|
||||||
|
pcTar.setAsciiLastName(lastAscii.equals(newLast));
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.throwbackError(pc, "Database was updated but ingame character failed to update.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String out = oldFirst + " was changed to " + newFirst + (newLast.isEmpty() ? "." : (' ' + newLast + '.'));
|
||||||
|
this.throwbackInfo(pc, out);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Changes the name of a player";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "'./changename oldFirstName newFirstName newLastName'";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.net.client.msg.TargetedActionMsg;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eighty
|
||||||
|
*/
|
||||||
|
public class CombatMessageCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public CombatMessageCmd() {
|
||||||
|
super("cm");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
if (pcSender == null)
|
||||||
|
return;
|
||||||
|
if (args.length != 1) {
|
||||||
|
this.sendUsage(pcSender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int num = 0;
|
||||||
|
try {
|
||||||
|
num = Integer.parseInt(args[0]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throwbackError(pcSender, "Supplied message number " + args[0] + " failed to parse to an Integer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TargetedActionMsg.un2cnt = num;
|
||||||
|
throwbackInfo(pcSender, "CombatMessage set to " + num);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /cm [cmNumber]'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Sets the combat message to the supplied integer value";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,21 +3,17 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.mbEnums;
|
|
||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Item;
|
import engine.objects.ItemBase;
|
||||||
import engine.objects.ItemTemplate;
|
import engine.objects.ItemFactory;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
@@ -29,46 +25,30 @@ public class CreateItemCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
AbstractGameObject target) {
|
AbstractGameObject target) {
|
||||||
|
|
||||||
if (words.length < 2) {
|
if (words.length < 2) {
|
||||||
this.sendUsage(playerCharacter);
|
this.sendUsage(pc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int id;
|
||||||
|
id = ItemBase.getIDByName(words[0]);
|
||||||
|
|
||||||
|
if (id == 0)
|
||||||
|
id = Integer.parseInt(words[0]);
|
||||||
|
if (id == 7) {
|
||||||
|
this.throwbackInfo(pc, "use /addgold to add gold.....");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int templateID = Integer.parseInt(words[0]);
|
|
||||||
ItemTemplate template = ItemTemplate.templates.get(templateID);
|
|
||||||
|
|
||||||
if (template == null) {
|
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "No such template found.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int size = 1;
|
int size = 1;
|
||||||
|
|
||||||
if (words.length == 2)
|
if (words.length < 3) {
|
||||||
size = Integer.parseInt(words[1]);
|
size = Integer.parseInt(words[1]);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
|
||||||
|
|
||||||
if (!playerCharacter.charItemManager.hasRoomInventory(template.item_wt)) {
|
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "You are encumbered!.");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item item = new Item(templateID);
|
ItemFactory.fillInventory(pc, id, size);
|
||||||
item.ownerID = playerCharacter.getObjectUUID();
|
|
||||||
item.ownerType = mbEnums.OwnerType.PlayerCharacter;
|
|
||||||
item.containerType = mbEnums.ItemContainerType.INVENTORY;
|
|
||||||
|
|
||||||
try {
|
|
||||||
item = DbManager.ItemQueries.PERSIST(item);
|
|
||||||
playerCharacter.charItemManager.addItemToInventory(item);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
playerCharacter.charItemManager.updateInventory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -78,7 +58,7 @@ public class CreateItemCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getUsageString() {
|
protected String _getUsageString() {
|
||||||
return "' /createitem <templateID> <quantity>'";
|
return "' /createitem <ItembaseID> <quantity>'";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.jobs.DebugTimerJob;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
public class DebugCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
|
||||||
|
public DebugCmd() {
|
||||||
|
super("debug");
|
||||||
|
// super("debug", MBServerStatics.ACCESS_GROUP_ALL_TEAM, 0, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void toggleDebugTimer(PlayerCharacter pc, String name, int num, int duration, boolean toggle) {
|
||||||
|
if (toggle) {
|
||||||
|
DebugTimerJob dtj = new DebugTimerJob(pc, name, num, duration);
|
||||||
|
pc.renewTimer(name, dtj, duration);
|
||||||
|
} else
|
||||||
|
pc.cancelTimer(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
if (words.length < 2) {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pc == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//pc.setDebug must use bit sizes: 1, 2, 4, 8, 16, 32
|
||||||
|
|
||||||
|
String command = words[0].toLowerCase();
|
||||||
|
boolean toggle = (words[1].toLowerCase().equals("on")) ? true : false;
|
||||||
|
|
||||||
|
switch (command) {
|
||||||
|
case "magictrek":
|
||||||
|
pc.RUN_MAGICTREK = toggle;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "combat":
|
||||||
|
pc.setDebug(64, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "health":
|
||||||
|
toggleDebugTimer(pc, "Debug_Health", 1, 1000, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "mana":
|
||||||
|
toggleDebugTimer(pc, "Debug_Mana", 2, 1000, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "stamina":
|
||||||
|
toggleDebugTimer(pc, "Debug_Stamina", 3, 500, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "spells":
|
||||||
|
pc.setDebug(16, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "damageabsorber":
|
||||||
|
pc.setDebug(2, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "recast":
|
||||||
|
case "recycle":
|
||||||
|
pc.setDebug(4, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "seeinvis":
|
||||||
|
pc.setDebug(8, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "movement":
|
||||||
|
pc.setDebug(1, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "noaggro":
|
||||||
|
pc.setDebug(32, toggle);
|
||||||
|
|
||||||
|
break;
|
||||||
|
// case "loot":
|
||||||
|
// MBServerStatics.debugLoot = toggle;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
String output = "Debug for " + command + " not found.";
|
||||||
|
throwbackError(pc, output);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setTarget(pc); //for logging
|
||||||
|
|
||||||
|
String output = "Debug for " + command + " turned " + ((toggle) ? "on." : "off.");
|
||||||
|
throwbackInfo(pc, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Runs debug commands";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "'./Debug command on/off'";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
public class DebugMeleeSyncCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public DebugMeleeSyncCmd() {
|
||||||
|
super("debugmeleesync");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
// Arg Count Check
|
||||||
|
if (words.length != 1) {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String s = words[0].toLowerCase();
|
||||||
|
|
||||||
|
if (s.equals("on")) {
|
||||||
|
pc.setDebug(64, true);
|
||||||
|
ChatManager.chatSayInfo(pc, "Melee Sync Debug ON");
|
||||||
|
} else if (s.equals("off")) {
|
||||||
|
pc.setDebug(64, false);
|
||||||
|
ChatManager.chatSayInfo(pc, "Melee Sync Debug OFF");
|
||||||
|
} else {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Turns on/off melee sync debugging.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "'./debugmeleesync on|off'";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.DbManager;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DecachePlayerCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public DecachePlayerCmd() {
|
||||||
|
super("decacheplayer");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
if (words.length < 1) {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
int objectUUID = Integer.parseInt(words[0]);
|
||||||
|
|
||||||
|
if (DbManager.inCache(Enum.GameObjectType.PlayerCharacter, objectUUID)) {
|
||||||
|
this.setTarget(PlayerCharacter.getFromCache(objectUUID)); //for logging
|
||||||
|
PlayerCharacter.getFromCache(objectUUID).removeFromCache();
|
||||||
|
} else {
|
||||||
|
this.sendHelp(pc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "No player found. Please make sure the table ID is correct.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /decacheplayer <UUID>'";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.Mob;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
public class DespawnCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public DespawnCmd() {
|
||||||
|
super("debugmob");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
|
||||||
|
if (pc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Mob mob = null;
|
||||||
|
|
||||||
|
if (target != null && target.getObjectType().equals(GameObjectType.Mob))
|
||||||
|
mob = (Mob) target;
|
||||||
|
|
||||||
|
if (mob == null)
|
||||||
|
mob = Mob.getFromCache(Integer.parseInt(words[1]));
|
||||||
|
|
||||||
|
if (mob == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (words[0].equalsIgnoreCase("respawn")) {
|
||||||
|
mob.respawn();
|
||||||
|
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Respawned");
|
||||||
|
} else if (words[0].equalsIgnoreCase("despawn")) {
|
||||||
|
mob.despawn();
|
||||||
|
this.throwbackInfo(pc, "Mob with ID " + mob.getObjectUUID() + " Despawned");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Gets distance from a target.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /distance'";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.AbstractWorldObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
public class DistanceCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public DistanceCmd() {
|
||||||
|
super("distance");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
|
||||||
|
// Arg Count Check
|
||||||
|
if (words.length != 1) {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target == null || !(target instanceof AbstractWorldObject)) {
|
||||||
|
throwbackError(pc, "No target found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractWorldObject awoTarget = (AbstractWorldObject) target;
|
||||||
|
|
||||||
|
Vector3fImmutable pcLoc = pc.getLoc();
|
||||||
|
Vector3fImmutable tarLoc = awoTarget.getLoc();
|
||||||
|
String out = "Distance: " + pcLoc.distance(tarLoc) +
|
||||||
|
"\r\nYour Loc: " + pcLoc.x + 'x' + pcLoc.y + 'x' + pcLoc.z +
|
||||||
|
"\r\nTarget Loc: " + tarLoc.x + 'x' + tarLoc.y + 'x' + tarLoc.z;
|
||||||
|
throwbackInfo(pc, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Gets distance from a target.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /distance'";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ChatManager;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.powers.EffectsBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Eighty
|
||||||
|
*/
|
||||||
|
public class EffectCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public EffectCmd() {
|
||||||
|
super("effect");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
int ID = 0;
|
||||||
|
int token = 0;
|
||||||
|
|
||||||
|
if (args.length != 2) {
|
||||||
|
this.sendUsage(pcSender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ID = Integer.parseInt(args[0]);
|
||||||
|
token = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
|
EffectsBase eb = PowersManager.setEffectToken(ID, token);
|
||||||
|
if (eb == null) {
|
||||||
|
throwbackError(pcSender, "Unable to find EffectsBase " + ID
|
||||||
|
+ " to modify.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChatManager.chatSayInfo(pcSender,
|
||||||
|
"EffectsBase with ID " + ID + " changed token to " + token);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /effect EffectsBaseID Token'";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Temporarily places the effect token with the corresponding EffectsBase on the server";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.objects.*;
|
||||||
|
|
||||||
|
public class EnchantCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public EnchantCmd() {
|
||||||
|
super("enchant");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
int rank = 0;
|
||||||
|
if (words.length < 1) {
|
||||||
|
this.sendUsage(pc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
rank = Integer.parseInt(words[0]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Item item;
|
||||||
|
if (target == null || target instanceof Item)
|
||||||
|
item = (Item) target;
|
||||||
|
else {
|
||||||
|
throwbackError(pc, "Must have an item targeted");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CharacterItemManager cim = pc.getCharItemManager();
|
||||||
|
if (cim == null) {
|
||||||
|
throwbackError(pc, "Unable to find the character item manager for player " + pc.getFirstName() + '.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (words[0].equals("clear")) {
|
||||||
|
item.clearEnchantments();
|
||||||
|
cim.updateInventory();
|
||||||
|
this.setResult(String.valueOf(item.getObjectUUID()));
|
||||||
|
} else {
|
||||||
|
int cnt = words.length;
|
||||||
|
for (int i = 1; i < cnt; i++) {
|
||||||
|
String enchant = words[i];
|
||||||
|
boolean valid = true;
|
||||||
|
for (Effect eff : item.getEffects().values()) {
|
||||||
|
if (eff.getEffectsBase().getIDString().equals(enchant)) {
|
||||||
|
throwbackError(pc, "This item already has that enchantment");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
item.addPermanentEnchantmentForDev(enchant, rank);
|
||||||
|
this.setResult(String.valueOf(item.getObjectUUID()));
|
||||||
|
} else
|
||||||
|
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
|
||||||
|
}
|
||||||
|
cim.updateInventory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Enchants an item with a prefix and suffix";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "' /enchant clear/Enchant1 Enchant2 Enchant3 ...'";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
// Magicbane Emulator Project © 2013 - 2026
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
// https://www.magicbane.com
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.Enum.BuildingGroup;
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.objects.*;
|
||||||
|
|
||||||
|
public class GateInfoCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public GateInfoCmd() {
|
||||||
|
super("gateinfo");
|
||||||
|
}
|
||||||
|
|
||||||
|
// AbstractDevCmd Overridden methods
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter player, String[] args,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
Building targetBuilding;
|
||||||
|
String outString;
|
||||||
|
Runegate runeGate;
|
||||||
|
Blueprint blueprint;
|
||||||
|
String newline = "\r\n ";
|
||||||
|
targetBuilding = (Building) target;
|
||||||
|
|
||||||
|
if (targetBuilding.getObjectType() != GameObjectType.Building) {
|
||||||
|
throwbackInfo(player, "GateInfo: target must be a Building");
|
||||||
|
throwbackInfo(player, "Found" + targetBuilding.getObjectType().toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
blueprint = Blueprint._meshLookup.get(targetBuilding.getMeshUUID());
|
||||||
|
|
||||||
|
if (blueprint == null ||
|
||||||
|
(blueprint.getBuildingGroup() != BuildingGroup.RUNEGATE)) {
|
||||||
|
throwbackInfo(player, "showgate: target must be a Runegate");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
runeGate = Runegate._runegates.get(targetBuilding.getObjectUUID());
|
||||||
|
|
||||||
|
outString = "RungateType: " + runeGate.gateBuilding.getName();
|
||||||
|
outString += newline;
|
||||||
|
|
||||||
|
outString += "Portal State:";
|
||||||
|
outString += newline;
|
||||||
|
|
||||||
|
for (Portal portal : runeGate.getPortals()) {
|
||||||
|
|
||||||
|
outString += "Portal: " + portal.portalType.name();
|
||||||
|
outString += " Active: " + portal.isActive();
|
||||||
|
outString += " Dest: " + portal.targetGate.getName();
|
||||||
|
outString += newline;
|
||||||
|
outString += " Origin: " + portal.getPortalLocation().x + 'x';
|
||||||
|
outString += " " + portal.getPortalLocation().y + 'y';
|
||||||
|
outString += newline;
|
||||||
|
|
||||||
|
Vector3fImmutable offset = portal.getPortalLocation().subtract(targetBuilding.getLoc());
|
||||||
|
outString += " Offset: " + offset.x + "x " + offset.z + 'y';
|
||||||
|
outString += newline;
|
||||||
|
outString += newline;
|
||||||
|
|
||||||
|
}
|
||||||
|
outString += newline;
|
||||||
|
throwbackInfo(player, outString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Displays a runegate's gate status";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
|
||||||
|
|
||||||
|
return "/gateinfo <target runegate> \n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user