Browse Source

nation sub limits added

master
FatBoy-DOTC 2 years ago
parent
commit
5f0803eec4
  1. 2
      src/engine/net/client/handlers/AcceptSubInviteHandler.java
  2. 2
      src/engine/net/client/handlers/InviteToSubHandler.java
  3. 12
      src/engine/objects/Guild.java

2
src/engine/net/client/handlers/AcceptSubInviteHandler.java

@ -75,7 +75,7 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler { @@ -75,7 +75,7 @@ public class AcceptSubInviteHandler extends AbstractClientMsgHandler {
//source guild is limited to 7 subs
//TODO this should be based on TOL rank
if (!targetGuild.canSubAGuild(sourceGuild,targetGuild)) {
if (!targetGuild.canSubAGuild(sourceGuild)) {
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 45); // Failure to swear guild
return true;
}

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

@ -103,7 +103,7 @@ public class InviteToSubHandler extends AbstractClientMsgHandler { @@ -103,7 +103,7 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
//TODO this should be based on TOL rank
if (!sourceGuild.canSubAGuild(targetGuild, null)) {
if (!sourceGuild.canSubAGuild(targetGuild)) {
sendChat(source, "This Guild can't be subbed.");
return true;
}

12
src/engine/objects/Guild.java

@ -559,17 +559,12 @@ public class Guild extends AbstractWorldObject { @@ -559,17 +559,12 @@ public class Guild extends AbstractWorldObject {
}
public boolean canSubAGuild(Guild toSub, Guild nation){
public boolean canSubAGuild(Guild toSub){
boolean canSub;
if (this.equals(toSub))
return false;
City nationCap = City.getCity(nation.cityUUID);
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
canSub = false;
return canSub;
}
switch(this.guildState) {
case Nation:
case Sovereign:
@ -587,7 +582,10 @@ public class Guild extends AbstractWorldObject { @@ -587,7 +582,10 @@ public class Guild extends AbstractWorldObject {
default:
canSub = false;
}
City nationCap = City.getCity(nation.cityUUID);
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
canSub = false;
}
return canSub;
}

Loading…
Cancel
Save