Browse Source

Lore Rules

combat-2
FatBoy-DOTC 9 months ago
parent
commit
c80b9013d2
  1. 8
      src/engine/gameManager/GuildManager.java
  2. 21
      src/engine/gameManager/PowersManager.java
  3. 11
      src/engine/net/client/handlers/GroupInviteHandler.java
  4. 8
      src/engine/net/client/handlers/InviteToGuildHandler.java
  5. 11
      src/engine/net/client/handlers/InviteToSubHandler.java
  6. 13
      src/engine/net/client/handlers/LeaveGuildHandler.java
  7. 29
      src/engine/objects/City.java

8
src/engine/gameManager/GuildManager.java

@ -200,5 +200,13 @@ public enum GuildManager { @@ -200,5 +200,13 @@ public enum GuildManager {
}
}
public static Boolean meetsLoreRequirements(Guild guild, PlayerCharacter player){
Enum.GuildCharterType charter = guild.getGuildType();
if(charter.requiredClasses.contains(player.absPromotionClass))
if(charter.requiredRaces.contains(player.absRace))
if(charter.sexRequired.contains(player.absGender))
return true;
return false;
}
}

21
src/engine/gameManager/PowersManager.java

@ -170,6 +170,19 @@ public enum PowersManager { @@ -170,6 +170,19 @@ public enum PowersManager {
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
boolean sendCastToSelf) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
PlayerCharacter caster = origin.getPlayerCharacter();
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
if(pb != null && pb.isHarmful == false) {
if (caster.guild.equals(Guild.getErrantGuild()))
return;
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false)
return;
}
}
if (usePowerA(msg, origin, sendCastToSelf)) {
// Cast failed for some reason, reset timer
@ -1258,7 +1271,13 @@ public enum PowersManager { @@ -1258,7 +1271,13 @@ public enum PowersManager {
return;
}
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if (pc.guild.getGuildType().equals(target.guild.getGuildType()) == false) {
ChatManager.chatInfoError(pc,
"Cannot summon player outside your charter.");
return;
}
}
PerformActionMsg pam = new PerformActionMsg(msg.getPowerToken(), msg
.getTrains(), msg.getSourceType(), msg.getSourceID(), target
.getObjectType().ordinal(), target.getObjectUUID(), 0f, 0f, 0f, 1, 0);

11
src/engine/net/client/handlers/GroupInviteHandler.java

@ -12,7 +12,9 @@ package engine.net.client.handlers; @@ -12,7 +12,9 @@ package engine.net.client.handlers;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.exception.MsgSendException;
import engine.gameManager.ConfigManager;
import engine.gameManager.GroupManager;
import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
@ -21,6 +23,7 @@ import engine.net.client.msg.ClientNetMsg; @@ -21,6 +23,7 @@ import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.group.GroupInviteMsg;
import engine.net.client.msg.group.GroupUpdateMsg;
import engine.objects.Group;
import engine.objects.Guild;
import engine.objects.PlayerCharacter;
public class GroupInviteHandler extends AbstractClientMsgHandler {
@ -103,7 +106,15 @@ public class GroupInviteHandler extends AbstractClientMsgHandler { @@ -103,7 +106,15 @@ public class GroupInviteHandler extends AbstractClientMsgHandler {
if (target.isIgnoringPlayer(source))
return false;
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(source.guild.equals(Guild.getErrantGuild()))
return false;
if (source.guild.getGuildType() != null) {
if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false)
return false;
}
}
// dont block invites to people already in a group and
// dont check for pending invites, the client does it
// Send invite message to target

8
src/engine/net/client/handlers/InviteToGuildHandler.java

@ -14,6 +14,7 @@ import engine.Enum; @@ -14,6 +14,7 @@ import engine.Enum;
import engine.Enum.GameObjectType;
import engine.exception.MsgSendException;
import engine.gameManager.ChatManager;
import engine.gameManager.ConfigManager;
import engine.gameManager.GuildManager;
import engine.gameManager.SessionManager;
import engine.net.Dispatch;
@ -124,7 +125,12 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler { @@ -124,7 +125,12 @@ public class InviteToGuildHandler extends AbstractClientMsgHandler {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 135);// you do not meet the level required for this SWORN guild
return true;
}
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if (GuildManager.meetsLoreRequirements(sourcePlayer.guild, targetPlayer) == false) {
ChatManager.chatGuildError(sourcePlayer,targetPlayer.getFirstName() + " does not meet charter requirements!");
return true;
}
}
targetPlayer.setLastGuildToInvite(sourcePlayer.getGuild().getObjectUUID());
// setup guild invite message to send to targetPlayer

11
src/engine/net/client/handlers/InviteToSubHandler.java

@ -12,9 +12,7 @@ package engine.net.client.handlers; @@ -12,9 +12,7 @@ package engine.net.client.handlers;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.exception.MsgSendException;
import engine.gameManager.ChatManager;
import engine.gameManager.DbManager;
import engine.gameManager.SessionManager;
import engine.gameManager.*;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@ -111,7 +109,12 @@ public class InviteToSubHandler extends AbstractClientMsgHandler { @@ -111,7 +109,12 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
sendChat(source, "This Guild can't be subbed.");
return true;
}
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if (source.guild.getGuildType().equals(target.guild.getGuildType()) == false){
sendChat(source, "You Must Be The Same Charter To Form A Nation.");
return true;
}
}
//all tests passed, let's send invite.
if (target.getClientConnection() != null) {

13
src/engine/net/client/handlers/LeaveGuildHandler.java

@ -11,17 +11,13 @@ package engine.net.client.handlers; @@ -11,17 +11,13 @@ package engine.net.client.handlers;
import engine.Enum.GuildHistoryType;
import engine.exception.MsgSendException;
import engine.gameManager.ChatManager;
import engine.gameManager.SessionManager;
import engine.gameManager.*;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.guild.LeaveGuildMsg;
import engine.objects.Guild;
import engine.objects.GuildStatusController;
import engine.objects.Mine;
import engine.objects.PlayerCharacter;
import engine.objects.*;
public class LeaveGuildHandler extends AbstractClientMsgHandler {
@ -65,7 +61,10 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler { @@ -65,7 +61,10 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
oldGuild.removePlayer(playerCharacter, GuildHistoryType.LEAVE);
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(GroupManager.getGroup(playerCharacter) != null)
GroupManager.getGroup(playerCharacter).removeGroupMember(playerCharacter);
}
// Send message back to client
msg.setMessage("You have left the guild.");
dispatch = Dispatch.borrow(playerCharacter, msg);

29
src/engine/objects/City.java

@ -325,8 +325,15 @@ public class City extends AbstractWorldObject { @@ -325,8 +325,15 @@ public class City extends AbstractWorldObject {
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc))
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){
cities.add(city);
}
}else {
cities.add(city); //verify nation or guild is same
}
}
} else if (Guild.sameNationExcludeErrant(city.getGuild(), pcG))
cities.add(city);
@ -345,8 +352,14 @@ public class City extends AbstractWorldObject { @@ -345,8 +352,14 @@ public class City extends AbstractWorldObject {
cities.add(city);
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){
cities.add(city);
}
}else {
cities.add(city); //verify nation or guild is same
}
}
}
}
@ -398,13 +411,25 @@ public class City extends AbstractWorldObject { @@ -398,13 +411,25 @@ public class City extends AbstractWorldObject {
if (city.isNpc == 1)
if (city.isNoobIsle == 1) {
if (playerCharacter.getLevel() < 21)
cities.add(city);
cities.add(city); //verify nation or guild is same
} else if (playerCharacter.getLevel() > 9)
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){
cities.add(city);
}
}else {
cities.add(city); //verify nation or guild is same
}
} else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){
cities.add(city);
}
}else {
cities.add(city); //verify nation or guild is same
}
}
}
}
}

Loading…
Cancel
Save