Project reformat.

This commit is contained in:
2024-03-24 09:42:27 -04:00
parent d0bb761344
commit 943d274e5f
53 changed files with 998 additions and 971 deletions
+16 -16
View File
@@ -986,7 +986,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
return 300;
}
float range = 8;
if (( this).charItemManager.equipped.get(EquipSlotType.RHELD) != null) {
if ((this).charItemManager.equipped.get(EquipSlotType.RHELD) != null) {
range = ((Mob) this).charItemManager.equipped.get(EquipSlotType.RHELD).template.item_weapon_max_range;
} else if (((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD) != null) {
range = ((Mob) this).charItemManager.equipped.get(EquipSlotType.LHELD).template.item_weapon_max_range;
@@ -1046,18 +1046,18 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
Building building = BuildingManager.getBuildingAtLocation(this.loc);
Regions region = null;
if(building != null) {
if (building != null) {
//look for region in the building we are in
for (Regions regionCycle : building.getBounds().getRegions()) {
float regionHeight = regionCycle.highLerp.y - regionCycle.lowLerp.y;
if(regionHeight < 10)
if (regionHeight < 10)
regionHeight = 10;
if (regionCycle.isPointInPolygon(value) && Math.abs(regionCycle.highLerp.y - value.y) < regionHeight)
region = regionCycle;
}
}
float regionHeightOffset = 0;
if(region != null){
if (region != null) {
this.region = region;
regionHeightOffset = region.lerpY(this);
this.inBuilding = region.level; // -1 not in building 0 on ground floor, 1 on first floor etc
@@ -1071,7 +1071,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
float terrainHeight = Terrain.getWorldHeight(value);
Vector3fImmutable finalLocation = new Vector3fImmutable(value.x,terrainHeight + regionHeightOffset, value.z);
Vector3fImmutable finalLocation = new Vector3fImmutable(value.x, terrainHeight + regionHeightOffset, value.z);
super.setLoc(finalLocation); // set the location in the world
this.resetLastSetLocUpdate();
@@ -1195,7 +1195,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public final void setCombatTarget(final AbstractWorldObject value) {
if(this.getObjectTypeMask() == 2050) {//MOB?
if (this.getObjectTypeMask() == 2050) {//MOB?
if (value == null) {
if (this.isCombat()) {
this.setCombat(false);
@@ -1203,7 +1203,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
rwss.setPlayer(this);
DispatchMessage.sendToAllInRange(this, rwss);
}
}else {
} else {
if (!this.isCombat()) {
this.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg();
@@ -1331,22 +1331,22 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
CombatManager.handleRetaliate(this, attacker);
}
if(this.getObjectType().equals(GameObjectType.Mob)){
if (this.getObjectType().equals(GameObjectType.Mob)) {
//handle hate value addition
Mob target = (Mob)this;
Mob target = (Mob) this;
if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) {
target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value);
if (target.isPlayerGuard()){
if(target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
if (target.isPlayerGuard()) {
if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false)
target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());
}
}
} else if(this.getObjectType().equals(GameObjectType.PlayerCharacter)){
} else if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) {
City playerCity = ZoneManager.getCityAtLocation(this.loc);
if(playerCity != null){
if(!attacker.getGuild().getNation().equals(playerCity.getGuild().getNation()))
if(!playerCity.getGuild().getNation().getAllyList().contains(attacker.getGuild().getNation()))
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID()))
if (playerCity != null) {
if (!attacker.getGuild().getNation().equals(playerCity.getGuild().getNation()))
if (!playerCity.getGuild().getNation().getAllyList().contains(attacker.getGuild().getNation()))
if (!playerCity.cityOutlaws.contains(attacker.getObjectUUID()))
playerCity.cityOutlaws.add(attacker.getObjectUUID());
}
}
+2 -2
View File
@@ -503,9 +503,9 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
this.lastLoc = new Vector3fImmutable(this.loc);
this.loc = loc;
if(this instanceof AbstractCharacter && this.region != null){
if (this instanceof AbstractCharacter && this.region != null) {
this.loc = this.loc.setY(this.region.lerpY(this) + this.getAltitude());
} else{
} else {
this.loc = this.loc.setY(Terrain.getWorldHeight(this.getLoc()) + this.getAltitude());
}
+17 -17
View File
@@ -1013,7 +1013,7 @@ public class CharacterSkill extends AbstractGameObject {
}
public void calculateMobBaseAmount(boolean isGuard) {
if(!isGuard) {
if (!isGuard) {
if (CharacterSkill.GetOwner(this) == null) {
Logger.error("owner not found for owner uuid : " + this.ownerUID);
this.baseAmount = 1;
@@ -1037,23 +1037,23 @@ public class CharacterSkill extends AbstractGameObject {
//Get bonuses from runes
bonus = CharacterSkill.GetOwner(this).getBonuses().getSkillBonus(this.skillsBase.sourceType);
//Get Base skill for unmodified stats
//Get Base skill for unmodified stats
if (this.skillsBase.getStrMod() > 0)
statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f;
if (this.skillsBase.getDexMod() > 0)
statMod += (float) this.skillsBase.getDexMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseDex() / 100f;
if (this.skillsBase.getConMod() > 0)
statMod += (float) this.skillsBase.getConMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseCon() / 100f;
if (this.skillsBase.getIntMod() > 0)
statMod += (float) this.skillsBase.getIntMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseInt() / 100f;
if (this.skillsBase.getSpiMod() > 0)
statMod += (float) this.skillsBase.getSpiMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseSpi() / 100f;
if (statMod < 1)
statMod = 1f;
else if (statMod > 600)
statMod = 600f;
if (this.skillsBase.getStrMod() > 0)
statMod += (float) this.skillsBase.getStrMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseStr() / 100f;
if (this.skillsBase.getDexMod() > 0)
statMod += (float) this.skillsBase.getDexMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseDex() / 100f;
if (this.skillsBase.getConMod() > 0)
statMod += (float) this.skillsBase.getConMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseCon() / 100f;
if (this.skillsBase.getIntMod() > 0)
statMod += (float) this.skillsBase.getIntMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseInt() / 100f;
if (this.skillsBase.getSpiMod() > 0)
statMod += (float) this.skillsBase.getSpiMod() * (float) ((Mob) CharacterSkill.GetOwner(this)).getMobBase().getMobBaseStats().getBaseSpi() / 100f;
if (statMod < 1)
statMod = 1f;
else if (statMod > 600)
statMod = 600f;
}
base += CharacterSkill.baseSkillValues[(int) statMod];
@@ -1065,7 +1065,7 @@ public class CharacterSkill extends AbstractGameObject {
}
public void calculateModifiedAmount(boolean isGuard) {
if(!isGuard) {
if (!isGuard) {
if (CharacterSkill.GetOwner(this) == null || this.skillsBase == null) {
Logger.error("owner or SkillsBase not found for skill " + this.getObjectUUID());
this.baseAmount = 1;
+13 -13
View File
@@ -325,11 +325,11 @@ public class City extends AbstractWorldObject {
if (city.open && city.getTOL() != null && city.getTOL().getRank() > 4) {
if (!BuildingManager.IsPlayerHostile(city.getTOL(), pc)) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){
if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
cities.add(city);
}
}else {
} else {
cities.add(city); //verify nation or guild is same
}
}
@@ -351,11 +351,11 @@ public class City extends AbstractWorldObject {
cities.add(city);
} else if (pc.getLevel() >= g.getTeleportMin() && pc.getLevel() <= g.getTeleportMax())
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(pc.guild.getGuildType())){
if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if (city.getGuild().getGuildType().equals(pc.guild.getGuildType())) {
cities.add(city);
}
}else {
} else {
cities.add(city); //verify nation or guild is same
}
}
@@ -410,22 +410,22 @@ public class City extends AbstractWorldObject {
if (city.isNpc == 1)
if (city.isNoobIsle == 1) {
if (playerCharacter.getLevel() < 21)
cities.add(city); //verify nation or guild is same
cities.add(city); //verify nation or guild is same
} else if (playerCharacter.getLevel() > 9)
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){
if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if (city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())) {
cities.add(city);
}
}else {
} else {
cities.add(city); //verify nation or guild is same
}
} else if (playerCharacter.getLevel() >= guild.getRepledgeMin() && playerCharacter.getLevel() <= guild.getRepledgeMax()) {
if(ConfigManager.MB_RULESET.getValue() == "LORE") {
if(city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())){
if (ConfigManager.MB_RULESET.getValue() == "LORE") {
if (city.getGuild().getGuildType().equals(playerCharacter.guild.getGuildType())) {
cities.add(city);
}
}else {
} else {
cities.add(city); //verify nation or guild is same
}
}
+1 -1
View File
@@ -993,7 +993,7 @@ public class Item extends AbstractWorldObject {
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
apa.applyBakedInStatsForItem(this, this.template.item_user_power_action.get(effectID)[0]);
}
}
}
public final void loadEnchantments() {
+2 -2
View File
@@ -10,13 +10,11 @@
package engine.objects;
import engine.Enum;
import engine.Enum.ItemType;
import engine.gameManager.DbManager;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
public class ItemBase {
@@ -96,6 +94,7 @@ public class ItemBase {
public final int getUUID() {
return uuid;
}
public String getMastery() {
return mastery;
}
@@ -127,6 +126,7 @@ public class ItemBase {
public short getMinDamage() {
return minDamage;
}
public Enum.SourceType getDamageType() {
return damageType;
}
+1 -1
View File
@@ -534,7 +534,7 @@ public class ItemTemplate {
return false;
//Item not valid for slot
if(item.template.item_eq_slots_or.contains(slot) == false)
if (item.template.item_eq_slots_or.contains(slot) == false)
return false;
// Slot is taken
+44 -44
View File
@@ -1037,13 +1037,13 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
}
public void recalculateStats() {
if(this.isPlayerGuard()){
if (this.isPlayerGuard()) {
NPCManager.setMaxHealthForGuard(this);
NPCManager.setAttackRatingForGuard(this);
NPCManager.setDefenseForGuard(this);
NPCManager.setDamageAndSpeedForGuard(this);
NPCManager.applyGuardStanceModifiers(this);
}else {
} else {
try {
calculateAtrDefenseDamage();
@@ -1061,64 +1061,64 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
} catch (Exception e) {
Logger.error(e.getMessage());
}
if(this.isSiege())
if (this.isSiege())
this.healthMax = 10000;
Resists.calculateResists(this);
}
public void calculateMaxHealthManaStamina() {
float h;
float m;
float s;
float h;
float m;
float s;
h = this.mobBase.getHealthMax();
if (this.isPet()) {
h = this.level * 0.5f * 120;
}
m = this.statSpiCurrent;
s = this.statConCurrent;
h = this.mobBase.getHealthMax();
if (this.isPet()) {
h = this.level * 0.5f * 120;
}
m = this.statSpiCurrent;
s = this.statConCurrent;
// Apply any bonuses from runes and effects
// Apply any bonuses from runes and effects
if (this.bonuses != null) {
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE);
if (this.bonuses != null) {
h += this.bonuses.getFloat(ModType.HealthFull, SourceType.NONE);
m += this.bonuses.getFloat(ModType.ManaFull, SourceType.NONE);
s += this.bonuses.getFloat(ModType.StaminaFull, SourceType.NONE);
//apply effects percent modifiers. DO THIS LAST!
//apply effects percent modifiers. DO THIS LAST!
h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE));
m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE));
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE));
}
h *= (1 + this.bonuses.getFloatPercentAll(ModType.HealthFull, SourceType.NONE));
m *= (1 + this.bonuses.getFloatPercentAll(ModType.ManaFull, SourceType.NONE));
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.NONE));
}
// Set max health, mana and stamina
// Set max health, mana and stamina
if (h > 0)
this.healthMax = h;
else
this.healthMax = 1;
if (h > 0)
this.healthMax = h;
else
this.healthMax = 1;
if (m > -1)
this.manaMax = m;
else
this.manaMax = 0;
if (m > -1)
this.manaMax = m;
else
this.manaMax = 0;
if (s > -1)
this.staminaMax = s;
else
this.staminaMax = 0;
if (s > -1)
this.staminaMax = s;
else
this.staminaMax = 0;
// Update health, mana and stamina if needed
// Update health, mana and stamina if needed
if (this.getHealth() > this.healthMax)
this.setHealth(this.healthMax);
if (this.getHealth() > this.healthMax)
this.setHealth(this.healthMax);
if (this.mana.get() > this.manaMax)
this.mana.set(this.manaMax);
if (this.mana.get() > this.manaMax)
this.mana.set(this.manaMax);
if (this.stamina.get() > this.staminaMax)
this.stamina.set(staminaMax);
if (this.stamina.get() > this.staminaMax)
this.stamina.set(staminaMax);
}
@@ -1885,9 +1885,9 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
}
}
public Boolean isGuard(){
public Boolean isGuard() {
switch(this.behaviourType){
switch (this.behaviourType) {
case GuardMinion:
case GuardCaptain:
case GuardWallArcher:
-1
View File
@@ -19,7 +19,6 @@ import engine.server.MBServerStatics;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
public class MobBase extends AbstractGameObject {
+6 -2
View File
@@ -79,8 +79,12 @@ public class MobBaseStats {
return baseDex;
}
public int getBaseSkill(){return mobbaseSkill;}
public int getBaseSkill() {
return mobbaseSkill;
}
public int getBaseSkillAmount(){return mobbaseSkillAmount;}
public int getBaseSkillAmount() {
return mobbaseSkillAmount;
}
}
+1
View File
@@ -7,6 +7,7 @@
// www.magicbane.com
package engine.objects;
import engine.math.Vector3fImmutable;
import engine.net.client.ClientConnection;
import engine.net.client.msg.PetitionReceivedMsg;
+7 -7
View File
@@ -4572,31 +4572,31 @@ public class PlayerCharacter extends AbstractCharacter {
this.setBounds(playerBounds);
//assign enum values for restrictions
String race = this.getRace().getName().replace("-","").replace(", Male","").replace(", Female","");
String race = this.getRace().getName().replace("-", "").replace(", Male", "").replace(", Female", "");
this.absRace = Enum.MonsterType.valueOf(race);
if(this.baseClass != null)
if (this.baseClass != null)
this.absBaseClass = ClassType.valueOf(this.getBaseClass().getName());
if(this.promotionClass != null)
if (this.promotionClass != null)
this.absPromotionClass = ClassType.valueOf(this.getPromotionClass().getName());
if(this.isMale())
if (this.isMale())
this.absGender = SexType.MALE;
else
this.absGender = SexType.FEMALE;
for(CharacterRune rune : this.runes){
for (CharacterRune rune : this.runes) {
try {
DisciplineType disc = DisciplineType.valueOf(RuneBase.getRuneBase(rune.getRuneBaseID()).getName().replace("-", "").replace(" ", ""));
if (disc != null) {
if(this.absDisciplines == null)
if (this.absDisciplines == null)
this.absDisciplines = EnumSet.of(disc);
else
this.absDisciplines.add(disc);
}
} catch(Exception e){
} catch (Exception e) {
}
}
+1 -2
View File
@@ -3,7 +3,6 @@ package engine.objects;
import engine.Enum;
import engine.Enum.PortalType;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.BuildingManager;
import engine.gameManager.ConfigManager;
import engine.job.JobScheduler;
import engine.jobs.CloseGateJob;
@@ -105,7 +104,7 @@ public class Portal {
if (player.getTimeStamp("lastMoveGate") < this.lastActive)
return;
player.teleport(targetGate.getLoc().add(0,6,0));//offset height of runegate
player.teleport(targetGate.getLoc().add(0, 6, 0));//offset height of runegate
player.setSafeMode();
}
+3 -3
View File
@@ -279,7 +279,7 @@ public class Regions {
Building building = (Building) awo;
if (!Bounds.collide(location, building.getBounds()))
continue;
if(building != null) {
if (building != null) {
region = BuildingManager.GetRegion(building, location.x, location.y, location.z);
}
//find regions that intersect x and z, check if object can enter.
@@ -289,13 +289,13 @@ public class Regions {
// if (region == null)
// region = toEnter;
// else // we're using a low level to high level tree structure, database not always in order low to high.
//check for highest level index.
//check for highest level index.
// if (region != null && toEnter.highLerp.y > region.highLerp.y)
// region = toEnter;
// }
// }
// }
}
return region;
}