Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ad5f239b0 | |||
| 3db8ee7afd | |||
| f07974f673 | |||
| 0d5cef1652 | |||
| 04203c092a | |||
| 78feee482b | |||
| 8c35844e08 | |||
| 0fbb43e021 | |||
| 145449f26d | |||
| feef6263b4 | |||
| 6c622c377f | |||
| 8943121336 | |||
| 70cb469190 | |||
| a42f307a70 | |||
| 2a3ae6eaec | |||
| 9e4b596aa1 | |||
| aa1fe792a3 | |||
| 79919121a8 | |||
| 80ccfff635 | |||
| 381139af35 | |||
| e79da63556 | |||
| 533565e37e | |||
| da0510d2bc | |||
| 1f732a8ca9 | |||
| 0d24789a93 | |||
| 35427cfb4a | |||
| 695a78b1e2 | |||
| 9f6710ccb9 | |||
| fff1e80f61 | |||
| 141af19daa | |||
| 630748541f | |||
| d32818f351 | |||
| d6f94bd0e7 | |||
| db6a4e471d | |||
| a24c611bac | |||
| 3926160ab1 | |||
| 4a7013de61 | |||
| 56564f1c3b | |||
| 8a3e39e97d | |||
| 5224c79441 | |||
| ede016a93d | |||
| cc1825dec9 | |||
| d257ce50cf | |||
| 5b246211e1 | |||
| 33c923b0de | |||
| 02d524663a | |||
| 5bd85addb7 |
@@ -136,6 +136,12 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|||||||
int cityUID = rs.getInt("cityUUID");
|
int cityUID = rs.getInt("cityUUID");
|
||||||
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
|
JSONObject jsonObject = new JSONObject(rs.getString("warehouse"));
|
||||||
City city = City.getCity(cityUID);
|
City city = City.getCity(cityUID);
|
||||||
|
|
||||||
|
if (city == null) {
|
||||||
|
Logger.error("No city " + cityUID + " for warehouse");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
city.warehouse = new Warehouse(jsonObject);
|
city.warehouse = new Warehouse(jsonObject);
|
||||||
city.warehouse.city = city;
|
city.warehouse.city = city;
|
||||||
|
|
||||||
|
|||||||
@@ -104,67 +104,67 @@ public enum BuildingManager {
|
|||||||
if (building == null)
|
if (building == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//cannot access destroyed buildings
|
||||||
if (building.getRank() == -1)
|
if (building.getRank() == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsOwner(building, player))
|
//admin characters can always access buildings
|
||||||
return true;
|
|
||||||
|
|
||||||
//individual friend.
|
|
||||||
|
|
||||||
if (building.getFriends() != null && building.getFriends().get(player.getObjectUUID()) != null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
//Admins can access stuff
|
|
||||||
|
|
||||||
if (player.isCSR())
|
if (player.isCSR())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Guild stuff
|
//owner can always access their own building
|
||||||
|
|
||||||
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus());
|
|
||||||
|
|
||||||
//TODO test friends list once added
|
|
||||||
//does not meet above criteria. Cannot access.
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean playerCanManageNotFriends(PlayerCharacter player, Building building) {
|
|
||||||
|
|
||||||
//Player Can only Control Building if player is in Same Guild as Building and is higher rank than IC.
|
|
||||||
|
|
||||||
if (player == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (building == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (building.getRank() == -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (IsOwner(building, player))
|
if (IsOwner(building, player))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
//check for default IC access if building belongs to same guild
|
||||||
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
if(player.guild.equals(building.getGuild())) {
|
||||||
return true;
|
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null) {
|
||||||
|
switch (building.getBlueprint().getBuildingGroup()) {
|
||||||
|
case TOL:
|
||||||
|
case BARRACK:
|
||||||
|
case SPIRE:
|
||||||
|
case SHRINE:
|
||||||
|
case BANESTONE:
|
||||||
|
case MINE:
|
||||||
|
case WAREHOUSE:
|
||||||
|
case BULWARK:
|
||||||
|
case SIEGETENT:
|
||||||
|
if (GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
|
return true;
|
||||||
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
//check against friends list entries if any present
|
||||||
return false;
|
if (building.getFriends() != null) {
|
||||||
|
|
||||||
|
//check individuals
|
||||||
|
if (building.getFriends().get(player.getObjectUUID()) != null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (building.getFriends().get(player.guild.objectUUID) != null) {
|
||||||
|
|
||||||
|
//check friend type for guild related access
|
||||||
|
switch (building.getFriends().get(player.guild.objectUUID).friendType) {
|
||||||
|
case 8: //full member
|
||||||
|
if (GuildStatusController.isFullMember(player.getGuildStatus()))
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case 9: //Inner Council
|
||||||
|
if (GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||||
|
return true;
|
||||||
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//did not meet access grant criteria, deny access
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized boolean lootBuilding(PlayerCharacter player, Building building) {
|
public static synchronized boolean lootBuilding(PlayerCharacter player, Building building) {
|
||||||
@@ -463,29 +463,19 @@ public enum BuildingManager {
|
|||||||
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetAvailableGold(Building building) {
|
|
||||||
|
|
||||||
if (building.getStrongboxValue() == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (building.getStrongboxValue() < building.reserve)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return building.getStrongboxValue() - building.reserve;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||||
|
|
||||||
//Nation Members and Guild members are not hostile.
|
|
||||||
// if (building.getGuild() != null){
|
|
||||||
// if (pc.getGuild() != null)
|
|
||||||
// if (building.getGuild().getObjectUUID() == pc.getGuildUUID()
|
|
||||||
// || pc.getGuild().getNation().getObjectUUID() == building.getGuild().getNation().getObjectUUID())
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
if (Guild.sameNationExcludeErrant(building.getGuild(), player.getGuild()))
|
if (Guild.sameNationExcludeErrant(building.getGuild(), player.getGuild()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if(building.enforceKOS) {
|
||||||
|
if (building.getCity() != null) {
|
||||||
|
Building TOL = building.getCity().getTOL();
|
||||||
|
if (TOL != null) {
|
||||||
|
building = TOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!building.reverseKOS) {
|
if (!building.reverseKOS) {
|
||||||
|
|
||||||
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
Condemned condemn = building.getCondemned().get(player.getObjectUUID());
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import engine.net.client.msg.UpdateStateMsg;
|
|||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.DamageShield;
|
import engine.powers.DamageShield;
|
||||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||||
|
import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -220,6 +221,16 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (inRange) {
|
if (inRange) {
|
||||||
|
|
||||||
|
if(attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)){
|
||||||
|
if(!attacker.getTimestamps().contains(slot.name()+"Attack")){
|
||||||
|
attacker.getTimestamps().put(slot.name()+"Attack", System.currentTimeMillis() - 1000);
|
||||||
|
} else if(System.currentTimeMillis() < attacker.getTimestamps().get(slot.name()+"Attack") + delay){
|
||||||
|
setAutoAttackJob(attacker,slot,delay);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//handle retaliate
|
//handle retaliate
|
||||||
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
if (AbstractCharacter.IsAbstractCharacter(target)) {
|
||||||
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
|
if (((AbstractCharacter) target).combatTarget == null || !((AbstractCharacter) target).combatTarget.isAlive()) {
|
||||||
@@ -356,6 +367,9 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check for proccing
|
||||||
|
checkForProc(attacker,target,weapon);
|
||||||
|
|
||||||
//calculate the base damage
|
//calculate the base damage
|
||||||
int damage = ThreadLocalRandom.current().nextInt(min, max + 1);
|
int damage = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||||
if (damage == 0) {
|
if (damage == 0) {
|
||||||
@@ -651,4 +665,20 @@ public enum CombatManager {
|
|||||||
int masteryLevel = 0;
|
int masteryLevel = 0;
|
||||||
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void checkForProc(AbstractCharacter attacker, AbstractWorldObject target, Item weapon){
|
||||||
|
|
||||||
|
if(weapon == null) // cant proc without a weapon
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(Effect eff : weapon.effects.values()){
|
||||||
|
for(AbstractEffectModifier mod : eff.getEffectsBase().getModifiers()){
|
||||||
|
if(mod.modType.equals(mbEnums.ModType.WeaponProc))
|
||||||
|
if(ThreadLocalRandom.current().nextInt(0,101) < 6)
|
||||||
|
((WeaponProcEffectModifier)mod).applyProc(attacker,target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -265,12 +265,12 @@ public enum ForgeManager implements Runnable {
|
|||||||
|
|
||||||
// Assign a prefix and suffix to this item if random rolled
|
// Assign a prefix and suffix to this item if random rolled
|
||||||
|
|
||||||
if (workOrder.prefixToken == 0)
|
if (workOrder.prefixToken == 0 && workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||||
forgedItem.prefixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.PREFIX, template.modTable);
|
forgedItem.prefixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.PREFIX, template.modTable);
|
||||||
else
|
else
|
||||||
forgedItem.prefixToken = workOrder.prefixToken;
|
forgedItem.prefixToken = workOrder.prefixToken;
|
||||||
|
|
||||||
if (workOrder.suffixToken == 0)
|
if (workOrder.suffixToken == 0 && workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||||
forgedItem.suffixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.SUFFIX, template.modTable);
|
forgedItem.suffixToken = calcRandomMod(workOrder.vendor, mbEnums.ItemModType.SUFFIX, template.modTable);
|
||||||
else
|
else
|
||||||
forgedItem.suffixToken = workOrder.suffixToken;
|
forgedItem.suffixToken = workOrder.suffixToken;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public enum ItemManager {
|
|||||||
if (characterSkill == null)
|
if (characterSkill == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (characterSkill.getModifiedAmountBeforeMods() > required_value)
|
if (characterSkill.getModifiedAmountBeforeMods() >= required_value)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,12 +176,29 @@ public enum PowersManager {
|
|||||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||||
PlayerCharacter caster = origin.getPlayerCharacter();
|
PlayerCharacter caster = origin.getPlayerCharacter();
|
||||||
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
|
||||||
if (pb != null && pb.isHarmful == false) {
|
if (pb != null && pb.enforceLore()) {
|
||||||
//if (caster.guild.equals(Guild.getErrantGuild()))
|
//if (caster.guild.equals(Guild.getErrantGuild()))
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false)
|
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(GameObjectType.Building) == false) {
|
||||||
|
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||||
|
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||||
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
|
||||||
|
// Send Fail to cast message
|
||||||
|
PlayerCharacter pc = SessionManager
|
||||||
|
.getPlayerCharacter(origin);
|
||||||
|
|
||||||
|
if (pc != null) {
|
||||||
|
sendPowerMsg(pc, 2, msg);
|
||||||
|
if (pc.isCasting()) {
|
||||||
|
pc.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
pc.setIsCasting(false);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,10 +925,6 @@ public enum PowersManager {
|
|||||||
if (pb.isHarmful())
|
if (pb.isHarmful())
|
||||||
mobTarget.handleDirectAggro(playerCharacter);
|
mobTarget.handleDirectAggro(playerCharacter);
|
||||||
}
|
}
|
||||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
|
||||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
|
||||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update target of used power timer
|
// update target of used power timer
|
||||||
|
|
||||||
@@ -933,8 +946,7 @@ public enum PowersManager {
|
|||||||
continue;
|
continue;
|
||||||
// If something blocks the action, then stop
|
// If something blocks the action, then stop
|
||||||
|
|
||||||
if (ab.blocked(target, pb, trains)) {
|
if (ab.blocked(target,pb.vampDrain)) {
|
||||||
|
|
||||||
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1109,7 +1121,7 @@ public enum PowersManager {
|
|||||||
continue;
|
continue;
|
||||||
// If something blocks the action, then stop
|
// If something blocks the action, then stop
|
||||||
|
|
||||||
if (ab.blocked(target, pb, trains))
|
if (ab.blocked(target,pb.vampDrain))
|
||||||
continue;
|
continue;
|
||||||
// TODO handle overwrite stack order here
|
// TODO handle overwrite stack order here
|
||||||
String stackType = ab.getStackType();
|
String stackType = ab.getStackType();
|
||||||
@@ -1423,7 +1435,7 @@ public enum PowersManager {
|
|||||||
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
|
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
|
||||||
continue;
|
continue;
|
||||||
// If something blocks the action, then stop
|
// If something blocks the action, then stop
|
||||||
if (ab.blocked(target, pb, trains))
|
if (ab.blocked(target,pb.vampDrain))
|
||||||
// sendPowerMsg(pc, 5, msg);
|
// sendPowerMsg(pc, 5, msg);
|
||||||
continue;
|
continue;
|
||||||
// TODO handle overwrite stack order here
|
// TODO handle overwrite stack order here
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ public class WorkOrder implements Delayed {
|
|||||||
if (!workOrder.vendor.charItemManager.hasRoomInventory(template.item_wt))
|
if (!workOrder.vendor.charItemManager.hasRoomInventory(template.item_wt))
|
||||||
return 30; //30: That person cannot carry that item
|
return 30; //30: That person cannot carry that item
|
||||||
|
|
||||||
if (!workOrder.vendor.getItemModTable().contains((template.modTable)))
|
if ((workOrder.prefixToken != 0 || workOrder.suffixToken != 0) &&
|
||||||
|
!workOrder.vendor.getItemModTable().contains((template.modTable)))
|
||||||
return 59; //59: This hireling does not have this formula
|
return 59; //59: This hireling does not have this formula
|
||||||
|
|
||||||
if (!Warehouse.calcCostOverrun(workOrder).isEmpty())
|
if (!Warehouse.calcCostOverrun(workOrder).isEmpty())
|
||||||
|
|||||||
+11
-3
@@ -831,16 +831,22 @@ public class mbEnums {
|
|||||||
SPIRES,
|
SPIRES,
|
||||||
SNARE,
|
SNARE,
|
||||||
STUN,
|
STUN,
|
||||||
BLIND,
|
BLINDNESS,
|
||||||
ROOT,
|
ROOT,
|
||||||
FEAR,
|
FEAR,
|
||||||
CHARM,
|
CHARM,
|
||||||
POWERBLOCK,
|
POWERINHIBITOR,
|
||||||
DEBUFF,
|
DEBUFF,
|
||||||
STEAL,
|
STEAL,
|
||||||
DRAIN;
|
DRAIN;
|
||||||
|
|
||||||
public static DamageType getDamageType(String modName) {
|
public static DamageType getDamageType(String modName) {
|
||||||
|
if(modName.toLowerCase().equals("blind"))
|
||||||
|
modName = "BLINDNESS";
|
||||||
|
|
||||||
|
if(modName.toLowerCase().equals("powerblock"))
|
||||||
|
modName = "POWERINHIBITOR";
|
||||||
|
|
||||||
DamageType damageType;
|
DamageType damageType;
|
||||||
if (modName.isEmpty())
|
if (modName.isEmpty())
|
||||||
return DamageType.NONE;
|
return DamageType.NONE;
|
||||||
@@ -2721,7 +2727,7 @@ public class mbEnums {
|
|||||||
ANTIMONY(1580014, 1256147265, 452320058, 1000, 10),
|
ANTIMONY(1580014, 1256147265, 452320058, 1000, 10),
|
||||||
AZOTH(1580012, -1205326951, 78329697, 2000, 20),
|
AZOTH(1580012, -1205326951, 78329697, 2000, 20),
|
||||||
BLOODSTONE(1580020, -1912381716, -1569826353, 500, 5),
|
BLOODSTONE(1580020, -1912381716, -1569826353, 500, 5),
|
||||||
BRONZEWOOD(1580006, -519681813, 1334770447, 500, 10),
|
BRONZEWOOD(1580006, -519681813, 1334770447, 1000, 30),
|
||||||
COAL(1580008, -1672872311, 2559427, 3000, 30),
|
COAL(1580008, -1672872311, 2559427, 3000, 30),
|
||||||
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
|
DIAMOND(1580010, 1540225085, -1730704107, 2000, 20),
|
||||||
GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
|
GALVOR(1580017, -1683992404, -1596311545, 2000, 5),
|
||||||
@@ -2741,6 +2747,7 @@ public class mbEnums {
|
|||||||
|
|
||||||
public static HashMap<Integer, ResourceType> templateLookup = new HashMap<>();
|
public static HashMap<Integer, ResourceType> templateLookup = new HashMap<>();
|
||||||
public static HashMap<Integer, ResourceType> templateHashLookup = new HashMap<>();
|
public static HashMap<Integer, ResourceType> templateHashLookup = new HashMap<>();
|
||||||
|
public static HashMap<Integer, ResourceType> resourceHashLookup = new HashMap<>();
|
||||||
public int templateID;
|
public int templateID;
|
||||||
public ItemTemplate template;
|
public ItemTemplate template;
|
||||||
public int resourceHash;
|
public int resourceHash;
|
||||||
@@ -2762,6 +2769,7 @@ public class mbEnums {
|
|||||||
for (ResourceType resourceType : ResourceType.values()) {
|
for (ResourceType resourceType : ResourceType.values()) {
|
||||||
templateLookup.put(resourceType.templateID, resourceType);
|
templateLookup.put(resourceType.templateID, resourceType);
|
||||||
templateHashLookup.put(resourceType.templateHash, resourceType);
|
templateHashLookup.put(resourceType.templateHash, resourceType);
|
||||||
|
resourceHashLookup.put(resourceType.resourceHash, resourceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
|||||||
|
|
||||||
//make sure valid resource
|
//make sure valid resource
|
||||||
|
|
||||||
mbEnums.ResourceType resource = mbEnums.ResourceType.templateHashLookup.get(changeProductionMsg.getResourceHash());
|
mbEnums.ResourceType resource = mbEnums.ResourceType.resourceHashLookup.get(changeProductionMsg.getResourceHash());
|
||||||
|
|
||||||
if (resource == null)
|
if (resource == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building.getGuild().isEmptyGuild())
|
if (building.getGuild().isEmptyGuild())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!ManageCityAssetMsgHandler.playerCanManageNotFriends(sourcePlayer, building))
|
if (!BuildingManager.playerCanManage(sourcePlayer, building))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
|||||||
(building == null) || playerZone == null || playerCity == null)
|
(building == null) || playerZone == null || playerCity == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!ManageCityAssetMsgHandler.playerCanManageNotFriends(sourcePlayer, building))
|
if (!BuildingManager.playerCanManage(sourcePlayer, building))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
boolean open = (msg.getMessageType() == OPEN_CITY);
|
boolean open = (msg.getMessageType() == OPEN_CITY);
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
|||||||
//source guild is limited to 7 subs
|
//source guild is limited to 7 subs
|
||||||
//TODO this should be based on TOL rank
|
//TODO this should be based on TOL rank
|
||||||
|
|
||||||
|
//cannot be subbed into a nation if you already have your own sub guilds
|
||||||
|
if(targetGuild.getSubGuildList() != null && targetGuild.getSubGuildList().size() > 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!sourceGuild.canSubAGuild(targetGuild)) {
|
if (!sourceGuild.canSubAGuild(targetGuild)) {
|
||||||
sendChat(source, "This Guild can't be subbed.");
|
sendChat(source, "This Guild can't be subbed.");
|
||||||
|
|||||||
@@ -28,30 +28,6 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean playerCanManageNotFriends(PlayerCharacter player, Building building) {
|
|
||||||
|
|
||||||
//Player Can only Control Building if player is in Same Guild as Building and is higher rank than IC.
|
|
||||||
|
|
||||||
if (player == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (building.getRank() == -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (BuildingManager.IsOwner(building, player))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//Somehow guild leader check fails above? lets check if Player is true Guild GL.
|
|
||||||
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return Guild.sameGuild(building.getGuild(), player.getGuild());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
City targetCity = null;
|
City targetCity = null;
|
||||||
|
|
||||||
if (isTeleport)
|
if (isTeleport)
|
||||||
cities = City.getCitiesToTeleportTo(player);
|
cities = City.getCitiesToTeleportTo(player, false);
|
||||||
else
|
else
|
||||||
cities = City.getCitiesToRepledgeTo(player);
|
cities = City.getCitiesToRepledgeTo(player);
|
||||||
for (City city : cities) {
|
for (City city : cities) {
|
||||||
|
|||||||
@@ -264,8 +264,9 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
|||||||
player.cancelOnSpell();
|
player.cancelOnSpell();
|
||||||
break;
|
break;
|
||||||
case RUNE:
|
case RUNE:
|
||||||
ApplyRuneMsg.applyRune(uuid, origin, player);
|
if(ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||||
itemMan.consume(item);
|
itemMan.consume(item);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default: //shouldn't be here, consume item
|
default: //shouldn't be here, consume item
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (building == null)
|
if (building == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ManageCityAssetMsgHandler.playerCanManageNotFriends(player, building) == false)
|
if (BuildingManager.playerCanManage(player, building) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (orderNpcMsg.getPatrolSize() >= 20)
|
if (orderNpcMsg.getPatrolSize() >= 20)
|
||||||
@@ -411,7 +411,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
case 2:
|
case 2:
|
||||||
player = SessionManager.getPlayerCharacter(origin);
|
player = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (ManageCityAssetMsgHandler.playerCanManageNotFriends(player, building) == false)
|
if (BuildingManager.playerCanManage(player, building) == false)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (building.getHirelings().containsKey(npc) == false)
|
if (building.getHirelings().containsKey(npc) == false)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class PetAttackMsgHandler extends AbstractClientMsgHandler {
|
|||||||
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
||||||
|
|
||||||
switch (msg.getTargetType()) {
|
switch (msg.getTargetType()) {
|
||||||
case 53: //player character
|
case 52: //player character
|
||||||
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
pet.setCombatTarget(PlayerCharacter.getPlayerCharacter(msg.getTargetID()));
|
||||||
break;
|
break;
|
||||||
case 37://mob
|
case 37://mob
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class TransferGoldToFromBuildingMsgHandler extends AbstractClientMsgHandl
|
|||||||
|
|
||||||
if (msg.getDirection() == 2) {
|
if (msg.getDirection() == 2) {
|
||||||
|
|
||||||
if (!ManageCityAssetMsgHandler.playerCanManageNotFriends(player, building))
|
if (!BuildingManager.playerCanManage(player, building))
|
||||||
return true;
|
return true;
|
||||||
if (building.setReserve(msg.getUnknown01(), player)) {
|
if (building.setReserve(msg.getUnknown01(), player)) {
|
||||||
dispatch = Dispatch.borrow(player, msg);
|
dispatch = Dispatch.borrow(player, msg);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class SendOwnPlayerMsg extends ClientNetMsg {
|
|||||||
@Override
|
@Override
|
||||||
protected int getPowerOfTwoBufferSize() {
|
protected int getPowerOfTwoBufferSize() {
|
||||||
//Larger size for historically larger opcodes
|
//Larger size for historically larger opcodes
|
||||||
return (17); // 2^17 == 131,072
|
return (18); // 2^17 == 131,072
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -73,10 +73,8 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
|||||||
|
|
||||||
public void configure() {
|
public void configure() {
|
||||||
|
|
||||||
if (isTeleport)
|
cities = City.getCitiesToTeleportTo(player, !isTeleport);
|
||||||
cities = City.getCitiesToTeleportTo(player);
|
|
||||||
else
|
|
||||||
cities = City.getCitiesToRepledgeTo(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -163,6 +163,11 @@ public class Building extends AbstractWorldObject {
|
|||||||
if (upgradeTimeStamp != null)
|
if (upgradeTimeStamp != null)
|
||||||
this.upgradeDateTime = LocalDateTime.ofInstant(upgradeTimeStamp.toInstant(), ZoneId.systemDefault());
|
this.upgradeDateTime = LocalDateTime.ofInstant(upgradeTimeStamp.toInstant(), ZoneId.systemDefault());
|
||||||
|
|
||||||
|
if(rs.getInt("enforceKOS") == 0)
|
||||||
|
this.enforceKOS = false;
|
||||||
|
else
|
||||||
|
this.enforceKOS = true;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e);
|
Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e);
|
||||||
}
|
}
|
||||||
@@ -1447,7 +1452,7 @@ public class Building extends AbstractWorldObject {
|
|||||||
|
|
||||||
public synchronized boolean setReserve(int amount, PlayerCharacter player) {
|
public synchronized boolean setReserve(int amount, PlayerCharacter player) {
|
||||||
|
|
||||||
if (!BuildingManager.playerCanManageNotFriends(player, this))
|
if (!BuildingManager.playerCanManage(player, this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (amount < 0)
|
if (amount < 0)
|
||||||
|
|||||||
@@ -1400,6 +1400,7 @@ public class CharacterItemManager {
|
|||||||
|
|
||||||
if (!ItemManager.validForSkills(item, pc.getSkills())) {
|
if (!ItemManager.validForSkills(item, pc.getSkills())) {
|
||||||
this.forceToInventory(slot, item, pc, initialized);
|
this.forceToInventory(slot, item, pc, initialized);
|
||||||
|
this.equipped.remove(slot);
|
||||||
pc.applyBonuses();
|
pc.applyBonuses();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+118
-127
@@ -120,9 +120,7 @@ public class City extends AbstractWorldObject {
|
|||||||
this.treeOfLifeID = rs.getInt("treeOfLifeUUID");
|
this.treeOfLifeID = rs.getInt("treeOfLifeUUID");
|
||||||
this.bindX = rs.getFloat("bindX");
|
this.bindX = rs.getFloat("bindX");
|
||||||
this.bindZ = rs.getFloat("bindZ");
|
this.bindZ = rs.getFloat("bindZ");
|
||||||
this.bindLoc = new Vector3fImmutable(this.location.getX() + this.bindX,
|
this.bindLoc = new Vector3fImmutable(this.location.getX() + this.bindX, this.location.getY(), this.location.getZ() + this.bindZ);
|
||||||
this.location.getY(),
|
|
||||||
this.location.getZ() + this.bindZ);
|
|
||||||
this.radiusType = rs.getInt("radiusType");
|
this.radiusType = rs.getInt("radiusType");
|
||||||
|
|
||||||
float bindradiustemp = rs.getFloat("bindRadius");
|
float bindradiustemp = rs.getFloat("bindRadius");
|
||||||
@@ -288,106 +286,119 @@ public class City extends AbstractWorldObject {
|
|||||||
return city.getBindLoc();
|
return city.getBindLoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter pc) {
|
public static ArrayList<City> getCitiesToTeleportTo(PlayerCharacter playerCharacter, boolean repledge) {
|
||||||
|
|
||||||
ArrayList<City> cities = new ArrayList<>();
|
ArrayList<City> cities = new ArrayList<>();
|
||||||
|
|
||||||
if (pc == null)
|
if (playerCharacter == null)
|
||||||
return cities;
|
return cities;
|
||||||
|
|
||||||
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City);
|
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(mbEnums.GameObjectType.City);
|
||||||
|
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
//handle compiling of cities able to be teleported to for lore rule-set
|
||||||
//handle compiling of cities able to be teleported to for lore rule-set
|
|
||||||
for (AbstractGameObject ago : worldCities.values()) {
|
for (AbstractGameObject ago : worldCities.values()) {
|
||||||
City city = (City) ago;
|
|
||||||
if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
City city = (City) ago;
|
||||||
continue; // cannot teleport to perdition or bastion
|
|
||||||
if (city.isNpc == 1 && city.getGuild().charter.equals(pc.guild.charter)) {
|
// Filter Player cities
|
||||||
cities.add(city); // anyone of the same charter can teleport to a safehold of that charter
|
|
||||||
|
if (city.parentZone == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//can't repledge to a guild you're already part of
|
||||||
|
|
||||||
|
if (repledge && city.getGuild().equals(playerCharacter.guild))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (city.parentZone.guild_zone) {
|
||||||
|
|
||||||
|
//players can all port and repledge inside their own nation
|
||||||
|
|
||||||
|
if(city.getGuild().getNation().equals(playerCharacter.guild.getNation())){
|
||||||
|
cities.add(city);
|
||||||
continue;
|
continue;
|
||||||
} else if (city.isNoobIsle == 1 && pc.level <= 20) {
|
}
|
||||||
cities.add(city); // everyone can go to noob island if they are under level 20
|
|
||||||
continue;
|
if (city.isOpen() && city.getTOL().rank > 4) {
|
||||||
} else if (city.cityName.equals("Khan'Ov Srekel")) {
|
|
||||||
cities.add(city); //everyone anytime can teleport to khan
|
// Filter Lore cities
|
||||||
continue;
|
|
||||||
} else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.equals(pc.guild.charter))
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||||
if (!city.getTOL().reverseKOS) {
|
|
||||||
cities.add(city);//can teleport to any open ToL that shares charter
|
if (repledge) {
|
||||||
continue;
|
if (!city.getGuild().charter.canJoin(playerCharacter))
|
||||||
|
continue;
|
||||||
|
} else if (!city.getGuild().charter.equals(playerCharacter.guild.charter))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer playerUUID = playerCharacter.objectUUID;
|
||||||
|
Integer guildUUID = playerCharacter.guildUUID;
|
||||||
|
Integer nationUUID = playerCharacter.guild.getNation().getObjectUUID();
|
||||||
|
boolean allowed = false;
|
||||||
|
|
||||||
|
if (city.getTOL().reverseKOS) {
|
||||||
|
|
||||||
|
//reverse KOS, specific values are allowed
|
||||||
|
|
||||||
|
if ((city.getTOL().getCondemned().containsKey(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) ||
|
||||||
|
(city.getTOL().getCondemned().containsKey(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) ||
|
||||||
|
(city.getTOL().getCondemned().containsKey(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active))
|
||||||
|
allowed = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (city.getTOL().getCondemned().contains(pc.objectUUID) && city.getTOL().getCondemned().get(pc.objectUUID).active) {
|
//not reverse KOS, everyone is allowed by default
|
||||||
cities.add(city);//this player is allowed for the reverse KOS
|
|
||||||
continue;
|
allowed = true;
|
||||||
}
|
|
||||||
if (city.getTOL().getCondemned().contains(pc.guildUUID) && city.getTOL().getCondemned().get(pc.guildUUID).active) {
|
//specific values are not allowed
|
||||||
cities.add(city);//this guild is allowed for the reverse KOS
|
|
||||||
continue;
|
if ((city.getTOL().getCondemned().containsKey(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) ||
|
||||||
}
|
(city.getTOL().getCondemned().containsKey(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) ||
|
||||||
if (city.getTOL().getCondemned().contains(pc.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(pc.guild.getNation().getObjectUUID()).active) {
|
(city.getTOL().getCondemned().containsKey(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active))
|
||||||
cities.add(city);//this nation is allowed for the reverse KOS
|
allowed = false;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (city.getGuild().getNation().equals(pc.guild.getNation())) {
|
|
||||||
cities.add(city);//can always teleport inside your own nation
|
if (allowed)
|
||||||
|
cities.add(city);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
|
||||||
|
|
||||||
Guild pcG = pc.getGuild();
|
// Filter NPC cities
|
||||||
//add npc cities
|
|
||||||
|
|
||||||
for (AbstractGameObject ago : worldCities.values()) {
|
if (city.isNoobIsle == 1) {
|
||||||
|
|
||||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
if (playerCharacter.level < 20)
|
||||||
City city = (City) ago;
|
cities.add(city); // everyone can go to noob island if they are under level 20
|
||||||
|
|
||||||
if (city.noTeleport)
|
continue;
|
||||||
continue;
|
}
|
||||||
|
|
||||||
if (city.parentZone != null && city.parentZone.guild_zone) {
|
// Players cannot teleport to perdition or bastion
|
||||||
|
|
||||||
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
|
if (city.cityName.equals("Perdition") || city.cityName.equals("Bastion"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// These cities are available for anyone off noob island
|
||||||
|
|
||||||
|
if (playerCharacter.level >= 20 && (city.cityName.equals("Sea Dog's Rest") || city.cityName.equals("Khan'Ov Srekel") || city.cityName.equals("City of Khar Th'Sekt"))) {
|
||||||
|
cities.add(city);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add Lore cities
|
||||||
|
|
||||||
|
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
|
||||||
|
|
||||||
|
if (repledge) {
|
||||||
|
if (city.getGuild().charter.canJoin(playerCharacter))
|
||||||
cities.add(city);
|
cities.add(city);
|
||||||
} else
|
} else if (city.getGuild().charter.equals(playerCharacter.guild.charter))
|
||||||
//list Player cities
|
cities.add(city);
|
||||||
|
|
||||||
//open city, just list
|
|
||||||
|
|
||||||
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
|
|
||||||
|
|
||||||
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
|
|
||||||
if (ConfigManager.MB_RULESET.getValue().equals("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);
|
|
||||||
|
|
||||||
|
|
||||||
} else if (city.isNpc == 1) {
|
|
||||||
|
|
||||||
//list NPC cities
|
|
||||||
|
|
||||||
Guild g = city.getGuild();
|
|
||||||
if (g == null) {
|
|
||||||
if (city.isNpc == 1)
|
|
||||||
if (city.isNoobIsle == 1) {
|
|
||||||
if (pc.getLevel() < 21)
|
|
||||||
cities.add(city); //verify nation or guild is same
|
|
||||||
} else if (pc.getLevel() > 9)
|
|
||||||
cities.add(city); //verify nation or guild is same
|
|
||||||
|
|
||||||
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
|
|
||||||
cities.add(city); //verify nation or guild is same
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cities;
|
return cities;
|
||||||
@@ -586,7 +597,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (this.siegesWithstood == siegesWithstood)
|
if (this.siegesWithstood == siegesWithstood)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (DbManager.CityQueries.updateSiegesWithstood(this, siegesWithstood) == true)
|
if (DbManager.CityQueries.updateSiegesWithstood(this, siegesWithstood))
|
||||||
this.siegesWithstood = siegesWithstood;
|
this.siegesWithstood = siegesWithstood;
|
||||||
else
|
else
|
||||||
Logger.error("Error when writing to database for cityUUID: " + this.getObjectUUID());
|
Logger.error("Error when writing to database for cityUUID: " + this.getObjectUUID());
|
||||||
@@ -640,19 +651,12 @@ public class City extends AbstractWorldObject {
|
|||||||
public Guild getGuild() {
|
public Guild getGuild() {
|
||||||
|
|
||||||
if (this.getTOL() == null)
|
if (this.getTOL() == null)
|
||||||
return null;
|
return Guild.getErrantGuild();
|
||||||
|
|
||||||
if (this.isNpc == 1) {
|
if (this.getTOL().getOwner() == null)
|
||||||
|
return Guild.getErrantGuild();
|
||||||
|
|
||||||
if (this.getTOL().getOwner() == null)
|
return this.getTOL().getOwner().getGuild();
|
||||||
return null;
|
|
||||||
return this.getTOL().getOwner().getGuild();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (this.getTOL().getOwner() == null)
|
|
||||||
return null;
|
|
||||||
return this.getTOL().getOwner().getGuild();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean openCity(boolean open) {
|
public boolean openCity(boolean open) {
|
||||||
@@ -731,7 +735,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
for (AbstractCharacter npc : getTOL().getHirelings().keySet()) {
|
for (AbstractCharacter npc : getTOL().getHirelings().keySet()) {
|
||||||
if (npc.getObjectType() == GameObjectType.NPC)
|
if (npc.getObjectType() == GameObjectType.NPC)
|
||||||
if (((NPC) npc).getContract().isRuneMaster() == true)
|
if (((NPC) npc).getContract().isRuneMaster())
|
||||||
outNPC = (NPC) npc;
|
outNPC = (NPC) npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,16 +768,13 @@ public class City extends AbstractWorldObject {
|
|||||||
// Set location for this city
|
// Set location for this city
|
||||||
|
|
||||||
this.location = new Vector3fImmutable(this.parentZone.absX, this.parentZone.absY, this.parentZone.absZ);
|
this.location = new Vector3fImmutable(this.parentZone.absX, this.parentZone.absY, this.parentZone.absZ);
|
||||||
this.bindLoc = new Vector3fImmutable(this.location.x + this.bindX,
|
this.bindLoc = new Vector3fImmutable(this.location.x + this.bindX, this.location.y, this.location.z + this.bindZ);
|
||||||
this.location.y,
|
|
||||||
this.location.z + this.bindZ);
|
|
||||||
|
|
||||||
// set city bounds
|
// set city bounds
|
||||||
|
|
||||||
Bounds cityBounds = Bounds.borrow();
|
Bounds cityBounds = Bounds.borrow();
|
||||||
cityBounds.setBounds(new Vector2f(this.location.x + 64, this.location.z + 64), // location x and z are offset by 64 from the center of the city.
|
cityBounds.setBounds(new Vector2f(this.location.x + 64, this.location.z + 64), // location x and z are offset by 64 from the center of the city.
|
||||||
new Vector2f(mbEnums.CityBoundsType.GRID.halfExtents, mbEnums.CityBoundsType.GRID.halfExtents),
|
new Vector2f(mbEnums.CityBoundsType.GRID.halfExtents, mbEnums.CityBoundsType.GRID.halfExtents), 0.0f);
|
||||||
0.0f);
|
|
||||||
this.setBounds(cityBounds);
|
this.setBounds(cityBounds);
|
||||||
|
|
||||||
// Sanity check; no tol
|
// Sanity check; no tol
|
||||||
@@ -781,8 +782,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (BuildingManager.getBuilding(this.treeOfLifeID) == null)
|
if (BuildingManager.getBuilding(this.treeOfLifeID) == null)
|
||||||
Logger.info("City UID " + this.getObjectUUID() + " Failed to Load Tree of Life with ID " + this.treeOfLifeID);
|
Logger.info("City UID " + this.getObjectUUID() + " Failed to Load Tree of Life with ID " + this.treeOfLifeID);
|
||||||
|
|
||||||
if ((ConfigManager.serverType.equals(ServerType.WORLDSERVER))
|
if ((ConfigManager.serverType.equals(ServerType.WORLDSERVER)) && (this.isNpc == (byte) 0)) {
|
||||||
&& (this.isNpc == (byte) 0)) {
|
|
||||||
|
|
||||||
this.realm = RealmMap.getRealmAtLocation(this.getLoc());
|
this.realm = RealmMap.getRealmAtLocation(this.getLoc());
|
||||||
|
|
||||||
@@ -802,8 +802,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (this.getGuild().getGuildState() == GuildState.Nation)
|
if (this.getGuild().getGuildState() == GuildState.Nation)
|
||||||
for (Guild sub : this.getGuild().getSubGuildList()) {
|
for (Guild sub : this.getGuild().getSubGuildList()) {
|
||||||
|
|
||||||
if ((sub.getGuildState() == GuildState.Protectorate) ||
|
if ((sub.getGuildState() == GuildState.Protectorate) || (sub.getGuildState() == GuildState.Province)) {
|
||||||
(sub.getGuildState() == GuildState.Province)) {
|
|
||||||
this.isCapital = 1;
|
this.isCapital = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -828,7 +827,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
this.setHash();
|
this.setHash();
|
||||||
|
|
||||||
if (DataWarehouse.recordExists(mbEnums.DataRecordType.CITY, this.getObjectUUID()) == false) {
|
if (!DataWarehouse.recordExists(DataRecordType.CITY, this.getObjectUUID())) {
|
||||||
CityRecord cityRecord = CityRecord.borrow(this, mbEnums.RecordEventType.CREATE);
|
CityRecord cityRecord = CityRecord.borrow(this, mbEnums.RecordEventType.CREATE);
|
||||||
DataWarehouse.pushToWarehouse(cityRecord);
|
DataWarehouse.pushToWarehouse(cityRecord);
|
||||||
}
|
}
|
||||||
@@ -853,9 +852,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
for (Building building : this.parentZone.zoneBuildingSet) {
|
for (Building building : this.parentZone.zoneBuildingSet) {
|
||||||
|
|
||||||
if (building.getBlueprint() != null &&
|
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE && building.getBlueprint().getBuildingGroup() != BuildingGroup.TOL) {
|
||||||
building.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE &&
|
|
||||||
building.getBlueprint().getBuildingGroup() != BuildingGroup.TOL) {
|
|
||||||
|
|
||||||
building.healthMax += (building.healthMax * Realm.getRealmHealthMod(this));
|
building.healthMax += (building.healthMax * Realm.getRealmHealthMod(this));
|
||||||
|
|
||||||
@@ -937,7 +934,7 @@ public class City extends AbstractWorldObject {
|
|||||||
|
|
||||||
// Reapply effect with timeout?
|
// Reapply effect with timeout?
|
||||||
|
|
||||||
if (refreshEffect == true)
|
if (refreshEffect)
|
||||||
player.addCityEffect(Integer.toString(effectBase.getUUID()), effectBase, rank, MBServerStatics.FOURTYFIVE_SECONDS, false, this);
|
player.addCityEffect(Integer.toString(effectBase.getUUID()), effectBase, rank, MBServerStatics.FOURTYFIVE_SECONDS, false, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1193,26 +1190,25 @@ public class City extends AbstractWorldObject {
|
|||||||
// All protection contracts are void upon transfer of a city
|
// All protection contracts are void upon transfer of a city
|
||||||
//Dont forget to not Flip protection on Banestones and siege Equipment... Noob.
|
//Dont forget to not Flip protection on Banestones and siege Equipment... Noob.
|
||||||
|
|
||||||
if (cityBuilding.getBlueprint() != null && !cityBuilding.getBlueprint().isSiegeEquip()
|
if (cityBuilding.getBlueprint() != null && !cityBuilding.getBlueprint().isSiegeEquip() && cityBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE)
|
||||||
&& cityBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.BANESTONE)
|
|
||||||
cityBuilding.setProtectionState(ProtectionState.NONE);
|
cityBuilding.setProtectionState(ProtectionState.NONE);
|
||||||
|
|
||||||
// Transfer ownership of valid city assets
|
// Transfer ownership of valid city assets
|
||||||
// these assets are autoprotected.
|
// these assets are autoprotected.
|
||||||
|
|
||||||
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)
|
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK) || (cityBuilding.getBlueprint().isWallPiece()) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE)
|
PlayerCharacter guildLeader = PlayerCharacter.getPlayerCharacter(sourcePlayer.guild.getGuildLeaderUUID());
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
if(guildLeader != null)
|
||||||
|| (cityBuilding.getBlueprint().isWallPiece())
|
cityBuilding.claim(guildLeader);
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
else
|
||||||
|
cityBuilding.claim(sourcePlayer);
|
||||||
cityBuilding.claim(sourcePlayer);
|
|
||||||
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setForceRename(true);
|
this.setForceRename(true);
|
||||||
|
|
||||||
|
|
||||||
// Reset city timer for map update
|
// Reset city timer for map update
|
||||||
|
|
||||||
City.lastCityUpdate = System.currentTimeMillis();
|
City.lastCityUpdate = System.currentTimeMillis();
|
||||||
@@ -1245,12 +1241,7 @@ public class City extends AbstractWorldObject {
|
|||||||
// Transfer ownership of valid city assets
|
// Transfer ownership of valid city assets
|
||||||
// these assets are autoprotected.
|
// these assets are autoprotected.
|
||||||
|
|
||||||
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL)
|
if ((cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.TOL) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK) || (cityBuilding.getBlueprint().isWallPiece()) || (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)) {
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SPIRE)
|
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
|
|
||||||
|| (cityBuilding.getBlueprint().isWallPiece())
|
|
||||||
|| (cityBuilding.getBlueprint().getBuildingGroup() == BuildingGroup.SHRINE)
|
|
||||||
) {
|
|
||||||
|
|
||||||
cityBuilding.claim(sourcePlayer);
|
cityBuilding.claim(sourcePlayer);
|
||||||
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
cityBuilding.setProtectionState(ProtectionState.PROTECTED);
|
||||||
|
|||||||
@@ -193,12 +193,16 @@ public class Guild extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean sameNationExcludeErrant(Guild a, Guild b) {
|
public static boolean sameNationExcludeErrant(Guild a, Guild b) {
|
||||||
|
|
||||||
if (a == null || b == null)
|
if (a == null || b == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (a.getObjectUUID() == b.getObjectUUID())
|
if (a.getObjectUUID() == b.getObjectUUID())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (a.nation == null || b.nation == null)
|
if (a.nation == null || b.nation == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isEmptyGuild();
|
return a.nation.getObjectUUID() == b.nation.getObjectUUID() && !a.nation.isEmptyGuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -349,13 +349,13 @@ public class Resists {
|
|||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Stun))
|
||||||
this.immuneTo.put(mbEnums.DamageType.STUN, true);
|
this.immuneTo.put(mbEnums.DamageType.STUN, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Blind))
|
||||||
this.immuneTo.put(mbEnums.DamageType.BLIND, true);
|
this.immuneTo.put(mbEnums.DamageType.BLINDNESS, true);
|
||||||
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
|
if (rb.getBool(ModType.ImmuneToAttack, SourceType.None))
|
||||||
this.immuneTo.put(mbEnums.DamageType.ATTACK, true);
|
this.immuneTo.put(mbEnums.DamageType.ATTACK, true);
|
||||||
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
|
if (rb.getBool(ModType.ImmuneToPowers, SourceType.None))
|
||||||
this.immuneTo.put(mbEnums.DamageType.POWERS, true);
|
this.immuneTo.put(mbEnums.DamageType.POWERS, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
||||||
this.immuneTo.put(mbEnums.DamageType.POWERBLOCK, true);
|
this.immuneTo.put(mbEnums.DamageType.POWERINHIBITOR, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.DeBuff))
|
||||||
this.immuneTo.put(mbEnums.DamageType.DEBUFF, true);
|
this.immuneTo.put(mbEnums.DamageType.DEBUFF, true);
|
||||||
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))
|
if (rb.getBool(ModType.ImmuneTo, SourceType.Fear))
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ public class Warehouse {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (addToInventory)
|
if (addToInventory)
|
||||||
if (!itemMan.hasRoomInventory(template.item_wt * amount)) {
|
if (!itemMan.hasRoomInventory(template.item_wt)) {
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item.");
|
ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ package engine.powers;
|
|||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.mbEnums;
|
||||||
import engine.mbEnums.ModType;
|
import engine.mbEnums.ModType;
|
||||||
import engine.mbEnums.SourceType;
|
import engine.mbEnums.SourceType;
|
||||||
import engine.mbEnums.StackType;
|
import engine.mbEnums.StackType;
|
||||||
import engine.objects.AbstractCharacter;
|
import engine.objects.*;
|
||||||
import engine.objects.AbstractWorldObject;
|
|
||||||
import engine.objects.PlayerBonuses;
|
|
||||||
import engine.objects.Runegate;
|
|
||||||
import engine.powers.poweractions.AbstractPowerAction;
|
import engine.powers.poweractions.AbstractPowerAction;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -244,32 +242,23 @@ public class ActionsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add blocked types here
|
//Add blocked types here
|
||||||
public boolean blocked(AbstractWorldObject awo, PowersBase pb, int trains) {
|
public boolean blocked(AbstractWorldObject awo, boolean vampDrain) {
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
//Check for immunities
|
||||||
AbstractCharacter ac = (AbstractCharacter) awo;
|
if (AbstractCharacter.IsAbstractCharacter(awo)){
|
||||||
PlayerBonuses bonus = ac.getBonuses();
|
AbstractCharacter pcTarget = (AbstractCharacter) awo;
|
||||||
if (bonus == null)
|
PlayerBonuses bonus = pcTarget.getBonuses();
|
||||||
return false;
|
|
||||||
|
|
||||||
//TODO make this more efficient then testing strings
|
if(vampDrain)
|
||||||
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.STUN))
|
return bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
|
||||||
return true; //Currently stun immune. Skip stun
|
|
||||||
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
|
if ((this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly)) ||
|
||||||
return true; //Currently snare immune. Skip snare
|
(this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))) {
|
||||||
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
|
|
||||||
return true; //Currently blind immune. Skip blind
|
|
||||||
else if (this.stackType.equals("PowerInhibitor") && bonus.getBool(ModType.ImmuneTo, SourceType.Powerblock))
|
|
||||||
return true; //Currently power block immune. Skip power block
|
|
||||||
else if (this.stackType.equals("Root") && bonus.getBool(ModType.ImmuneTo, SourceType.Root))
|
|
||||||
return true;
|
return true;
|
||||||
// else if (pb.isHeal() && (bonus.getByte("immuneTo.Heal")) >= trains)
|
}
|
||||||
// return true; //Currently shadowmantled. Skip heals
|
|
||||||
else if (this.stackType.equals("Flight") && bonus.getBool(ModType.NoMod, SourceType.Fly))
|
mbEnums.DamageType damageType = mbEnums.DamageType.getDamageType(this.stackType.toUpperCase());
|
||||||
return true;
|
return pcTarget.getResists().immuneTo(damageType);
|
||||||
else if (this.stackType.equals("Track") && bonus.getBool(ModType.CannotTrack, SourceType.None))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return pb.vampDrain() && bonus.getBool(ModType.BlockedPowerType, SourceType.VAMPDRAIN);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -633,4 +633,8 @@ public class PowersBase {
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean enforceLore(){
|
||||||
|
return this.powerCategory.equals(PowerCategoryType.SUMMON) || this.powerCategory.equals(PowerCategoryType.HEAL)|| this.powerCategory.equals(PowerCategoryType.BUFF);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,13 @@ public class DestroyCityThread implements Runnable {
|
|||||||
|
|
||||||
cityBuilding.setProtectionState(mbEnums.ProtectionState.NONE);
|
cityBuilding.setProtectionState(mbEnums.ProtectionState.NONE);
|
||||||
|
|
||||||
|
// Remove warehouse entry if one exists.
|
||||||
|
|
||||||
|
if (cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.WAREHOUSE) {
|
||||||
|
DbManager.WarehouseQueries.DELETE_WAREHOUSE(city.warehouse);
|
||||||
|
city.warehouse = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Destroy all remaining city assets
|
// Destroy all remaining city assets
|
||||||
|
|
||||||
if ((cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.BARRACK)
|
if ((cityBuilding.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.BARRACK)
|
||||||
|
|||||||
Reference in New Issue
Block a user