DispatchManager is now an official manager singleton.

This commit is contained in:
2024-05-12 13:14:42 -04:00
parent ff17cacda7
commit 96ba17f67a
160 changed files with 642 additions and 718 deletions
@@ -9,15 +9,11 @@
package engine.net.client.handlers;
import engine.exception.MsgSendException;
import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager;
import engine.gameManager.*;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.mbEnums.DispatchChannel;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.*;
import engine.objects.*;
@@ -42,35 +38,35 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
case 0: // Close Dialog
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 180: // Promote to class
promote(playerCharacter, npc);
msg.updateMessage(4, 0); // <-0 closes dialog
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 1000: // TrainSkill skills and powers
msg.updateMessage(4, 2); // <-2 sends trainer screen
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 1001: // Open Bank
getBank(playerCharacter, npc, origin);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 1002: // Open Vault
getVault(playerCharacter, npc, origin);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 1003: //Refine
msg.updateMessage(4, 3); // <-3 sends refine screen
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
// Mainland Teleports
@@ -80,7 +76,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 10, 75, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100012: // teleport me to SDR
city = City.getCity(24);
@@ -88,7 +84,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 10, 75, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100013: // teleport me to Erkeng Hold
city = City.getCity(26);
@@ -96,7 +92,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 10, 75, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100014: // teleport me to Khan
city = City.getCity(36);
@@ -104,7 +100,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 1, 75, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100015: // teleport me to Maelstrom
@@ -112,28 +108,28 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, loc, 10, 75, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100016: // teleport me to Oblivion
loc = new Vector3fImmutable(108921f, 167f, -51590f);
handleTeleport(playerCharacter, loc, 10, 75, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100017: // teleport me to Vander's Doom
loc = new Vector3fImmutable(42033f, 46f, -54471f);
handleTeleport(playerCharacter, loc, 10, 75, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100018: // teleport me to The Sinking Isle
loc = new Vector3fImmutable(67177f, 36f, -31940f);
handleTeleport(playerCharacter, loc, 10, 75, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
// MainLand Repledges
@@ -143,7 +139,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleRepledge(playerCharacter, city, 10, 55, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100031: // repledge me to Sea Dog's Rest
city = City.getCity(24);
@@ -151,7 +147,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleRepledge(playerCharacter, city, 10, 75, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100032: // repledge me to Erkeng Hold
city = City.getCity(26);
@@ -159,7 +155,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleRepledge(playerCharacter, city, 10, 55, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100033: // repledge me to Khan\'Of Srekel
city = City.getCity(36);
@@ -167,7 +163,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleRepledge(playerCharacter, city, 1, 75, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100035: // repledge me to Starkholm
city = City.getCity(27);
@@ -175,7 +171,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleRepledge(playerCharacter, city, 1, 20, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
// Noob Isle Teleports
@@ -185,7 +181,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 1, 20, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100041: // teleport me to All-Father's Rest
city = City.getCity(28);
@@ -193,7 +189,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 1, 20, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100042: // teleport me to Hengest
city = City.getCity(33);
@@ -201,7 +197,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 1, 20, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100043: // teleport me to Hrimdal
city = City.getCity(30);
@@ -209,14 +205,14 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 1, 20, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100044: // teleport me to Hothor's Doom
city = City.getCity(29);
if (city != null)
handleTeleport(playerCharacter, city.getLoc(), 1, 20, true);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100045: // teleport me to Scraefahl
city = City.getCity(32);
@@ -224,7 +220,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 1, 20, false);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
case 100046: // teleport me to Valkirch
city = City.getCity(31);
@@ -232,7 +228,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
handleTeleport(playerCharacter, city.getLoc(), 1, 20, true);
msg.updateMessage(4, 0);
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
@@ -244,7 +240,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
private static boolean finishMessage(VendorDialogMsg msg, ClientConnection origin) throws MsgSendException {
msg.updateMessage(4, 0);
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}
@@ -415,7 +411,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
// send the rune application to the clients
ApplyRuneMsg arm = new ApplyRuneMsg(pc.getObjectType().ordinal(), pc.getObjectUUID(), promo.getObjectUUID(), promo.getObjectType().ordinal(), promo
.getObjectUUID(), true);
DispatchMessage.dispatchMsgToInterestArea(pc, arm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
DispatchManager.dispatchMsgToInterestArea(pc, arm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
}
@@ -462,11 +458,11 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
OpenVaultMsg openVaultMsg = new OpenVaultMsg(playerCharacter, target);
Dispatch dispatch = Dispatch.borrow(playerCharacter, openVaultMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
ShowVaultInventoryMsg showVaultInventoryMsg = new ShowVaultInventoryMsg(playerCharacter, ac, target); // 37??
dispatch = Dispatch.borrow(playerCharacter, showVaultInventoryMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
// All recordings have "open - show - open."
// Seems to work fine with just "show - open" as well.
@@ -513,15 +509,15 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
CostOpenBankMsg costOpenBankMsg = new CostOpenBankMsg(playerCharacter, 0L, 0L);
Dispatch dispatch = Dispatch.borrow(playerCharacter, costOpenBankMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
ReqBankInventoryMsg reqBankInventoryMsg = new ReqBankInventoryMsg(playerCharacter, 0L);
dispatch = Dispatch.borrow(playerCharacter, reqBankInventoryMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
ShowBankInventoryMsg showBankInventoryMsg = new ShowBankInventoryMsg(playerCharacter, 0L);
dispatch = Dispatch.borrow(playerCharacter, showBankInventoryMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
@@ -594,7 +590,7 @@ public class VendorDialogMsgHandler extends AbstractClientMsgHandler {
}
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
return true;
}