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
+18 -19
View File
@@ -31,7 +31,6 @@ import engine.mbEnums;
import engine.mbEnums.*;
import engine.net.ByteBufferWriter;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.*;
import engine.net.client.msg.login.CommitNewCharacterMsg;
@@ -1478,7 +1477,7 @@ public class PlayerCharacter extends AbstractCharacter {
if (disable)
return;
UpdateCharOrMobMessage ucm = new UpdateCharOrMobMessage(pc, 2, pc.getRank());
DispatchMessage.sendToAllInRange(pc, ucm);
DispatchManager.sendToAllInRange(pc, ucm);
}
public static void GroundPlayer(PlayerCharacter groundee) {
@@ -1490,7 +1489,7 @@ public class PlayerCharacter extends AbstractCharacter {
ChangeAltitudeMsg msg = ChangeAltitudeMsg.GroundPlayerMsg(groundee);
// force a landing
DispatchMessage.dispatchMsgToInterestArea(groundee, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
DispatchManager.dispatchMsgToInterestArea(groundee, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
}
@@ -1899,7 +1898,7 @@ public class PlayerCharacter extends AbstractCharacter {
TargetedActionMsg targetedActionMsg = new TargetedActionMsg(this, true);
Dispatch dispatch = Dispatch.borrow(this, targetedActionMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
String message = this.getFirstName();
@@ -1959,7 +1958,7 @@ public class PlayerCharacter extends AbstractCharacter {
this.respawn(false, false, true);
} else {
TargetedActionMsg killmsg = new TargetedActionMsg(this, true);
DispatchMessage.dispatchMsgToInterestArea(this, killmsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
DispatchManager.dispatchMsgToInterestArea(this, killmsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
}
} catch (Exception e) {
Logger.error(e);
@@ -2665,7 +2664,7 @@ public class PlayerCharacter extends AbstractCharacter {
rm.setToken(skill.getToken());
Dispatch dispatch = Dispatch.borrow(this, rm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
} else {
Logger.error("Failed to force refine of skill " + skill.getObjectUUID() + " by character " + this.getObjectUUID());
@@ -2912,7 +2911,7 @@ public class PlayerCharacter extends AbstractCharacter {
GrantExperienceMsg gem = new GrantExperienceMsg(this, remainingXP);
Dispatch dispatch = Dispatch.borrow(this, gem);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
this.addDatabaseJob("EXP", MBServerStatics.FIVE_MINUTES);
return;
@@ -2927,7 +2926,7 @@ public class PlayerCharacter extends AbstractCharacter {
GrantExperienceMsg grantExperienceMsg = new GrantExperienceMsg(this, remainingXP);
Dispatch dispatch = Dispatch.borrow(this, grantExperienceMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
this.addDatabaseJob("EXP", MBServerStatics.FIVE_MINUTES);
return;
@@ -2938,7 +2937,7 @@ public class PlayerCharacter extends AbstractCharacter {
GrantExperienceMsg grantExperienceMsg = new GrantExperienceMsg(this, remainingXP);
remainingXP = 0;
Dispatch dispatch = Dispatch.borrow(this, grantExperienceMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
this.addDatabaseJob("EXP", MBServerStatics.FIVE_MINUTES);
return;
@@ -2971,10 +2970,10 @@ public class PlayerCharacter extends AbstractCharacter {
GrantExperienceMsg grantExperienceMsg = new GrantExperienceMsg(this, 1);
Dispatch dispatch = Dispatch.borrow(this, grantExperienceMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
SetObjectValueMsg upm = new SetObjectValueMsg(this, 9);
DispatchMessage.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
DispatchManager.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
checkGuildStatus();
this.addDatabaseJob("EXP", MBServerStatics.FIVE_MINUTES);
// double overflow exp used up, remaining overflow will just add to level + 1.
@@ -2986,9 +2985,9 @@ public class PlayerCharacter extends AbstractCharacter {
this.overFlowEXP = 0;
GrantExperienceMsg grantExperienceMsg = new GrantExperienceMsg(this, 1);
Dispatch dispatch = Dispatch.borrow(this, grantExperienceMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
SetObjectValueMsg upm = new SetObjectValueMsg(this, 9);
DispatchMessage.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
DispatchManager.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
checkGuildStatus();
this.addDatabaseJob("EXP", MBServerStatics.FIVE_MINUTES);
}
@@ -3006,13 +3005,13 @@ public class PlayerCharacter extends AbstractCharacter {
GrantExperienceMsg grantExperienceMsg = new GrantExperienceMsg(this, neededXP);
Dispatch dispatch = Dispatch.borrow(this, grantExperienceMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
remainingXP -= neededXP;
//Send newLevel.
SetObjectValueMsg upm = new SetObjectValueMsg(this, 9);
DispatchMessage.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
DispatchManager.dispatchMsgToInterestArea(this, upm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
checkGuildStatus();
} else {
@@ -3020,7 +3019,7 @@ public class PlayerCharacter extends AbstractCharacter {
GrantExperienceMsg grantExperienceMsg = new GrantExperienceMsg(this, remainingXP);
remainingXP = 0;
Dispatch dispatch = Dispatch.borrow(this, grantExperienceMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
this.addDatabaseJob("EXP", MBServerStatics.FIVE_MINUTES);
}
@@ -4200,7 +4199,7 @@ public class PlayerCharacter extends AbstractCharacter {
toCommand.setCombatTarget(null);
PetMsg petMsg = new PetMsg(6, toCommand);
Dispatch dispatch = Dispatch.borrow(this, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
if (toCommand.isAlive())
WorldGrid.updateObject(toCommand);
@@ -4772,7 +4771,7 @@ public class PlayerCharacter extends AbstractCharacter {
ModifyHealthMsg modifyHealthMsg = new ModifyHealthMsg(null, this, 0, 1, 1, -1984683793, "", 0, 652920987);
//mhm.setOmitFromChat(0);
Dispatch dispatch = Dispatch.borrow(this, modifyHealthMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
@@ -4850,7 +4849,7 @@ public class PlayerCharacter extends AbstractCharacter {
moveToMsg.setSourceID(this.getObjectUUID());
Dispatch dispatch = Dispatch.borrow(this, moveToMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
try {
MovementManager.movement(moveToMsg, this);