Compare commits

..

27 Commits

Author SHA1 Message Date
FatBoy da0510d2bc proccing system 2024-06-22 19:50:53 -05:00
FatBoy 1f732a8ca9 failed rune sno longer get consumed 2024-06-22 19:31:13 -05:00
FatBoy 0d24789a93 reverse KOS function completed 2024-06-22 19:22:13 -05:00
FatBoy 35427cfb4a reverse KOS function 2024-06-22 19:04:04 -05:00
MagicBot 695a78b1e2 Noob island filter at 20 2024-06-19 17:57:28 -04:00
MagicBot 9f6710ccb9 More logic work 2024-06-19 17:51:42 -04:00
MagicBot fff1e80f61 More logic work 2024-06-19 17:49:46 -04:00
MagicBot 141af19daa More logic work 2024-06-19 17:38:44 -04:00
MagicBot 630748541f More logic work 2024-06-19 17:36:09 -04:00
MagicBot d32818f351 Rearrange logic 2024-06-19 17:27:04 -04:00
MagicBot d6f94bd0e7 Merged methods 2024-06-19 17:10:49 -04:00
MagicBot db6a4e471d Lore rules added to method 2024-06-19 17:08:56 -04:00
MagicBot a24c611bac Lore rules added to method 2024-06-19 17:01:02 -04:00
MagicBot 3926160ab1 Unused method removed 2024-06-19 16:56:57 -04:00
MagicBot 4a7013de61 Signature update 2024-06-19 16:56:06 -04:00
MagicBot 56564f1c3b Cleanup of teleport list 2024-06-19 16:53:55 -04:00
MagicBot 8a3e39e97d Cleanup of cityChoice handler 2024-06-19 15:05:01 -04:00
MagicBot 5224c79441 Condemned uuid is key not value in map 2024-06-19 14:53:57 -04:00
MagicBot ede016a93d Never null 2024-06-19 14:43:31 -04:00
MagicBot cc1825dec9 Increase to handle larger banks. 2024-06-18 12:43:59 -04:00
MagicBot d257ce50cf Sanity check for null city. 2024-06-18 11:56:19 -04:00
MagicBot 5b246211e1 Warehouse record removed in destruction banes. 2024-06-18 11:51:11 -04:00
FatBoy 33c923b0de fixed immunities in powers manager 2024-06-13 20:47:28 -05:00
FatBoy 02d524663a fixed a lore issue in powers manager 2024-06-13 20:14:43 -05:00
MagicBot 5bd85addb7 Removed count when validating stack withdraw weight. 2024-06-13 15:42:54 -04:00
FatBoy 40bae67443 fixed mob damage defense and ATR 2024-06-12 19:35:20 -05:00
FatBoy 1cf1d731c4 added = to range checks and converted speed to float 2024-06-12 19:23:34 -05:00
14 changed files with 213 additions and 175 deletions
@@ -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;
@@ -463,26 +463,8 @@ 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;
+23 -4
View File
@@ -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;
@@ -168,12 +169,12 @@ public enum CombatManager {
switch (target.getObjectType()) { switch (target.getObjectType()) {
case PlayerCharacter: case PlayerCharacter:
attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f; attackRange += ((PlayerCharacter) target).getCharacterHeight() * 0.5f;
if (distanceSquared < attackRange * attackRange) if (distanceSquared <= attackRange * attackRange)
inRange = true; inRange = true;
break; break;
case Mob: case Mob:
attackRange += ((AbstractCharacter) target).calcHitBox(); attackRange += ((AbstractCharacter) target).calcHitBox();
if (distanceSquared < attackRange * attackRange) if (distanceSquared <= attackRange * attackRange)
inRange = true; inRange = true;
break; break;
case Building: case Building:
@@ -196,12 +197,14 @@ public enum CombatManager {
} }
} }
checkForProc(attacker,target,weapon);
//get delay for the auto attack job //get delay for the auto attack job
long delay = 5000; long delay = 5000;
if (weapon != null) { if (weapon != null) {
int wepSpeed = (int) (weapon.template.item_weapon_wepspeed); float wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None)); wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
@@ -212,7 +215,7 @@ public enum CombatManager {
if (wepSpeed < 10) if (wepSpeed < 10)
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects. wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
delay = wepSpeed * 100L; delay = (long)wepSpeed * 100L;
} }
if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob))
@@ -651,4 +654,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);
}
}
}
} }
+32 -4
View File
@@ -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,9 +925,20 @@ 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) { //Check for immunities
if (target.getObjectType() == GameObjectType.PlayerCharacter) {
PlayerCharacter pcTarget = (PlayerCharacter) target; PlayerCharacter pcTarget = (PlayerCharacter) target;
PlayerBonuses tarBonus = pcTarget.getBonuses();
SourceType source = SourceType.GetSourceType(pb.category);
boolean immune = tarBonus.getBool(ModType.ImmuneTo, source);
if(!immune){
DamageType damageType = DamageType.getDamageType(pb.category);
immune = pcTarget.getResists().immuneTo(damageType);
}
if(immune){
return;
}
} }
// update target of used power timer // update target of used power timer
@@ -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);
@@ -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);
} }
/** /**
+7 -7
View File
@@ -656,13 +656,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD)); AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD));
if (abstractCharacter.getObjectType().equals(GameObjectType.Mob)) { if (abstractCharacter.getObjectType().equals(GameObjectType.Mob)) {
Mob mob = (Mob) abstractCharacter; Mob mob = (Mob) abstractCharacter;
abstractCharacter.minDamageHandOne += (int) mob.mobBase.getDamageMin(); abstractCharacter.minDamageHandOne = (int) mob.mobBase.getDamageMin();
abstractCharacter.minDamageHandTwo += (int) mob.mobBase.getDamageMin(); abstractCharacter.minDamageHandTwo = (int) mob.mobBase.getDamageMin();
abstractCharacter.maxDamageHandOne += (int) mob.mobBase.getDamageMax(); abstractCharacter.maxDamageHandOne = (int) mob.mobBase.getDamageMax();
abstractCharacter.maxDamageHandTwo += (int) mob.mobBase.getDamageMax(); abstractCharacter.maxDamageHandTwo = (int) mob.mobBase.getDamageMax();
abstractCharacter.atrHandOne += mob.mobBase.getAttackRating(); abstractCharacter.atrHandOne = mob.mobBase.getAttackRating();
abstractCharacter.atrHandTwo += mob.mobBase.getAttackRating(); abstractCharacter.atrHandTwo = mob.mobBase.getAttackRating();
abstractCharacter.defenseRating += mob.mobBase.getDefenseRating(); abstractCharacter.defenseRating = mob.mobBase.getDefenseRating();
} }
} }
+122 -133
View File
@@ -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,121 @@ 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
continue; if (city.parentZone == null)
} else if (city.isNoobIsle == 1 && pc.level <= 20) { continue;
cities.add(city); // everyone can go to noob island if they are under level 20
continue; if(repledge && city.getGuild().equals(playerCharacter.guild)){
} else if (city.cityName.equals("Khan'Ov Srekel")) { //can't repledge to a guild you're already part of
cities.add(city); //everyone anytime can teleport to khan continue;
continue;
} else if (city.isOpen() && city.getTOL().rank > 4 && city.getGuild().charter.equals(pc.guild.charter))
if (!city.getTOL().reverseKOS) {
cities.add(city);//can teleport to any open ToL that shares charter
continue;
} else {
if (city.getTOL().getCondemned().contains(pc.objectUUID) && city.getTOL().getCondemned().get(pc.objectUUID).active) {
cities.add(city);//this player is allowed for the reverse KOS
continue;
}
if (city.getTOL().getCondemned().contains(pc.guildUUID) && city.getTOL().getCondemned().get(pc.guildUUID).active) {
cities.add(city);//this guild is allowed for the reverse KOS
continue;
}
if (city.getTOL().getCondemned().contains(pc.guild.getNation().getObjectUUID()) && city.getTOL().getCondemned().get(pc.guild.getNation().getObjectUUID()).active) {
cities.add(city);//this nation is allowed for the reverse KOS
continue;
}
}
if (city.getGuild().getNation().equals(pc.guild.getNation())) {
cities.add(city);//can always teleport inside your own nation
}
} }
} else {
Guild pcG = pc.getGuild(); if (city.parentZone.guild_zone) {
//add npc cities
for (AbstractGameObject ago : worldCities.values()) {
if (ago.getObjectType().equals(GameObjectType.City)) {
City city = (City) ago;
if (city.noTeleport)
continue;
if (city.parentZone != null && city.parentZone.guild_zone) {
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city);
} else
//list Player cities
//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
}
if(city.getGuild().getNation().equals(playerCharacter.guild.getNation())){
//players can all port and repledge inside their own nation
cities.add(city);
continue;
} }
if (city.isOpen() && city.getTOL().rank > 4) {
// Filter Lore cities
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) {
if (!repledge)
if (!city.getGuild().charter.equals(playerCharacter.guild.charter))
continue;
else if (!city.getGuild().charter.canJoin(playerCharacter))
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().contains(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) {
//individual is cleared for teleport/repledge
allowed = true;
} else if (city.getTOL().getCondemned().contains(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) {
//player guild is cleared for teleport/repledge
allowed = true;
} else if (city.getTOL().getCondemned().contains(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active) {
//player nation is cleared for teleport/repledge
allowed = true;
}
} else {
//not reverse KOS, everyone is allowed by default
allowed = true;
//specific values are not allowed
if (city.getTOL().getCondemned().contains(playerUUID) && city.getTOL().getCondemned().get(playerUUID).active) {
//individual is cleared for teleport/repledge
allowed = false;
} else if (city.getTOL().getCondemned().contains(guildUUID) && city.getTOL().getCondemned().get(guildUUID).active) {
//player guild is cleared for teleport/repledge
allowed = false;
} else if (city.getTOL().getCondemned().contains(nationUUID) && city.getTOL().getCondemned().get(nationUUID).active) {
//player nation is cleared for teleport/repledge
allowed = false;
}
}
if (allowed) {
cities.add(city);
continue;
}
}
} else {
// Filter NPC cities
if (city.isNoobIsle == 1) {
if (playerCharacter.level < 20)
cities.add(city); // everyone can go to noob island if they are under level 20
continue;
}
// Players cannot teleport to perdition or bastion
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);
} else if (city.getGuild().charter.equals(playerCharacter.guild.charter))
cities.add(city);
}
} }
} }
return cities; return cities;
@@ -586,7 +599,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 +653,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 +737,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 +770,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 +784,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 +804,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 +829,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 +854,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 +936,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,18 +1192,13 @@ 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)
|| (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);
@@ -1245,12 +1239,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);
+4
View File
@@ -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();
} }
+1 -1
View File
@@ -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;
} }
+4
View File
@@ -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)