|
|
@ -17,6 +17,7 @@ import engine.powers.PowersBase; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* @Author: |
|
|
|
* @Author: |
|
|
@ -105,7 +106,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
// Validate player can obtain blessing
|
|
|
|
// Validate player can obtain blessing
|
|
|
|
|
|
|
|
|
|
|
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) { |
|
|
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) { |
|
|
|
ErrorPopupMsg.sendErrorPopup(player, 173); // You must be the leader of a guild to receive a blessing
|
|
|
|
ErrorPopupMsg.sendErrorPopup(player, 173); // You must be the leader of a guild to receive a blessing
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -126,12 +127,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
realm = RealmMap.getRealmForCity(city); |
|
|
|
realm = RealmMap.getRealmForCity(city); |
|
|
|
|
|
|
|
|
|
|
|
if (realm.getCanBeClaimed() == false) { |
|
|
|
if (!realm.getCanBeClaimed()) { |
|
|
|
ErrorPopupMsg.sendErrorPopup(player, 180); // This territory cannot be ruled by anyone
|
|
|
|
ErrorPopupMsg.sendErrorPopup(player, 180); // This territory cannot be ruled by anyone
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (realm.isRuled() == true) { |
|
|
|
if (realm.isRuled()) { |
|
|
|
ErrorPopupMsg.sendErrorPopup(player, 178); // This territory is already claimed
|
|
|
|
ErrorPopupMsg.sendErrorPopup(player, 178); // This territory is already claimed
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -142,12 +143,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void requestBoon(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) { |
|
|
|
private static void requestBoon(PlayerCharacter player, NPC npc) { |
|
|
|
|
|
|
|
|
|
|
|
Building shrineBuilding; |
|
|
|
Building shrineBuilding; |
|
|
|
Shrine shrine; |
|
|
|
Shrine shrine; |
|
|
|
|
|
|
|
|
|
|
|
if (npc.getGuild() != player.getGuild()) |
|
|
|
if (!npc.getGuild().getNation().equals(player.getGuild().getNation())) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
shrineBuilding = npc.getBuilding(); |
|
|
|
shrineBuilding = npc.getBuilding(); |
|
|
@ -155,7 +156,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { |
|
|
|
if (shrineBuilding == null) |
|
|
|
if (shrineBuilding == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (shrineBuilding.getBlueprint() != null && shrineBuilding.getBlueprint().getBuildingGroup() != engine.Enum.BuildingGroup.SHRINE) |
|
|
|
if (shrineBuilding.getBlueprint() != null && !shrineBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.SHRINE)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (shrineBuilding.getRank() == -1) |
|
|
|
if (shrineBuilding.getRank() == -1) |
|
|
@ -171,11 +172,9 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//already haz boon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player.containsEffect(shrine.getShrineType().getPowerToken())) { |
|
|
|
if (player.containsEffect(shrine.getShrineType().getPowerToken())) { |
|
|
|
ErrorPopupMsg.sendErrorPopup(player, 199); |
|
|
|
//remove old boon to apply new one, allows boon refreshing
|
|
|
|
return; |
|
|
|
player.effects.remove(PowersManager.getPowerByToken(shrine.getShrineType().getPowerToken()).name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!Shrine.canTakeFavor(player, shrine)) |
|
|
|
if (!Shrine.canTakeFavor(player, shrine)) |
|
|
@ -191,16 +190,34 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int rank = shrine.getRank(); |
|
|
|
int trains = 0; |
|
|
|
//R8 trees always get atleast rank 2 boons. rank uses index, where 0 is first place, 1 is second, etc...
|
|
|
|
switch(npc.getRank()){ |
|
|
|
if (shrineBuilding.getCity() != null && shrineBuilding.getCity().getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8) |
|
|
|
case 1: |
|
|
|
if (rank != 0) |
|
|
|
trains = 5; |
|
|
|
rank = 1; |
|
|
|
break; |
|
|
|
int trains = 40 - (rank * 10); |
|
|
|
case 2: |
|
|
|
if (trains < 0) |
|
|
|
trains = 10; |
|
|
|
trains = 0; |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
trains = 15; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
trains = 20; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 5: |
|
|
|
|
|
|
|
trains = 25; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 6: |
|
|
|
|
|
|
|
trains = 30; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 7: |
|
|
|
|
|
|
|
trains = 35; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Objects.requireNonNull(shrineBuilding.getCity()).getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8) |
|
|
|
|
|
|
|
trains += 5; |
|
|
|
|
|
|
|
|
|
|
|
//System.out.println(trains);
|
|
|
|
|
|
|
|
PowersManager.applyPower(player, player, player.getLoc(), shrinePower.getToken(), trains, false); |
|
|
|
PowersManager.applyPower(player, player, player.getLoc(), shrinePower.getToken(), trains, false); |
|
|
|
ChatManager.chatGuildInfo(player.getGuild(), player.getName() + " has recieved a boon costing " + 1 + " point of favor."); |
|
|
|
ChatManager.chatGuildInfo(player.getGuild(), player.getName() + " has recieved a boon costing " + 1 + " point of favor."); |
|
|
|
shrineBuilding.addEffectBit(1000000 << 2); |
|
|
|
shrineBuilding.addEffectBit(1000000 << 2); |
|
|
@ -420,7 +437,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler { |
|
|
|
if (isHermit(npc)) |
|
|
|
if (isHermit(npc)) |
|
|
|
requestHermitBlessing(msg, origin, player, npc); |
|
|
|
requestHermitBlessing(msg, origin, player, npc); |
|
|
|
else |
|
|
|
else |
|
|
|
requestBoon(msg, origin, player, npc); |
|
|
|
requestBoon(player, npc); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 15: |
|
|
|
case 15: |
|
|
|
LeaderboardMessage lbm = new LeaderboardMessage(); |
|
|
|
LeaderboardMessage lbm = new LeaderboardMessage(); |
|
|
|