Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5bbc9eee0 | |||
| 4092f7f38f | |||
| a4eea2173d | |||
| d193a12554 | |||
| 96387aa4f4 | |||
| 785a5eb736 | |||
| dd4f4bffe9 | |||
| 2cdeaa4d66 | |||
| 0430fb3e42 | |||
| 5c34853293 | |||
| d991a4f2d8 | |||
| d87d3e2f41 | |||
| edf11f166f | |||
| e5c1dc7bcb | |||
| 9542034e32 |
@@ -1,150 +0,0 @@
|
|||||||
package engine.Dungeons;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.net.ByteBufferWriter;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class Dungeon {
|
|
||||||
|
|
||||||
public static int NoFlyEffectID = -1733819072;
|
|
||||||
public static int NoTeleportEffectID = -1971545187;
|
|
||||||
public static int NoSummonEffectID = 2122002462;
|
|
||||||
public ArrayList<PlayerCharacter> participants;
|
|
||||||
public int maxPerGuild;
|
|
||||||
public Vector3fImmutable entrance;
|
|
||||||
public ArrayList<Mob> dungeon_mobs;
|
|
||||||
public Long respawnTime = 0L;
|
|
||||||
|
|
||||||
public Dungeon(Vector3fImmutable entrance, int maxCount){
|
|
||||||
this.participants = new ArrayList<>();
|
|
||||||
this.entrance = entrance;
|
|
||||||
this.dungeon_mobs = new ArrayList<>();
|
|
||||||
this.maxPerGuild = maxCount;
|
|
||||||
}
|
|
||||||
public void applyDungeonEffects(PlayerCharacter player){
|
|
||||||
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
|
|
||||||
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
|
|
||||||
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
|
|
||||||
|
|
||||||
if(noFly != null)
|
|
||||||
player.addEffectNoTimer(noFly.getName(),noFly,40,true);
|
|
||||||
|
|
||||||
if(noTele != null)
|
|
||||||
player.addEffectNoTimer(noTele.getName(),noTele,40,true);
|
|
||||||
|
|
||||||
if(noSum != null)
|
|
||||||
player.addEffectNoTimer(noSum.getName(),noSum,40,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeDungeonEffects(PlayerCharacter player) {
|
|
||||||
EffectsBase noFly = PowersManager.getEffectByToken(NoFlyEffectID);
|
|
||||||
EffectsBase noTele = PowersManager.getEffectByToken(NoTeleportEffectID);
|
|
||||||
EffectsBase noSum = PowersManager.getEffectByToken(NoSummonEffectID);
|
|
||||||
for (Effect eff : player.effects.values()) {
|
|
||||||
if (noFly != null && eff.getEffectsBase().equals(noFly))
|
|
||||||
eff.endEffect();
|
|
||||||
|
|
||||||
if (noTele != null && eff.getEffectsBase().equals(noTele))
|
|
||||||
eff.endEffect();
|
|
||||||
|
|
||||||
if (noSum != null && eff.getEffectsBase().equals(noSum))
|
|
||||||
eff.endEffect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void serializeForClientMsgTeleport(ByteBufferWriter writer) {
|
|
||||||
Guild rulingGuild = Guild.getErrantGuild();
|
|
||||||
Guild rulingNation = Guild.getErrantGuild();
|
|
||||||
|
|
||||||
Zone zone = ZoneManager.getZoneByUUID(994);
|
|
||||||
// Begin Serialzing soverign guild data
|
|
||||||
writer.putInt(Enum.GameObjectType.Zone.ordinal());
|
|
||||||
writer.putInt(994);
|
|
||||||
writer.putString("Whitehorn Citadel");
|
|
||||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
|
||||||
writer.putInt(rulingGuild.getObjectUUID());
|
|
||||||
|
|
||||||
writer.putString("Whitehorn Militants"); // guild name
|
|
||||||
writer.putString("In the Citadel, We Fight!"); // motto
|
|
||||||
writer.putString(rulingGuild.getLeadershipType());
|
|
||||||
|
|
||||||
// Serialize guild ruler's name
|
|
||||||
// If tree is abandoned blank out the name
|
|
||||||
// to allow them a rename.
|
|
||||||
|
|
||||||
writer.putString("Kol'roth The Destroyer");//sovreign
|
|
||||||
|
|
||||||
writer.putInt(rulingGuild.getCharter());
|
|
||||||
writer.putInt(0); // always 00000000
|
|
||||||
|
|
||||||
writer.put((byte)0);
|
|
||||||
|
|
||||||
writer.put((byte) 1);
|
|
||||||
writer.put((byte) 1); // *** Refactor: What are these flags?
|
|
||||||
writer.put((byte) 1);
|
|
||||||
writer.put((byte) 1);
|
|
||||||
writer.put((byte) 1);
|
|
||||||
|
|
||||||
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
|
|
||||||
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
|
|
||||||
|
|
||||||
writer.putInt(0);// TODO Implement description text
|
|
||||||
|
|
||||||
writer.put((byte) 1);
|
|
||||||
writer.put((byte) 0);
|
|
||||||
writer.put((byte) 1);
|
|
||||||
|
|
||||||
// Begin serializing nation guild info
|
|
||||||
|
|
||||||
if (rulingNation.isEmptyGuild()) {
|
|
||||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
|
||||||
writer.putInt(rulingGuild.getObjectUUID());
|
|
||||||
} else {
|
|
||||||
writer.putInt(rulingNation.getObjectType().ordinal());
|
|
||||||
writer.putInt(rulingNation.getObjectUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Serialize nation name
|
|
||||||
|
|
||||||
writer.putString("Whitehorn Militants"); //nation name
|
|
||||||
|
|
||||||
writer.putInt(-1);//city rank, -1 puts it at top of list always
|
|
||||||
|
|
||||||
writer.putInt(0xFFFFFFFF);
|
|
||||||
|
|
||||||
writer.putInt(0);
|
|
||||||
|
|
||||||
writer.putString("Kol'roth The Destroyer");//nation ruler
|
|
||||||
|
|
||||||
writer.putLocalDateTime(LocalDateTime.now());
|
|
||||||
|
|
||||||
//location
|
|
||||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
|
|
||||||
|
|
||||||
writer.putFloat(loc.x);
|
|
||||||
writer.putFloat(loc.y);
|
|
||||||
writer.putFloat(loc.z);
|
|
||||||
|
|
||||||
writer.putInt(0);
|
|
||||||
|
|
||||||
writer.put((byte) 1);
|
|
||||||
writer.put((byte) 0);
|
|
||||||
writer.putInt(0x64);
|
|
||||||
writer.put((byte) 0);
|
|
||||||
writer.put((byte) 0);
|
|
||||||
writer.put((byte) 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
package engine.Dungeons;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class DungeonManager {
|
|
||||||
public static ArrayList<Dungeon> dungeons;
|
|
||||||
|
|
||||||
private static final float dungeonAiRange = 64f;
|
|
||||||
private static final float maxTravel = 64f;
|
|
||||||
|
|
||||||
public static void joinDungeon(PlayerCharacter pc, Dungeon dungeon){
|
|
||||||
if(requestEnter(pc,dungeon)) {
|
|
||||||
dungeon.participants.add(pc);
|
|
||||||
dungeon.applyDungeonEffects(pc);
|
|
||||||
translocateToDungeon(pc, dungeon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void leaveDungeon(PlayerCharacter pc, Dungeon dungeon){
|
|
||||||
dungeon.participants.remove(pc);
|
|
||||||
dungeon.removeDungeonEffects(pc);
|
|
||||||
translocateOutOfDungeon(pc);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean requestEnter(PlayerCharacter pc, Dungeon dungeon){
|
|
||||||
int current = 0;
|
|
||||||
Guild nation = pc.guild.getNation();
|
|
||||||
|
|
||||||
if(nation == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for(PlayerCharacter participant : dungeon.participants){
|
|
||||||
if(participant.guild.getNation().equals(nation)){
|
|
||||||
current ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(current >= dungeon.maxPerGuild)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void translocateToDungeon(PlayerCharacter pc, Dungeon dungeon){
|
|
||||||
pc.teleport(dungeon.entrance);
|
|
||||||
pc.setSafeMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void translocateOutOfDungeon(PlayerCharacter pc){
|
|
||||||
pc.teleport(pc.bindLoc);
|
|
||||||
pc.setSafeMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void pulse_dungeons(){
|
|
||||||
for(Dungeon dungeon : dungeons){
|
|
||||||
|
|
||||||
//early exit, if no players present don't waste resources
|
|
||||||
if(dungeon.participants.isEmpty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(dungeon.respawnTime > 0 && System.currentTimeMillis() > dungeon.respawnTime){
|
|
||||||
respawnMobs(dungeon);
|
|
||||||
}
|
|
||||||
|
|
||||||
//remove any players that have left
|
|
||||||
HashSet<AbstractWorldObject> obj = WorldGrid.getObjectsInRangePartial(dungeon.entrance,4096f,MBServerStatics.MASK_PLAYER);
|
|
||||||
for(PlayerCharacter player : dungeon.participants)
|
|
||||||
if(!obj.contains(player))
|
|
||||||
leaveDungeon(player,dungeon);
|
|
||||||
|
|
||||||
//cycle dungeon mob AI
|
|
||||||
for(Mob mob : dungeon.dungeon_mobs)
|
|
||||||
dungeonMobAI(mob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void dungeonMobAI(Mob mob){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void respawnMobs(Dungeon dungeon){
|
|
||||||
for(Mob mob : dungeon.dungeon_mobs){
|
|
||||||
|
|
||||||
if(!mob.isAlive() && mob.despawned)
|
|
||||||
mob.respawn();
|
|
||||||
|
|
||||||
if(!mob.isAlive() && !mob.despawned){
|
|
||||||
mob.despawn();
|
|
||||||
mob.respawn();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+18
-35
@@ -9,13 +9,15 @@
|
|||||||
package engine;
|
package engine;
|
||||||
|
|
||||||
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
import ch.claude_martin.enumbitset.EnumBitSetHelper;
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.PowersManager;
|
import engine.gameManager.PowersManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractCharacter;
|
||||||
|
import engine.objects.ItemBase;
|
||||||
|
import engine.objects.Shrine;
|
||||||
|
import engine.objects.Zone;
|
||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -137,8 +139,8 @@ public class Enum {
|
|||||||
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
||||||
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||||
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.MALE, 1.1f),
|
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
|
||||||
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.FEMALE, 1.1f),
|
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
||||||
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||||
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
||||||
@@ -150,8 +152,7 @@ public class Enum {
|
|||||||
NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
||||||
HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
|
HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
|
||||||
VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||||
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
|
||||||
SAETOR(1999,MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE,1);
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
||||||
@@ -207,8 +208,8 @@ public class Enum {
|
|||||||
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
||||||
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
||||||
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f),
|
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
|
||||||
IREKEI(6.499500105f, 14.6685f, 4.2199998f, 14.6685f, 6.3299999f, 18.379999f, 6.5f);
|
|
||||||
private float walkStandard;
|
private float walkStandard;
|
||||||
private float walkCombat;
|
private float walkCombat;
|
||||||
private float runStandard;
|
private float runStandard;
|
||||||
@@ -468,14 +469,11 @@ public class Enum {
|
|||||||
|
|
||||||
// 14001 does not have a banestone to bind at
|
// 14001 does not have a banestone to bind at
|
||||||
|
|
||||||
if (ruinZone.getLoadNum() == 14001) {
|
if (ruinZone.getLoadNum() == 14001)
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||||
}else {
|
else
|
||||||
//spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||||
//.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
.add(new Vector3fImmutable(-196.016f, 2.812f, 203.621f)), 30);
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(27977).loc,30f);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -778,7 +776,6 @@ public class Enum {
|
|||||||
Combat,
|
Combat,
|
||||||
Spires,
|
Spires,
|
||||||
Snare,
|
Snare,
|
||||||
Snared,
|
|
||||||
Stun,
|
Stun,
|
||||||
Blind,
|
Blind,
|
||||||
Root,
|
Root,
|
||||||
@@ -881,7 +878,6 @@ public class Enum {
|
|||||||
Siege,
|
Siege,
|
||||||
Slash,
|
Slash,
|
||||||
Snare,
|
Snare,
|
||||||
Snared,
|
|
||||||
Sorcery,
|
Sorcery,
|
||||||
Spear,
|
Spear,
|
||||||
SpearMastery,
|
SpearMastery,
|
||||||
@@ -961,17 +957,6 @@ public class Enum {
|
|||||||
Wizardry;
|
Wizardry;
|
||||||
|
|
||||||
public static SourceType GetSourceType(String modName) {
|
public static SourceType GetSourceType(String modName) {
|
||||||
switch(modName){
|
|
||||||
case "Slashing":
|
|
||||||
modName = "Slash";
|
|
||||||
break;
|
|
||||||
case "Crushing":
|
|
||||||
modName = "Crush";
|
|
||||||
break;
|
|
||||||
case "Piercing":
|
|
||||||
modName = "Pierce";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
SourceType returnMod;
|
SourceType returnMod;
|
||||||
if (modName.isEmpty())
|
if (modName.isEmpty())
|
||||||
return SourceType.None;
|
return SourceType.None;
|
||||||
@@ -979,8 +964,8 @@ public class Enum {
|
|||||||
try {
|
try {
|
||||||
returnMod = SourceType.valueOf(modName.replace(",", ""));
|
returnMod = SourceType.valueOf(modName.replace(",", ""));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//Logger.error(modName);
|
Logger.error(modName);
|
||||||
//Logger.error(e);
|
Logger.error(e);
|
||||||
return SourceType.None;
|
return SourceType.None;
|
||||||
}
|
}
|
||||||
return returnMod;
|
return returnMod;
|
||||||
@@ -1031,7 +1016,6 @@ public class Enum {
|
|||||||
Silence,
|
Silence,
|
||||||
Slash,
|
Slash,
|
||||||
Snare,
|
Snare,
|
||||||
Snared,
|
|
||||||
Stance,
|
Stance,
|
||||||
Stun,
|
Stun,
|
||||||
Summon,
|
Summon,
|
||||||
@@ -1156,7 +1140,6 @@ public class Enum {
|
|||||||
SkillDebuff,
|
SkillDebuff,
|
||||||
SlashResistanceDebuff,
|
SlashResistanceDebuff,
|
||||||
Snare,
|
Snare,
|
||||||
Snared,
|
|
||||||
StackableAttrCONBuff,
|
StackableAttrCONBuff,
|
||||||
StackableAttrDEXBuff,
|
StackableAttrDEXBuff,
|
||||||
StackableAttrSTRBuff,
|
StackableAttrSTRBuff,
|
||||||
@@ -2323,9 +2306,9 @@ public class Enum {
|
|||||||
|
|
||||||
public enum CityBoundsType {
|
public enum CityBoundsType {
|
||||||
|
|
||||||
GRID(544),
|
GRID(640),
|
||||||
ZONE(672),
|
ZONE(875),
|
||||||
PLACEMENT(673);
|
PLACEMENT(876);
|
||||||
|
|
||||||
public final float extents;
|
public final float extents;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ import engine.net.AbstractNetMsg;
|
|||||||
import engine.net.Dispatch;
|
import engine.net.Dispatch;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.ClientConnection;
|
import engine.net.client.ClientConnection;
|
||||||
import engine.net.client.msg.*;
|
import engine.net.client.msg.LoadCharacterMsg;
|
||||||
|
import engine.net.client.msg.LoadStructureMsg;
|
||||||
|
import engine.net.client.msg.MoveToPointMsg;
|
||||||
|
import engine.net.client.msg.UnloadObjectsMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
@@ -511,18 +514,6 @@ public enum InterestManager implements Runnable {
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
|
||||||
if(pc.equals(player)){
|
|
||||||
try{
|
|
||||||
WorldGrid.RemoveWorldObject(player);
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ClientConnection origin = player.getClientConnection();
|
ClientConnection origin = player.getClientConnection();
|
||||||
|
|
||||||
if (origin == null)
|
if (origin == null)
|
||||||
@@ -530,10 +521,10 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// Update loaded upbjects lists
|
// Update loaded upbjects lists
|
||||||
|
|
||||||
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
|
|
||||||
player.setDirtyLoad(true);
|
player.setDirtyLoad(true);
|
||||||
updateStaticList(player, origin);
|
updateStaticList(player, origin);
|
||||||
updateMobileList(player, origin);
|
updateMobileList(player, origin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||||
@@ -567,23 +558,4 @@ public enum InterestManager implements Runnable {
|
|||||||
playerCharacter.setDirtyLoad(true);
|
playerCharacter.setDirtyLoad(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshLoadedObjects(PlayerCharacter player){
|
|
||||||
try {
|
|
||||||
if (player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ClientConnection origin = player.getClientConnection();
|
|
||||||
|
|
||||||
if (origin == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Update loaded upbjects lists
|
|
||||||
player.setDirtyLoad(true);
|
|
||||||
updateStaticList(player, origin);
|
|
||||||
updateMobileList(player, origin);
|
|
||||||
}catch(Exception e){
|
|
||||||
Logger.error(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
package engine.ZergMehcanics;
|
|
||||||
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ZergManager;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class MineAntiZerg {
|
|
||||||
|
|
||||||
public static HashMap<Mine,HashMap<PlayerCharacter,Long>> leaveTimers = new HashMap<>();
|
|
||||||
public static HashMap<Mine,ArrayList<PlayerCharacter>> currentPlayers = new HashMap<>();
|
|
||||||
|
|
||||||
public static void runMines(){
|
|
||||||
for(Mine mine : Mine.getMines()){
|
|
||||||
|
|
||||||
Building tower = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
|
||||||
|
|
||||||
if(tower == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!mine.isActive)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
logPlayersPresent(tower,mine);
|
|
||||||
|
|
||||||
auditPlayersPresent(tower,mine);
|
|
||||||
|
|
||||||
auditPlayers(mine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void logPlayersPresent(Building tower, Mine mine){
|
|
||||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> playersPresent = new ArrayList<>();
|
|
||||||
for(AbstractWorldObject player : loadedPlayers){
|
|
||||||
playersPresent.add((PlayerCharacter)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPlayers.put(mine,playersPresent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void auditPlayersPresent(Building tower, Mine mine){
|
|
||||||
HashSet<AbstractWorldObject> loadedPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, MBServerStatics.CHARACTER_LOAD_RANGE * 3,MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
ArrayList<PlayerCharacter> toRemove = new ArrayList<>();
|
|
||||||
|
|
||||||
for(PlayerCharacter player : currentPlayers.get(mine)){
|
|
||||||
if(!loadedPlayers.contains(player)){
|
|
||||||
toRemove.add(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPlayers.get(mine).removeAll(toRemove);
|
|
||||||
|
|
||||||
for(PlayerCharacter player : toRemove){
|
|
||||||
if(leaveTimers.containsKey(mine)){
|
|
||||||
leaveTimers.get(mine).put(player,System.currentTimeMillis());
|
|
||||||
}else{
|
|
||||||
HashMap<PlayerCharacter,Long> leaveTime = new HashMap<>();
|
|
||||||
leaveTime.put(player,System.currentTimeMillis());
|
|
||||||
leaveTimers.put(mine,leaveTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
toRemove.clear();
|
|
||||||
|
|
||||||
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
|
|
||||||
long timeGone = System.currentTimeMillis() - leaveTimers.get(mine).get(player);
|
|
||||||
if(timeGone > 180000L) {//3 minutes
|
|
||||||
toRemove.add(player);
|
|
||||||
player.ZergMultiplier = 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(PlayerCharacter player : toRemove) {
|
|
||||||
leaveTimers.get(mine).remove(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void auditPlayers(Mine mine){
|
|
||||||
|
|
||||||
HashMap<Guild,ArrayList<PlayerCharacter>> playersByNation = new HashMap<>();
|
|
||||||
|
|
||||||
for(PlayerCharacter player : currentPlayers.get(mine)){
|
|
||||||
if(playersByNation.containsKey(player.guild.getNation())){
|
|
||||||
playersByNation.get(player.guild.getNation()).add(player);
|
|
||||||
}else{
|
|
||||||
ArrayList<PlayerCharacter> players = new ArrayList<>();
|
|
||||||
players.add(player);
|
|
||||||
playersByNation.put(player.guild.getNation(),players);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(PlayerCharacter player : leaveTimers.get(mine).keySet()){
|
|
||||||
if(playersByNation.containsKey(player.guild.getNation())){
|
|
||||||
playersByNation.get(player.guild.getNation()).add(player);
|
|
||||||
}else{
|
|
||||||
ArrayList<PlayerCharacter> players = new ArrayList<>();
|
|
||||||
players.add(player);
|
|
||||||
playersByNation.put(player.guild.getNation(),players);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Guild nation : playersByNation.keySet()){
|
|
||||||
for(PlayerCharacter player : playersByNation.get(nation)){
|
|
||||||
player.ZergMultiplier = ZergManager.getCurrentMultiplier(playersByNation.get(nation).size(), mine.capSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,13 +13,14 @@ import engine.Enum;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.gameManager.ConfigManager;
|
import engine.gameManager.ConfigManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.net.DispatchMessage;
|
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
|
||||||
import engine.objects.Account;
|
import engine.objects.Account;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class dbAccountHandler extends dbHandlerBase {
|
public class dbAccountHandler extends dbHandlerBase {
|
||||||
@@ -76,24 +77,18 @@ public class dbAccountHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SET_TRASH(String machineID, String type) {
|
public void SET_TRASH(String machineID) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO dyn_trash(`machineID`, `count`)"
|
||||||
"INSERT INTO dyn_trash(`machineID`, `count`, `type`)"
|
+ " VALUES (?, 1) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
|
||||||
+ " VALUES (?, 1, ?) ON DUPLICATE KEY UPDATE `count` = `count` + 1;")) {
|
|
||||||
|
|
||||||
preparedStatement.setString(1, machineID);
|
preparedStatement.setString(1, machineID);
|
||||||
preparedStatement.setString(2, type);
|
|
||||||
preparedStatement.execute();
|
preparedStatement.execute();
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, "Account: " + machineID + " has been kicked from game for cheating");
|
|
||||||
chatMsg.setMessageType(10);
|
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<String> GET_TRASH_LIST() {
|
public ArrayList<String> GET_TRASH_LIST() {
|
||||||
@@ -275,21 +270,4 @@ public class dbAccountHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TRASH_CHEATERS() {
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
CallableStatement callableStatement = connection.prepareCall("{CALL BanAccountsWithMachineID()}")) {
|
|
||||||
|
|
||||||
boolean hasResultSet = callableStatement.execute();
|
|
||||||
|
|
||||||
if (!hasResultSet && callableStatement.getUpdateCount() > 0) {
|
|
||||||
Logger.info("TRASHED CHEATERS");
|
|
||||||
} else {
|
|
||||||
Logger.warn("No cheaters to trash.");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error("Error trashing cheaters: ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,17 @@
|
|||||||
package engine.db.handlers;
|
package engine.db.handlers;
|
||||||
|
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.objects.Bane;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.objects.Building;
|
||||||
import engine.objects.*;
|
import engine.objects.City;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class dbBaneHandler extends dbHandlerBase {
|
public class dbBaneHandler extends dbHandlerBase {
|
||||||
|
|
||||||
@@ -85,139 +89,6 @@ public class dbBaneHandler extends dbHandlerBase {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean SET_BANE_TIME_NEW(int hour, int cityUUID) {
|
|
||||||
hour += 12; // Adjust hour
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
|
||||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `time_set`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
// Retrieve placementDate and liveDate
|
|
||||||
getStatement.setInt(1, cityUUID);
|
|
||||||
try (ResultSet rs = getStatement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
|
||||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
|
||||||
|
|
||||||
// Explicitly check if liveDate is null
|
|
||||||
DateTime toSet;
|
|
||||||
if (liveDateTimestamp == null) {
|
|
||||||
// If liveDate is null, default to placementDate
|
|
||||||
toSet = placementDate;
|
|
||||||
} else {
|
|
||||||
// If liveDate is not null, use it
|
|
||||||
DateTime liveDate = new DateTime(liveDateTimestamp.getTime());
|
|
||||||
toSet = liveDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust the time
|
|
||||||
toSet = toSet.withHourOfDay(hour).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0);
|
|
||||||
|
|
||||||
// Update liveDate and time_set flag
|
|
||||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(toSet.getMillis()));
|
|
||||||
updateStatement.setInt(2, 1); // time_set flag
|
|
||||||
updateStatement.setInt(3, cityUUID);
|
|
||||||
|
|
||||||
updateStatement.execute();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean SET_BANE_DAY_NEW(int dayOffset, int cityUUID) {
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement getStatement = connection.prepareStatement("SELECT `placementDate`, `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?");
|
|
||||||
PreparedStatement updateStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `liveDate`=?, `day_set`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
// Retrieve placementDate and liveDate
|
|
||||||
getStatement.setInt(1, cityUUID);
|
|
||||||
try (ResultSet rs = getStatement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
DateTime placementDate = new DateTime(rs.getTimestamp("placementDate").getTime());
|
|
||||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
|
||||||
|
|
||||||
// Explicitly check if liveDate is null
|
|
||||||
DateTime liveDate;
|
|
||||||
if (liveDateTimestamp == null) {
|
|
||||||
// If liveDate is null, default to placementDate
|
|
||||||
liveDate = placementDate;
|
|
||||||
} else {
|
|
||||||
// If liveDate is not null, use it
|
|
||||||
liveDate = new DateTime(liveDateTimestamp.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate the new liveDate while preserving the time component
|
|
||||||
DateTime updatedDate = placementDate.plusDays(dayOffset)
|
|
||||||
.withHourOfDay(liveDate.getHourOfDay())
|
|
||||||
.withMinuteOfHour(liveDate.getMinuteOfHour())
|
|
||||||
.withSecondOfMinute(liveDate.getSecondOfMinute())
|
|
||||||
.withMillisOfSecond(liveDate.getMillisOfSecond());
|
|
||||||
|
|
||||||
// Update liveDate and day_set flag
|
|
||||||
updateStatement.setTimestamp(1, new java.sql.Timestamp(updatedDate.getMillis()));
|
|
||||||
updateStatement.setInt(2, 1); // day_set flag
|
|
||||||
updateStatement.setInt(3, cityUUID);
|
|
||||||
|
|
||||||
updateStatement.execute();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean SET_BANE_CAP_NEW(int count, int cityUUID) {
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, count);
|
|
||||||
preparedStatement.setLong(2, cityUUID);
|
|
||||||
|
|
||||||
preparedStatement.execute();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_set`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, 1);
|
|
||||||
preparedStatement.setLong(2, cityUUID);
|
|
||||||
|
|
||||||
preparedStatement.execute();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `dyn_banes` SET `cap_size`=? WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, count);
|
|
||||||
preparedStatement.setLong(2, cityUUID);
|
|
||||||
|
|
||||||
preparedStatement.execute();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean REMOVE_BANE(Bane bane) {
|
public boolean REMOVE_BANE(Bane bane) {
|
||||||
|
|
||||||
if (bane == null)
|
if (bane == null)
|
||||||
@@ -236,25 +107,4 @@ public class dbBaneHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getLiveDate(int cityUUID) {
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement statement = connection.prepareStatement("SELECT `liveDate` FROM `dyn_banes` WHERE `cityUUID`=?")) {
|
|
||||||
|
|
||||||
statement.setInt(1, cityUUID);
|
|
||||||
|
|
||||||
try (ResultSet rs = statement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
Timestamp liveDateTimestamp = rs.getTimestamp("liveDate");
|
|
||||||
if (liveDateTimestamp != null) {
|
|
||||||
return new DateTime(liveDateTimestamp.getTime());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
return null; // Return null if liveDate is not found or an error occurs
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ package engine.db.handlers;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.Building;
|
||||||
|
import engine.objects.City;
|
||||||
|
import engine.objects.Zone;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
@@ -92,16 +95,7 @@ public class dbCityHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
return objectList;
|
return objectList;
|
||||||
}
|
}
|
||||||
public Integer GET_CAPITAL_CITY_COUNT() {
|
|
||||||
|
|
||||||
int cityCount = 0;
|
|
||||||
for(Realm realm : Realm._realms.values()){
|
|
||||||
if(realm.isRuled())
|
|
||||||
cityCount ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cityCount;
|
|
||||||
}
|
|
||||||
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
||||||
|
|
||||||
ArrayList<City> cityList = new ArrayList<>();
|
ArrayList<City> cityList = new ArrayList<>();
|
||||||
|
|||||||
@@ -98,54 +98,32 @@ public class dbContractHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
|
public void LOAD_SELL_LIST_FOR_CONTRACT(final Contract contract) {
|
||||||
|
|
||||||
if(!contract.getName().contains("Sage")) {
|
try (Connection connection = DbManager.getConnection();
|
||||||
try (Connection connection = DbManager.getConnection();
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;")) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, contract.getObjectUUID());
|
preparedStatement.setInt(1, contract.getObjectUUID());
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
int type = rs.getInt("type");
|
int type = rs.getInt("type");
|
||||||
int value = rs.getInt("value");
|
int value = rs.getInt("value");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
contract.getBuyItemType().add(value);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
contract.getBuySkillToken().add(value);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
contract.getBuyUnknownToken().add(value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_contract_selltype`;")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
int value = rs.getInt("value");
|
|
||||||
if(!contract.getBuySkillToken().contains(value))
|
|
||||||
contract.getBuySkillToken().add(value);
|
|
||||||
|
|
||||||
if(!contract.getBuyItemType().contains(value))
|
|
||||||
contract.getBuyItemType().add(value);
|
contract.getBuyItemType().add(value);
|
||||||
|
break;
|
||||||
if(!contract.getBuyUnknownToken().contains(value))
|
case 2:
|
||||||
|
contract.getBuySkillToken().add(value);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
contract.getBuyUnknownToken().add(value);
|
contract.getBuyUnknownToken().add(value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public abstract class dbHandlerBase {
|
|||||||
try {
|
try {
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||||
|
|
||||||
DbManager.addToCache(abstractGameObject);
|
DbManager.addToCache(abstractGameObject);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -56,28 +57,12 @@ public abstract class dbHandlerBase {
|
|||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
int id = rs.getInt(1);
|
int id = rs.getInt(1);
|
||||||
try {
|
|
||||||
if (rs.getInt("capSize") == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
//not a mine
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DbManager.inCache(localObjectType, id)) {
|
if (DbManager.inCache(localObjectType, id)) {
|
||||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||||
} else {
|
} else {
|
||||||
try{
|
|
||||||
if(rs.getInt("mineLiveHour") == 1)
|
|
||||||
continue;
|
|
||||||
}catch(Exception e){
|
|
||||||
//not a mine
|
|
||||||
}
|
|
||||||
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||||
DbManager.addToCache(toAdd);
|
DbManager.addToCache(toAdd);
|
||||||
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
objectList.add((T) toAdd);
|
objectList.add((T) toAdd);
|
||||||
|
|
||||||
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class dbItemBaseHandler extends dbHandlerBase {
|
public class dbItemBaseHandler extends dbHandlerBase {
|
||||||
|
|
||||||
public static final HashMap<Integer,Float> dexReductions = new HashMap<>();
|
|
||||||
public dbItemBaseHandler() {
|
public dbItemBaseHandler() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -46,14 +45,6 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_DEX_REDUCTION(ItemBase itemBase) {
|
|
||||||
if(dexReductions.containsKey(itemBase.getUUID())){
|
|
||||||
itemBase.dexReduction = dexReductions.get(itemBase.getUUID());
|
|
||||||
}else{
|
|
||||||
itemBase.dexReduction = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
||||||
|
|
||||||
ArrayList<Integer> tempList = new ArrayList<>();
|
ArrayList<Integer> tempList = new ArrayList<>();
|
||||||
@@ -103,21 +94,6 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty`")) {
|
|
||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
// Check if a result was found
|
|
||||||
if (rs.next()) {
|
|
||||||
int ID = rs.getInt("ID");
|
|
||||||
float factor = rs.getInt("item_bulk_factor");
|
|
||||||
dexReductions.put(ID,factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||||
|
|||||||
@@ -134,13 +134,9 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
if (rs.next()) {
|
if (rs.next())
|
||||||
try {
|
worked = rs.getBoolean("result");
|
||||||
worked = rs.getBoolean("result");
|
|
||||||
}catch(Exception e){
|
|
||||||
worked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
@@ -500,18 +496,4 @@ public class dbItemHandler extends dbHandlerBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean UPDATE_NUM_ITEMS(final Item item, int newValue) {
|
|
||||||
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
|
||||||
return false;
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
|
||||||
preparedStatement.setInt(1, newValue);
|
|
||||||
preparedStatement.setLong(2, item.getObjectUUID());
|
|
||||||
return (preparedStatement.executeUpdate() > 0);
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,32 +131,6 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int BANE_COMMANDER_EXISTS(final int objectUUID) {
|
|
||||||
|
|
||||||
int uid = 0;
|
|
||||||
|
|
||||||
String query = "SELECT `UID` FROM `obj_npc` WHERE `npc_buildingID` = ? LIMIT 1;";
|
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(query)) {
|
|
||||||
|
|
||||||
preparedStatement.setInt(1, objectUUID);
|
|
||||||
|
|
||||||
try (ResultSet rs = preparedStatement.executeQuery()) {
|
|
||||||
if (rs.next()) {
|
|
||||||
// Retrieve the UID column value
|
|
||||||
uid = rs.getInt("UID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return uid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
|
public int MOVE_NPC(long npcID, long parentID, float locX, float locY, float locZ) {
|
||||||
|
|
||||||
int rowCount;
|
int rowCount;
|
||||||
@@ -202,18 +176,6 @@ public class dbNPCHandler extends dbHandlerBase {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateSpecialPricing(final NPC npc){
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE obj_npc SET specialPrice=? WHERE UID = ?")) {
|
|
||||||
preparedStatement.setInt(1, npc.getSpecialPrice());
|
|
||||||
preparedStatement.setInt(2, npc.getDBID());
|
|
||||||
|
|
||||||
preparedStatement.executeUpdate();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void updateDatabase(final NPC npc) {
|
public void updateDatabase(final NPC npc) {
|
||||||
|
|
||||||
try (Connection connection = DbManager.getConnection();
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import engine.gameManager.ChatManager;
|
|||||||
import engine.objects.AbstractGameObject;
|
import engine.objects.AbstractGameObject;
|
||||||
import engine.objects.Item;
|
import engine.objects.Item;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Eighty
|
* @author Eighty
|
||||||
@@ -47,10 +46,10 @@ public class AddGoldCmd extends AbstractDevCmd {
|
|||||||
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
|
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
if (amt < 1 || amt > 10000000) {
|
||||||
throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT);
|
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
|
||||||
return;
|
return;
|
||||||
} else if ((curAmt + amt) > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
} else if ((curAmt + amt) > 10000000) {
|
||||||
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
|
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,17 +9,12 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.InterestManagement.InterestManager;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.ChatManager;
|
import engine.gameManager.ChatManager;
|
||||||
import engine.gameManager.DbManager;
|
import engine.gameManager.DbManager;
|
||||||
import engine.gameManager.LootManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mobileAI.utilities.MovementUtilities;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -88,41 +83,13 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),null, true, zone, null, 0, "", 1);
|
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||||
//Mob mob = Mob.createStrongholdMob(loadID,pc.loc,Guild.getErrantGuild(),true,zone,null,0,"Whitehorn Militant",75);
|
null, true, zone, null, 0, "", 1);
|
||||||
if (mob != null) {
|
if (mob != null) {
|
||||||
mob.updateDatabase();
|
mob.updateDatabase();
|
||||||
ChatManager.chatSayInfo(pc,
|
ChatManager.chatSayInfo(pc,
|
||||||
"Mob with ID " + mob.getDBID() + " added");
|
"Mob with ID " + mob.getDBID() + " added");
|
||||||
this.setResult(String.valueOf(mob.getDBID()));
|
this.setResult(String.valueOf(mob.getDBID()));
|
||||||
|
|
||||||
mob.parentZone = zone;
|
|
||||||
mob.bindLoc = pc.loc;
|
|
||||||
mob.setLoc(pc.loc);
|
|
||||||
mob.equipmentSetID = 6327;
|
|
||||||
mob.runAfterLoad();
|
|
||||||
mob.setLevel((short)75);
|
|
||||||
mob.setResists(new Resists("Elite"));
|
|
||||||
mob.spawnTime = 10;
|
|
||||||
mob.BehaviourType = Enum.MobBehaviourType.Aggro;
|
|
||||||
zone.zoneMobSet.add(mob);
|
|
||||||
mob.isHellgateMob = true;
|
|
||||||
LootManager.GenerateStrongholdLoot(mob,false,false);
|
|
||||||
mob.healthMax = mob.mobBase.getHealthMax();
|
|
||||||
mob.setHealth(mob.healthMax);
|
|
||||||
mob.maxDamageHandOne = 1550;
|
|
||||||
mob.minDamageHandOne = 750;
|
|
||||||
mob.atrHandOne = 1800;
|
|
||||||
mob.defenseRating = 2200;
|
|
||||||
mob.setFirstName("Whitehorn Militant");
|
|
||||||
//InterestManager.setObjectDirty(mob);
|
|
||||||
//WorldGrid.addObject(mob,pc.loc.x,pc.loc.z);
|
|
||||||
//WorldGrid.updateObject(mob);
|
|
||||||
//guard.stronghold = mine;
|
|
||||||
mob.mobPowers.clear();
|
|
||||||
mob.mobPowers.put(429399948,20); // find weakness
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throwbackError(pc, "Failed to create mob of type " + loadID);
|
throwbackError(pc, "Failed to create mob of type " + loadID);
|
||||||
Logger.error("Failed to create mob of type "
|
Logger.error("Failed to create mob of type "
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import engine.Enum.GameObjectType;
|
|||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -32,6 +31,7 @@ public class AddNPCCmd extends AbstractDevCmd {
|
|||||||
int contractID;
|
int contractID;
|
||||||
String name = "";
|
String name = "";
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
if (words.length < 2) {
|
if (words.length < 2) {
|
||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
@@ -39,54 +39,59 @@ public class AddNPCCmd extends AbstractDevCmd {
|
|||||||
try {
|
try {
|
||||||
contractID = Integer.parseInt(words[0]);
|
contractID = Integer.parseInt(words[0]);
|
||||||
level = Integer.parseInt(words[1]);
|
level = Integer.parseInt(words[1]);
|
||||||
|
|
||||||
for (int i = 2; i < words.length; i++) {
|
for (int i = 2; i < words.length; i++) {
|
||||||
name += words[i];
|
name += words[i];
|
||||||
if (i + 1 < words.length)
|
if (i + 1 < words.length)
|
||||||
name += "";
|
name += "";
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throwbackError(pc,
|
throwbackError(pc,
|
||||||
"Failed to parse supplied contractID or level to an Integer.");
|
"Failed to parse supplied contractID or level to an Integer.");
|
||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
|
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
|
||||||
|
|
||||||
if (contract == null || level < 1 || level > 75) {
|
if (contract == null || level < 1 || level > 75) {
|
||||||
throwbackError(pc,
|
throwbackError(pc,
|
||||||
"Invalid addNPC Command. Need contract ID, and level");
|
"Invalid addNPC Command. Need contract ID, and level");
|
||||||
return; // NaN
|
return; // NaN
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a random name
|
// Pick a random name
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
name = NPCManager.getPirateName(contract.getMobbaseID());
|
name = NPCManager.getPirateName(contract.getMobbaseID());
|
||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||||
|
|
||||||
if (zone == null) {
|
if (zone == null) {
|
||||||
throwbackError(pc, "Failed to find zone to place npc in.");
|
throwbackError(pc, "Failed to find zone to place npc in.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Building building = null;
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
if (target.getObjectType() == GameObjectType.Building) {
|
if (target.getObjectType() == GameObjectType.Building) {
|
||||||
building = (Building)target;
|
Building parentBuilding = (Building) target;
|
||||||
|
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
NPC created;
|
|
||||||
Guild guild = null;
|
NPC npc = NPC.createNPC(name, contractID,
|
||||||
Vector3fImmutable loc;
|
pc.getLoc(), null, zone, (short) level, null);
|
||||||
if(building != null){
|
|
||||||
guild = building.getGuild();
|
if (npc != null) {
|
||||||
loc = building.loc;
|
WorldGrid.addObject(npc, pc);
|
||||||
} else{
|
ChatManager.chatSayInfo(pc,
|
||||||
loc = pc.loc;
|
"NPC with ID " + npc.getDBID() + " added");
|
||||||
|
this.setResult(String.valueOf(npc.getDBID()));
|
||||||
|
} else {
|
||||||
|
throwbackError(pc, "Failed to create npc of contract type "
|
||||||
|
+ contractID);
|
||||||
|
Logger.error(
|
||||||
|
"Failed to create npc of contract type " + contractID);
|
||||||
}
|
}
|
||||||
created = NPC.createNPC(name, contractID, loc, guild, zone, (short)level, building);
|
|
||||||
created.bindLoc = loc;
|
|
||||||
if(building != null) {
|
|
||||||
created.buildingUUID = building.getObjectUUID();
|
|
||||||
created.building = building;
|
|
||||||
NPCManager.slotCharacterInBuilding(created);
|
|
||||||
}
|
|
||||||
created.setLoc(created.bindLoc);
|
|
||||||
created.updateDatabase();
|
|
||||||
throwbackInfo(pc, "Created NPC with UUID: " + created.getObjectUUID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Dungeons.DungeonManager;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class DungenonCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public DungenonCmd() {
|
|
||||||
super("dungeon");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
Zone parent = ZoneManager.findSmallestZone(pc.loc);
|
|
||||||
if(parent == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(BuildingManager.getBuilding(2827951).loc,30f);
|
|
||||||
pc.teleport(loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "indicate mob or building followed by an id and a level";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "'/dungeon mob 2001 10'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum.ItemContainerType;
|
|
||||||
import engine.Enum.ItemType;
|
|
||||||
import engine.Enum.OwnerType;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.ChatManager;
|
|
||||||
import engine.gameManager.DbManager;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Eighty
|
|
||||||
*/
|
|
||||||
public class GimmeCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public GimmeCmd() {
|
|
||||||
super("gimme");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
int amt = 0;
|
|
||||||
int currentGold = pc.getCharItemManager().getGoldInventory().getNumOfItems();
|
|
||||||
amt = MBServerStatics.PLAYER_GOLD_LIMIT - currentGold;
|
|
||||||
if (!pc.getCharItemManager().addGoldToInventory(amt, true)) {
|
|
||||||
throwbackError(pc, "Failed to add gold to inventory");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatManager.chatSayInfo(pc, amt + " gold added to inventory");
|
|
||||||
|
|
||||||
if(pc.level < 75) {
|
|
||||||
pc.setLevel((short) 75);
|
|
||||||
ChatManager.chatSayInfo(pc, "Level set to 75");
|
|
||||||
}
|
|
||||||
pc.getCharItemManager().updateInventory();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Round up current gold in inventory to 10,000,000";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "'./gimme";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ./hotzone <- display the current hotzone & time remaining
|
||||||
|
* ./hotzone random <- change hotzone to random new zone
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HotzoneCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
|
public HotzoneCmd() {
|
||||||
|
super("hotzone");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
||||||
|
AbstractGameObject target) {
|
||||||
|
|
||||||
|
StringBuilder data = new StringBuilder();
|
||||||
|
String outString;
|
||||||
|
|
||||||
|
for (String s : words) {
|
||||||
|
data.append(s);
|
||||||
|
data.append(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
String input = data.toString().trim();
|
||||||
|
|
||||||
|
if (input.length() == 0) {
|
||||||
|
outString = "Current hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
||||||
|
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||||
|
throwbackInfo(playerCharacter, outString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.equalsIgnoreCase("random")) {
|
||||||
|
ZoneManager.generateAndSetRandomHotzone();
|
||||||
|
outString = "New hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
||||||
|
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||||
|
throwbackInfo(playerCharacter, outString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.equalsIgnoreCase("reset")) {
|
||||||
|
ZoneManager.resetHotZones();
|
||||||
|
throwbackInfo(playerCharacter, "Available hotZones: " + ZoneManager.availableHotZones());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "'./hotzone [random]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,13 +15,9 @@ import engine.Enum.GameObjectType;
|
|||||||
import engine.Enum.TargetColor;
|
import engine.Enum.TargetColor;
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.BuildingManager;
|
import engine.gameManager.BuildingManager;
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.gameManager.SessionManager;
|
import engine.gameManager.SessionManager;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
import engine.powers.PowersBase;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
import engine.util.StringUtils;
|
import engine.util.StringUtils;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -335,19 +331,13 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += "Movement State: " + targetPC.getMovementState().name();
|
output += "Movement State: " + targetPC.getMovementState().name();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "Movement Speed: " + targetPC.getSpeed();
|
output += "Movement Speed: " + targetPC.getSpeed();
|
||||||
output += newline;
|
|
||||||
output += "Altitude : " + targetPC.getLoc().y;
|
output += "Altitude : " + targetPC.getLoc().y;
|
||||||
output += newline;
|
|
||||||
output += "Swimming : " + targetPC.isSwimming();
|
output += "Swimming : " + targetPC.isSwimming();
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "isMoving : " + targetPC.isMoving();
|
output += "isMoving : " + targetPC.isMoving();
|
||||||
output += newline;
|
|
||||||
output += "Zerg Multiplier : " + targetPC.ZergMultiplier + newline;
|
|
||||||
output += "Hidden : " + targetPC.getHidden() + newline;
|
|
||||||
output += "Target Loc: " + targetPC.loc + newline;
|
|
||||||
output += "Player Loc: " + pc.loc + newline;
|
|
||||||
output += "Distance Squared: " + pc.loc.distanceSquared(targetPC.loc) + newline;
|
|
||||||
output += "IsBoxed: " + targetPC.isBoxed;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NPC:
|
case NPC:
|
||||||
@@ -502,16 +492,13 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "No building found." + newline;
|
output += "No building found." + newline;
|
||||||
}
|
}
|
||||||
|
int max = (int)(4.882 * targetMob.level + 121.0);
|
||||||
output += "Damage: " + targetMob.mobBase.getDamageMin() + " - " + targetMob.mobBase.getDamageMax() + newline;
|
if(max > 321){
|
||||||
output += "ATR: " + targetMob.mobBase.getAttackRating() + newline;
|
max = 321;
|
||||||
output += "DEF: " + targetMob.defenseRating + newline;
|
|
||||||
output += "RANGE: " + targetMob.getRange() + newline;
|
|
||||||
output += "Effects:" + newline;
|
|
||||||
for(MobBaseEffects mbe : targetMob.mobBase.mobbaseEffects){
|
|
||||||
EffectsBase eb = PowersManager.getEffectByToken(mbe.getToken());
|
|
||||||
output += eb.getName() + newline;
|
|
||||||
}
|
}
|
||||||
|
int min = (int)(4.469 * targetMob.level - 3.469);
|
||||||
|
output += "Min Loot Roll = " + min;
|
||||||
|
output += "Max Loot Roll = " + max;
|
||||||
break;
|
break;
|
||||||
case Item: //intentional passthrough
|
case Item: //intentional passthrough
|
||||||
case MobLoot:
|
case MobLoot:
|
||||||
@@ -542,13 +529,6 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Corpse:
|
|
||||||
Corpse corpse = (Corpse)target;
|
|
||||||
Long timeLeft = MBServerStatics.CORPSE_CLEANUP_TIMER_MS - (System.currentTimeMillis() - corpse.spawnedTime);
|
|
||||||
output += "Despawn in: " + timeLeft;
|
|
||||||
output += newline;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throwbackInfo(pc, output);
|
throwbackInfo(pc, output);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import engine.objects.AbstractGameObject;
|
|||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.Mine;
|
import engine.objects.Mine;
|
||||||
import engine.objects.PlayerCharacter;
|
import engine.objects.PlayerCharacter;
|
||||||
import engine.workthreads.HalfHourlyJobThread;
|
|
||||||
import engine.workthreads.HourlyJobThread;
|
import engine.workthreads.HourlyJobThread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,10 +41,10 @@ public class MineActiveCmd extends AbstractDevCmd {
|
|||||||
String trigger = args[0];
|
String trigger = args[0];
|
||||||
switch (trigger) {
|
switch (trigger) {
|
||||||
case "true":
|
case "true":
|
||||||
HalfHourlyJobThread.mineWindowOpen(mine);
|
HourlyJobThread.mineWindowOpen(mine);
|
||||||
break;
|
break;
|
||||||
case "false":
|
case "false":
|
||||||
HalfHourlyJobThread.mineWindowClose(mine);
|
HourlyJobThread.mineWindowClose(mine);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.sendUsage(pcSender);
|
this.sendUsage(pcSender);
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
||||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
||||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
||||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
||||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
||||||
// Magicbane Emulator Project © 2013 - 2022
|
|
||||||
// www.magicbane.com
|
|
||||||
|
|
||||||
|
|
||||||
package engine.devcmd.cmds;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.BuildingGroup;
|
|
||||||
import engine.Enum.GameObjectType;
|
|
||||||
import engine.Enum.TargetColor;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
|
||||||
import engine.gameManager.BuildingManager;
|
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.gameManager.SessionManager;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.powers.EffectsBase;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
import engine.util.StringUtils;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author
|
|
||||||
*/
|
|
||||||
public class PrintEffectsCmd extends AbstractDevCmd {
|
|
||||||
|
|
||||||
public PrintEffectsCmd() {
|
|
||||||
super("printeffects");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
|
||||||
AbstractGameObject target) {
|
|
||||||
|
|
||||||
if(!target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
|
||||||
throwbackInfo(pc, "Target Must PlayerCharacter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String output = "Effects for Player:" + newline;
|
|
||||||
|
|
||||||
AbstractCharacter absTar = (AbstractCharacter) target;
|
|
||||||
|
|
||||||
for(String key : absTar.effects.keySet()){
|
|
||||||
Effect eff = absTar.effects.get(key);
|
|
||||||
if(eff.getJobContainer() != null) {
|
|
||||||
output += "[" + key + "] " + eff.getName() + " (" + eff.getTrains() + ") " + eff.getJobContainer().timeToExecutionLeft() * 0.001f + newline;
|
|
||||||
}else{
|
|
||||||
output += eff.getName() + " (" + eff.getTrains() + ") " + "PERMANENT" + newline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throwbackInfo(pc, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getHelpString() {
|
|
||||||
return "Gets information on an Object.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String _getUsageString() {
|
|
||||||
return "' /info targetID'";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -49,8 +49,6 @@ public class PrintSkillsCmd extends AbstractDevCmd {
|
|||||||
+ skill.getModifiedAmount() + '('
|
+ skill.getModifiedAmount() + '('
|
||||||
+ skill.getTotalSkillPercet() + " )");
|
+ skill.getTotalSkillPercet() + " )");
|
||||||
}
|
}
|
||||||
//throwbackInfo(pc, "= = = = = NEW CALCULATIONS = = = = =");
|
|
||||||
// PlayerCombatStats.PrintSkillsToClient(pc);
|
|
||||||
} else
|
} else
|
||||||
throwbackInfo(pc, "Skills not found for player");
|
throwbackInfo(pc, "Skills not found for player");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
|
|
||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.PowersManager;
|
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -58,43 +56,23 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
||||||
String newline = "\r\n ";
|
String newline = "\r\n ";
|
||||||
|
String out = "Server stats for Player " + tar.getFirstName() + newline;
|
||||||
String newOut = "Server stats for Player " + tar.getFirstName() + newline;
|
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
||||||
newOut += "HEALTH: " + tar.getHealth() + " / " + tar.getHealthMax() + newline;
|
out += "Stats Base (Modified)" + newline;
|
||||||
newOut += "MANA: " + tar.getMana() + " / " + tar.getManaMax() + newline;
|
out += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
||||||
newOut += "STAMINA: " + tar.getStamina() + " / " + tar.getStaminaMax() + newline;
|
out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
||||||
newOut += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
||||||
newOut += "Stats Base (Modified)" + newline;
|
out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
||||||
newOut += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
||||||
newOut += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
throwbackInfo(pc, out);
|
||||||
newOut += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
|
||||||
newOut += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
|
||||||
newOut += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
|
||||||
newOut += "Move Speed: " + tar.getSpeed() + newline;
|
out += "Defense: " + tar.getDefenseRating() + newline;
|
||||||
newOut += "Health Regen: " + tar.combatStats.healthRegen + newline;
|
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
|
||||||
newOut += "Mana Regen: " + tar.combatStats.manaRegen + newline;
|
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
||||||
newOut += "Stamina Regen: " + tar.combatStats.staminaRegen + newline;
|
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||||
newOut += "DEFENSE: " + tar.combatStats.defense + newline;
|
throwbackInfo(pc, out);
|
||||||
newOut += "HAND ONE" + newline;
|
|
||||||
newOut += "ATR: " + tar.combatStats.atrHandOne + newline;
|
|
||||||
newOut += "MIN: " + tar.combatStats.minDamageHandOne + newline;
|
|
||||||
newOut += "MAX: " + tar.combatStats.maxDamageHandOne + newline;
|
|
||||||
newOut += "RANGE: " + tar.combatStats.rangeHandOne + newline;
|
|
||||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandOne + newline;
|
|
||||||
newOut += "HAND TWO" + newline;
|
|
||||||
newOut += "ATR: " + tar.combatStats.atrHandTwo + newline;
|
|
||||||
newOut += "MIN: " + tar.combatStats.minDamageHandTwo + newline;
|
|
||||||
newOut += "MAX: " + tar.combatStats.maxDamageHandTwo + newline;
|
|
||||||
newOut += "RANGE: " + tar.combatStats.rangeHandTwo + newline;
|
|
||||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandTwo + newline;
|
|
||||||
newOut += "IS BOXED: " + tar.isBoxed + newline;
|
|
||||||
newOut += "=== POWERS ===" + newline;
|
|
||||||
for(CharacterPower power : pc.getPowers().values()){
|
|
||||||
if(power.getPower().requiresHitRoll) {
|
|
||||||
newOut += power.getPower().name + " ATR: " + Math.round(PlayerCombatStats.getSpellAtr(pc,power.getPower())) + newline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throwbackInfo(pc, newOut);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printStatsMob(PlayerCharacter pc, Mob tar) {
|
public void printStatsMob(PlayerCharacter pc, Mob tar) {
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
|
import engine.devcmd.AbstractDevCmd;
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
import engine.gameManager.ZoneManager;
|
||||||
|
import engine.objects.*;
|
||||||
|
|
||||||
|
public class SetCampLevelCmd extends AbstractDevCmd {
|
||||||
|
public SetCampLevelCmd() { super("setcamplevel"); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _doCmd(PlayerCharacter pcSender, String[] args, AbstractGameObject target) {
|
||||||
|
|
||||||
|
if (args.length > 1)
|
||||||
|
{
|
||||||
|
this.sendUsage(pcSender);
|
||||||
|
}
|
||||||
|
|
||||||
|
int targetLevel = 0;
|
||||||
|
if (args.length == 1) {
|
||||||
|
try {
|
||||||
|
targetLevel = Integer.parseInt(args[0]);
|
||||||
|
} catch (NumberFormatException nfe) {
|
||||||
|
throwbackError(pcSender, "Argument MUST be integer. Received: " + args[0]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throwbackError(pcSender, "Unknown command parsing provided camp level: " + args[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((target instanceof Mob))
|
||||||
|
{
|
||||||
|
// Get the camp that owns the targeted Mob
|
||||||
|
Zone campZone = ((Mob) target).parentZone;
|
||||||
|
|
||||||
|
// Make sure that the zone we're targeting is valid for action
|
||||||
|
if (campZone == null ||
|
||||||
|
campZone.zoneMobSet.isEmpty() ||
|
||||||
|
campZone.isPlayerCity()) {
|
||||||
|
throwbackError(pcSender, "Current zone must own mobs, and NOT be a city.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
campZone.setCampLvl(targetLevel);
|
||||||
|
}
|
||||||
|
else if (target instanceof PlayerCharacter)
|
||||||
|
{
|
||||||
|
PlayerCharacter pc = (PlayerCharacter)target;
|
||||||
|
PowersManager.applyPower(pc, pc, pc.getLoc(), "CMP-001", targetLevel, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getUsageString() {
|
||||||
|
return "Sets the level of the currently occupied camp to the desired level";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String _getHelpString() {
|
||||||
|
return "'./setcamplevel levelNum'";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,7 +46,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
|||||||
this.sendUsage(pc);
|
this.sendUsage(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (level < 1 || level > 80) {
|
if (level < 1 || level > 75) {
|
||||||
this.sendHelp(pc);
|
this.sendHelp(pc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String _getHelpString() {
|
protected String _getHelpString() {
|
||||||
return "Sets your character's level to 'amount'. 'amount' must be between 1-80";
|
return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package engine.devcmd.cmds;
|
package engine.devcmd.cmds;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.devcmd.AbstractDevCmd;
|
import engine.devcmd.AbstractDevCmd;
|
||||||
import engine.gameManager.LootManager;
|
import engine.gameManager.LootManager;
|
||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
@@ -11,8 +10,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class SimulateBootyCmd extends AbstractDevCmd {
|
public class SimulateBootyCmd extends AbstractDevCmd {
|
||||||
|
|
||||||
public int simCount = 250;
|
|
||||||
public SimulateBootyCmd() {
|
public SimulateBootyCmd() {
|
||||||
super("bootysim");
|
super("bootysim");
|
||||||
}
|
}
|
||||||
@@ -27,61 +24,8 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
String newline = "\r\n ";
|
String newline = "\r\n ";
|
||||||
|
|
||||||
String output;
|
String output;
|
||||||
if(target.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
|
||||||
int ATR = Integer.parseInt(words[0]);
|
|
||||||
int DEF = Integer.parseInt(words[1]);
|
|
||||||
int attacks = Integer.parseInt(words[2]);
|
|
||||||
|
|
||||||
int hits = 0;
|
output = "Booty Simulation:" + newline;
|
||||||
int misses = 0;
|
|
||||||
int defaultHits = 0;
|
|
||||||
int defualtMisses = 0;
|
|
||||||
|
|
||||||
float chance = (ATR-((ATR+DEF) * 0.315f)) / ((DEF-((ATR+DEF) * 0.315f)) + (ATR-((ATR+DEF) * 0.315f)));
|
|
||||||
float convertedChance = chance * 100;
|
|
||||||
output = "" + newline;
|
|
||||||
output += "DEF VS ATR SIMULATION: " + attacks + " ATTACKS SIMULATED" + newline;
|
|
||||||
output += "DEF = " + DEF + newline;
|
|
||||||
output += "ATR = " + ATR + newline;
|
|
||||||
output += "CHANCE TO LAND HIT: " + convertedChance + "%" + newline;
|
|
||||||
if(convertedChance < 5){
|
|
||||||
output += "CHANCE ADJUSTED TO 5.0%" + newline;
|
|
||||||
convertedChance = 5.0f;
|
|
||||||
}
|
|
||||||
if(convertedChance > 95){
|
|
||||||
output += "CHANCE ADJUSTED TO 95.0%" + newline;
|
|
||||||
convertedChance = 95.0f;
|
|
||||||
}
|
|
||||||
for(int i = 0; i < attacks; i++){
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
|
||||||
|
|
||||||
if(roll <= convertedChance){
|
|
||||||
hits += 1;
|
|
||||||
}else{
|
|
||||||
misses += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float totalHits = defaultHits + hits;
|
|
||||||
float totalMisses = defualtMisses + misses;
|
|
||||||
float hitPercent = Math.round(totalHits / attacks * 100);
|
|
||||||
float missPercent = Math.round(totalMisses / attacks * 100);
|
|
||||||
|
|
||||||
output += "HITS LANDED: " + (defaultHits + hits) + "(" + Math.round(hitPercent) + "%)" + newline;
|
|
||||||
output += "HITS MISSED: " + (defualtMisses + misses) + "(" + Math.round(missPercent) + "%)";
|
|
||||||
|
|
||||||
throwbackInfo(playerCharacter,output);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
simCount = Integer.parseInt(words[0]);
|
|
||||||
}catch(Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
output = "Booty Simulation: Rolls:" + simCount + newline;
|
|
||||||
|
|
||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
output += "Name: " + mob.getName() + newline;
|
output += "Name: " + mob.getName() + newline;
|
||||||
@@ -100,7 +44,6 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
ArrayList<Item> Resources = new ArrayList<Item>();
|
ArrayList<Item> Resources = new ArrayList<Item>();
|
||||||
ArrayList<Item> Runes = new ArrayList<Item>();
|
ArrayList<Item> Runes = new ArrayList<Item>();
|
||||||
ArrayList<Item> Contracts = new ArrayList<Item>();
|
ArrayList<Item> Contracts = new ArrayList<Item>();
|
||||||
ArrayList<Item> GuardContracts = new ArrayList<Item>();
|
|
||||||
ArrayList<Item> Offerings = new ArrayList<Item>();
|
ArrayList<Item> Offerings = new ArrayList<Item>();
|
||||||
ArrayList<Item> OtherDrops = new ArrayList<Item>();
|
ArrayList<Item> OtherDrops = new ArrayList<Item>();
|
||||||
ArrayList<Item> EquipmentDrops = new ArrayList<Item>();
|
ArrayList<Item> EquipmentDrops = new ArrayList<Item>();
|
||||||
@@ -108,17 +51,14 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
int failures = 0;
|
int failures = 0;
|
||||||
int goldAmount = 0;
|
int goldAmount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < simCount; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mob.loadInventory();
|
mob.loadInventory();
|
||||||
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
for (Item lootItem : mob.getCharItemManager().getInventory()) {
|
||||||
switch (lootItem.getItemBase().getType()) {
|
switch (lootItem.getItemBase().getType()) {
|
||||||
case CONTRACT: //CONTRACT
|
case CONTRACT: //CONTRACT
|
||||||
if(lootItem.getName().contains("Captain"))
|
Contracts.add(lootItem);
|
||||||
GuardContracts.add(lootItem);
|
|
||||||
else
|
|
||||||
Contracts.add(lootItem);
|
|
||||||
break;
|
break;
|
||||||
case OFFERING: //OFFERING
|
case OFFERING: //OFFERING
|
||||||
Offerings.add(lootItem);
|
Offerings.add(lootItem);
|
||||||
@@ -190,17 +130,9 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int baseBound = 100000;
|
|
||||||
int levelPenalty = (int) (Math.max(0, Math.abs(50 - mob.level)) * 0.01 * 100000);
|
|
||||||
int totalRange = baseBound + levelPenalty;
|
|
||||||
if(mob.level >= 50){
|
|
||||||
totalRange = baseBound;
|
|
||||||
}
|
|
||||||
output += "TOTAL ROLL POTENTIAL: " + totalRange + newline;
|
|
||||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
||||||
output += "RUNE DROPS: " + Runes.size() + newline;
|
output += "RUNE DROPS: " + Runes.size() + newline;
|
||||||
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
||||||
output += "GUARD CONTRACTS DROPS: " + GuardContracts.size() + newline;
|
|
||||||
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
||||||
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
||||||
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
||||||
|
|||||||
@@ -1,168 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.exception.MsgSendException;
|
|
||||||
import engine.math.Vector3f;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class ArenaManager {
|
|
||||||
private static final List<Arena> activeArenas = new ArrayList<>();
|
|
||||||
public static final List<PlayerCharacter> playerQueue = new ArrayList<>();
|
|
||||||
public static Long pulseDelay = 180000L;
|
|
||||||
public static Long lastExecution = 0L;
|
|
||||||
|
|
||||||
public static void pulseArenas() {
|
|
||||||
if(lastExecution == 0L){
|
|
||||||
lastExecution = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(activeArenas.isEmpty() && playerQueue.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Iterator<Arena> iterator = activeArenas.iterator();
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Arena arena = iterator.next();
|
|
||||||
if (arena.checkToComplete()) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(lastExecution + pulseDelay > System.currentTimeMillis())
|
|
||||||
return;
|
|
||||||
|
|
||||||
lastExecution = System.currentTimeMillis();
|
|
||||||
|
|
||||||
while (playerQueue.size() > 1) {
|
|
||||||
createArena();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void joinQueue(PlayerCharacter player) {
|
|
||||||
if (!playerQueue.contains(player)) {
|
|
||||||
playerQueue.add(player);
|
|
||||||
}
|
|
||||||
for(PlayerCharacter pc : playerQueue){
|
|
||||||
if(pc.equals(player))
|
|
||||||
continue;
|
|
||||||
ChatManager.chatSystemInfo(pc, player.getName() + " has joined the arena que. There are now " + playerQueue.size() + " players queued.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void leaveQueue(PlayerCharacter player) {
|
|
||||||
playerQueue.remove(player);
|
|
||||||
for(PlayerCharacter pc : playerQueue){
|
|
||||||
if(pc.equals(player))
|
|
||||||
continue;
|
|
||||||
ChatManager.chatSystemInfo(pc, player.getName() + " has left the arena que. There are now " + playerQueue.size() + " players queued.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void createArena() {
|
|
||||||
if (playerQueue.size() > 1) {
|
|
||||||
|
|
||||||
Collections.shuffle(playerQueue);
|
|
||||||
Arena newArena = new Arena();
|
|
||||||
|
|
||||||
//set starting time
|
|
||||||
newArena.startTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
//decide an arena location
|
|
||||||
newArena.loc = selectRandomArenaLocation();
|
|
||||||
|
|
||||||
// Assign players to the arena
|
|
||||||
newArena.player1 = playerQueue.remove(0);
|
|
||||||
newArena.player2 = playerQueue.remove(0);
|
|
||||||
|
|
||||||
// Teleport players to the arena location
|
|
||||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
|
||||||
MovementManager.translocate(newArena.player1, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
|
||||||
MovementManager.translocate(newArena.player2, Vector3fImmutable.getRandomPointOnCircle(newArena.loc,75f), null);
|
|
||||||
|
|
||||||
// Add the new arena to the active arenas list
|
|
||||||
activeArenas.add(newArena);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void endArena(Arena arena, PlayerCharacter winner, PlayerCharacter loser, String condition){
|
|
||||||
if (winner != null && loser != null) {
|
|
||||||
Logger.info("[ARENA] The fight between {} and {} is concluded. Victor: {}",
|
|
||||||
arena.player1.getName(), arena.player2.getName(), winner.getName());
|
|
||||||
} else {
|
|
||||||
Logger.info("[ARENA] The fight between {} and {} is concluded. No Winner Declared.",
|
|
||||||
arena.player1.getName(), arena.player2.getName());
|
|
||||||
}
|
|
||||||
// Teleport players to the arena location
|
|
||||||
Zone sdr = ZoneManager.getZoneByUUID(656);
|
|
||||||
MovementManager.translocate(arena.player1, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
|
||||||
MovementManager.translocate(arena.player2, Vector3fImmutable.getRandomPointOnCircle(sdr.getLoc(),50f), null);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
activeArenas.remove(arena);
|
|
||||||
|
|
||||||
if(winner != null){
|
|
||||||
ChatManager.chatPVP("[ARENA] " + winner.getName() + " has slain " + loser.getName() + " in the arena!");
|
|
||||||
//handle prize distribution
|
|
||||||
//ItemBase specialLoot = ItemBase.getItemBase(866);
|
|
||||||
//Item promoted = new MobLoot(winner, specialLoot, 1, false).promoteToItem(winner);
|
|
||||||
//promoted.setNumOfItems(21235);
|
|
||||||
//promoted.setName("Special Banker(21235)");
|
|
||||||
//DbManager.ItemQueries.UPDATE_NUM_ITEMS(promoted,21235);
|
|
||||||
//winner.getCharItemManager().addItemToInventory(promoted);
|
|
||||||
//winner.getCharItemManager().updateInventory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Vector3fImmutable selectRandomArenaLocation() {
|
|
||||||
boolean locSet = false;
|
|
||||||
Vector3fImmutable loc = Vector3fImmutable.ZERO;
|
|
||||||
|
|
||||||
while (!locSet) {
|
|
||||||
try {
|
|
||||||
float x = ThreadLocalRandom.current().nextInt(114300, 123600);
|
|
||||||
float z = ThreadLocalRandom.current().nextInt(82675, 91700);
|
|
||||||
float y = 0; // Y coordinate is always 0
|
|
||||||
|
|
||||||
loc = new Vector3fImmutable(x, y, z * -1);
|
|
||||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(loc,500f, MBServerStatics.MASK_PLAYER);
|
|
||||||
if(inRange.isEmpty() && !isUnderWater(loc))
|
|
||||||
locSet = true;
|
|
||||||
//}
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isUnderWater(Vector3fImmutable loc) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(loc);
|
|
||||||
|
|
||||||
if (zone.getSeaLevel() != 0) {
|
|
||||||
|
|
||||||
float localAltitude = loc.y;
|
|
||||||
if (localAltitude < zone.getSeaLevel())
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (loc.y < 0)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -438,18 +438,6 @@ public enum BuildingManager {
|
|||||||
|
|
||||||
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
public static boolean IsPlayerHostile(Building building, PlayerCharacter player) {
|
||||||
|
|
||||||
if(building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() != null && building.getBlueprint().getBuildingGroup().equals(BuildingGroup.BANESTONE))
|
|
||||||
{
|
|
||||||
Guild playerNation = player.guild.getNation();
|
|
||||||
City banedCity = ZoneManager.getCityAtLocation(building.loc);
|
|
||||||
if(banedCity != null){
|
|
||||||
if(banedCity.getGuild().getNation().equals(playerNation)){
|
|
||||||
return false;
|
|
||||||
}else{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Nation Members and Guild members are not hostile.
|
//Nation Members and Guild members are not hostile.
|
||||||
// if (building.getGuild() != null){
|
// if (building.getGuild() != null){
|
||||||
// if (pc.getGuild() != null)
|
// if (pc.getGuild() != null)
|
||||||
@@ -532,30 +520,7 @@ public enum BuildingManager {
|
|||||||
if (building.getBlueprintUUID() == 0)
|
if (building.getBlueprintUUID() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL)){
|
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||||
if(contract.getContractID() == 850) {
|
|
||||||
boolean hasRunemaster = false;
|
|
||||||
for (AbstractCharacter npc : building.getHirelings().keySet()) {
|
|
||||||
|
|
||||||
if (npc.getObjectType() != GameObjectType.NPC)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(npc.contractUUID == 850)
|
|
||||||
hasRunemaster = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasRunemaster)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int maxSlots = building.getBlueprint().getMaxSlots();
|
|
||||||
if(building.getBlueprint().getBuildingGroup() != null) {
|
|
||||||
maxSlots = building.getBlueprint().getSlotsForRank(building.getRank());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxSlots == building.getHirelings().size())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import engine.objects.*;
|
|||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import engine.server.world.WorldServer;
|
import engine.server.world.WorldServer;
|
||||||
import engine.session.Session;
|
import engine.session.Session;
|
||||||
import engine.util.KeyCloneAudit;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -85,15 +84,6 @@ public enum ChatManager {
|
|||||||
if ((checkTime > 0L) && (curMsgTime - checkTime < FLOOD_TIME_THRESHOLD))
|
if ((checkTime > 0L) && (curMsgTime - checkTime < FLOOD_TIME_THRESHOLD))
|
||||||
isFlood = true;
|
isFlood = true;
|
||||||
|
|
||||||
if(KeyCloneAudit.auditChatMsg(pc,msg.getMessage())){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(msg.getMessage().equalsIgnoreCase("./zerg")){
|
|
||||||
ZergManager.PrintDetailsToClient(pc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (protocolMsg) {
|
switch (protocolMsg) {
|
||||||
case CHATSAY:
|
case CHATSAY:
|
||||||
ChatManager.chatSay(pc, msg.getMessage(), isFlood);
|
ChatManager.chatSay(pc, msg.getMessage(), isFlood);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
package engine.gameManager;
|
package engine.gameManager;
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.job.JobContainer;
|
import engine.job.JobContainer;
|
||||||
@@ -27,6 +26,7 @@ import engine.powers.effectmodifiers.WeaponProcEffectModifier;
|
|||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
@@ -301,21 +301,6 @@ public enum CombatManager {
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
//pet to assist in attacking target
|
|
||||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
PlayerCharacter attacker = (PlayerCharacter)abstractCharacter;
|
|
||||||
if(attacker.combatStats == null){
|
|
||||||
attacker.combatStats = new PlayerCombatStats(attacker);
|
|
||||||
}
|
|
||||||
if(attacker.getPet() != null){
|
|
||||||
Mob pet = attacker.getPet();
|
|
||||||
if(pet.combatTarget == null && pet.assist)
|
|
||||||
pet.setCombatTarget(attacker.combatTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//target must be valid type
|
//target must be valid type
|
||||||
|
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||||
@@ -331,13 +316,10 @@ public enum CombatManager {
|
|||||||
else if (!tar.isActive())
|
else if (!tar.isActive())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getTimers().get("Attack" + slot) == null) {
|
if (target.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && abstractCharacter.getTimers().get("Attack" + slot) == null)
|
||||||
if(((PlayerCharacter)target).combatStats == null){
|
|
||||||
((PlayerCharacter)target).combatStats = new PlayerCombatStats(((PlayerCharacter)target));
|
|
||||||
}
|
|
||||||
if (!((PlayerCharacter) abstractCharacter).canSee((PlayerCharacter) target))
|
if (!((PlayerCharacter) abstractCharacter).canSee((PlayerCharacter) target))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
//must not be immune to all or immune to attack
|
//must not be immune to all or immune to attack
|
||||||
|
|
||||||
Resists res = tar.getResists();
|
Resists res = tar.getResists();
|
||||||
@@ -432,10 +414,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//Source can attack.
|
//Source can attack.
|
||||||
//NOTE Don't 'return;' beyond this point until timer created
|
//NOTE Don't 'return;' beyond this point until timer created
|
||||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
|
|
||||||
pc.updateMovementState();
|
|
||||||
}
|
|
||||||
boolean attackFailure = (wb != null) && (wb.getRange() > 35f) && abstractCharacter.isMoving();
|
boolean attackFailure = (wb != null) && (wb.getRange() > 35f) && abstractCharacter.isMoving();
|
||||||
|
|
||||||
//Target can't attack on move with ranged weapons.
|
//Target can't attack on move with ranged weapons.
|
||||||
@@ -473,28 +452,6 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//Range check.
|
//Range check.
|
||||||
|
|
||||||
//if(abstractCharacter.isMoving()){
|
|
||||||
// range += (abstractCharacter.getSpeed() * 0.1f); // add movement vector offset for moving attacker
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
|
||||||
// AbstractCharacter tarAc = (AbstractCharacter) target;
|
|
||||||
// if(tarAc != null && tarAc.isMoving()){
|
|
||||||
// range += (tarAc.getSpeed() * 0.1f); // add movement vector offset for moving target
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//float attackerHitBox = abstractCharacter.calcHitBox(); // add attacker hitbox
|
|
||||||
//float targetHitBox = 0.0f;
|
|
||||||
//if(AbstractCharacter.IsAbstractCharacter(target)){
|
|
||||||
// AbstractCharacter targetCharacter = (AbstractCharacter)target;
|
|
||||||
// targetHitBox = targetCharacter.calcHitBox(); // add target hitbox
|
|
||||||
//}
|
|
||||||
|
|
||||||
//range += attackerHitBox + targetHitBox + 2.5f; // offset standard range to sync where client tries to stop
|
|
||||||
|
|
||||||
range += 2; //sync offset
|
|
||||||
|
|
||||||
if (NotInRange(abstractCharacter, target, range)) {
|
if (NotInRange(abstractCharacter, target, range)) {
|
||||||
|
|
||||||
//target is in stealth and can't be seen by source
|
//target is in stealth and can't be seen by source
|
||||||
@@ -518,16 +475,6 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
|
|
||||||
if(pc.isBoxed){
|
|
||||||
if(target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
|
||||||
ChatManager.chatSystemInfo(pc, "You Are PvE Flagged: Cannot Attack Players.");
|
|
||||||
attackFailure = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO Verify attacker has los (if not ranged weapon).
|
//TODO Verify attacker has los (if not ranged weapon).
|
||||||
|
|
||||||
if (!attackFailure) {
|
if (!attackFailure) {
|
||||||
@@ -536,24 +483,16 @@ public enum CombatManager {
|
|||||||
createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon
|
createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon
|
||||||
else {
|
else {
|
||||||
int wepSpeed = (int) (wb.getSpeed());
|
int wepSpeed = (int) (wb.getSpeed());
|
||||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
|
|
||||||
if(slot == 1){
|
|
||||||
wepSpeed = (int) pc.combatStats.attackSpeedHandOne;
|
|
||||||
}else{
|
|
||||||
wepSpeed = (int) pc.combatStats.attackSpeedHandTwo;
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
|
|
||||||
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
|
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
|
||||||
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None));
|
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None));
|
||||||
|
|
||||||
if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus
|
if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus
|
||||||
wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||||
|
|
||||||
|
if (wepSpeed < 10)
|
||||||
|
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||||
|
|
||||||
if (wepSpeed < 10)
|
|
||||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
|
||||||
}
|
|
||||||
createTimer(abstractCharacter, slot, wepSpeed, true);
|
createTimer(abstractCharacter, slot, wepSpeed, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,32 +537,14 @@ public enum CombatManager {
|
|||||||
if (target == null)
|
if (target == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
if (mainHand) {
|
||||||
PlayerCharacter pc = (PlayerCharacter) ac;
|
atr = ac.getAtrHandOne();
|
||||||
if( pc.combatStats == null){
|
minDamage = ac.getMinDamageHandOne();
|
||||||
pc.combatStats = new PlayerCombatStats(pc);
|
maxDamage = ac.getMaxDamageHandOne();
|
||||||
}
|
} else {
|
||||||
pc.combatStats.calculateATR(true);
|
atr = ac.getAtrHandTwo();
|
||||||
pc.combatStats.calculateATR(false);
|
minDamage = ac.getMinDamageHandTwo();
|
||||||
if (mainHand) {
|
maxDamage = ac.getMaxDamageHandTwo();
|
||||||
atr = pc.combatStats.atrHandOne;
|
|
||||||
minDamage = pc.combatStats.minDamageHandOne;
|
|
||||||
maxDamage = pc.combatStats.maxDamageHandOne;
|
|
||||||
} else {
|
|
||||||
atr = pc.combatStats.atrHandTwo;
|
|
||||||
minDamage = pc.combatStats.minDamageHandTwo;
|
|
||||||
maxDamage = pc.combatStats.maxDamageHandTwo;
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
if (mainHand) {
|
|
||||||
atr = ac.getAtrHandOne();
|
|
||||||
minDamage = ac.getMinDamageHandOne();
|
|
||||||
maxDamage = ac.getMaxDamageHandOne();
|
|
||||||
} else {
|
|
||||||
atr = ac.getAtrHandTwo();
|
|
||||||
minDamage = ac.getMinDamageHandTwo();
|
|
||||||
maxDamage = ac.getMaxDamageHandTwo();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean tarIsRat = false;
|
boolean tarIsRat = false;
|
||||||
@@ -717,15 +638,7 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AbstractCharacter tar = (AbstractCharacter) target;
|
AbstractCharacter tar = (AbstractCharacter) target;
|
||||||
if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
defense = tar.getDefenseRating();
|
||||||
if(((PlayerCharacter)tar).combatStats == null){
|
|
||||||
((PlayerCharacter)tar).combatStats = new PlayerCombatStats((PlayerCharacter)tar);
|
|
||||||
}
|
|
||||||
((PlayerCharacter)tar).combatStats.calculateDefense();
|
|
||||||
defense = ((PlayerCharacter)tar).combatStats.defense;
|
|
||||||
}else {
|
|
||||||
defense = tar.getDefenseRating();
|
|
||||||
}
|
|
||||||
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
|
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,24 +646,24 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//Get hit chance
|
//Get hit chance
|
||||||
|
|
||||||
//int chance;
|
int chance;
|
||||||
//float dif = atr - defense;
|
float dif = atr - defense;
|
||||||
|
|
||||||
//if (dif > 100)
|
if (dif > 100)
|
||||||
// chance = 94;
|
chance = 94;
|
||||||
//else if (dif < -100)
|
else if (dif < -100)
|
||||||
// chance = 4;
|
chance = 4;
|
||||||
//else
|
else
|
||||||
// chance = (int) ((0.45 * dif) + 49);
|
chance = (int) ((0.45 * dif) + 49);
|
||||||
|
|
||||||
errorTrack = 5;
|
errorTrack = 5;
|
||||||
|
|
||||||
//calculate hit/miss
|
//calculate hit/miss
|
||||||
|
|
||||||
|
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||||
DeferredPowerJob dpj = null;
|
DeferredPowerJob dpj = null;
|
||||||
|
|
||||||
boolean hitLanded = LandHit((int)atr,(int)defense);
|
if (roll < chance) {
|
||||||
if (hitLanded) {
|
|
||||||
|
|
||||||
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||||
updateAttackTimers((PlayerCharacter) ac, target, true);
|
updateAttackTimers((PlayerCharacter) ac, target, true);
|
||||||
@@ -779,25 +692,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
PlayerBonuses bonus = ac.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
|
dpj.attack(target, attackRange);
|
||||||
if(ac.isMoving()){
|
|
||||||
attackRange += (ac.getSpeed() * 0.1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
|
||||||
//AbstractCharacter tarAc = (AbstractCharacter) target;
|
|
||||||
if(tarAc != null && tarAc.isMoving()){
|
|
||||||
attackRange += (tarAc.getSpeed() * 0.1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(specialCaseHitRoll(dpj.getPowerToken())) {
|
|
||||||
if(hitLanded) {
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518))
|
||||||
((PlayerCharacter) ac).setWeaponPower(dpj);
|
((PlayerCharacter) ac).setWeaponPower(dpj);
|
||||||
@@ -812,25 +707,7 @@ public enum CombatManager {
|
|||||||
|
|
||||||
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
if (dpj != null && dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) {
|
||||||
float attackRange = getWeaponRange(wb, bonuses);
|
float attackRange = getWeaponRange(wb, bonuses);
|
||||||
|
dpj.attack(target, attackRange);
|
||||||
if(ac.isMoving()){
|
|
||||||
attackRange += (ac.getSpeed() * 0.1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
|
||||||
//AbstractCharacter tarAc = (AbstractCharacter) target;
|
|
||||||
if(tarAc != null && tarAc.isMoving()){
|
|
||||||
attackRange += (tarAc.getSpeed() * 0.1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(specialCaseHitRoll(dpj.getPowerToken())) {
|
|
||||||
if(hitLanded) {
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -937,28 +814,8 @@ public enum CombatManager {
|
|||||||
else
|
else
|
||||||
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||||
|
|
||||||
if(weapon != null && weapon.effects != null){
|
|
||||||
float armorPierce = 0;
|
|
||||||
for(Effect eff : weapon.effects.values()){
|
|
||||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
|
||||||
if(mod.modType.equals(ModType.ArmorPiercing)){
|
|
||||||
armorPierce += mod.getPercentMod() + (mod.getRamp() * eff.getTrains());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(armorPierce > 0){
|
|
||||||
damage *= 1 + (armorPierce * 0.01f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Resists.handleFortitude(tarAc,damageType,damage);
|
|
||||||
|
|
||||||
float d = 0f;
|
float d = 0f;
|
||||||
|
|
||||||
int originalDamage = (int)damage;
|
|
||||||
if(ac != null && ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
damage *= ((PlayerCharacter)ac).ZergMultiplier;
|
|
||||||
} // Health modifications are modified by the ZergMechanic
|
|
||||||
|
|
||||||
errorTrack = 12;
|
errorTrack = 12;
|
||||||
|
|
||||||
//Subtract Damage from target's health
|
//Subtract Damage from target's health
|
||||||
@@ -972,15 +829,9 @@ public enum CombatManager {
|
|||||||
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
||||||
((Mob) tarAc).handleDirectAggro(ac);
|
((Mob) tarAc).handleDirectAggro(ac);
|
||||||
}
|
}
|
||||||
if (tarAc.getHealth() > 0) {
|
|
||||||
d = tarAc.modifyHealth(-damage, ac, false);
|
|
||||||
if(tarAc != null && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter) && ((PlayerCharacter)ac).ZergMultiplier != 1.0f){
|
|
||||||
PlayerCharacter debugged = (PlayerCharacter)tarAc;
|
|
||||||
ChatManager.chatSystemInfo(debugged, "ZERG DEBUG: " + ac.getName() + " Hits You For: " + (int)damage + " instead of " + originalDamage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tarAc.cancelOnTakeDamage();
|
if (tarAc.getHealth() > 0)
|
||||||
|
d = tarAc.modifyHealth(-damage, ac, false);
|
||||||
|
|
||||||
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||||
|
|
||||||
@@ -1012,7 +863,35 @@ public enum CombatManager {
|
|||||||
errorTrack = 14;
|
errorTrack = 14;
|
||||||
|
|
||||||
//handle procs
|
//handle procs
|
||||||
procChanceHandler(weapon,ac,tarAc);
|
|
||||||
|
if (weapon != null && tarAc != null && tarAc.isAlive()) {
|
||||||
|
|
||||||
|
ConcurrentHashMap<String, Effect> effects = weapon.getEffects();
|
||||||
|
|
||||||
|
for (Effect eff : effects.values()) {
|
||||||
|
if (eff == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
HashSet<AbstractEffectModifier> aems = eff.getEffectModifiers();
|
||||||
|
|
||||||
|
if (aems != null) {
|
||||||
|
for (AbstractEffectModifier aem : aems) {
|
||||||
|
|
||||||
|
if (!tarAc.isAlive())
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (aem instanceof WeaponProcEffectModifier) {
|
||||||
|
|
||||||
|
int procChance = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
|
||||||
|
if (procChance < MBServerStatics.PROC_CHANCE)
|
||||||
|
((WeaponProcEffectModifier) aem).applyProc(ac, target);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
errorTrack = 15;
|
errorTrack = 15;
|
||||||
|
|
||||||
@@ -1021,16 +900,6 @@ public enum CombatManager {
|
|||||||
if (ac.isAlive() && tarAc != null && tarAc.isAlive())
|
if (ac.isAlive() && tarAc != null && tarAc.isAlive())
|
||||||
handleDamageShields(ac, tarAc, damage);
|
handleDamageShields(ac, tarAc, damage);
|
||||||
|
|
||||||
//handle mob hate values
|
|
||||||
if(target.getObjectType().equals(GameObjectType.Mob) && ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
Mob mobTarget = (Mob)target;
|
|
||||||
if(mobTarget.hate_values.containsKey((PlayerCharacter) ac)){
|
|
||||||
mobTarget.hate_values.put((PlayerCharacter) ac,mobTarget.hate_values.get((PlayerCharacter) ac) + damage);
|
|
||||||
}else{
|
|
||||||
mobTarget.hate_values.put((PlayerCharacter) ac, damage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Apply Weapon power effect if any.
|
// Apply Weapon power effect if any.
|
||||||
@@ -1046,26 +915,7 @@ public enum CombatManager {
|
|||||||
if (wp.requiresHitRoll() == false) {
|
if (wp.requiresHitRoll() == false) {
|
||||||
PlayerBonuses bonus = ac.getBonuses();
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
float attackRange = getWeaponRange(wb, bonus);
|
float attackRange = getWeaponRange(wb, bonus);
|
||||||
|
dpj.attack(target, attackRange);
|
||||||
if(ac.isMoving()){
|
|
||||||
attackRange += (ac.getSpeed() * 0.1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(AbstractWorldObject.IsAbstractCharacter(target)) {
|
|
||||||
AbstractCharacter tarAc = (AbstractCharacter) target;
|
|
||||||
if(tarAc != null && tarAc.isMoving()){
|
|
||||||
attackRange += (tarAc.getSpeed() * 0.1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(specialCaseHitRoll(dpj.getPowerToken())) {
|
|
||||||
if(hitLanded) {
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
dpj.attack(target, attackRange);
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
((PlayerCharacter) ac).setWeaponPower(null);
|
((PlayerCharacter) ac).setWeaponPower(null);
|
||||||
}
|
}
|
||||||
@@ -1096,41 +946,6 @@ public enum CombatManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void procChanceHandler(Item weapon, AbstractCharacter ac, AbstractCharacter tarAc) {
|
|
||||||
|
|
||||||
//no weapon means no proc
|
|
||||||
if(weapon == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//caster is dead of null, no proc
|
|
||||||
if(ac == null || !ac.isAlive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
//target is dead or null, no proc
|
|
||||||
if(tarAc == null || !tarAc.isAlive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
//no effects on weapon, skip proc
|
|
||||||
if(weapon.effects == null || weapon.effects.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Effect eff : weapon.effects.values()){
|
|
||||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()) {
|
|
||||||
if (mod.modType.equals(ModType.WeaponProc)) {
|
|
||||||
int procChance = ThreadLocalRandom.current().nextInt(100);
|
|
||||||
if (procChance < MBServerStatics.PROC_CHANCE) {
|
|
||||||
try {
|
|
||||||
((WeaponProcEffectModifier) mod).applyProc(ac, tarAc);
|
|
||||||
break;
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(eff.getName() + " Failed To Cast Proc");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canTestParry(AbstractCharacter ac, AbstractWorldObject target) {
|
public static boolean canTestParry(AbstractCharacter ac, AbstractWorldObject target) {
|
||||||
|
|
||||||
if (ac == null || target == null || !AbstractWorldObject.IsAbstractCharacter(target))
|
if (ac == null || target == null || !AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
@@ -1149,12 +964,6 @@ public enum CombatManager {
|
|||||||
Item tarMain = tarItem.getItemFromEquipped(1);
|
Item tarMain = tarItem.getItemFromEquipped(1);
|
||||||
Item tarOff = tarItem.getItemFromEquipped(2);
|
Item tarOff = tarItem.getItemFromEquipped(2);
|
||||||
|
|
||||||
if(target.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
PlayerCharacter pc = (PlayerCharacter) target;
|
|
||||||
if(pc.getRaceID() == 1999 && !isRanged(acMain) && !isRanged(acOff))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !isRanged(acMain) && !isRanged(acOff) && !isRanged(tarMain) && !isRanged(tarOff);
|
return !isRanged(acMain) && !isRanged(acOff) && !isRanged(tarMain) && !isRanged(tarOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1213,12 +1022,10 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//calculate resists in if any
|
//calculate resists in if any
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (resists != null)
|
if (resists != null)
|
||||||
damage = resists.getResistedDamage(source, target, damageType, damage, 0);
|
return resists.getResistedDamage(source, target, damageType, damage, 0);
|
||||||
|
else
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
|
private static void sendPassiveDefenseMessage(AbstractCharacter source, ItemBase wb, AbstractWorldObject target, int passiveType, DeferredPowerJob dpj, boolean mainHand) {
|
||||||
@@ -1368,14 +1175,6 @@ public enum CombatManager {
|
|||||||
|
|
||||||
private static boolean testPassive(AbstractCharacter source, AbstractCharacter target, String type) {
|
private static boolean testPassive(AbstractCharacter source, AbstractCharacter target, String type) {
|
||||||
|
|
||||||
if(target.getBonuses() != null)
|
|
||||||
if(target.getBonuses().getBool(ModType.Stunned, SourceType.None))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(source.getBonuses() != null)
|
|
||||||
if(source.getBonuses().getBool(ModType.IgnorePassiveDefense, SourceType.None))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
float chance = target.getPassiveChance(type, source.getLevel(), true);
|
float chance = target.getPassiveChance(type, source.getLevel(), true);
|
||||||
|
|
||||||
if (chance == 0f)
|
if (chance == 0f)
|
||||||
@@ -1386,7 +1185,7 @@ public enum CombatManager {
|
|||||||
if (chance > 75f)
|
if (chance > 75f)
|
||||||
chance = 75f;
|
chance = 75f;
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(1,100);
|
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
|
||||||
return roll < chance;
|
return roll < chance;
|
||||||
|
|
||||||
@@ -1438,17 +1237,14 @@ public enum CombatManager {
|
|||||||
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleSit(boolean toggle, ClientConnection origin) {
|
private static void toggleSit(boolean toggle, ClientConnection origin) {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (pc == null)
|
if (pc == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(pc.isFlying())
|
pc.setSit(toggle);
|
||||||
pc.setSit(false);
|
|
||||||
else
|
|
||||||
pc.setSit(toggle);
|
|
||||||
|
|
||||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||||
rwss.setPlayer(pc);
|
rwss.setPlayer(pc);
|
||||||
@@ -1526,13 +1322,6 @@ public enum CombatManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
retaliater.setCombatTarget(ac);
|
retaliater.setCombatTarget(ac);
|
||||||
if(retaliater.isPlayerGuard && (retaliater.BehaviourType.equals(MobBehaviourType.GuardMinion) || retaliater.BehaviourType.equals(MobBehaviourType.GuardCaptain))){
|
|
||||||
for(Mob guard : retaliater.guardedCity.getParent().zoneMobSet){
|
|
||||||
if(guard.isPlayerGuard && guard.combatTarget == null){
|
|
||||||
guard.setCombatTarget(ac);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1564,9 +1353,9 @@ public enum CombatManager {
|
|||||||
|
|
||||||
Resists resists = ac.getResists();
|
Resists resists = ac.getResists();
|
||||||
|
|
||||||
if (resists != null) {
|
if (resists != null)
|
||||||
amount = resists.getResistedDamage(target, ac, ds.getDamageType(), amount, 0);
|
amount = resists.getResistedDamage(target, ac, ds.getDamageType(), amount, 0);
|
||||||
}
|
|
||||||
total += amount;
|
total += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1649,31 +1438,4 @@ public enum CombatManager {
|
|||||||
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
|
((AbstractCharacter) awo).getCharItemManager().damageRandomArmor(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean LandHit(int ATR, int DEF){
|
|
||||||
|
|
||||||
//float chance = (ATR-((ATR+DEF) * 0.315f)) / ((DEF-((ATR+DEF) * 0.315f)) + (ATR-((ATR+DEF) * 0.315f)));
|
|
||||||
//float convertedChance = chance * 100;
|
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
|
||||||
|
|
||||||
//if(roll <= 5)//always 5% chance to miss
|
|
||||||
// return false;
|
|
||||||
|
|
||||||
//if(roll >= 95)//always 5% chance to hit
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
float chance = PlayerCombatStats.getHitChance(ATR,DEF);
|
|
||||||
return chance >= roll;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean specialCaseHitRoll(int powerID){
|
|
||||||
switch(powerID) {
|
|
||||||
case 563200808: // Naargal's Bite
|
|
||||||
case 563205337: // Naargal's Dart
|
|
||||||
case 563205930: // Sword of Saint Malorn
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ public enum ConfigManager {
|
|||||||
MB_WORLD_MAINTENANCE,
|
MB_WORLD_MAINTENANCE,
|
||||||
MB_WORLD_GREETING,
|
MB_WORLD_GREETING,
|
||||||
MB_WORLD_KEYCLONE_MAX,
|
MB_WORLD_KEYCLONE_MAX,
|
||||||
MB_WORLD_TESTMODE,
|
|
||||||
MB_USE_RUINS,
|
MB_USE_RUINS,
|
||||||
|
|
||||||
// Mobile AI modifiers
|
// Mobile AI modifiers
|
||||||
@@ -98,8 +97,7 @@ public enum ConfigManager {
|
|||||||
MB_MAGICBOT_FORTOFIX,
|
MB_MAGICBOT_FORTOFIX,
|
||||||
MB_MAGICBOT_RECRUIT,
|
MB_MAGICBOT_RECRUIT,
|
||||||
MB_MAGICBOT_MAGICBOX,
|
MB_MAGICBOT_MAGICBOX,
|
||||||
MB_MAGICBOT_ADMINLOG,
|
MB_MAGICBOT_ADMINLOG;
|
||||||
MB_WORLD_BOXLIMIT;
|
|
||||||
|
|
||||||
// Map to hold our config pulled in from the environment
|
// Map to hold our config pulled in from the environment
|
||||||
// We also use the config to point to the current message pump
|
// We also use the config to point to the current message pump
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new PrintResistsCmd());
|
DevCmdManager.registerDevCmd(new PrintResistsCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintLocationCmd());
|
DevCmdManager.registerDevCmd(new PrintLocationCmd());
|
||||||
DevCmdManager.registerDevCmd(new InfoCmd());
|
DevCmdManager.registerDevCmd(new InfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new PrintEffectsCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new aiInfoCmd());
|
DevCmdManager.registerDevCmd(new aiInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new SimulateBootyCmd());
|
DevCmdManager.registerDevCmd(new SimulateBootyCmd());
|
||||||
DevCmdManager.registerDevCmd(new GetHeightCmd());
|
DevCmdManager.registerDevCmd(new GetHeightCmd());
|
||||||
@@ -80,13 +79,13 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
||||||
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
|
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
|
||||||
DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
|
DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
|
||||||
|
DevCmdManager.registerDevCmd(new HotzoneCmd());
|
||||||
DevCmdManager.registerDevCmd(new MineActiveCmd());
|
DevCmdManager.registerDevCmd(new MineActiveCmd());
|
||||||
// Dev
|
// Dev
|
||||||
DevCmdManager.registerDevCmd(new ApplyStatModCmd());
|
DevCmdManager.registerDevCmd(new ApplyStatModCmd());
|
||||||
DevCmdManager.registerDevCmd(new AddBuildingCmd());
|
DevCmdManager.registerDevCmd(new AddBuildingCmd());
|
||||||
DevCmdManager.registerDevCmd(new AddNPCCmd());
|
DevCmdManager.registerDevCmd(new AddNPCCmd());
|
||||||
DevCmdManager.registerDevCmd(new AddMobCmd());
|
DevCmdManager.registerDevCmd(new AddMobCmd());
|
||||||
DevCmdManager.registerDevCmd(new DungenonCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new RemoveObjectCmd());
|
DevCmdManager.registerDevCmd(new RemoveObjectCmd());
|
||||||
DevCmdManager.registerDevCmd(new RotateCmd());
|
DevCmdManager.registerDevCmd(new RotateCmd());
|
||||||
DevCmdManager.registerDevCmd(new FlashMsgCmd());
|
DevCmdManager.registerDevCmd(new FlashMsgCmd());
|
||||||
@@ -104,7 +103,6 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
DevCmdManager.registerDevCmd(new SetAdminRuneCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetInvulCmd());
|
DevCmdManager.registerDevCmd(new SetInvulCmd());
|
||||||
DevCmdManager.registerDevCmd(new MakeItemCmd());
|
DevCmdManager.registerDevCmd(new MakeItemCmd());
|
||||||
DevCmdManager.registerDevCmd(new GimmeCmd());
|
|
||||||
DevCmdManager.registerDevCmd(new EnchantCmd());
|
DevCmdManager.registerDevCmd(new EnchantCmd());
|
||||||
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
|
DevCmdManager.registerDevCmd(new SetSubRaceCmd());
|
||||||
// Admin
|
// Admin
|
||||||
@@ -145,6 +143,7 @@ public enum DevCmdManager {
|
|||||||
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
DevCmdManager.registerDevCmd(new ApplyBonusCmd());
|
||||||
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
DevCmdManager.registerDevCmd(new AuditFailedItemsCmd());
|
||||||
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
DevCmdManager.registerDevCmd(new SlotTestCmd());
|
||||||
|
DevCmdManager.registerDevCmd(new SetCampLevelCmd());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,44 +178,10 @@ public enum DevCmdManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pcSender.getTimestamps().containsKey("DEVCOMMAND"))
|
|
||||||
pcSender.getTimestamps().put("DEVCOMMAND",System.currentTimeMillis() - 1500L);
|
|
||||||
else if(System.currentTimeMillis() - pcSender.getTimestamps().get("DEVCOMMAND") < 1000L)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//kill any commands not available to everyone on production server
|
//kill any commands not available to everyone on production server
|
||||||
//only admin level can run dev commands on production
|
//only admin level can run dev commands on production
|
||||||
boolean playerAllowed = false;
|
|
||||||
if(ConfigManager.MB_WORLD_TESTMODE.getValue().equals("true")) {
|
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
||||||
switch (adc.getMainCmdString()) {
|
|
||||||
case "printresists":
|
|
||||||
case "printstats":
|
|
||||||
case "printskills":
|
|
||||||
case "printpowers":
|
|
||||||
case "gimme":
|
|
||||||
case "goto":
|
|
||||||
case "teleportmode":
|
|
||||||
case "printbonuses":
|
|
||||||
playerAllowed = true;
|
|
||||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
|
||||||
target = pcSender;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
switch (adc.getMainCmdString()) {
|
|
||||||
case "printresists":
|
|
||||||
case "printstats":
|
|
||||||
case "printskills":
|
|
||||||
case "printpowers":
|
|
||||||
case "printbonuses":
|
|
||||||
//case "gimme":
|
|
||||||
playerAllowed = true;
|
|
||||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
|
||||||
target = pcSender;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!playerAllowed && !a.status.equals(Enum.AccountStatus.ADMIN)) {
|
|
||||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,289 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.mobileAI.MobAI;
|
|
||||||
import engine.mobileAI.utilities.CombatUtilities;
|
|
||||||
import engine.mobileAI.utilities.MovementUtilities;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class HellgateManager {
|
|
||||||
public static ArrayList<Mob> hellgate_mobs;
|
|
||||||
public static ArrayList<Mob> hellgate_mini_bosses;
|
|
||||||
public static Mob hellgate_boss;
|
|
||||||
|
|
||||||
public static Long hellgate_time_completed = 0L;
|
|
||||||
public static final int citadel_ruins_zone_id = 993;
|
|
||||||
public static final int hell_portal_1_zone_id = 994;
|
|
||||||
public static final int hell_portal_2_zone_id = 996;
|
|
||||||
public static final int hell_portal_3_zone_id = 997;
|
|
||||||
public static final int hell_portal_4_zone_id = 998;
|
|
||||||
|
|
||||||
public static boolean initialized = false;
|
|
||||||
|
|
||||||
public static final ArrayList<Integer> static_rune_ids_low = new ArrayList<>(Arrays.asList(
|
|
||||||
250001, 250002, 250003, 250004, 250005, 250006, 250010, 250011,
|
|
||||||
250012, 250013, 250014, 250015, 250019, 250020, 250021, 250022,
|
|
||||||
250023, 250024, 250028, 250029, 250030, 250031, 250032, 250033,
|
|
||||||
250037, 250038, 250039, 250040, 250041, 250042
|
|
||||||
));
|
|
||||||
|
|
||||||
public static final ArrayList<Integer> static_rune_ids_mid = new ArrayList<>(Arrays.asList(
|
|
||||||
250006, 250007, 250008,
|
|
||||||
250015, 250016, 250017,
|
|
||||||
250024, 250025, 250026,
|
|
||||||
250033, 250034, 250035,
|
|
||||||
250042, 250043, 250044
|
|
||||||
));
|
|
||||||
|
|
||||||
public static final ArrayList<Integer> static_rune_ids_high = new ArrayList<>(Arrays.asList(
|
|
||||||
250007, 250008,
|
|
||||||
250016, 250017,
|
|
||||||
250025, 250026,
|
|
||||||
250034, 250035,
|
|
||||||
250043, 250044
|
|
||||||
));
|
|
||||||
public static void confiureHellgate(){
|
|
||||||
compile_mob_list();
|
|
||||||
}
|
|
||||||
public static void pulseHellgates(){
|
|
||||||
if(!initialized){
|
|
||||||
confiureHellgate();
|
|
||||||
if(hellgate_boss != null)
|
|
||||||
initialized = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hellgate_mobs == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(hellgate_mini_bosses == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(hellgate_boss == null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!hellgate_boss.isAlive() && hellgate_time_completed == 0L)
|
|
||||||
hellgate_time_completed = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if(hellgate_time_completed != 0L && System.currentTimeMillis() > hellgate_time_completed + MBServerStatics.THIRTY_MINUTES){
|
|
||||||
ResetHellgate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void compile_mob_list(){
|
|
||||||
if(hellgate_mobs == null) {
|
|
||||||
hellgate_mobs =new ArrayList<>();
|
|
||||||
}
|
|
||||||
if(hellgate_mini_bosses == null) {
|
|
||||||
hellgate_mini_bosses =new ArrayList<>();
|
|
||||||
}
|
|
||||||
Zone hellgate_zone = ZoneManager.getZoneByUUID(citadel_ruins_zone_id);
|
|
||||||
if(hellgate_zone == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(Mob mob : hellgate_zone.zoneMobSet){
|
|
||||||
switch(mob.getMobBaseID()){
|
|
||||||
case 14163: // basic saetor warrior
|
|
||||||
mob.getCharItemManager().clearInventory();
|
|
||||||
SpecialLootHandler(mob,false,false);
|
|
||||||
mob.setResists(new Resists("Elite"));
|
|
||||||
mob.healthMax = 8500;
|
|
||||||
mob.setHealth(mob.healthMax);
|
|
||||||
hellgate_mobs.add(mob);
|
|
||||||
break;
|
|
||||||
case 12770: // minotaur mini boss
|
|
||||||
mob.getCharItemManager().clearInventory();
|
|
||||||
SpecialLootHandler(mob,true,false);
|
|
||||||
mob.setResists(new Resists("Elite"));
|
|
||||||
mob.healthMax = 12500;
|
|
||||||
mob.setHealth(mob.healthMax);
|
|
||||||
hellgate_mini_bosses.add(mob);
|
|
||||||
break;
|
|
||||||
case 14180: // mordoth, son of morlock
|
|
||||||
mob.getCharItemManager().clearInventory();
|
|
||||||
SpecialLootHandler(mob,false,true);
|
|
||||||
mob.setResists(new Resists("Elite"));
|
|
||||||
mob.healthMax = mob.mobBase.getHealthMax();
|
|
||||||
mob.setHealth(mob.healthMax);
|
|
||||||
hellgate_boss = mob;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ResetHellgate(){
|
|
||||||
hellgate_time_completed = 0L;
|
|
||||||
for(Mob mob : hellgate_mobs){
|
|
||||||
if(!mob.isAlive()){
|
|
||||||
if(!mob.despawned){
|
|
||||||
mob.despawn();
|
|
||||||
}
|
|
||||||
mob.respawn();
|
|
||||||
}
|
|
||||||
mob.setHealth(mob.healthMax);
|
|
||||||
SpecialLootHandler(mob,false,false);
|
|
||||||
}
|
|
||||||
for(Mob mob : hellgate_mini_bosses){
|
|
||||||
if(!mob.isAlive()){
|
|
||||||
if(!mob.despawned){
|
|
||||||
mob.despawn();
|
|
||||||
}
|
|
||||||
mob.respawn();
|
|
||||||
}
|
|
||||||
mob.setHealth(mob.healthMax);
|
|
||||||
SpecialLootHandler(mob,true,false);
|
|
||||||
}
|
|
||||||
if(!hellgate_boss.isAlive()){
|
|
||||||
if(!hellgate_boss.despawned){
|
|
||||||
hellgate_boss.despawn();
|
|
||||||
}
|
|
||||||
hellgate_boss.respawn();
|
|
||||||
}
|
|
||||||
hellgate_boss.setHealth(hellgate_boss.healthMax);
|
|
||||||
SpecialLootHandler(hellgate_boss,false,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SpecialMobAIHandler(Mob mob){
|
|
||||||
|
|
||||||
if(mob.playerAgroMap.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!mob.isAlive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.combatTarget == null)
|
|
||||||
MobAI.NewAggroMechanic(mob);
|
|
||||||
|
|
||||||
if(MovementUtilities.canMove(mob) && mob.combatTarget != null && !CombatUtilities.inRangeToAttack(mob,mob.combatTarget))
|
|
||||||
MobAI.chaseTarget(mob);
|
|
||||||
|
|
||||||
if(mob.combatTarget != null)
|
|
||||||
MobAI.CheckForAttack(mob);
|
|
||||||
|
|
||||||
if(mob.combatTarget == null && mob.loc.distanceSquared(mob.bindLoc) > 1024) {//32 units
|
|
||||||
mob.teleport(mob.bindLoc);
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
MovementUtilities.aiMove(mob,mob.bindLoc,true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SpecialLootHandler(Mob mob, Boolean commander, Boolean epic){
|
|
||||||
mob.getCharItemManager().clearInventory();
|
|
||||||
int contractRoll = ThreadLocalRandom.current().nextInt(1,101);
|
|
||||||
if(contractRoll <= 25){
|
|
||||||
//generate random contract
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int runeRoll = ThreadLocalRandom.current().nextInt(1,101);
|
|
||||||
ItemBase runeBase = null;
|
|
||||||
int roll;
|
|
||||||
int itemId;
|
|
||||||
if(runeRoll <= 60 && !commander && !epic) {
|
|
||||||
//generate random rune (standard 5-30)
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(static_rune_ids_low.size() + 1);
|
|
||||||
itemId = static_rune_ids_low.get(0);
|
|
||||||
try {
|
|
||||||
itemId = static_rune_ids_low.get(roll);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(mob, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(runeRoll <= 50 && commander) {
|
|
||||||
//generate random rune (30-40)
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(static_rune_ids_mid.size() + 1);
|
|
||||||
itemId = static_rune_ids_mid.get(0);
|
|
||||||
try {
|
|
||||||
itemId = static_rune_ids_mid.get(roll);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(mob, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(runeRoll <= 80 && epic) {
|
|
||||||
//generate random rune (35-40)
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(static_rune_ids_high.size() + 1);
|
|
||||||
itemId = static_rune_ids_high.get(0);
|
|
||||||
try {
|
|
||||||
itemId = static_rune_ids_high.get(roll);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(mob, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(commander || epic) {
|
|
||||||
//handle special case for racial guards
|
|
||||||
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(LootManager.racial_guard_uuids.size() + 1);
|
|
||||||
itemId = LootManager.racial_guard_uuids.get(0);
|
|
||||||
try {
|
|
||||||
itemId = LootManager.racial_guard_uuids.get(roll);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(mob, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(epic){
|
|
||||||
//handle glass chance for epic
|
|
||||||
int glassRoll = ThreadLocalRandom.current().nextInt(1,101);
|
|
||||||
if(glassRoll < 5){
|
|
||||||
int glassID = LootManager.rollRandomItem(126);
|
|
||||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
|
||||||
if (glassItem != null) {
|
|
||||||
MobLoot glass = new MobLoot(mob, glassItem, true);
|
|
||||||
|
|
||||||
if (glass != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(glass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//handle gold drops
|
|
||||||
int goldDrop;
|
|
||||||
if(!commander && !epic){
|
|
||||||
goldDrop = ThreadLocalRandom.current().nextInt(25000);
|
|
||||||
mob.getCharItemManager().addGoldToInventory(goldDrop,false);
|
|
||||||
}
|
|
||||||
if(commander){
|
|
||||||
goldDrop = ThreadLocalRandom.current().nextInt(100000,250000);
|
|
||||||
mob.getCharItemManager().addGoldToInventory(goldDrop,false);
|
|
||||||
}
|
|
||||||
if(epic){
|
|
||||||
goldDrop = ThreadLocalRandom.current().nextInt(2500000,5000000);
|
|
||||||
mob.getCharItemManager().addGoldToInventory(goldDrop,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,238 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.net.Dispatch;
|
|
||||||
import engine.net.DispatchMessage;
|
|
||||||
import engine.net.client.msg.HotzoneChangeMsg;
|
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class HotzoneManager {
|
|
||||||
public static Long lastPulseTime = 0L;
|
|
||||||
public static HashMap<Guild, ArrayList<PlayerCharacter>> playersPresent;
|
|
||||||
public static Mob hotzoneMob = null;
|
|
||||||
public static boolean three_quarter_health = false;
|
|
||||||
public static boolean half_health = false;
|
|
||||||
public static boolean quarter_health = false;
|
|
||||||
public static void SelectRandomHotzone(){
|
|
||||||
if(hotzoneMob != null){
|
|
||||||
hotzoneMob.killCharacter("Hotzone Over");
|
|
||||||
hotzoneMob.despawn();
|
|
||||||
hotzoneMob.spawnTime = 1000000000;
|
|
||||||
DbManager.MobQueries.DELETE_MOB( hotzoneMob);
|
|
||||||
}
|
|
||||||
Random random = new Random();
|
|
||||||
Zone newHotzone = null;
|
|
||||||
while (newHotzone == null || newHotzone.getObjectUUID() == 931 || newHotzone.getObjectUUID() == 913)
|
|
||||||
newHotzone = (Zone) ZoneManager.macroZones.toArray()[random.nextInt(ZoneManager.macroZones.size())];
|
|
||||||
ZoneManager.setHotZone(newHotzone);
|
|
||||||
ZoneManager.hotZone = newHotzone;
|
|
||||||
int R8UUId = 0;
|
|
||||||
switch(random.nextInt(5)) {
|
|
||||||
case 1:
|
|
||||||
R8UUId = 14152;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
R8UUId = 14179;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
R8UUId = 14180;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
R8UUId = 14220;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
R8UUId = 14319;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Mob created = Mob.createMob(R8UUId,newHotzone.getLoc(), Guild.getErrantGuild(),true,newHotzone,null,0,"",85);
|
|
||||||
if(created == null){
|
|
||||||
Logger.error("Failed To Generate Hotzone R8 Mob");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, created.getFirstName() + " has spawned in " + newHotzone.getName() + ". Glory and riches await adventurers who dare defeat it!");
|
|
||||||
chatMsg.setMessageType(10);
|
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
|
|
||||||
created.bindLoc = newHotzone.getLoc();
|
|
||||||
created.runAfterLoad();
|
|
||||||
WorldGrid.addObject(created,created.bindLoc.x,created.bindLoc.z);
|
|
||||||
created.teleport(created.bindLoc);
|
|
||||||
created.BehaviourType = Enum.MobBehaviourType.Aggro;
|
|
||||||
hotzoneMob = created;
|
|
||||||
created.setHealth(100000);
|
|
||||||
created.setResists(new Resists("Dropper"));
|
|
||||||
GenerateHotzoneEpicLoot(created);
|
|
||||||
ZoneManager.hotZone = newHotzone;
|
|
||||||
|
|
||||||
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) {
|
|
||||||
HotzoneChangeMsg hcm = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, hcm);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
three_quarter_health = false;
|
|
||||||
half_health = false;
|
|
||||||
quarter_health = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GenerateHotzoneEpicLoot(Mob mob) {
|
|
||||||
mob.getCharItemManager().clearInventory();
|
|
||||||
Random random = new Random();
|
|
||||||
int roll;
|
|
||||||
int itemId;
|
|
||||||
//wrapped rune:
|
|
||||||
ItemBase runeBase = ItemBase.getItemBase(971070);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(mob, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(1, 101);
|
|
||||||
if (roll >= 95) {
|
|
||||||
//glass
|
|
||||||
int glassID = LootManager.rollRandomItem(126);
|
|
||||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
|
||||||
if (glassItem != null) {
|
|
||||||
MobLoot glass = new MobLoot(mob, glassItem, true);
|
|
||||||
|
|
||||||
if (glass != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(glass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(1, 101);
|
|
||||||
if (roll >= 95) {
|
|
||||||
//r8 banescroll
|
|
||||||
int baneID = 910018;
|
|
||||||
ItemBase baneItem = ItemBase.getItemBase(baneID);
|
|
||||||
if (baneItem != null) {
|
|
||||||
MobLoot bane = new MobLoot(mob, baneItem, true);
|
|
||||||
|
|
||||||
if (bane != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(bane);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(1, 101);
|
|
||||||
if (roll >= 95) {
|
|
||||||
//guard captain
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(LootManager.racial_guard_uuids.size() + 1);
|
|
||||||
itemId = LootManager.racial_guard_uuids.get(0);
|
|
||||||
try {
|
|
||||||
itemId = LootManager.racial_guard_uuids.get(roll);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(mob, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ClearHotzone(){
|
|
||||||
ZoneManager.hotZone = null;
|
|
||||||
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) {
|
|
||||||
HotzoneChangeMsg hcm = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), 0);
|
|
||||||
Dispatch dispatch = Dispatch.borrow(player, hcm);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void pulse(){
|
|
||||||
if(HotzoneManager.playersPresent == null)
|
|
||||||
HotzoneManager.playersPresent = new HashMap<>();
|
|
||||||
|
|
||||||
if(ZoneManager.hotZone == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(lastPulseTime + 5000L > System.currentTimeMillis())
|
|
||||||
return;
|
|
||||||
|
|
||||||
lastPulseTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
//handle world announcements for HZ boss
|
|
||||||
if(hotzoneMob != null){
|
|
||||||
float health = hotzoneMob.getHealth();
|
|
||||||
if(health < 75000 && health > 50000 && !three_quarter_health){
|
|
||||||
//mob at 50%-75% health
|
|
||||||
three_quarter_health = true;
|
|
||||||
String name = hotzoneMob.getName();
|
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, name + " In The Hotzone Is At 75% Health");
|
|
||||||
chatMsg.setMessageType(10);
|
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
}else if(health < 50000 && health > 25000 && !half_health){
|
|
||||||
//mob ta 25%-50% health
|
|
||||||
half_health = true;
|
|
||||||
String name = hotzoneMob.getName();
|
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, name + " In The Hotzone Is At 50% Health");
|
|
||||||
chatMsg.setMessageType(10);
|
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
}else if(health < 25000 && !quarter_health){
|
|
||||||
//mob under 25% health
|
|
||||||
quarter_health = true;
|
|
||||||
String name = hotzoneMob.getName();
|
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, name + " In The Hotzone Is At 25% Health");
|
|
||||||
chatMsg.setMessageType(10);
|
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
}else if (health > 75000){
|
|
||||||
//mob at 75% - 100% health
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(ZoneManager.hotZone.getLoc(),ZoneManager.hotZone.getBounds().getHalfExtents().x * 2, MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
//clear out old players who aren't here anymore
|
|
||||||
for(Guild nation : HotzoneManager.playersPresent.keySet()){
|
|
||||||
for(PlayerCharacter pc : HotzoneManager.playersPresent.get(nation)){
|
|
||||||
if (!inRange.contains(pc)) {
|
|
||||||
HotzoneManager.playersPresent.get(nation).remove(pc);
|
|
||||||
if(HotzoneManager.playersPresent.get(nation).size() < 1){
|
|
||||||
HotzoneManager.playersPresent.remove(nation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//check status of current players/nation in vicinity
|
|
||||||
for(AbstractWorldObject awo : inRange){
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)awo;
|
|
||||||
Guild nation = pc.guild.getNation();
|
|
||||||
if(HotzoneManager.playersPresent.containsKey(nation)){
|
|
||||||
//nation already here, add to list
|
|
||||||
if(HotzoneManager.playersPresent.get(nation).size() >= 5 && !HotzoneManager.playersPresent.get(nation).contains(pc)){
|
|
||||||
//more than 5, boot player out
|
|
||||||
MovementManager.translocate(pc, Vector3fImmutable.getRandomPointOnCircle(ZoneManager.getZoneByUUID(656).getLoc(),30f),Regions.GetRegionForTeleport(ZoneManager.getZoneByUUID(656).getLoc()));
|
|
||||||
}
|
|
||||||
if(!HotzoneManager.playersPresent.get(nation).contains(pc)){
|
|
||||||
//less than 5, allow player in
|
|
||||||
HotzoneManager.playersPresent.get(nation).add(pc);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
ArrayList<PlayerCharacter> newList = new ArrayList<>();
|
|
||||||
newList.add(pc);
|
|
||||||
HotzoneManager.playersPresent.put(nation,newList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,10 +14,11 @@ import engine.net.DispatchMessage;
|
|||||||
import engine.net.client.msg.ErrorPopupMsg;
|
import engine.net.client.msg.ErrorPopupMsg;
|
||||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.server.MBServerStatics;
|
import engine.util.ZoneLevel;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,21 +35,6 @@ public enum LootManager {
|
|||||||
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
||||||
|
|
||||||
public static final ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510));
|
|
||||||
public static final ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(27570,188900,188910,188920,188930,188940,188950,189500));
|
|
||||||
public static final ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(27550,27560,189100,189110,189120,189130,189140,189150));
|
|
||||||
public static final ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(27600,188700,188720,189550,189560));
|
|
||||||
public static final ArrayList<Integer> racial_guard_uuids = new ArrayList<>(Arrays.asList(841,951,952,1050,1052,1180,1182,1250,1252,1350,1352,1450,1452,1500,1502,1525,1527,1550,1552,1575,1577,1600,1602,1650,1652,1700,980100,980102));
|
|
||||||
|
|
||||||
public static final ArrayList<Integer> static_rune_ids = new ArrayList<>(Arrays.asList(
|
|
||||||
250001, 250002, 250003, 250004, 250005, 250006, 250007, 250008, 250010, 250011,
|
|
||||||
250012, 250013, 250014, 250015, 250016, 250017, 250019, 250020, 250021, 250022,
|
|
||||||
250023, 250024, 250025, 250026, 250028, 250029, 250030, 250031, 250032, 250033,
|
|
||||||
250034, 250035, 250037, 250038, 250039, 250040, 250041, 250042, 250043, 250044,
|
|
||||||
250115, 250118, 250119, 250120, 250121, 250122, 252123, 252124, 252125, 252126,
|
|
||||||
252127
|
|
||||||
));
|
|
||||||
|
|
||||||
// Drop Rates
|
// Drop Rates
|
||||||
|
|
||||||
public static float NORMAL_DROP_RATE;
|
public static float NORMAL_DROP_RATE;
|
||||||
@@ -83,88 +69,56 @@ public enum LootManager {
|
|||||||
|
|
||||||
public static void GenerateMobLoot(Mob mob) {
|
public static void GenerateMobLoot(Mob mob) {
|
||||||
|
|
||||||
if(mob == null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mob.getSafeZone()) {
|
|
||||||
SpecialLootHandler.RollContract(mob);
|
|
||||||
SpecialLootHandler.RollGlass(mob);
|
|
||||||
SpecialLootHandler.RollRune(mob);
|
|
||||||
SpecialLootHandler.RollRacialGuard(mob);
|
|
||||||
}
|
|
||||||
|
|
||||||
//determine if mob is in hotzone
|
//determine if mob is in hotzone
|
||||||
boolean inHotzone = false;
|
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
||||||
|
|
||||||
//iterate the booty sets
|
//iterate the booty sets
|
||||||
|
|
||||||
if(mob.mobBase == null || mob.getMobBaseID() == 253003){
|
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
|
||||||
int i = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet))
|
|
||||||
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
||||||
|
|
||||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet)) {
|
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
|
||||||
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
||||||
}else if(mob.bootySet != 0 && ItemBase.getItemBase(mob.bootySet) != null){
|
|
||||||
MobLoot specialDrop = null;
|
|
||||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(mob.bootySet),true);
|
|
||||||
if(specialDrop != null) {
|
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
|
|
||||||
chatMsg.setMessageType(10);
|
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
mob.getCharItemManager().addItemToInventory(specialDrop);
|
|
||||||
mob.setResists(new Resists("Dropper"));
|
|
||||||
if(!Mob.discDroppers.contains(mob))
|
|
||||||
Mob.AddDiscDropper(mob);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
||||||
for (Item it : mob.getInventory()) {
|
for (Item it : mob.getInventory()) {
|
||||||
|
|
||||||
ItemBase ib = it.getItemBase();
|
ItemBase ib = it.getItemBase();
|
||||||
if (ib == null)
|
if(ib == null)
|
||||||
break;
|
break;
|
||||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
||||||
Zone camp = mob.getParentZone();
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||||
Zone macro = camp.getParent();
|
chatMsg.setMessageType(10);
|
||||||
String name = camp.getName() + "(" + macro.getName() + ")";
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + name + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
chatMsg.setMessageType(10);
|
}
|
||||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
|
||||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
||||||
|
|
||||||
boolean hotzoneWasRan = false;
|
boolean hotzoneWasRan = false;
|
||||||
float dropRate;
|
float dropRate = 1.0f;
|
||||||
|
|
||||||
|
if (mob.getSafeZone() == false)
|
||||||
|
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||||
|
|
||||||
|
if (inHotzone == true)
|
||||||
|
dropRate = LootManager.HOTZONE_DROP_RATE;
|
||||||
|
|
||||||
|
// Adjust for camp scaling
|
||||||
|
Zone camp = mob.getParentZone();
|
||||||
|
dropRate = dropRate * ZoneLevel.getLootDropModifier(camp);
|
||||||
|
|
||||||
// Iterate all entries in this bootySet and process accordingly
|
// Iterate all entries in this bootySet and process accordingly
|
||||||
Zone zone = ZoneManager.findSmallestZone(mob.loc);
|
|
||||||
for (BootySetEntry bse : entries) {
|
for (BootySetEntry bse : entries) {
|
||||||
switch (bse.bootyType) {
|
switch (bse.bootyType) {
|
||||||
case "GOLD":
|
case "GOLD":
|
||||||
if (zone != null && zone.getSafeZone() == (byte)1)
|
|
||||||
return; // no loot to drop in safezones
|
|
||||||
GenerateGoldDrop(mob, bse, inHotzone);
|
GenerateGoldDrop(mob, bse, inHotzone);
|
||||||
break;
|
break;
|
||||||
case "LOOT":
|
case "LOOT":
|
||||||
if (zone != null && zone.getSafeZone() == (byte)1)
|
|
||||||
return; // no loot to drop in safezones
|
|
||||||
|
|
||||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
|
||||||
|
|
||||||
if (inHotzone == true)
|
|
||||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
|
||||||
|
|
||||||
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
|
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
|
||||||
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
|
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
|
||||||
@@ -186,90 +140,6 @@ public enum LootManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SpecialCaseContractDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
|
||||||
|
|
||||||
int lootTableID = 0;
|
|
||||||
for(BootySetEntry entry : entries){
|
|
||||||
if(entry.bootyType.equals("LOOT")){
|
|
||||||
lootTableID = entry.genTable;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(lootTableID == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int ContractTableID = 0;
|
|
||||||
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
|
||||||
try {
|
|
||||||
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.CONTRACT)) {
|
|
||||||
ContractTableID = entry.itemTableID;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ContractTableID == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ContractTableID));
|
|
||||||
if(ib != null){
|
|
||||||
MobLoot toAdd = new MobLoot(mob,ib,false);
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SpecialCaseRuneDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(static_rune_ids.size() + 1);
|
|
||||||
int itemId = static_rune_ids.get(0);
|
|
||||||
try {
|
|
||||||
itemId = static_rune_ids.get(roll);
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
ItemBase ib = ItemBase.getItemBase(itemId);
|
|
||||||
if(ib != null){
|
|
||||||
MobLoot toAdd = new MobLoot(mob,ib,false);
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SpecialCaseResourceDrop(Mob mob,ArrayList<BootySetEntry> entries){
|
|
||||||
int lootTableID = 0;
|
|
||||||
for(BootySetEntry entry : entries){
|
|
||||||
if(entry.bootyType.equals("LOOT")){
|
|
||||||
lootTableID = entry.genTable;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(lootTableID == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int ResourceTableID = 0;
|
|
||||||
for(GenTableEntry entry : _genTables.get(lootTableID)){
|
|
||||||
try {
|
|
||||||
if (ItemBase.getItemBase(_itemTables.get(entry.itemTableID).get(0).cacheID).getType().equals(Enum.ItemType.RESOURCE)) {
|
|
||||||
ResourceTableID = entry.itemTableID;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ResourceTableID == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ItemBase ib = ItemBase.getItemBase(rollRandomItem(ResourceTableID));
|
|
||||||
if(ib != null){
|
|
||||||
MobLoot toAdd = new MobLoot(mob,ib,false);
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
|
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
|
||||||
|
|
||||||
if (mob == null || _genTables.containsKey(genTableID) == false)
|
if (mob == null || _genTables.containsKey(genTableID) == false)
|
||||||
@@ -291,10 +161,11 @@ public enum LootManager {
|
|||||||
|
|
||||||
//gets the 1-320 roll for this mob
|
//gets the 1-320 roll for this mob
|
||||||
int itemTableRoll = 0;
|
int itemTableRoll = 0;
|
||||||
|
int objectType = mob.getObjectType().ordinal();
|
||||||
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
||||||
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
itemTableRoll = TableRoll(mob.level);
|
itemTableRoll = TableRoll(mob.level, inHotzone);
|
||||||
}
|
}
|
||||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
||||||
if (tableRow == null)
|
if (tableRow == null)
|
||||||
@@ -305,24 +176,14 @@ public enum LootManager {
|
|||||||
if (itemUUID == 0)
|
if (itemUUID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.RESOURCE) || ItemBase.getItemBase(itemUUID).getName().equals("Mithril")) {
|
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||||
if(ThreadLocalRandom.current().nextInt(1,101) < 91)
|
|
||||||
return null; // cut down world drops rates of resources by 90%
|
|
||||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||||
}
|
}
|
||||||
if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.RUNE)){
|
|
||||||
int randomRune = rollRandomItem(itemTableId);
|
|
||||||
if(randomRune != 0) {
|
|
||||||
itemUUID = randomRune;
|
|
||||||
}
|
|
||||||
} else if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.CONTRACT)){
|
|
||||||
int randomContract = rollRandomItem(itemTableId);
|
|
||||||
if(randomContract != 0) {
|
|
||||||
itemUUID = randomContract;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||||
|
Enum.ItemType outType = outItem.getItemBase().getType();
|
||||||
|
|
||||||
|
|
||||||
if(selectedRow.pModTable != 0){
|
if(selectedRow.pModTable != 0){
|
||||||
try {
|
try {
|
||||||
@@ -341,11 +202,8 @@ public enum LootManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(outItem.getItemBase().getType().equals(Enum.ItemType.CONTRACT) || outItem.getItemBase().getType().equals(Enum.ItemType.RUNE)){
|
// We don't want to bother with identifying gear
|
||||||
if(ThreadLocalRandom.current().nextInt(1,101) < 66)
|
outItem.setIsID(true);
|
||||||
return null; // cut down world drops rates of resources by 65%
|
|
||||||
}
|
|
||||||
|
|
||||||
return outItem;
|
return outItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +224,7 @@ public enum LootManager {
|
|||||||
if(mob.getObjectType().ordinal() == 52) {
|
if(mob.getObjectType().ordinal() == 52) {
|
||||||
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
prefixTableRoll = TableRoll(mob.level);
|
prefixTableRoll = TableRoll(mob.level, inHotzone);
|
||||||
}
|
}
|
||||||
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
||||||
|
|
||||||
@@ -374,23 +232,8 @@ public enum LootManager {
|
|||||||
return inItem;
|
return inItem;
|
||||||
|
|
||||||
if (prefixMod.action.length() > 0) {
|
if (prefixMod.action.length() > 0) {
|
||||||
String action = prefixMod.action;
|
inItem.setPrefix(prefixMod.action);
|
||||||
if(action.equals("PRE-108") || action.equals("PRE-058") || action.equals("PRE-031")){//massive, barons and avatars to be replaced by leg or warlords
|
inItem.addPermanentEnchantment(prefixMod.action, 0, prefixMod.level, true);
|
||||||
int roll = ThreadLocalRandom.current().nextInt(1,100);
|
|
||||||
if(inItem.getItemBase().getRange() > 15){
|
|
||||||
action = "PRE-040";
|
|
||||||
}else {
|
|
||||||
if (roll > 50) {
|
|
||||||
//set warlords
|
|
||||||
action = "PRE-021";
|
|
||||||
} else {
|
|
||||||
//set legendary
|
|
||||||
action = "PRE-040";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inItem.setPrefix(action);
|
|
||||||
inItem.addPermanentEnchantment(action, 0, prefixMod.level, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return inItem;
|
return inItem;
|
||||||
@@ -413,34 +256,14 @@ public enum LootManager {
|
|||||||
if(mob.getObjectType().ordinal() == 52) {
|
if(mob.getObjectType().ordinal() == 52) {
|
||||||
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||||
} else{
|
} else{
|
||||||
suffixTableRoll = TableRoll(mob.level);
|
suffixTableRoll = TableRoll(mob.level, inHotzone);
|
||||||
}
|
}
|
||||||
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
||||||
|
|
||||||
if (suffixMod == null)
|
if (suffixMod == null)
|
||||||
return inItem;
|
return inItem;
|
||||||
|
|
||||||
int moveSpeedRoll = ThreadLocalRandom.current().nextInt(100);
|
if (suffixMod.action.length() > 0) {
|
||||||
if(inItem.getItemBase().getValidSlot() == MBServerStatics.SLOT_FEET && moveSpeedRoll < 10){
|
|
||||||
int rankRoll = ThreadLocalRandom.current().nextInt(10);
|
|
||||||
String suffixSpeed = "SUF-148";
|
|
||||||
switch(rankRoll) {
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
suffixSpeed = "SUF-149";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
case 7:
|
|
||||||
suffixSpeed = "SUF-150";
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
inItem.setSuffix(suffixSpeed);
|
|
||||||
inItem.addPermanentEnchantment(suffixSpeed, 0, suffixMod.level, false);
|
|
||||||
}else if (suffixMod.action.length() > 0) {
|
|
||||||
inItem.setSuffix(suffixMod.action);
|
inItem.setSuffix(suffixMod.action);
|
||||||
inItem.addPermanentEnchantment(suffixMod.action, 0, suffixMod.level, false);
|
inItem.addPermanentEnchantment(suffixMod.action, 0, suffixMod.level, false);
|
||||||
}
|
}
|
||||||
@@ -448,36 +271,23 @@ public enum LootManager {
|
|||||||
return inItem;
|
return inItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int TableRoll(int mobLevel) {
|
public static int TableRoll(int mobLevel, Boolean inHotzone) {
|
||||||
|
|
||||||
int rank = (int)(mobLevel * 0.1f);
|
if (mobLevel > 65)
|
||||||
int min = 50;
|
mobLevel = 65;
|
||||||
int max = 100;
|
|
||||||
switch(rank){
|
int max = (int) (4.882 * mobLevel + 127.0);
|
||||||
case 1:
|
|
||||||
min = 200;
|
if (max > 319)
|
||||||
max = 250;
|
max = 319;
|
||||||
break;
|
|
||||||
case 2:
|
int min = (int) (4.469 * mobLevel - 3.469);
|
||||||
min = 210;
|
|
||||||
max = 275;
|
if (min < 70)
|
||||||
break;
|
min = 70;
|
||||||
case 3:
|
|
||||||
min = 220;
|
if (inHotzone)
|
||||||
max = 300;
|
min += mobLevel;
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
min = 230;
|
|
||||||
max = 320;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
case 6:
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
min = 240;
|
|
||||||
max = 320;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||||
|
|
||||||
@@ -497,7 +307,15 @@ public enum LootManager {
|
|||||||
|
|
||||||
int high = bse.highGold;
|
int high = bse.highGold;
|
||||||
int low = bse.lowGold;
|
int low = bse.lowGold;
|
||||||
int gold = (int) (ThreadLocalRandom.current().nextInt(low, high + 1) * NORMAL_GOLD_RATE);
|
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
|
||||||
|
|
||||||
|
if (inHotzone == true)
|
||||||
|
gold = (int) (gold * HOTZONE_GOLD_RATE);
|
||||||
|
else
|
||||||
|
gold = (int) (gold * NORMAL_GOLD_RATE);
|
||||||
|
|
||||||
|
Zone camp = mob.getParentZone();
|
||||||
|
gold = (int) (gold * ZoneLevel.getGoldDropModifier(camp));
|
||||||
|
|
||||||
if (gold > 0) {
|
if (gold > 0) {
|
||||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||||
@@ -508,67 +326,45 @@ public enum LootManager {
|
|||||||
|
|
||||||
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
||||||
|
|
||||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
try {
|
||||||
if(toAdd != null){
|
|
||||||
ItemBase ib = toAdd.getItemBase();
|
|
||||||
switch(ib.getType()){
|
|
||||||
case CONTRACT:
|
|
||||||
case RUNE:
|
|
||||||
case RESOURCE:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ib.getUUID() == 1580021)//mithril
|
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||||
return;
|
|
||||||
|
|
||||||
toAdd.setIsID(true);
|
if (toAdd != null)
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||||
|
int i = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void GenerateEquipmentDrop(Mob mob) {
|
public static void GenerateEquipmentDrop(Mob mob) {
|
||||||
|
|
||||||
if (mob == null || mob.getSafeZone())
|
|
||||||
return; // no equipment to drop in safezones
|
|
||||||
|
|
||||||
if(mob.StrongholdGuardian || mob.StrongholdCommander || mob.StrongholdEpic)
|
|
||||||
return; // stronghold mobs don't drop equipment
|
|
||||||
|
|
||||||
//do equipment here
|
//do equipment here
|
||||||
if (mob.getEquip() != null) {
|
int dropCount = 0;
|
||||||
boolean isVorg = false;
|
if (mob.getEquip() != null)
|
||||||
for (MobEquipment me : mob.getEquip().values()) {
|
for (MobEquipment me : mob.getEquip().values()) {
|
||||||
|
|
||||||
if (me.getDropChance() == 0)
|
if (me.getDropChance() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String name = me.getItemBase().getName().toLowerCase();
|
|
||||||
if (name.contains("vorgrim legionnaire's") || name.contains("vorgrim auxiliary's") ||name.contains("bellugh nuathal") || name.contains("crimson circle"))
|
|
||||||
isVorg = true;
|
|
||||||
|
|
||||||
if(isVorg && !mob.isDropper){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||||
float dropChance = me.getDropChance() * 100;
|
float dropChance = me.getDropChance() * 100;
|
||||||
ItemBase itemBase = me.getItemBase();
|
|
||||||
if(isVorg) {
|
|
||||||
mob.spawnTime = ThreadLocalRandom.current().nextInt(300, 2700);
|
|
||||||
dropChance = 7.5f;
|
|
||||||
itemBase = getRandomVorg(itemBase);
|
|
||||||
}
|
|
||||||
if (equipmentRoll > dropChance)
|
if (equipmentRoll > dropChance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MobLoot ml = new MobLoot(mob, itemBase, false);
|
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||||
|
|
||||||
ml.setIsID(true);
|
if (ml != null && dropCount < 1) {
|
||||||
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
ml.setIsID(true);
|
||||||
mob.getCharItemManager().addItemToInventory(ml);
|
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||||
|
mob.getCharItemManager().addItemToInventory(ml);
|
||||||
|
dropCount = 1;
|
||||||
|
//break; // Exit on first successful roll.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
||||||
@@ -580,134 +376,12 @@ public enum LootManager {
|
|||||||
if (chanceRoll > bse.dropChance)
|
if (chanceRoll > bse.dropChance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(bse.itemBase == 1580021)//mithril
|
|
||||||
return;
|
|
||||||
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
||||||
|
|
||||||
if (lootItem != null) {
|
if (lootItem != null)
|
||||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||||
if(lootItem.getItemBase().isDiscRune() && !Mob.discDroppers.contains(mob))
|
|
||||||
Mob.AddDiscDropper(mob);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void newFatePeddler(PlayerCharacter playerCharacter, Item gift) {
|
|
||||||
|
|
||||||
CharacterItemManager itemMan = playerCharacter.getCharItemManager();
|
|
||||||
|
|
||||||
if (itemMan == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//check if player owns the gift he is trying to open
|
|
||||||
|
|
||||||
if (!itemMan.doesCharOwnThisItem(gift.getObjectUUID()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ItemBase ib = gift.getItemBase();
|
|
||||||
|
|
||||||
MobLoot winnings = null;
|
|
||||||
|
|
||||||
if (ib == null)
|
|
||||||
return;
|
|
||||||
switch (ib.getUUID()) {
|
|
||||||
case 971070: //wrapped rune
|
|
||||||
Random random = new Random();
|
|
||||||
int roll = random.nextInt(100);
|
|
||||||
int itemId;
|
|
||||||
ItemBase runeBase;
|
|
||||||
if (roll >= 90) {
|
|
||||||
//35 or 40
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(HellgateManager.static_rune_ids_high.size() + 1);
|
|
||||||
itemId = HellgateManager.static_rune_ids_high.get(0);
|
|
||||||
try {
|
|
||||||
itemId = HellgateManager.static_rune_ids_high.get(roll);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(playerCharacter, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
playerCharacter.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
} else if (roll >= 65 && roll <= 89) {
|
|
||||||
//30,35 or 40
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(HellgateManager.static_rune_ids_mid.size() + 1);
|
|
||||||
itemId = HellgateManager.static_rune_ids_mid.get(0);
|
|
||||||
try {
|
|
||||||
itemId = HellgateManager.static_rune_ids_mid.get(roll);
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(playerCharacter, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
playerCharacter.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//5-30
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(HellgateManager.static_rune_ids_low.size() + 1);
|
|
||||||
itemId = HellgateManager.static_rune_ids_low.get(0);
|
|
||||||
try {
|
|
||||||
itemId = HellgateManager.static_rune_ids_low.get(roll);
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
|
|
||||||
}
|
|
||||||
runeBase = ItemBase.getItemBase(itemId);
|
|
||||||
if (runeBase != null) {
|
|
||||||
MobLoot rune = new MobLoot(playerCharacter, runeBase, true);
|
|
||||||
|
|
||||||
if (rune != null)
|
|
||||||
playerCharacter.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 971012: //wrapped glass
|
|
||||||
int chance = ThreadLocalRandom.current().nextInt(100);
|
|
||||||
if(chance == 50){
|
|
||||||
int ID = 7000000;
|
|
||||||
int additional = ThreadLocalRandom.current().nextInt(0,28);
|
|
||||||
ID += (additional * 10);
|
|
||||||
ItemBase glassBase = ItemBase.getItemBase(ID);
|
|
||||||
if(glassBase != null) {
|
|
||||||
winnings = new MobLoot(playerCharacter, glassBase, 1, false);
|
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "You've Won A " + glassBase.getName());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "Please Try Again!");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (winnings == null) {
|
|
||||||
itemMan.consume(gift);
|
|
||||||
itemMan.updateInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//early exit if the inventory of the player will not hold the item
|
|
||||||
|
|
||||||
if (!itemMan.hasRoomInventory(winnings.getItemBase().getWeight())) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
winnings.setIsID(true);
|
|
||||||
|
|
||||||
//remove gift from inventory
|
|
||||||
|
|
||||||
itemMan.consume(gift);
|
|
||||||
|
|
||||||
//add winnings to player inventory
|
|
||||||
|
|
||||||
Item playerWinnings = winnings.promoteToItem(playerCharacter);
|
|
||||||
itemMan.addItemToInventory(playerWinnings);
|
|
||||||
itemMan.updateInventory();
|
|
||||||
|
|
||||||
}
|
|
||||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||||
|
|
||||||
//get table ID for the itembase ID
|
//get table ID for the itembase ID
|
||||||
@@ -729,12 +403,12 @@ public enum LootManager {
|
|||||||
|
|
||||||
//check if player owns the gift he is trying to open
|
//check if player owns the gift he is trying to open
|
||||||
|
|
||||||
if (!itemMan.doesCharOwnThisItem(gift.getObjectUUID()))
|
if (itemMan.doesCharOwnThisItem(gift.getObjectUUID()) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//roll 1-100 for the gen table selection
|
//roll 1-100 for the gen table selection
|
||||||
|
|
||||||
int genRoll = ThreadLocalRandom.current().nextInt(94, 100) + 1;
|
int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||||
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
|
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
|
||||||
|
|
||||||
if(selectedRow == null)
|
if(selectedRow == null)
|
||||||
@@ -750,276 +424,45 @@ public enum LootManager {
|
|||||||
|
|
||||||
//create the item from the table, quantity is always 1
|
//create the item from the table, quantity is always 1
|
||||||
|
|
||||||
ItemBase ib = ItemBase.getItemBase(selectedItem.cacheID);
|
MobLoot winnings = new MobLoot(playerCharacter, ItemBase.getItemBase(selectedItem.cacheID), 1, false);
|
||||||
if(ib.getUUID() == Warehouse.coalIB.getUUID()){
|
|
||||||
//no more coal, give gold instead
|
|
||||||
if (itemMan.getGoldInventory().getNumOfItems() + 250000 > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
|
||||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
itemMan.addGoldToInventory(250000,false);
|
|
||||||
itemMan.updateInventory();
|
|
||||||
}else {
|
|
||||||
MobLoot winnings = new MobLoot(playerCharacter, ib, 1, false);
|
|
||||||
|
|
||||||
if (winnings == null)
|
if (winnings == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//early exit if the inventory of the player will not hold the item
|
//early exit if the inventory of the player will not old the item
|
||||||
|
|
||||||
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
|
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
|
||||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
//determine if the winning item needs a prefix
|
|
||||||
|
|
||||||
if (selectedRow.pModTable != 0) {
|
|
||||||
int prefixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
|
|
||||||
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
|
|
||||||
if (prefix != null)
|
|
||||||
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//determine if the winning item needs a suffix
|
|
||||||
|
|
||||||
if (selectedRow.sModTable != 0) {
|
|
||||||
int suffixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
|
|
||||||
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
|
|
||||||
if (suffix != null)
|
|
||||||
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
|
|
||||||
}
|
|
||||||
winnings.setIsID(true);
|
|
||||||
|
|
||||||
//remove gift from inventory
|
|
||||||
|
|
||||||
itemMan.consume(gift);
|
|
||||||
|
|
||||||
//add winnings to player inventory
|
|
||||||
|
|
||||||
Item playerWinnings = winnings.promoteToItem(playerCharacter);
|
|
||||||
itemMan.addItemToInventory(playerWinnings);
|
|
||||||
itemMan.updateInventory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int rollRandomItem(int itemTable){
|
|
||||||
int returnedID = ItemTableEntry.getRandomItem(itemTable);
|
|
||||||
return returnedID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemBase getRandomVorg(ItemBase itemBase){
|
|
||||||
int roll = 0;
|
|
||||||
if(vorg_ha_uuids.contains(itemBase.getUUID())) {
|
|
||||||
roll = ThreadLocalRandom.current().nextInt(0, 9);
|
|
||||||
switch (roll) {
|
|
||||||
case 1:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(0));
|
|
||||||
case 2:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(1));
|
|
||||||
case 3:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(2));
|
|
||||||
case 4:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(3));
|
|
||||||
case 5:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(4));
|
|
||||||
case 6:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(5));
|
|
||||||
case 7:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(6));
|
|
||||||
case 8:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(7));
|
|
||||||
default:
|
|
||||||
return ItemBase.getItemBase(vorg_ha_uuids.get(8));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vorg_ma_uuids.contains(itemBase.getUUID())) {
|
//determine if the winning item needs a prefix
|
||||||
roll = ThreadLocalRandom.current().nextInt(0, 8);
|
|
||||||
switch (roll) {
|
if(selectedRow.pModTable != 0){
|
||||||
case 1:
|
int prefixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1);
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(0));
|
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
|
||||||
case 2:
|
if(prefix != null)
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(1));
|
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
|
||||||
case 3:
|
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(2));
|
|
||||||
case 4:
|
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(3));
|
|
||||||
case 5:
|
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(4));
|
|
||||||
case 6:
|
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(5));
|
|
||||||
case 7:
|
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(6));
|
|
||||||
default:
|
|
||||||
return ItemBase.getItemBase(vorg_ma_uuids.get(7));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vorg_la_uuids.contains(itemBase.getUUID())) {
|
//determine if the winning item needs a suffix
|
||||||
roll = ThreadLocalRandom.current().nextInt(0, 8);
|
|
||||||
switch (roll) {
|
if(selectedRow.sModTable != 0){
|
||||||
case 1:
|
int suffixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1);
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(0));
|
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
|
||||||
case 2:
|
if (suffix != null)
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(1));
|
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
|
||||||
case 3:
|
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(2));
|
|
||||||
case 4:
|
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(3));
|
|
||||||
case 5:
|
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(4));
|
|
||||||
case 6:
|
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(5));
|
|
||||||
case 7:
|
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(6));
|
|
||||||
default:
|
|
||||||
return ItemBase.getItemBase(vorg_la_uuids.get(7));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
winnings.setIsID(true);
|
||||||
|
|
||||||
if(vorg_cloth_uuids.contains(itemBase.getUUID())) {
|
//remove gift from inventory
|
||||||
roll = ThreadLocalRandom.current().nextInt(0, 5);
|
|
||||||
switch (roll) {
|
|
||||||
case 1:
|
|
||||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(0));
|
|
||||||
case 2:
|
|
||||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(1));
|
|
||||||
case 3:
|
|
||||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(2));
|
|
||||||
case 4:
|
|
||||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(3));
|
|
||||||
default:
|
|
||||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(4));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
itemMan.consume(gift);
|
||||||
}
|
|
||||||
|
|
||||||
public static void DropPresent(Mob mob){
|
//add winnings to player inventory
|
||||||
int random = 971049 + ThreadLocalRandom.current().nextInt(24);
|
|
||||||
if (random > 971071)
|
|
||||||
random = 971071;
|
|
||||||
|
|
||||||
ItemBase present = ItemBase.getItemBase(random);
|
Item playerWinnings = winnings.promoteToItem(playerCharacter);
|
||||||
if (present != null) {
|
itemMan.addItemToInventory(playerWinnings);
|
||||||
MobLoot toAdd = new MobLoot(mob, present, true);
|
itemMan.updateInventory();
|
||||||
|
|
||||||
if (toAdd != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GenerateStrongholdLoot(Mob mob, boolean commander, boolean epic) {
|
|
||||||
|
|
||||||
mob.getCharItemManager().clearInventory();
|
|
||||||
|
|
||||||
int multiplier = 1;
|
|
||||||
if (commander)
|
|
||||||
multiplier = 2;
|
|
||||||
if(epic)
|
|
||||||
multiplier = 10;
|
|
||||||
|
|
||||||
int high = 125000;
|
|
||||||
int low = 50000;
|
|
||||||
int gold = ThreadLocalRandom.current().nextInt(low, high + 1) * multiplier;
|
|
||||||
|
|
||||||
if (gold > 0) {
|
|
||||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
|
||||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
//present drop chance for all
|
|
||||||
//if (ThreadLocalRandom.current().nextInt(100) < 35)
|
|
||||||
// DropPresent(mob);
|
|
||||||
|
|
||||||
//random contract drop chance for all
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) < 40) {
|
|
||||||
int contractTableID = 250;
|
|
||||||
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
|
|
||||||
if (contractTableID > 259)
|
|
||||||
contractTableID = 659;
|
|
||||||
|
|
||||||
int id = rollRandomItem(contractTableID);
|
|
||||||
ItemBase ib = ItemBase.getItemBase(id);
|
|
||||||
if (ib != null) {
|
|
||||||
MobLoot contract = new MobLoot(mob, ib, true);
|
|
||||||
|
|
||||||
if (contract != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(contract);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//special commander drop chances
|
|
||||||
if (commander)
|
|
||||||
GenerateCommanderLoot(mob,false);
|
|
||||||
|
|
||||||
//special epic drop chances
|
|
||||||
if (epic) {
|
|
||||||
GenerateCommanderLoot(mob, true);
|
|
||||||
GenerateCommanderLoot(mob,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GenerateCommanderLoot(Mob mob, boolean epic){
|
|
||||||
//present chance
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) < 25)
|
|
||||||
DropPresent(mob);
|
|
||||||
|
|
||||||
//present chance
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) < 25)
|
|
||||||
DropPresent(mob);
|
|
||||||
|
|
||||||
//chance for glass
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
|
||||||
int glassID = rollRandomItem(126);
|
|
||||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
|
||||||
if (glassItem != null) {
|
|
||||||
MobLoot toAdd2 = new MobLoot(mob, glassItem, true);
|
|
||||||
|
|
||||||
if (toAdd2 != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//chance for disc
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
|
||||||
int discID = rollRandomItem(3202);
|
|
||||||
ItemBase discItem = ItemBase.getItemBase(discID);
|
|
||||||
if (discItem != null) {
|
|
||||||
MobLoot toAdd3 = new MobLoot(mob, discItem, true);
|
|
||||||
|
|
||||||
if (toAdd3 != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//chance for stat rune
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) < 75) {
|
|
||||||
int runeID = rollRandomItem(3201);
|
|
||||||
ItemBase runeItem = ItemBase.getItemBase(runeID);
|
|
||||||
if (runeItem != null) {
|
|
||||||
MobLoot toAdd4 = new MobLoot(mob, runeItem, true);
|
|
||||||
|
|
||||||
if (toAdd4 != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(epic){
|
|
||||||
int contractTableID = 250;
|
|
||||||
contractTableID += ThreadLocalRandom.current().nextInt(0, 11);
|
|
||||||
if (contractTableID > 259)
|
|
||||||
contractTableID = 659;
|
|
||||||
|
|
||||||
int id = rollRandomItem(contractTableID);
|
|
||||||
ItemBase ib = ItemBase.getItemBase(id);
|
|
||||||
if (ib != null) {
|
|
||||||
MobLoot contract = new MobLoot(mob, ib, true);
|
|
||||||
|
|
||||||
if (contract != null)
|
|
||||||
mob.getCharItemManager().addItemToInventory(contract);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,130 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.Guild;
|
|
||||||
import engine.objects.Mine;
|
|
||||||
import engine.objects.PlayerCharacter;
|
|
||||||
import engine.objects.Regions;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class LoreMineManager {
|
|
||||||
|
|
||||||
//Saetor Allowed Charters:
|
|
||||||
//BARBARIAN
|
|
||||||
//MILITARY
|
|
||||||
//RANGER
|
|
||||||
//AMAZON
|
|
||||||
//WIZARD
|
|
||||||
//MERCENARY
|
|
||||||
//THIEVES
|
|
||||||
//SCOURGE
|
|
||||||
//UNHOLY
|
|
||||||
public static final Map<Enum.GuildType, List<String>> GUILD_RACES = new HashMap<>();
|
|
||||||
public static final Map<Enum.GuildType, List<String>> GUILD_CLASSES = new HashMap<>();
|
|
||||||
public static final Map<Enum.GuildType, Boolean> GUILD_GENDER_RESTRICTION = new HashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
GUILD_RACES.put(Enum.GuildType.CATHEDRAL, Arrays.asList("Aelfborn", "Centaur", "Elf", "Half Giant", "Human"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.CATHEDRAL, Arrays.asList("Bard", "Channeler", "Crusader", "Nightstalker", "Prelate", "Priest", "Scout", "Sentinel"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.MILITARY, Arrays.asList("Centaur", "Half Giant", "Human", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.MILITARY, Arrays.asList("Bard", "Priest", "Scout", "Warlock", "Warrior", "Wizard"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.TEMPLE, Arrays.asList("Half Giant", "Human"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.TEMPLE, Arrays.asList("Assassin", "Bard", "Channeler", "Confessor", "Nightstalker", "Priest", "Scout", "Templar"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.BARBARIAN, Arrays.asList("Aelfborn", "Half Giant", "Human", "Minotaur", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.BARBARIAN, Arrays.asList("Barbarian", "Bard", "Doomsayer", "Fury", "Priest", "Scout", "Thief", "Warrior"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.RANGER, Arrays.asList("Aelfborn", "Elf", "Half Giant", "Human", "Shade", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.RANGER, Arrays.asList("Bard", "Channeler", "Druid", "Priest", "Ranger", "Scout", "Warrior"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.AMAZON, Arrays.asList("Aelfborn", "Elf", "Half Giant", "Human", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.AMAZON, Arrays.asList("Bard", "Druid", "Fury", "Huntress", "Priest", "Scout", "Warrior", "Wizard"));
|
|
||||||
GUILD_GENDER_RESTRICTION.put(Enum.GuildType.AMAZON, true); // Female only
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.NOBLE, Arrays.asList("Aelfborn", "Half Giant", "Human"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.NOBLE, Arrays.asList("Assassin", "Bard", "Channeler", "Priest", "Scout", "Thief", "Warlock", "Warrior", "Wizard"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.WIZARD, Arrays.asList("Aelfborn", "Elf", "Human", "Nephilim", "Shade", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.WIZARD, Arrays.asList("Assassin", "Bard", "Channeler", "Doomsayer", "Fury", "Necromancer", "Priest", "Warlock", "Wizard"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.MERCENARY, Arrays.asList("Aelfborn", "Aracoix", "Half Giant", "Human", "Shade", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.MERCENARY, Arrays.asList("Assassin", "Bard", "Priest", "Scout", "Thief", "Warlock", "Warrior"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.THIEVES, Arrays.asList("Aelfborn", "Aracoix", "Elf", "Human", "Irekei", "Nephilim", "Shade", "Vampire", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.THIEVES, Arrays.asList("Assassin", "Barbarian", "Bard", "Priest", "Scout", "Thief", "Wizard"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.DWARF, Arrays.asList("Dwarf"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.DWARF, Arrays.asList("Crusader", "Prelate", "Priest", "Sentinel", "Warrior"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.HIGHCOURT, Arrays.asList("Elf", "Minotaur"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.HIGHCOURT, Arrays.asList("Assassin", "Bard", "Channeler", "Druid", "Necromancer", "Priest", "Ranger", "Scout", "Thief", "Warrior", "Wizard"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.VIRAKT, Arrays.asList("Irekei"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.VIRAKT, Arrays.asList("Assassin", "Bard", "Channeler", "Fury", "Huntress", "Nightstalker", "Priest", "Ranger", "Scout", "Thief", "Warrior", "Wizard"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.SCOURGE, Arrays.asList("Aelfborn", "Human", "Minotaur", "Nephilim", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.SCOURGE, Arrays.asList("Bard", "Channeler", "Doomsayer", "Priest", "Scout", "Warrior", "Wizard"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.KHREE, Arrays.asList("Aracoix"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.KHREE, Arrays.asList("Assassin", "Barbarian", "Bard", "Huntress", "Priest", "Ranger", "Scout", "Thief", "Warlock", "Warrior"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.CENTAUR, Arrays.asList("Centaur"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.CENTAUR, Arrays.asList("Barbarian", "Crusader", "Druid", "Huntress", "Prelate", "Priest", "Ranger", "Sentinel", "Warrior"));
|
|
||||||
|
|
||||||
GUILD_RACES.put(Enum.GuildType.UNHOLY, Arrays.asList("Human", "Shade", "Vampire", "Saetor"));
|
|
||||||
GUILD_CLASSES.put(Enum.GuildType.UNHOLY, Arrays.asList("Assassin", "Channeler", "Necromancer", "Priest", "Scout", "Thief", "Warlock", "Warrior", "Wizard"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AuditPlayer(PlayerCharacter pc, Mine mine){
|
|
||||||
Guild nation = pc.guild.getNation();
|
|
||||||
|
|
||||||
if(mine.chosen_charters == null){
|
|
||||||
mine.chosen_charters = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Enum.GuildType guildType;
|
|
||||||
if (mine.chosen_charters.containsKey(nation)) {
|
|
||||||
guildType = mine.chosen_charters.get(nation);
|
|
||||||
}else{
|
|
||||||
guildType = Enum.GuildType.getGuildTypeFromInt(pc.guild.getCharter());
|
|
||||||
mine.chosen_charters.put(nation,guildType);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!validForCharter(pc,guildType)){
|
|
||||||
//bounce out to SDR
|
|
||||||
Vector3fImmutable bounceLoc = Vector3fImmutable.getRandomPointOnCircle(ZoneManager.getZoneByUUID(656).getLoc(),30f);
|
|
||||||
pc.setLoc(bounceLoc);
|
|
||||||
MovementManager.translocate(pc, bounceLoc, Regions.GetRegionForTeleport(ZoneManager.getZoneByUUID(656).getLoc()));
|
|
||||||
ChatManager.chatSystemInfo(pc, "You Failed To Meet Lore Requirements");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean validForCharter(PlayerCharacter pc, Enum.GuildType guildType) {
|
|
||||||
if(pc.getPromotionClass() == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Define the races and classes for each GuildType
|
|
||||||
|
|
||||||
|
|
||||||
// Get the allowed races and classes for this guildType
|
|
||||||
List<String> allowedRaces = GUILD_RACES.getOrDefault(guildType, Collections.emptyList());
|
|
||||||
List<String> allowedClasses = GUILD_CLASSES.getOrDefault(guildType, Collections.emptyList());
|
|
||||||
|
|
||||||
// Validate player's race and class
|
|
||||||
if (!allowedRaces.contains(pc.getRace().getName()) || !allowedClasses.contains(pc.getPromotionClass().getName())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gender restriction check for AMAZON
|
|
||||||
if (guildType.equals(Enum.GuildType.AMAZON) && pc.isMale() && pc.getRaceID() != 1999) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -24,7 +24,7 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
||||||
|
|
||||||
building.maintDateTime = maintDate.withHour(1).withMinute(0).withSecond(0);
|
building.maintDateTime = maintDate;
|
||||||
DbManager.BuildingQueries.updateMaintDate(building);
|
DbManager.BuildingQueries.updateMaintDate(building);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -49,15 +49,19 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
if (chargeUpkeep(building) == false)
|
if (chargeUpkeep(building) == false)
|
||||||
derankList.add(building);
|
derankList.add(building);
|
||||||
else
|
|
||||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
|
||||||
}
|
}
|
||||||
|
// Reset maintenance dates for these buildings
|
||||||
|
|
||||||
|
for (Building building : maintList) {
|
||||||
|
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||||
|
|
||||||
for (Building building : derankList) {
|
|
||||||
building.destroyOrDerank(null);
|
|
||||||
if(building.getRank() > 0)
|
|
||||||
setMaintDateTime(building, LocalDateTime.now().plusDays(1));
|
|
||||||
}
|
}
|
||||||
|
// Derak or destroy buildings that did not
|
||||||
|
// have funds available.
|
||||||
|
|
||||||
|
for (Building building : derankList)
|
||||||
|
building.destroyOrDerank(null);
|
||||||
|
|
||||||
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,10 +98,6 @@ public enum MaintenanceManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//only ToL pays maintenance
|
|
||||||
if(building.getBlueprint().getBuildingGroup() != null && !building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// No maintenance on banestones omfg
|
// No maintenance on banestones omfg
|
||||||
|
|
||||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
|
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
|
||||||
@@ -122,9 +122,9 @@ public enum MaintenanceManager {
|
|||||||
|
|
||||||
|
|
||||||
//no maintenance if day of week doesnt match
|
//no maintenance if day of week doesnt match
|
||||||
//if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
|
if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
|
||||||
// continue;
|
continue;
|
||||||
//}
|
}
|
||||||
// Add building to maintenance queue
|
// Add building to maintenance queue
|
||||||
|
|
||||||
maintList.add(building);
|
maintList.add(building);
|
||||||
@@ -186,8 +186,49 @@ public enum MaintenanceManager {
|
|||||||
// If this is an R8 tree, validate that we can
|
// If this is an R8 tree, validate that we can
|
||||||
// cover the resources required
|
// cover the resources required
|
||||||
|
|
||||||
|
if (building.getRank() == 8) {
|
||||||
|
|
||||||
|
hasResources = true;
|
||||||
|
|
||||||
|
if (warehouse == null)
|
||||||
|
hasResources = false;
|
||||||
|
else {
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||||
|
|
||||||
|
if (resourceValue < 1500)
|
||||||
|
hasResources = false;
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||||
|
|
||||||
|
if (resourceValue < 1500)
|
||||||
|
hasResources = false;
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||||
|
|
||||||
|
if (resourceValue < 5)
|
||||||
|
hasResources = false;
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||||
|
|
||||||
|
if (resourceValue < 5)
|
||||||
|
hasResources = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Validation completed but has failed. We can derank
|
||||||
|
// the target building and early exit
|
||||||
|
|
||||||
|
if ((hasFunds == false) ||
|
||||||
|
((building.getRank() == 8) && !hasResources)) {
|
||||||
|
|
||||||
|
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
||||||
|
// and it's not an R8 deranking
|
||||||
|
|
||||||
|
if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
||||||
|
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
||||||
|
}
|
||||||
|
|
||||||
if (hasFunds == false) {
|
|
||||||
return false; // Early exit for having failed to meet maintenance
|
return false; // Early exit for having failed to meet maintenance
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,6 +253,58 @@ public enum MaintenanceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Early exit as we're done if we're not an R8 tree
|
||||||
|
|
||||||
|
if (building.getRank() < 8)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Now for the resources if it's an R8 tree
|
||||||
|
|
||||||
|
// Withdraw Stone
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||||
|
|
||||||
|
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
||||||
|
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500);
|
||||||
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
||||||
|
} else {
|
||||||
|
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Withdraw Lumber
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||||
|
|
||||||
|
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
||||||
|
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500);
|
||||||
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
||||||
|
} else {
|
||||||
|
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Withdraw Galvor
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||||
|
|
||||||
|
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
||||||
|
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5);
|
||||||
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
||||||
|
} else {
|
||||||
|
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||||
|
|
||||||
|
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
||||||
|
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5);
|
||||||
|
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
||||||
|
} else {
|
||||||
|
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ public enum MovementManager {
|
|||||||
if (!toMove.isAlive())
|
if (!toMove.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||||
|
if (((PlayerCharacter) toMove).isCasting())
|
||||||
|
((PlayerCharacter) toMove).update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
toMove.setIsCasting(false);
|
toMove.setIsCasting(false);
|
||||||
toMove.setItemCasting(false);
|
toMove.setItemCasting(false);
|
||||||
|
|
||||||
@@ -90,7 +96,7 @@ public enum MovementManager {
|
|||||||
if (!toMove.isMoving())
|
if (!toMove.isMoving())
|
||||||
toMove.resetLastSetLocUpdate();
|
toMove.resetLastSetLocUpdate();
|
||||||
else
|
else
|
||||||
toMove.update(false);
|
toMove.update();
|
||||||
|
|
||||||
// Update movement for the player
|
// Update movement for the player
|
||||||
|
|
||||||
@@ -99,9 +105,6 @@ public enum MovementManager {
|
|||||||
// ((Mob)toMove).updateLocation();
|
// ((Mob)toMove).updateLocation();
|
||||||
// get start and end locations for the move
|
// get start and end locations for the move
|
||||||
Vector3fImmutable startLocation = new Vector3fImmutable(msg.getStartLat(), msg.getStartAlt(), msg.getStartLon());
|
Vector3fImmutable startLocation = new Vector3fImmutable(msg.getStartLat(), msg.getStartAlt(), msg.getStartLon());
|
||||||
//if(toMove.isMoving()){
|
|
||||||
// startLocation = toMove.getMovementLoc();
|
|
||||||
//}
|
|
||||||
Vector3fImmutable endLocation = new Vector3fImmutable(msg.getEndLat(), msg.getEndAlt(), msg.getEndLon());
|
Vector3fImmutable endLocation = new Vector3fImmutable(msg.getEndLat(), msg.getEndAlt(), msg.getEndLon());
|
||||||
|
|
||||||
// if (toMove.getObjectType() == GameObjectType.PlayerCharacter)
|
// if (toMove.getObjectType() == GameObjectType.PlayerCharacter)
|
||||||
@@ -348,7 +351,7 @@ public enum MovementManager {
|
|||||||
ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
|
ChatManager.chatSystemInfo((PlayerCharacter) ac, "Finished Alt change, setting the end location to " + ac.getEndLoc().getX() + ' ' + ac.getEndLoc().getZ() + " moving=" + ac.isMoving() + " and current location is " + curLoc.getX() + ' ' + curLoc.getZ());
|
||||||
|
|
||||||
//Send run/walk/sit/stand to tell the client we are flying / landing etc
|
//Send run/walk/sit/stand to tell the client we are flying / landing etc
|
||||||
ac.update(false);
|
ac.update();
|
||||||
ac.stopMovement(ac.getLoc());
|
ac.stopMovement(ac.getLoc());
|
||||||
if (ac.isAlive())
|
if (ac.isAlive())
|
||||||
MovementManager.sendRWSSMsg(ac);
|
MovementManager.sendRWSSMsg(ac);
|
||||||
@@ -405,9 +408,7 @@ public enum MovementManager {
|
|||||||
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//member.update(false);
|
member.update();
|
||||||
member.updateLocation();
|
|
||||||
member.updateMovementState();
|
|
||||||
|
|
||||||
|
|
||||||
// All checks passed, let's move the player
|
// All checks passed, let's move the player
|
||||||
|
|||||||
@@ -340,8 +340,8 @@ public enum NPCManager {
|
|||||||
else
|
else
|
||||||
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
||||||
|
|
||||||
//if (buildingSlot == -1)
|
if (buildingSlot == -1)
|
||||||
//Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||||
|
|
||||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ package engine.gameManager;
|
|||||||
|
|
||||||
import engine.Enum.*;
|
import engine.Enum.*;
|
||||||
import engine.InterestManagement.HeightMap;
|
import engine.InterestManagement.HeightMap;
|
||||||
import engine.InterestManagement.InterestManager;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.db.handlers.dbEffectsBaseHandler;
|
import engine.db.handlers.dbEffectsBaseHandler;
|
||||||
import engine.db.handlers.dbPowerHandler;
|
import engine.db.handlers.dbPowerHandler;
|
||||||
@@ -164,47 +163,6 @@ public enum PowersManager {
|
|||||||
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
public static void usePower(final PerformActionMsg msg, ClientConnection origin,
|
||||||
boolean sendCastToSelf) {
|
boolean sendCastToSelf) {
|
||||||
|
|
||||||
PlayerCharacter pc = SessionManager.getPlayerCharacter(origin);
|
|
||||||
|
|
||||||
if(pc == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(pc.getRecycleTimers().containsKey(msg.getPowerUsedID())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!pc.isFlying() && powersBaseByToken.get(msg.getPowerUsedID()) != null && powersBaseByToken.get(msg.getPowerUsedID()).isSpell) //cant be sitting if flying
|
|
||||||
CombatManager.toggleSit(false,origin);
|
|
||||||
|
|
||||||
//if(pc.isMoving())
|
|
||||||
//pc.stopMovement(pc.getMovementLoc());
|
|
||||||
if(msg.getPowerUsedID() != 421084024 && origin.getPlayerCharacter().getPromotionClassID() != 2513) {
|
|
||||||
if (!origin.getPlayerCharacter().getPowers().containsKey(msg.getPowerUsedID())) {
|
|
||||||
Logger.error(origin.getPlayerCharacter().getFirstName() + " attempted to cast a power they do not have");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//crusader sacrifice
|
|
||||||
if((msg.getPowerUsedID() == 428695403 && msg.getTargetID() == pc.getObjectUUID())){
|
|
||||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
|
||||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
|
||||||
|
|
||||||
// Send Fail to cast message
|
|
||||||
if (pc != null) {
|
|
||||||
sendPowerMsg(pc, 2, msg);
|
|
||||||
if (pc.isCasting()) {
|
|
||||||
pc.update(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
pc.setIsCasting(false);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(msg.getPowerUsedID() == -1851459567){//backstab
|
|
||||||
applyPower(pc,pc,pc.loc,-1851459567,msg.getNumTrains(),false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usePowerA(msg, origin, sendCastToSelf)) {
|
if (usePowerA(msg, origin, sendCastToSelf)) {
|
||||||
// Cast failed for some reason, reset timer
|
// Cast failed for some reason, reset timer
|
||||||
|
|
||||||
@@ -213,20 +171,19 @@ public enum PowersManager {
|
|||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||||
|
|
||||||
// Send Fail to cast message
|
// Send Fail to cast message
|
||||||
|
PlayerCharacter pc = SessionManager
|
||||||
|
.getPlayerCharacter(origin);
|
||||||
|
|
||||||
if (pc != null) {
|
if (pc != null) {
|
||||||
sendPowerMsg(pc, 2, msg);
|
sendPowerMsg(pc, 2, msg);
|
||||||
if (pc.isCasting()) {
|
if (pc.isCasting()) {
|
||||||
pc.update(false);
|
pc.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
pc.setIsCasting(false);
|
pc.setIsCasting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg.getPowerUsedID() == 429429978){
|
|
||||||
origin.getPlayerCharacter().getRecycleTimers().remove(429429978);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void useMobPower(Mob caster, AbstractCharacter target, PowersBase pb, int rank) {
|
public static void useMobPower(Mob caster, AbstractCharacter target, PowersBase pb, int rank) {
|
||||||
@@ -235,8 +192,7 @@ public enum PowersManager {
|
|||||||
msg.setUnknown04(1);
|
msg.setUnknown04(1);
|
||||||
|
|
||||||
if (useMobPowerA(msg, caster)) {
|
if (useMobPowerA(msg, caster)) {
|
||||||
if(pb.token == -1994153779)
|
//sendMobPowerMsg(caster,2,msg); //Lol wtf was i thinking sending msg's to mobs... ZZZZ
|
||||||
InterestManager.setObjectDirty(caster);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,56 +203,8 @@ public enum PowersManager {
|
|||||||
if (playerCharacter == null)
|
if (playerCharacter == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//if(playerCharacter.getRecycleTimers().containsKey(msg.getPowerUsedID())){
|
|
||||||
// playerCharacter.setIsCasting(false);
|
|
||||||
// playerCharacter.setItemCasting(false);
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
boolean CSRCast = false;
|
boolean CSRCast = false;
|
||||||
|
|
||||||
if(msg.getPowerUsedID() == 430628895) {
|
|
||||||
|
|
||||||
boolean failed = false;// group teleport
|
|
||||||
City city = ZoneManager.getCityAtLocation(playerCharacter.loc);
|
|
||||||
if (city == null) {
|
|
||||||
failed = true;
|
|
||||||
}//else{
|
|
||||||
// Bane bane = city.getBane();
|
|
||||||
// if (bane == null) {
|
|
||||||
// failed = true;
|
|
||||||
// }else{
|
|
||||||
// if(!bane.getSiegePhase().equals(SiegePhase.WAR)){
|
|
||||||
// failed = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
if(failed){
|
|
||||||
//check to see if we are at an active mine
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(playerCharacter.loc);
|
|
||||||
if(zone != null){
|
|
||||||
Mine mine = null;
|
|
||||||
for(Building building : zone.zoneBuildingSet){
|
|
||||||
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.MINE)){
|
|
||||||
mine = Mine.getMineFromTower(building.getObjectUUID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(mine != null){
|
|
||||||
failed = !mine.isActive;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(failed) {
|
|
||||||
playerCharacter.setIsCasting(false);
|
|
||||||
|
|
||||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
|
||||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MBServerStatics.POWERS_DEBUG) {
|
if (MBServerStatics.POWERS_DEBUG) {
|
||||||
ChatManager.chatSayInfo(
|
ChatManager.chatSayInfo(
|
||||||
@@ -333,7 +241,6 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// get power
|
// get power
|
||||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||||
|
|
||||||
if (pb == null) {
|
if (pb == null) {
|
||||||
ChatManager.chatSayInfo(playerCharacter,
|
ChatManager.chatSayInfo(playerCharacter,
|
||||||
"This power is not implemented yet.");
|
"This power is not implemented yet.");
|
||||||
@@ -345,35 +252,6 @@ public enum PowersManager {
|
|||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check for movement buffs while flying
|
|
||||||
if(playerCharacter.isFlying()) {
|
|
||||||
switch(pb.token){
|
|
||||||
case 429005674:
|
|
||||||
case 429505739:
|
|
||||||
case 431054700:
|
|
||||||
case 428005600:
|
|
||||||
case 431610080:
|
|
||||||
case 427935608:
|
|
||||||
case 427857146:
|
|
||||||
case 427988218:
|
|
||||||
case 431854842:
|
|
||||||
case 421074170:
|
|
||||||
case 429611355:
|
|
||||||
case 428955899:
|
|
||||||
case 1794395699:
|
|
||||||
case 429428796:
|
|
||||||
case 1514898036:
|
|
||||||
ChatManager.chatSystemInfo(playerCharacter, "You Cannot Fly While Having A MovementBuff");
|
|
||||||
//resync stamina
|
|
||||||
playerCharacter.setStamina(playerCharacter.getStamina(), playerCharacter);
|
|
||||||
|
|
||||||
// Update all surrounding clients.
|
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(playerCharacter);
|
|
||||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, cmm, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCharacter.getLastPower() != null)
|
if (playerCharacter.getLastPower() != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -381,18 +259,17 @@ public enum PowersManager {
|
|||||||
|
|
||||||
|
|
||||||
// Check powers for normal users
|
// Check powers for normal users
|
||||||
if(msg.getPowerUsedID() != 421084024) {
|
if (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID()))
|
||||||
if (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID()))
|
if (!playerCharacter.isCSR()) {
|
||||||
if (!playerCharacter.isCSR()) {
|
if (!MBServerStatics.POWERS_DEBUG) {
|
||||||
if (!MBServerStatics.POWERS_DEBUG) {
|
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
||||||
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
|
||||||
|
Logger.info("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' was not associated with " + playerCharacter.getName());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
CSRCast = true;
|
||||||
|
|
||||||
Logger.info("usePowerA(): Cheat attempted? '" + msg.getPowerUsedID() + "' was not associated with " + playerCharacter.getName());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
CSRCast = true;
|
|
||||||
}
|
|
||||||
// get numTrains for power
|
// get numTrains for power
|
||||||
int trains = msg.getNumTrains();
|
int trains = msg.getNumTrains();
|
||||||
|
|
||||||
@@ -402,14 +279,6 @@ public enum PowersManager {
|
|||||||
msg.setNumTrains(trains);
|
msg.setNumTrains(trains);
|
||||||
}
|
}
|
||||||
|
|
||||||
//double stack point values for some useless disc spells
|
|
||||||
switch(pb.token){
|
|
||||||
case 429420458: // BH eyes
|
|
||||||
case 429601664: // huntsman skin the beast
|
|
||||||
msg.setNumTrains(msg.getNumTrains() * 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// can't go over total trains by player
|
// can't go over total trains by player
|
||||||
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
||||||
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
||||||
@@ -501,20 +370,15 @@ public enum PowersManager {
|
|||||||
float range = pb.getRange();
|
float range = pb.getRange();
|
||||||
// verify target is in range
|
// verify target is in range
|
||||||
|
|
||||||
if(pb.token != 429396028) {
|
|
||||||
|
|
||||||
if (verifyInvalidRange(playerCharacter, target, range))
|
|
||||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
|
||||||
// TODO send message that target is out of range
|
|
||||||
return true;
|
|
||||||
// verify target is valid type
|
|
||||||
if (!validateTarget(target, playerCharacter, pb))
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
pb.isSpell = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (verifyInvalidRange(playerCharacter, target, range))
|
||||||
|
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||||
|
// TODO send message that target is out of range
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// verify target is valid type
|
||||||
|
if (!validateTarget(target, playerCharacter, pb))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
@@ -545,23 +409,6 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!passed){
|
|
||||||
if (playerCharacter.getRace().getName().contains("Shade")) {
|
|
||||||
if(playerCharacter.getHidden() > 0){
|
|
||||||
switch(msg.getPowerUsedID()){
|
|
||||||
case -1851459567:
|
|
||||||
case 2094922127:
|
|
||||||
case -355707373:
|
|
||||||
case 246186475:
|
|
||||||
case 666419835:
|
|
||||||
case 1480354319:
|
|
||||||
passed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!passed)
|
if (!passed)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -640,6 +487,7 @@ public enum PowersManager {
|
|||||||
// Validity checks passed, move on to casting spell
|
// Validity checks passed, move on to casting spell
|
||||||
//get caster's live counter
|
//get caster's live counter
|
||||||
int casterLiveCounter = playerCharacter.getLiveCounter();
|
int casterLiveCounter = playerCharacter.getLiveCounter();
|
||||||
|
|
||||||
// run recycle job for when cast is available again, don't bother adding the timer for CSRs
|
// run recycle job for when cast is available again, don't bother adding the timer for CSRs
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg);
|
FinishRecycleTimeJob frtj = new FinishRecycleTimeJob(playerCharacter, msg);
|
||||||
@@ -666,7 +514,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
|
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
|
||||||
if (pb.isSpell() && !pb.isChant() && playerCharacter.isSit()) {
|
if (pb.isSpell() && !pb.isChant() && playerCharacter.isSit()) {
|
||||||
playerCharacter.update(false);
|
playerCharacter.update();
|
||||||
playerCharacter.setSit(false);
|
playerCharacter.setSit(false);
|
||||||
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
|
UpdateStateMsg updateStateMsg = new UpdateStateMsg(playerCharacter);
|
||||||
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
@@ -674,12 +522,10 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update cast (use skill) fail condition
|
// update cast (use skill) fail condition
|
||||||
if(pb.token != 429396028 && pb.breaksForm) {
|
playerCharacter.cancelOnCast();
|
||||||
playerCharacter.cancelOnCast();
|
|
||||||
}
|
|
||||||
|
|
||||||
// update castSpell (use spell) fail condition if spell
|
// update castSpell (use spell) fail condition if spell
|
||||||
if (pb.isSpell() && pb.breaksForm)
|
if (pb.isSpell())
|
||||||
playerCharacter.cancelOnSpell();
|
playerCharacter.cancelOnSpell();
|
||||||
|
|
||||||
// get cast time in ms.
|
// get cast time in ms.
|
||||||
@@ -689,12 +535,13 @@ public enum PowersManager {
|
|||||||
|
|
||||||
|
|
||||||
if (time > 100) {
|
if (time > 100) {
|
||||||
playerCharacter.update(false);
|
playerCharacter.update();
|
||||||
playerCharacter.setIsCasting(true);
|
playerCharacter.setIsCasting(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
||||||
|
|
||||||
// run timer job to end cast
|
// run timer job to end cast
|
||||||
if (time < 1) // run immediately
|
if (time < 1) // run immediately
|
||||||
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
||||||
@@ -820,11 +667,10 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
|
// make person casting stand up if spell (unless they're casting a chant which does not make them stand up)
|
||||||
// update cast (use skill) fail condition
|
// update cast (use skill) fail condition
|
||||||
if(pb.breaksForm)
|
caster.cancelOnCast();
|
||||||
caster.cancelOnCast();
|
|
||||||
|
|
||||||
// update castSpell (use spell) fail condition if spell
|
// update castSpell (use spell) fail condition if spell
|
||||||
if (pb.isSpell() && pb.breaksForm)
|
if (pb.isSpell())
|
||||||
caster.cancelOnSpell();
|
caster.cancelOnSpell();
|
||||||
|
|
||||||
// get cast time in ms.
|
// get cast time in ms.
|
||||||
@@ -854,56 +700,14 @@ public enum PowersManager {
|
|||||||
// called when a spell finishes casting. perform actions
|
// called when a spell finishes casting. perform actions
|
||||||
public static void finishUsePower(final PerformActionMsg msg, PlayerCharacter playerCharacter, int casterLiveCounter, int targetLiveCounter) {
|
public static void finishUsePower(final PerformActionMsg msg, PlayerCharacter playerCharacter, int casterLiveCounter, int targetLiveCounter) {
|
||||||
|
|
||||||
// if(true) {
|
|
||||||
// newFinishCast(msg);
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if(HandleItemEnchantments(playerCharacter, msg)) {
|
|
||||||
// playerCharacter.setIsCasting(false);
|
|
||||||
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
|
||||||
// castMsg.setNumTrains(9999);
|
|
||||||
// castMsg.setUnknown04(2);
|
|
||||||
// DispatchMessage.dispatchMsgToInterestArea(playerCharacter, castMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
PerformActionMsg performActionMsg;
|
PerformActionMsg performActionMsg;
|
||||||
Dispatch dispatch;
|
Dispatch dispatch;
|
||||||
|
|
||||||
if (playerCharacter == null || msg == null)
|
if (playerCharacter == null || msg == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//handle sprint for bard sprint
|
|
||||||
if(msg.getPowerUsedID() == 429005674){
|
|
||||||
msg.setPowerUsedID(429611355);
|
|
||||||
}
|
|
||||||
|
|
||||||
//handle root and snare break for wildkin's chase
|
|
||||||
if(msg.getPowerUsedID() == 429494441) {
|
|
||||||
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
|
|
||||||
playerCharacter.removeEffectBySource(EffectSourceType.Snare,40,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//handle power block portion for shade hide
|
|
||||||
if(playerCharacter.getRace().getName().contains("Shade")) {
|
|
||||||
if (msg.getPowerUsedID() == 429407306 || msg.getPowerUsedID() == 429495514) {
|
|
||||||
int trains = msg.getNumTrains() - 1;
|
|
||||||
if (trains < 1)
|
|
||||||
trains = 1;
|
|
||||||
applyPower(playerCharacter, playerCharacter, playerCharacter.loc, 429397210, trains, false);
|
|
||||||
playerCharacter.removeEffectBySource(EffectSourceType.Invisibility,40,true);
|
|
||||||
applyPower(playerCharacter, playerCharacter, playerCharacter.loc, msg.getPowerUsedID(), msg.getNumTrains(), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(msg.getTargetType() == GameObjectType.PlayerCharacter.ordinal()) {
|
|
||||||
PlayerCharacter target = PlayerCharacter.getPlayerCharacter(msg.getTargetID());
|
|
||||||
if (msg.getPowerUsedID() == 429601664)
|
|
||||||
if(target.getPromotionClassID() != 2516)//templar
|
|
||||||
PlayerCharacter.getPlayerCharacter(msg.getTargetID()).removeEffectBySource(EffectSourceType.Transform, msg.getNumTrains(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerCharacter.isCasting()) {
|
if (playerCharacter.isCasting()) {
|
||||||
playerCharacter.update(false);
|
playerCharacter.update();
|
||||||
playerCharacter.updateStamRegen(-100);
|
playerCharacter.updateStamRegen(-100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -943,9 +747,6 @@ public enum PowersManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pb.targetSelf)
|
|
||||||
msg.setTargetID(playerCharacter.getObjectUUID());
|
|
||||||
|
|
||||||
int trains = msg.getNumTrains();
|
int trains = msg.getNumTrains();
|
||||||
|
|
||||||
// verify player is not stunned or power type is blocked
|
// verify player is not stunned or power type is blocked
|
||||||
@@ -1008,16 +809,15 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
float range = pb.getRange() + speedRange;
|
float range = pb.getRange() + speedRange;
|
||||||
|
|
||||||
if(pb.token != 429396028) {
|
|
||||||
|
|
||||||
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
|
if (verifyInvalidRange(playerCharacter, mainTarget, range)) {
|
||||||
|
|
||||||
sendPowerMsg(playerCharacter, 8, msg);
|
sendPowerMsg(playerCharacter, 8, msg);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
|
||||||
// TODO send message that target is out of range
|
|
||||||
}
|
}
|
||||||
|
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||||
|
// TODO send message that target is out of range
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1106,13 +906,6 @@ public enum PowersManager {
|
|||||||
|
|
||||||
//Player didn't miss power, send finish cast. Miss cast already sent.
|
//Player didn't miss power, send finish cast. Miss cast already sent.
|
||||||
|
|
||||||
//if (playerCharacter.isBoxed) {
|
|
||||||
// if (AbstractCharacter.IsAbstractCharacter(target)) {
|
|
||||||
// if (target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
// finally Apply actions
|
// finally Apply actions
|
||||||
for (ActionsBase ab : pb.getActions()) {
|
for (ActionsBase ab : pb.getActions()) {
|
||||||
@@ -1122,7 +915,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, playerCharacter)) {
|
if (ab.blocked(target, pb, trains)) {
|
||||||
|
|
||||||
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
|
||||||
continue;
|
continue;
|
||||||
@@ -1209,18 +1002,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
|
|
||||||
//DispatchMessage.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
//DispatchMessage.dispatchMsgToInterestArea(playerCharacter, msg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
||||||
//handle mob hate values
|
|
||||||
HashSet<AbstractWorldObject> mobs = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,60.0f,MBServerStatics.MASK_MOB);
|
|
||||||
for(AbstractWorldObject awo : mobs){
|
|
||||||
Mob mobTarget = (Mob)awo;
|
|
||||||
if(mobTarget.hate_values != null) {
|
|
||||||
if (mobTarget.hate_values.containsKey(playerCharacter)) {
|
|
||||||
mobTarget.hate_values.put(playerCharacter, mobTarget.hate_values.get(playerCharacter) + pb.getHateValue(trains));
|
|
||||||
} else {
|
|
||||||
mobTarget.hate_values.put(playerCharacter, pb.getHateValue(trains));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1309,7 +1091,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, caster))
|
if (ab.blocked(target, pb, trains))
|
||||||
continue;
|
continue;
|
||||||
// TODO handle overwrite stack order here
|
// TODO handle overwrite stack order here
|
||||||
String stackType = ab.getStackType();
|
String stackType = ab.getStackType();
|
||||||
@@ -1451,7 +1233,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
PlayerCharacter target = SessionManager
|
PlayerCharacter target = SessionManager
|
||||||
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
||||||
if (target == null || target.equals(pc)) {
|
if (target == null || target.equals(pc) || target.isCombat()) {
|
||||||
|
|
||||||
if (target == null) // Player not found. Send not found message
|
if (target == null) // Player not found. Send not found message
|
||||||
ChatManager.chatInfoError(pc,
|
ChatManager.chatInfoError(pc,
|
||||||
@@ -1510,7 +1292,7 @@ public enum PowersManager {
|
|||||||
// Handle Accepting or Denying a summons.
|
// Handle Accepting or Denying a summons.
|
||||||
// set timer based on summon type.
|
// set timer based on summon type.
|
||||||
boolean wentThrough = false;
|
boolean wentThrough = false;
|
||||||
if (msg.accepted()) {
|
if (msg.accepted())
|
||||||
// summons accepted, let's move the player if within time
|
// summons accepted, let's move the player if within time
|
||||||
if (source.isAlive()) {
|
if (source.isAlive()) {
|
||||||
|
|
||||||
@@ -1555,16 +1337,6 @@ public enum PowersManager {
|
|||||||
else
|
else
|
||||||
duration = 45000; // Belgosh Summons, 45 seconds
|
duration = 45000; // Belgosh Summons, 45 seconds
|
||||||
|
|
||||||
boolean enemiesNear = false;
|
|
||||||
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(pc.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)) {
|
|
||||||
PlayerCharacter playerCharacter = (PlayerCharacter) awo;
|
|
||||||
if (!playerCharacter.guild.getNation().equals(pc.guild.getNation())) {
|
|
||||||
enemiesNear = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enemiesNear && !pc.isInSafeZone())
|
|
||||||
duration += 60000;
|
|
||||||
|
|
||||||
// Teleport to summoners location
|
// Teleport to summoners location
|
||||||
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
||||||
@@ -1574,10 +1346,7 @@ public enum PowersManager {
|
|||||||
timers.put("Summon", jc);
|
timers.put("Summon", jc);
|
||||||
wentThrough = true;
|
wentThrough = true;
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
// recycle summons power
|
|
||||||
finishRecycleTime(428523680, source, true);
|
|
||||||
}
|
|
||||||
// Summons failed
|
// Summons failed
|
||||||
if (!wentThrough)
|
if (!wentThrough)
|
||||||
// summons refused. Let's be nice and reset recycle timer
|
// summons refused. Let's be nice and reset recycle timer
|
||||||
@@ -1693,28 +1462,8 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create list of characters
|
// create list of characters
|
||||||
HashSet<AbstractCharacter> trackChars;
|
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
|
||||||
|
allTargets, playerCharacter, maxTargets);
|
||||||
PowersBase trackPower = PowersManager.getPowerByToken(msg.getPowerToken());
|
|
||||||
if(trackPower != null && trackPower.category.equals("TRACK")){
|
|
||||||
trackChars = getTrackList(playerCharacter);
|
|
||||||
}else{
|
|
||||||
trackChars = RangeBasedAwo.getTrackList(allTargets, playerCharacter, maxTargets);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//switch(msg.getPowerToken()){
|
|
||||||
// case 431511776: // Hunt Foe Huntress
|
|
||||||
// case 429578587: // Hunt Foe Scout
|
|
||||||
// case 429503360: // Track Huntsman
|
|
||||||
// case 44106356: //
|
|
||||||
// trackChars = getTrackList(playerCharacter);
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// trackChars = RangeBasedAwo.getTrackList(allTargets, playerCharacter, maxTargets);
|
|
||||||
// break;
|
|
||||||
//}
|
|
||||||
|
|
||||||
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
||||||
|
|
||||||
@@ -1727,30 +1476,6 @@ public enum PowersManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashSet<AbstractCharacter> getTrackList(PlayerCharacter tracker){
|
|
||||||
HashSet<AbstractCharacter> list = new HashSet<AbstractCharacter>();
|
|
||||||
HashSet<AbstractWorldObject> shortList = WorldGrid.getObjectsInRangePartial(tracker.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
|
||||||
HashSet<AbstractWorldObject> fullList = WorldGrid.getObjectsInRangePartial(tracker.loc,1408, MBServerStatics.MASK_PLAYER);
|
|
||||||
ArrayList<Guild> guildsPresent = new ArrayList<>();
|
|
||||||
for(AbstractWorldObject awo : shortList){
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)awo;
|
|
||||||
if(!guildsPresent.contains(pc.guild.getNation())){
|
|
||||||
guildsPresent.add(pc.guild.getNation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(AbstractWorldObject awo : fullList){
|
|
||||||
if(awo.equals(tracker))
|
|
||||||
continue;
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)awo;
|
|
||||||
if(!pc.isAlive())
|
|
||||||
continue;
|
|
||||||
if(guildsPresent.contains(pc.guild.getNation()))
|
|
||||||
list.add(pc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendRecyclePower(int token, ClientConnection origin) {
|
private static void sendRecyclePower(int token, ClientConnection origin) {
|
||||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(token);
|
||||||
|
|
||||||
@@ -1866,10 +1591,6 @@ public enum PowersManager {
|
|||||||
private static void applyPowerA(AbstractCharacter ac, AbstractWorldObject target,
|
private static void applyPowerA(AbstractCharacter ac, AbstractWorldObject target,
|
||||||
Vector3fImmutable targetLoc, PowersBase pb, int trains,
|
Vector3fImmutable targetLoc, PowersBase pb, int trains,
|
||||||
boolean fromItem) {
|
boolean fromItem) {
|
||||||
|
|
||||||
if(fromItem && pb.token == 429021400)
|
|
||||||
trains = 40;
|
|
||||||
|
|
||||||
int time = pb.getCastTime(trains);
|
int time = pb.getCastTime(trains);
|
||||||
if (!fromItem)
|
if (!fromItem)
|
||||||
finishApplyPowerA(ac, target, targetLoc, pb, trains, false);
|
finishApplyPowerA(ac, target, targetLoc, pb, trains, false);
|
||||||
@@ -1928,18 +1649,6 @@ public enum PowersManager {
|
|||||||
public static void finishApplyPowerA(AbstractCharacter ac,
|
public static void finishApplyPowerA(AbstractCharacter ac,
|
||||||
AbstractWorldObject target, Vector3fImmutable targetLoc,
|
AbstractWorldObject target, Vector3fImmutable targetLoc,
|
||||||
PowersBase pb, int trains, boolean fromChant) {
|
PowersBase pb, int trains, boolean fromChant) {
|
||||||
|
|
||||||
|
|
||||||
//if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
// PlayerCharacter pc = (PlayerCharacter) ac;
|
|
||||||
// if (pc.isBoxed && pb.token != -2133617927) {
|
|
||||||
// if(AbstractCharacter.IsAbstractCharacter(target)){
|
|
||||||
// if (target.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
// finally Apply actions
|
// finally Apply actions
|
||||||
ArrayList<ActionsBase> actions = pb.getActions();
|
ArrayList<ActionsBase> actions = pb.getActions();
|
||||||
for (ActionsBase ab : actions) {
|
for (ActionsBase ab : actions) {
|
||||||
@@ -1947,7 +1656,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, ac))
|
if (ab.blocked(target, pb, trains))
|
||||||
// sendPowerMsg(pc, 5, msg);
|
// sendPowerMsg(pc, 5, msg);
|
||||||
continue;
|
continue;
|
||||||
// TODO handle overwrite stack order here
|
// TODO handle overwrite stack order here
|
||||||
@@ -2020,10 +1729,14 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runPowerAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, ActionsBase ab, int trains, PowersBase pb) {
|
public static void runPowerAction(AbstractCharacter source,
|
||||||
|
AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
||||||
|
ActionsBase ab, int trains, PowersBase pb) {
|
||||||
AbstractPowerAction pa = ab.getPowerAction();
|
AbstractPowerAction pa = ab.getPowerAction();
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
Logger.error("runPowerAction(): PowerAction not found of IDString: " + ab.getEffectID());
|
Logger.error(
|
||||||
|
"runPowerAction(): PowerAction not found of IDString: "
|
||||||
|
+ ab.getEffectID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pa.startAction(source, awo, targetLoc, trains, ab, pb);
|
pa.startAction(source, awo, targetLoc, trains, ab, pb);
|
||||||
@@ -2476,7 +2189,7 @@ public enum PowersManager {
|
|||||||
|
|
||||||
// set player is not casting for regens
|
// set player is not casting for regens
|
||||||
if (pc.isCasting()) {
|
if (pc.isCasting()) {
|
||||||
pc.update(false);
|
pc.update();
|
||||||
}
|
}
|
||||||
pc.setIsCasting(false);
|
pc.setIsCasting(false);
|
||||||
|
|
||||||
@@ -2518,8 +2231,7 @@ public enum PowersManager {
|
|||||||
public static boolean testAttack(PlayerCharacter pc, AbstractWorldObject awo,
|
public static boolean testAttack(PlayerCharacter pc, AbstractWorldObject awo,
|
||||||
PowersBase pb, PerformActionMsg msg) {
|
PowersBase pb, PerformActionMsg msg) {
|
||||||
// Get defense for target
|
// Get defense for target
|
||||||
//float atr = CharacterSkill.getATR(pc, pb.getSkillName());
|
float atr = CharacterSkill.getATR(pc, pb.getSkillName());
|
||||||
float atr = PlayerCombatStats.getSpellAtr(pc, pb);
|
|
||||||
float defense;
|
float defense;
|
||||||
|
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
||||||
@@ -2529,26 +2241,28 @@ public enum PowersManager {
|
|||||||
defense = 0f;
|
defense = 0f;
|
||||||
// Get hit chance
|
// Get hit chance
|
||||||
|
|
||||||
//if (pc.getDebug(16)) {
|
if (pc.getDebug(16)) {
|
||||||
// String smsg = "ATR: " + atr + ", Defense: " + defense;
|
String smsg = "ATR: " + atr + ", Defense: " + defense;
|
||||||
// ChatManager.chatSystemInfo(pc, smsg);
|
ChatManager.chatSystemInfo(pc, smsg);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//int chance;
|
int chance;
|
||||||
|
|
||||||
//if (atr > defense || defense == 0)
|
if (atr > defense || defense == 0)
|
||||||
// chance = 94;
|
chance = 94;
|
||||||
//else {
|
else {
|
||||||
// float dif = atr / defense;
|
float dif = atr / defense;
|
||||||
// if (dif <= 0.8f)
|
if (dif <= 0.8f)
|
||||||
// chance = 4;
|
chance = 4;
|
||||||
// else
|
else
|
||||||
// chance = ((int) (450 * (dif - 0.8f)) + 4);
|
chance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||||
//}
|
}
|
||||||
|
|
||||||
// calculate hit/miss
|
// calculate hit/miss
|
||||||
|
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||||
|
|
||||||
if (CombatManager.LandHit((int)atr,(int)defense)) {
|
boolean disable = true;
|
||||||
|
if (roll < chance) {
|
||||||
// Hit, check if dodge kicked in
|
// Hit, check if dodge kicked in
|
||||||
if (awo instanceof AbstractCharacter) {
|
if (awo instanceof AbstractCharacter) {
|
||||||
AbstractCharacter tarAc = (AbstractCharacter) awo;
|
AbstractCharacter tarAc = (AbstractCharacter) awo;
|
||||||
@@ -2560,15 +2274,6 @@ public enum PowersManager {
|
|||||||
dodgeMsg.setTargetID(awo.getObjectUUID());
|
dodgeMsg.setTargetID(awo.getObjectUUID());
|
||||||
sendPowerMsg(pc, 4, dodgeMsg);
|
sendPowerMsg(pc, 4, dodgeMsg);
|
||||||
return true;
|
return true;
|
||||||
} else if (testPassive(pc, tarAc, "Block")) {
|
|
||||||
// Dodge fired, send dodge message
|
|
||||||
//PerformActionMsg dodgeMsg = new PerformActionMsg(msg);
|
|
||||||
//dodgeMsg.setTargetType(awo.getObjectType().ordinal());
|
|
||||||
//dodgeMsg.setTargetID(awo.getObjectUUID());
|
|
||||||
//sendPowerMsg(pc, 4, dodgeMsg);
|
|
||||||
TargetedActionMsg cmm = new TargetedActionMsg(pc, 75, tarAc, MBServerStatics.COMBAT_SEND_BLOCK);
|
|
||||||
DispatchMessage.sendToAllInRange(tarAc, cmm);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -2616,12 +2321,7 @@ public enum PowersManager {
|
|||||||
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
if (AbstractWorldObject.IsAbstractCharacter(awo)) {
|
||||||
AbstractCharacter tarAc = (AbstractCharacter) awo;
|
AbstractCharacter tarAc = (AbstractCharacter) awo;
|
||||||
// Handle Dodge passive
|
// Handle Dodge passive
|
||||||
boolean passiveFired = false;
|
return testPassive(caster, tarAc, "Dodge");
|
||||||
passiveFired = testPassive(caster, tarAc, "Dodge");
|
|
||||||
if(!passiveFired)
|
|
||||||
passiveFired = testPassive(caster, tarAc, "Block");
|
|
||||||
|
|
||||||
return passiveFired;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
@@ -2862,9 +2562,7 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void cancelOnStun(AbstractCharacter ac) {
|
public static void cancelOnStun(AbstractCharacter ac) {
|
||||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
|
||||||
//PlayerCharacter.GroundPlayer((PlayerCharacter)ac);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PowersBase getLastPower(AbstractCharacter ac) {
|
private static PowersBase getLastPower(AbstractCharacter ac) {
|
||||||
@@ -3010,191 +2708,6 @@ public enum PowersManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean breakForm(int token) {
|
|
||||||
switch (token) {
|
|
||||||
case 429505865:
|
|
||||||
case 429407561:
|
|
||||||
case 429492073:
|
|
||||||
case 429644123:
|
|
||||||
case 429393769:
|
|
||||||
case 429545819:
|
|
||||||
case 429426537:
|
|
||||||
case 429590377:
|
|
||||||
case 429508425:
|
|
||||||
case 429541193:
|
|
||||||
case 429573961:
|
|
||||||
case 427924330:
|
|
||||||
case 429402918:
|
|
||||||
case 429545688:
|
|
||||||
case 429005674:
|
|
||||||
case 429637823:
|
|
||||||
case 429590426:
|
|
||||||
case 428066972:
|
|
||||||
case 429441862:
|
|
||||||
case 431611756:
|
|
||||||
case 431578988:
|
|
||||||
case 429502506:
|
|
||||||
case 429398191:
|
|
||||||
case 429447384:
|
|
||||||
case 428892191:
|
|
||||||
case 431579167:
|
|
||||||
case 430977067:
|
|
||||||
case 429409100:
|
|
||||||
case 429441868:
|
|
||||||
case 429594877:
|
|
||||||
case 427908971:
|
|
||||||
case 683741153:
|
|
||||||
case 429770569:
|
|
||||||
case 429452379:
|
|
||||||
case 429605055:
|
|
||||||
case 429086971:
|
|
||||||
case 429443230:
|
|
||||||
case 429505400:
|
|
||||||
case 429492122:
|
|
||||||
case 429643992:
|
|
||||||
case 550062236:
|
|
||||||
case 429498252:
|
|
||||||
case 429611224:
|
|
||||||
case 429441834:
|
|
||||||
case 428918940:
|
|
||||||
case 429633739:
|
|
||||||
case 429633579:
|
|
||||||
case 429568043:
|
|
||||||
case 429048646:
|
|
||||||
case 428392639:
|
|
||||||
case 428425407:
|
|
||||||
case 429054168:
|
|
||||||
case 429021400:
|
|
||||||
case 428955864:
|
|
||||||
case 429119704:
|
|
||||||
case 428890328:
|
|
||||||
case 428923096:
|
|
||||||
case 429218008:
|
|
||||||
case 429086936:
|
|
||||||
case 428988632:
|
|
||||||
case 428688204:
|
|
||||||
case 429514603:
|
|
||||||
case 428924959:
|
|
||||||
case 429393818:
|
|
||||||
case 429720966:
|
|
||||||
case 428982463:
|
|
||||||
case 427933887:
|
|
||||||
case 429572287:
|
|
||||||
case 429501222:
|
|
||||||
case 430694431:
|
|
||||||
case 429436131:
|
|
||||||
case 430006124:
|
|
||||||
case 429611355:
|
|
||||||
case 428005600:
|
|
||||||
case 427935608:
|
|
||||||
case 428949695:
|
|
||||||
case 427988218:
|
|
||||||
case 429414616:
|
|
||||||
case 429496495:
|
|
||||||
case 429428796:
|
|
||||||
case 563795754:
|
|
||||||
case 428988217:
|
|
||||||
case 429432716:
|
|
||||||
case 428955899:
|
|
||||||
case 429393286:
|
|
||||||
case 550062220:
|
|
||||||
case 429495557:
|
|
||||||
case 429401278:
|
|
||||||
case 428377478:
|
|
||||||
case 429409094:
|
|
||||||
case 428191947:
|
|
||||||
case 429434474:
|
|
||||||
case 429403363:
|
|
||||||
case 429512920:
|
|
||||||
case 429419611:
|
|
||||||
case 429645676:
|
|
||||||
case 429602895:
|
|
||||||
case 429605071:
|
|
||||||
case 429592428:
|
|
||||||
case 429500010:
|
|
||||||
case 429406602:
|
|
||||||
case 429426586:
|
|
||||||
case 429633898:
|
|
||||||
case 550062212:
|
|
||||||
case 429994027:
|
|
||||||
case 430813227:
|
|
||||||
case 429928491:
|
|
||||||
case 430026795:
|
|
||||||
case 429517915:
|
|
||||||
case 431854842:
|
|
||||||
case 429767544:
|
|
||||||
case 429502507:
|
|
||||||
case 428398816:
|
|
||||||
case 429446315:
|
|
||||||
case 429441979:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean HandleItemEnchantments(PlayerCharacter pc, PerformActionMsg msg){
|
|
||||||
switch(msg.getPowerUsedID()){
|
|
||||||
case 429505998: // Reinforce Item
|
|
||||||
case 429407694: // hone weapon
|
|
||||||
case 429440462: // hone armor
|
|
||||||
case 429016905: //poison blade
|
|
||||||
case 429505610: // poison blade
|
|
||||||
case 427908971: // consecrate weapon
|
|
||||||
case 429439055: // mark of slaying
|
|
||||||
case 429605702: // annoint blade
|
|
||||||
case 429414682: // slay rat
|
|
||||||
case 429594877: // consecrate weapon
|
|
||||||
case 429440895: // charm of slaying
|
|
||||||
case 429491437: // infuse with power
|
|
||||||
PowersBase pb = PowersManager.getPowerByToken(msg.getPowerUsedID());
|
|
||||||
if(pb == null)
|
|
||||||
return false;
|
|
||||||
for (ActionsBase action : pb.getActions()){
|
|
||||||
try {
|
|
||||||
if(msg.getNumTrains() > action.maxTrains)
|
|
||||||
continue;
|
|
||||||
EffectsBase eb = action.getPowerAction().getEffectsBase();
|
|
||||||
if(eb == null)
|
|
||||||
return false;
|
|
||||||
//Effect eff = pc.addEffectNoTimer(eb.getName(),eb,msg.getNumTrains(),false);
|
|
||||||
//if(eff == null){
|
|
||||||
// Logger.error(pc.getFirstName() + " failed to apply self buff: " + msg.getPowerUsedID());
|
|
||||||
//}
|
|
||||||
|
|
||||||
UsePowerJob asj = new UsePowerJob(pc,msg,pb.getToken(),pb,pc.getLiveCounter(),pc.getLiveCounter());
|
|
||||||
|
|
||||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(asj, 1800000);
|
|
||||||
Effect eff = new Effect(jc, eb, msg.getNumTrains());
|
|
||||||
// pc.effects.put("CASTABLE", eff);
|
|
||||||
pc.addEffect("CASTABLE",1800,asj,eb,msg.getNumTrains());
|
|
||||||
pc.applyAllBonuses();
|
|
||||||
|
|
||||||
ApplyEffectMsg pum = new ApplyEffectMsg();
|
|
||||||
pum.setEffectID(eff.getEffectToken());
|
|
||||||
pum.setSourceType(pc.getObjectType().ordinal());
|
|
||||||
pum.setSourceID(pc.getObjectUUID());
|
|
||||||
pum.setTargetType(pc.getObjectType().ordinal());
|
|
||||||
pum.setTargetID(pc.getObjectUUID());
|
|
||||||
pum.setNumTrains(eff.getTrains());
|
|
||||||
pum.setUnknown05(1);
|
|
||||||
pum.setUnknown02(2);
|
|
||||||
pum.setUnknown06((byte) 1);
|
|
||||||
pum.setEffectSourceType(GameObjectType.PlayerCharacter.ordinal());
|
|
||||||
pum.setEffectSourceID(pc.getObjectUUID());
|
|
||||||
pum.setDuration(1800);
|
|
||||||
|
|
||||||
|
|
||||||
DispatchMessage.dispatchMsgToInterestArea(pc, pum, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
|
|
||||||
}
|
|
||||||
catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ package engine.gameManager;
|
|||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.objects.*;
|
import engine.objects.AbstractGameObject;
|
||||||
|
import engine.objects.City;
|
||||||
|
import engine.objects.PlayerCharacter;
|
||||||
|
import engine.objects.Runegate;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@@ -30,7 +33,7 @@ public enum SimulationManager {
|
|||||||
SERVERHEARTBEAT;
|
SERVERHEARTBEAT;
|
||||||
|
|
||||||
private static final long CITY_PULSE = 2000;
|
private static final long CITY_PULSE = 2000;
|
||||||
private static final long RUNEGATE_PULSE = 1000;
|
private static final long RUNEGATE_PULSE = 3000;
|
||||||
private static final long UPDATE_PULSE = 1000;
|
private static final long UPDATE_PULSE = 1000;
|
||||||
private static final long FlIGHT_PULSE = 100;
|
private static final long FlIGHT_PULSE = 100;
|
||||||
public static Duration executionTime = Duration.ofNanos(1);
|
public static Duration executionTime = Duration.ofNanos(1);
|
||||||
@@ -91,13 +94,16 @@ public enum SimulationManager {
|
|||||||
"Fatal error in City Pulse: DISABLED. Error Message : "
|
"Fatal error in City Pulse: DISABLED. Error Message : "
|
||||||
+ e.getMessage());
|
+ e.getMessage());
|
||||||
}
|
}
|
||||||
//try {
|
try {
|
||||||
|
|
||||||
// if ((_updatePulseTime != 0) && (System.currentTimeMillis() > _updatePulseTime))
|
if ((_updatePulseTime != 0)
|
||||||
// pulseUpdate();
|
&& (System.currentTimeMillis() > _updatePulseTime))
|
||||||
//} catch (Exception e) {
|
pulseUpdate();
|
||||||
// Logger.error("Fatal error in Update Pulse: DISABLED");
|
} catch (Exception e) {
|
||||||
//}
|
Logger.error(
|
||||||
|
"Fatal error in Update Pulse: DISABLED");
|
||||||
|
// _runegatePulseTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ((_runegatePulseTime != 0)
|
if ((_runegatePulseTime != 0)
|
||||||
@@ -110,18 +116,9 @@ public enum SimulationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ((_cityPulseTime != 0) && (System.currentTimeMillis() > _cityPulseTime)) {
|
if ((_cityPulseTime != 0)
|
||||||
try {
|
&& (System.currentTimeMillis() > _cityPulseTime))
|
||||||
pulseCities();
|
pulseCities();
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
ArenaManager.pulseArenas();
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(
|
Logger.error(
|
||||||
"Fatal error in City Pulse: DISABLED. Error Message : "
|
"Fatal error in City Pulse: DISABLED. Error Message : "
|
||||||
@@ -130,25 +127,6 @@ public enum SimulationManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//try{
|
|
||||||
// HellgateManager.pulseHellgates();
|
|
||||||
//}catch(Exception e){
|
|
||||||
// Logger.error("Failed to pulse hellgates");
|
|
||||||
// Logger.error(e.getMessage());
|
|
||||||
//}
|
|
||||||
|
|
||||||
try{
|
|
||||||
if(ZoneManager.hotZone != null && HotzoneManager.hotzoneMob != null && !HotzoneManager.hotzoneMob.isAlive()){
|
|
||||||
HotzoneManager.ClearHotzone();
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
HotzoneManager.pulse();
|
|
||||||
}catch(Exception e){
|
|
||||||
//
|
|
||||||
}
|
|
||||||
SimulationManager.executionTime = Duration.between(startTime, Instant.now());
|
SimulationManager.executionTime = Duration.between(startTime, Instant.now());
|
||||||
|
|
||||||
if (executionTime.compareTo(executionMax) > 0)
|
if (executionTime.compareTo(executionMax) > 0)
|
||||||
@@ -176,11 +154,7 @@ public enum SimulationManager {
|
|||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
continue;
|
continue;
|
||||||
try {
|
player.update();
|
||||||
player.update(false);
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_updatePulseTime = System.currentTimeMillis() + 500;
|
_updatePulseTime = System.currentTimeMillis() + 500;
|
||||||
@@ -229,12 +203,8 @@ public enum SimulationManager {
|
|||||||
city = (City) cityObject;
|
city = (City) cityObject;
|
||||||
city.onEnter();
|
city.onEnter();
|
||||||
}
|
}
|
||||||
for(Mine mine : Mine.getMines()){
|
|
||||||
if(mine != null && mine.isActive)
|
|
||||||
mine.onEnter();
|
|
||||||
}
|
|
||||||
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
|
||||||
|
|
||||||
|
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -244,10 +214,6 @@ public enum SimulationManager {
|
|||||||
private void pulseRunegates() {
|
private void pulseRunegates() {
|
||||||
|
|
||||||
for (Runegate runegate : Runegate._runegates.values()) {
|
for (Runegate runegate : Runegate._runegates.values()) {
|
||||||
for(Portal portal : runegate._portals)
|
|
||||||
if(!portal.isActive())
|
|
||||||
portal.activate(false);
|
|
||||||
|
|
||||||
runegate.collidePortals();
|
runegate.collidePortals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,277 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class SpecialLootHandler {
|
|
||||||
public static final List<Integer> DWARVEN_contracts = Arrays.asList(
|
|
||||||
35250, 35251, 35252, 35253, 35254, 35255, 35256, 35257, 35258, 35259, 35260, 35261, 35262, 35263
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> INVORRI_contracts = Arrays.asList(
|
|
||||||
35050, 35051, 35052, 35053, 35054, 35055, 35056, 35057, 35058, 35059, 35060, 35061, 35062, 35063
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> SHADE_contracts = Arrays.asList(
|
|
||||||
35400, 35401, 35402, 35403, 35404, 35405, 35406, 35407, 35408, 35409, 35410, 35411, 35412, 35413,
|
|
||||||
35414, 35415, 35416, 35417, 35418, 35419, 35420, 35421, 35422, 35423, 35424, 35425, 35426, 35427
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> VAMPIRE_contracts = Arrays.asList(
|
|
||||||
35545, 35546, 35547, 35548, 35549, 35550, 35551, 35552, 35553, 35554, 35555, 35556, 35557, 35558,
|
|
||||||
35559, 35560, 35561, 35562, 35563, 35564, 35565, 35566, 35567, 35568, 35569, 35570
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> IREKEI_contracts = Arrays.asList(
|
|
||||||
35100, 35101, 35102, 35103, 35104, 35105, 35106, 35107, 35108, 35109, 35110, 35111, 35112, 35113,
|
|
||||||
35114, 35115, 35116, 35117, 35118, 35119, 35120, 35121, 35122, 35123, 35124, 35125, 35126, 35127
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> AMAZON_contracts = Arrays.asList(
|
|
||||||
35200, 35201, 35202, 35203, 35204, 35205, 35206, 35207, 35208, 35209, 35210, 35211, 35212, 35213
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> GWENDANNEN_contracts = Arrays.asList(
|
|
||||||
35350, 35351, 35352, 35353, 35354, 35355, 35356, 35357, 35358, 35359, 35360, 35361, 35362, 35363,
|
|
||||||
35364, 35365, 35366, 35367, 35368, 35369, 35370, 35371, 35372, 35373, 35374, 35375, 35376, 35377
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> NEPHILIM_contracts = Arrays.asList(
|
|
||||||
35500, 35501, 35502, 35503, 35504, 35505, 35506, 35507, 35508, 35509, 35510, 35511, 35512, 35513,
|
|
||||||
35514, 35515, 35516, 35517, 35518, 35519, 35520, 35521, 35522, 35523, 35524, 35525
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> ELVEN_contracts = Arrays.asList(
|
|
||||||
35000, 35001, 35002, 35003, 35004, 35005, 35006, 35007, 35008, 35009, 35010, 35011, 35012, 35013,
|
|
||||||
35014, 35015, 35016, 35017, 35018, 35019, 35020, 35021, 35022, 35023, 35024, 35025, 35026, 35027
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> CENTAUR_contracts = Arrays.asList(
|
|
||||||
35150, 35151, 35152, 35153, 35154, 35155, 35156, 35157, 35158, 35159, 35160, 35161, 35162, 35163,
|
|
||||||
35164, 35165, 35166, 35167, 35168, 35169, 35170, 35171, 35172, 35173, 35174, 35175, 35176, 35177
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> LIZARDMAN_contracts = Arrays.asList(
|
|
||||||
35300, 35301, 35302, 35303, 35304, 35305, 35306, 35307, 35308, 35309, 35310, 35311, 35312, 35313
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> GLASS_ITEMS = Arrays.asList(
|
|
||||||
7000100, 7000110, 7000120, 7000130, 7000140, 7000150, 7000160, 7000170, 7000180, 7000190,
|
|
||||||
7000200, 7000210, 7000220, 7000230, 7000240, 7000250, 7000270, 7000280
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> STAT_RUNES = Arrays.asList(
|
|
||||||
250001, 250002, 250003, 250004, 250005, 250006, 250007, 250008, 250010, 250011,
|
|
||||||
250012, 250013, 250014, 250015, 250016, 250017, 250019, 250020, 250021, 250022,
|
|
||||||
250023, 250024, 250025, 250026, 250028, 250029, 250030, 250031, 250032, 250033,
|
|
||||||
250034, 250035, 250037, 250038, 250039, 250040, 250041, 250042, 250043, 250044
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final List<Integer> racial_guard = Arrays.asList(
|
|
||||||
841,951,952,1050,1052,1180,1182,1250,1252,1350,1352,1450,
|
|
||||||
1452,1500,1502,1525,1527,1550,1552,1575,1577,1600,1602,1650,1652,1700,980100,
|
|
||||||
980102
|
|
||||||
);
|
|
||||||
|
|
||||||
public static void RollContract(Mob mob){
|
|
||||||
|
|
||||||
Zone zone = getMacroZone(mob);
|
|
||||||
if(zone == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int contactId = 0;
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(250);
|
|
||||||
if(roll == 125){
|
|
||||||
contactId = getContractForZone(zone);
|
|
||||||
}
|
|
||||||
if(contactId == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ItemBase contractBase = ItemBase.getItemBase(contactId);
|
|
||||||
if(contractBase == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.getCharItemManager() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
MobLoot contract = new MobLoot(mob,contractBase,false);
|
|
||||||
mob.getCharItemManager().addItemToInventory(contract);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Zone getMacroZone(Mob mob){
|
|
||||||
|
|
||||||
Zone parentZone = mob.parentZone;
|
|
||||||
if(parentZone == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
while(!parentZone.isMacroZone() && !parentZone.equals(ZoneManager.getSeaFloor())){
|
|
||||||
parentZone = parentZone.getParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
return parentZone;
|
|
||||||
|
|
||||||
//for(Zone zone : ZoneManager.macroZones){
|
|
||||||
// HashSet<AbstractWorldObject> inZone = WorldGrid.getObjectsInRangePartial(zone.getLoc(),zone.getBounds().getHalfExtents().x * 2f, MBServerStatics.MASK_MOB);
|
|
||||||
// if(inZone.contains(mob)){
|
|
||||||
// return zone;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getContractForZone(Zone zone){
|
|
||||||
Random random = new Random();
|
|
||||||
switch (zone.getObjectUUID())
|
|
||||||
{
|
|
||||||
case 178:
|
|
||||||
// Kralgaar Holm
|
|
||||||
return DWARVEN_contracts.get(random.nextInt(DWARVEN_contracts.size()));
|
|
||||||
case 122:
|
|
||||||
// Aurrochs Skrae
|
|
||||||
return INVORRI_contracts.get(random.nextInt(INVORRI_contracts.size()));
|
|
||||||
case 197:
|
|
||||||
// Ymur's Crown
|
|
||||||
return INVORRI_contracts.get(random.nextInt(INVORRI_contracts.size()));
|
|
||||||
case 234:
|
|
||||||
// Ecklund Wilds
|
|
||||||
return INVORRI_contracts.get(random.nextInt(INVORRI_contracts.size()));
|
|
||||||
case 313:
|
|
||||||
// Greensward Pyre
|
|
||||||
return SHADE_contracts.get(random.nextInt(SHADE_contracts.size()));
|
|
||||||
case 331:
|
|
||||||
// The Doomplain
|
|
||||||
return VAMPIRE_contracts.get(random.nextInt(VAMPIRE_contracts.size()));
|
|
||||||
case 353:
|
|
||||||
// Thollok Marsh
|
|
||||||
return LIZARDMAN_contracts.get(random.nextInt(LIZARDMAN_contracts.size()));
|
|
||||||
case 371:
|
|
||||||
// The Black Bog
|
|
||||||
return LIZARDMAN_contracts.get(random.nextInt(LIZARDMAN_contracts.size()));
|
|
||||||
case 388:
|
|
||||||
// Sevaath Mere
|
|
||||||
return LIZARDMAN_contracts.get(random.nextInt(LIZARDMAN_contracts.size()));
|
|
||||||
case 418:
|
|
||||||
// Valkos Wilds
|
|
||||||
return GWENDANNEN_contracts.get(random.nextInt(GWENDANNEN_contracts.size()));
|
|
||||||
case 437:
|
|
||||||
// Grimscairne
|
|
||||||
return SHADE_contracts.get(random.nextInt(SHADE_contracts.size()));
|
|
||||||
case 475:
|
|
||||||
// Phaedra's Prize
|
|
||||||
return AMAZON_contracts.get(random.nextInt(AMAZON_contracts.size()));
|
|
||||||
case 491:
|
|
||||||
// Holloch Forest
|
|
||||||
return GWENDANNEN_contracts.get(random.nextInt(GWENDANNEN_contracts.size()));
|
|
||||||
case 508:
|
|
||||||
// Aeran Belendor
|
|
||||||
return ELVEN_contracts.get(random.nextInt(ELVEN_contracts.size()));
|
|
||||||
case 532:
|
|
||||||
// Tainted Swamp
|
|
||||||
return NEPHILIM_contracts.get(random.nextInt(NEPHILIM_contracts.size()));
|
|
||||||
case 550:
|
|
||||||
// Aerath Hellendroth
|
|
||||||
return ELVEN_contracts.get(random.nextInt(ELVEN_contracts.size()));
|
|
||||||
case 569:
|
|
||||||
// Aedroch Highlands
|
|
||||||
return GWENDANNEN_contracts.get(random.nextInt(GWENDANNEN_contracts.size()));
|
|
||||||
case 590:
|
|
||||||
// Fellgrim Forest
|
|
||||||
return GWENDANNEN_contracts.get(random.nextInt(GWENDANNEN_contracts.size()));
|
|
||||||
case 616:
|
|
||||||
// Derros Plains
|
|
||||||
return CENTAUR_contracts.get(random.nextInt(CENTAUR_contracts.size()));
|
|
||||||
case 632:
|
|
||||||
// Ashfell Plain
|
|
||||||
return SHADE_contracts.get(random.nextInt(SHADE_contracts.size()));
|
|
||||||
case 717:
|
|
||||||
// Kharsoom
|
|
||||||
return IREKEI_contracts.get(random.nextInt(IREKEI_contracts.size()));
|
|
||||||
case 737:
|
|
||||||
// Leth'khalivar Desert
|
|
||||||
return IREKEI_contracts.get(random.nextInt(IREKEI_contracts.size()));
|
|
||||||
case 761:
|
|
||||||
// The Blood Sands
|
|
||||||
return IREKEI_contracts.get(random.nextInt(IREKEI_contracts.size()));
|
|
||||||
case 785:
|
|
||||||
// Vale of Nar Addad
|
|
||||||
return IREKEI_contracts.get(random.nextInt(IREKEI_contracts.size()));
|
|
||||||
case 824:
|
|
||||||
// Western Battleground
|
|
||||||
return NEPHILIM_contracts.get(random.nextInt(NEPHILIM_contracts.size()));
|
|
||||||
case 842:
|
|
||||||
// Pandemonium
|
|
||||||
return NEPHILIM_contracts.get(random.nextInt(NEPHILIM_contracts.size()));
|
|
||||||
case 951:
|
|
||||||
//Bone Marches
|
|
||||||
return VAMPIRE_contracts.get(random.nextInt(VAMPIRE_contracts.size()));
|
|
||||||
case 952:
|
|
||||||
//plain of ashes
|
|
||||||
return VAMPIRE_contracts.get(random.nextInt(VAMPIRE_contracts.size()));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RollGlass(Mob mob){
|
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(10000);
|
|
||||||
if(roll != 5000)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Random random = new Random();
|
|
||||||
int glassId = GLASS_ITEMS.get(random.nextInt(GLASS_ITEMS.size()));
|
|
||||||
ItemBase glassBase = ItemBase.getItemBase(glassId);
|
|
||||||
if(glassBase == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.getCharItemManager() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
MobLoot glass = new MobLoot(mob,glassBase,false);
|
|
||||||
mob.getCharItemManager().addItemToInventory(glass);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RollRune(Mob mob){
|
|
||||||
int runeID = 0;
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(250);
|
|
||||||
Random random = new Random();
|
|
||||||
if(roll == 125){
|
|
||||||
runeID = STAT_RUNES.get(random.nextInt(STAT_RUNES.size()));
|
|
||||||
}
|
|
||||||
if(runeID == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ItemBase runeBase = ItemBase.getItemBase(runeID);
|
|
||||||
if(runeBase == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.getCharItemManager() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
MobLoot rune = new MobLoot(mob,runeBase,false);
|
|
||||||
mob.getCharItemManager().addItemToInventory(rune);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RollRacialGuard(Mob mob){
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(5000);
|
|
||||||
if(roll != 2500)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Random random = new Random();
|
|
||||||
int guardId = racial_guard.get(random.nextInt(racial_guard.size()));
|
|
||||||
ItemBase guardBase = ItemBase.getItemBase(guardId);
|
|
||||||
if(guardBase == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.getCharItemManager() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
MobLoot guard = new MobLoot(mob,guardBase,false);
|
|
||||||
mob.getCharItemManager().addItemToInventory(guard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,347 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.InterestManagement.InterestManager;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.math.Vector3f;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.objects.*;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class StrongholdManager {
|
|
||||||
|
|
||||||
public static void processStrongholds() {
|
|
||||||
ArrayList<Mine> mines = Mine.getMines();
|
|
||||||
|
|
||||||
|
|
||||||
//process strongholds selecting 3 randomly to become active
|
|
||||||
int count = 0;
|
|
||||||
while (count < 3) {
|
|
||||||
int random = ThreadLocalRandom.current().nextInt(1, mines.size()) - 1;
|
|
||||||
Mine mine = mines.get(random);
|
|
||||||
if (mine != null) {
|
|
||||||
if (!mine.isActive && !mine.isStronghold) {
|
|
||||||
StartStronghold(mine);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void StartStronghold(Mine mine){
|
|
||||||
|
|
||||||
//remove buildings
|
|
||||||
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
|
||||||
if(tower == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mine.isStronghold = true;
|
|
||||||
mine.strongholdMobs = new ArrayList<>();
|
|
||||||
mine.oldBuildings = new HashMap<>();
|
|
||||||
|
|
||||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
|
||||||
for(Building building : mineZone.zoneBuildingSet){
|
|
||||||
mine.oldBuildings.put(building.getObjectUUID(),building.meshUUID);
|
|
||||||
building.setMeshUUID(407650);
|
|
||||||
building.setMeshScale(new Vector3f(0,0,0));
|
|
||||||
InterestManager.setObjectDirty(building);
|
|
||||||
WorldGrid.updateObject(building);
|
|
||||||
}
|
|
||||||
|
|
||||||
//update tower to become stronghold mesh
|
|
||||||
tower.setMeshUUID(getStrongholdMeshID(mine.getParentZone()));
|
|
||||||
tower.setMeshScale(new Vector3f(1,1,1));
|
|
||||||
InterestManager.setObjectDirty(tower);
|
|
||||||
WorldGrid.updateObject(tower);
|
|
||||||
|
|
||||||
//create elite mobs
|
|
||||||
for(int i = 0; i < mine.capSize * 2; i++){
|
|
||||||
Vector3fImmutable loc = Vector3fImmutable.getRandomPointOnCircle(tower.loc,30);
|
|
||||||
MobBase guardBase = MobBase.getMobBase(getStrongholdGuardianID(tower.meshUUID));
|
|
||||||
Mob guard = Mob.createStrongholdMob(guardBase.getLoadID(), loc, Guild.getErrantGuild(),true,mineZone,null,0, guardBase.getFirstName(),65);
|
|
||||||
if(guard != null){
|
|
||||||
guard.parentZone = mine.getParentZone();
|
|
||||||
guard.bindLoc = loc;
|
|
||||||
guard.setLoc(loc);
|
|
||||||
guard.StrongholdGuardian = true;
|
|
||||||
guard.equipmentSetID = getStrongholdMobEquipSetID(guard);
|
|
||||||
guard.runAfterLoad();
|
|
||||||
guard.setLevel((short)65);
|
|
||||||
guard.setResists(new Resists("Elite"));
|
|
||||||
guard.spawnTime = 1000000000;
|
|
||||||
guard.BehaviourType = Enum.MobBehaviourType.Aggro;
|
|
||||||
mine.strongholdMobs.add(guard);
|
|
||||||
LootManager.GenerateStrongholdLoot(guard,false,false);
|
|
||||||
guard.healthMax = 12500;
|
|
||||||
guard.setHealth(guard.healthMax);
|
|
||||||
guard.maxDamageHandOne = 1550;
|
|
||||||
guard.minDamageHandOne = 750;
|
|
||||||
guard.atrHandOne = 1800;
|
|
||||||
guard.defenseRating = 2200;
|
|
||||||
guard.setFirstName("Elite Guardian");
|
|
||||||
InterestManager.setObjectDirty(guard);
|
|
||||||
WorldGrid.addObject(guard,loc.x,loc.z);
|
|
||||||
WorldGrid.updateObject(guard);
|
|
||||||
guard.stronghold = mine;
|
|
||||||
guard.mobPowers.clear();
|
|
||||||
guard.mobPowers.put(429399948,20); // find weakness
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//create stronghold commander
|
|
||||||
Vector3fImmutable loc = tower.loc;
|
|
||||||
MobBase commanderBase = MobBase.getMobBase(getStrongholdCommanderID(tower.meshUUID));
|
|
||||||
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc,Guild.getErrantGuild(),true,mineZone,null,0, commanderBase.getFirstName(),75);
|
|
||||||
if(commander != null){
|
|
||||||
commander.parentZone = mine.getParentZone();
|
|
||||||
commander.bindLoc = loc;
|
|
||||||
commander.setLoc(loc);
|
|
||||||
commander.StrongholdCommander = true;
|
|
||||||
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
|
|
||||||
commander.runAfterLoad();
|
|
||||||
commander.setLevel((short)75);
|
|
||||||
commander.setResists(new Resists("Elite"));
|
|
||||||
commander.spawnTime = 1000000000;
|
|
||||||
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
|
||||||
commander.mobPowers.clear();
|
|
||||||
commander.mobPowers.put(429032838, 40); // gravechill
|
|
||||||
commander.mobPowers.put(429757701,20); // magebolt
|
|
||||||
commander.mobPowers.put(429121388,20); // blight
|
|
||||||
commander.mobPowers.put(431566891,20); // lightning bolt
|
|
||||||
commander.mobPowers.put(428716075,20); // fire bolt
|
|
||||||
commander.mobPowers.put(429010987,20); // ice bolt
|
|
||||||
mine.strongholdMobs.add(commander);
|
|
||||||
LootManager.GenerateStrongholdLoot(commander,true, false);
|
|
||||||
commander.healthMax = 50000;
|
|
||||||
commander.setHealth(commander.healthMax);
|
|
||||||
commander.maxDamageHandOne = 3500;
|
|
||||||
commander.minDamageHandOne = 1500;
|
|
||||||
commander.atrHandOne = 3500;
|
|
||||||
commander.defenseRating = 3500;
|
|
||||||
commander.setFirstName("Guardian Commander");
|
|
||||||
InterestManager.setObjectDirty(commander);
|
|
||||||
WorldGrid.addObject(commander,loc.x,loc.z);
|
|
||||||
WorldGrid.updateObject(commander);
|
|
||||||
commander.stronghold = mine;
|
|
||||||
}
|
|
||||||
|
|
||||||
mine.isActive = true;
|
|
||||||
tower.setProtectionState(Enum.ProtectionState.PROTECTED);
|
|
||||||
tower.getBounds().setRegions(tower);
|
|
||||||
InterestManager.setObjectDirty(tower);
|
|
||||||
WorldGrid.updateObject(tower);
|
|
||||||
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Begun!");
|
|
||||||
Logger.info(mine.getZoneName() + "'s Stronghold Has Begun!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void EndStronghold(Mine mine){
|
|
||||||
|
|
||||||
//restore the buildings
|
|
||||||
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
|
||||||
if(tower == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mine.isStronghold = false;
|
|
||||||
|
|
||||||
//get rid of the mobs
|
|
||||||
for(Mob mob : mine.strongholdMobs) {
|
|
||||||
mob.despawn();
|
|
||||||
mob.removeFromCache();
|
|
||||||
DbManager.MobQueries.DELETE_MOB(mob);
|
|
||||||
}
|
|
||||||
|
|
||||||
//restore the buildings
|
|
||||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
|
||||||
for(Building building : mineZone.zoneBuildingSet){
|
|
||||||
if(mine.oldBuildings.containsKey(building.getObjectUUID())) {
|
|
||||||
building.setMeshUUID(mine.oldBuildings.get(building.getObjectUUID()));
|
|
||||||
building.setMeshScale(new Vector3f(1, 1, 1));
|
|
||||||
InterestManager.setObjectDirty(building);
|
|
||||||
WorldGrid.updateObject(building);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//update tower to become Mine Tower again
|
|
||||||
tower.setMeshUUID(1500100);
|
|
||||||
|
|
||||||
mine.isActive = false;
|
|
||||||
tower.setProtectionState(Enum.ProtectionState.NPC);
|
|
||||||
tower.getBounds().setRegions(tower);
|
|
||||||
InterestManager.setObjectDirty(tower);
|
|
||||||
WorldGrid.updateObject(tower);
|
|
||||||
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Stronghold Has Concluded!");
|
|
||||||
Logger.info(mine.getZoneName() + "'s Stronghold Has Concluded!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getStrongholdMeshID(Zone parent){
|
|
||||||
while(!parent.isMacroZone()){
|
|
||||||
parent = parent.getParent();
|
|
||||||
if(parent.getName().equalsIgnoreCase("seafloor")){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch(parent.getObjectUUID()){
|
|
||||||
case 197:
|
|
||||||
case 234:
|
|
||||||
case 178:
|
|
||||||
case 122:
|
|
||||||
return 814000; //Frost Giant Hall (ICE)
|
|
||||||
case 968:
|
|
||||||
case 951:
|
|
||||||
case 313:
|
|
||||||
case 331:
|
|
||||||
return 5001500; // Lich Queens Keep (UNDEAD)
|
|
||||||
case 785:
|
|
||||||
case 761:
|
|
||||||
case 717:
|
|
||||||
case 737:
|
|
||||||
return 1306600; // Temple of the Dragon (DESERT)
|
|
||||||
case 353:
|
|
||||||
case 371:
|
|
||||||
case 388:
|
|
||||||
case 532:
|
|
||||||
return 564600; // Undead Lord's Keep (SWAMP)
|
|
||||||
case 550:
|
|
||||||
case 508:
|
|
||||||
case 475:
|
|
||||||
case 418:
|
|
||||||
return 1326600; // elven hall
|
|
||||||
case 437:
|
|
||||||
case 491:
|
|
||||||
case 590:
|
|
||||||
case 569:
|
|
||||||
return 602400;
|
|
||||||
case 824:
|
|
||||||
case 842:
|
|
||||||
case 632:
|
|
||||||
return 1600000; // chaos temple
|
|
||||||
}
|
|
||||||
return 456100; // small stockade
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getStrongholdGuardianID(int ID){
|
|
||||||
switch(ID){
|
|
||||||
case 814000:
|
|
||||||
return 253004; // Mountain Giant Raider Axe
|
|
||||||
case 5001500:
|
|
||||||
return 253008; // Vampire Spear Warrior
|
|
||||||
case 1306600:
|
|
||||||
return 253007; // Desert Orc Warrior
|
|
||||||
case 564600:
|
|
||||||
return 253010; // Kolthoss Warrior
|
|
||||||
case 1326600:
|
|
||||||
return 253005; //elven warrior
|
|
||||||
case 602400:
|
|
||||||
return 253009; // templar missionary
|
|
||||||
case 1600000:
|
|
||||||
return 253006; // scourger
|
|
||||||
}
|
|
||||||
return 13434; // human sword and board warrior
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getStrongholdEpicID(int ID){
|
|
||||||
switch(ID){
|
|
||||||
case 814000:
|
|
||||||
return 253023; // Mountain Giant Raider Axe
|
|
||||||
case 5001500:
|
|
||||||
return 253022; // Vampire Spear Warrior
|
|
||||||
case 1306600:
|
|
||||||
return 253021; // Desert Orc Warrior
|
|
||||||
case 564600:
|
|
||||||
return 253018; // Kolthoss Warrior
|
|
||||||
case 1326600:
|
|
||||||
return 253019; //elven warrior
|
|
||||||
case 602400:
|
|
||||||
return 253024; // templar missionary
|
|
||||||
case 1600000:
|
|
||||||
return 253020; // scourger
|
|
||||||
}
|
|
||||||
return 13434; // human sword and board warrior
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getStrongholdCommanderID(int ID){
|
|
||||||
switch(ID){
|
|
||||||
case 814000:
|
|
||||||
return 253017;
|
|
||||||
case 5001500:
|
|
||||||
return 253012;
|
|
||||||
case 1306600:
|
|
||||||
return 253016; // Desert Orc Xbow
|
|
||||||
case 564600:
|
|
||||||
return 253011; // xbow kolthoss
|
|
||||||
case 1326600:
|
|
||||||
return 253013; //elven bow warrior
|
|
||||||
case 602400:
|
|
||||||
return 253015; // dune giant with xbow
|
|
||||||
case 1600000:
|
|
||||||
return 253014; // barbator
|
|
||||||
}
|
|
||||||
return 13433;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getStrongholdMobEquipSetID(Mob mob) {
|
|
||||||
if(mob.StrongholdGuardian){
|
|
||||||
return 6327;
|
|
||||||
}else{
|
|
||||||
return 10790;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CheckToEndStronghold(Mine mine) {
|
|
||||||
|
|
||||||
boolean stillAlive = false;
|
|
||||||
for (Mob mob : mine.strongholdMobs)
|
|
||||||
if (mob.isAlive())
|
|
||||||
stillAlive = true;
|
|
||||||
|
|
||||||
if (!stillAlive) {
|
|
||||||
// Epic encounter
|
|
||||||
|
|
||||||
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
|
||||||
if (tower == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Zone mineZone = ZoneManager.findSmallestZone(tower.loc);
|
|
||||||
|
|
||||||
Vector3fImmutable loc = tower.loc;
|
|
||||||
MobBase commanderBase = MobBase.getMobBase(getStrongholdEpicID(tower.meshUUID));
|
|
||||||
Mob commander = Mob.createStrongholdMob(commanderBase.getLoadID(), loc, Guild.getErrantGuild(), true, mineZone, null, 0, commanderBase.getFirstName(), 75);
|
|
||||||
if (commander != null) {
|
|
||||||
commander.parentZone = mine.getParentZone();
|
|
||||||
commander.bindLoc = loc;
|
|
||||||
commander.setLoc(loc);
|
|
||||||
commander.StrongholdEpic = true;
|
|
||||||
commander.equipmentSetID = getStrongholdMobEquipSetID(commander);
|
|
||||||
commander.runAfterLoad();
|
|
||||||
commander.setLevel((short) 85);
|
|
||||||
commander.setResists(new Resists("Elite"));
|
|
||||||
commander.spawnTime = 1000000000;
|
|
||||||
commander.BehaviourType = Enum.MobBehaviourType.Aggro;
|
|
||||||
commander.mobPowers.clear();
|
|
||||||
commander.mobPowers.put(429032838, 40); // gravechill
|
|
||||||
commander.mobPowers.put(429757701,40); // magebolt
|
|
||||||
commander.mobPowers.put(429121388,40); // blight
|
|
||||||
commander.mobPowers.put(431566891,40); // lightning bolt
|
|
||||||
commander.mobPowers.put(428716075,40); // fire bolt
|
|
||||||
commander.mobPowers.put(429010987,40); // ice bolt
|
|
||||||
mine.strongholdMobs.add(commander);
|
|
||||||
LootManager.GenerateStrongholdLoot(commander, true, true);
|
|
||||||
commander.healthMax = 250000;
|
|
||||||
commander.setHealth(commander.healthMax);
|
|
||||||
commander.maxDamageHandOne = 5000;
|
|
||||||
commander.minDamageHandOne = 2500;
|
|
||||||
commander.atrHandOne = 5000;
|
|
||||||
commander.defenseRating = 3500;
|
|
||||||
commander.setFirstName("Defender of " + mine.getParentZone().getParent().getName());
|
|
||||||
InterestManager.setObjectDirty(commander);
|
|
||||||
WorldGrid.addObject(commander,loc.x,loc.z);
|
|
||||||
WorldGrid.updateObject(commander);
|
|
||||||
commander.stronghold = mine;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
package engine.gameManager;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ZergManager {
|
|
||||||
|
|
||||||
public static float getCurrentMultiplier(int count, int maxCount){
|
|
||||||
switch(maxCount) {
|
|
||||||
case 3: return getMultiplier3Man(count);
|
|
||||||
case 5: return getMultiplier5Man(count);
|
|
||||||
case 10: return getMultiplier10Man(count);
|
|
||||||
case 20: return getMultiplier20Man(count);
|
|
||||||
case 30: return getMultiplier30Man(count);
|
|
||||||
case 40: return getMultiplier40Man(count);
|
|
||||||
default: return 1.0f; //unlimited
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static float getMultiplier3Man(int count) {
|
|
||||||
if(count < 4)
|
|
||||||
return 1.0f;
|
|
||||||
|
|
||||||
if(count > 6)
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
switch(count){
|
|
||||||
case 4: return 0.50f;
|
|
||||||
case 5: return 0.0f;
|
|
||||||
case 6: return 0.0f;
|
|
||||||
default: return 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static float getMultiplier5Man(int count) {
|
|
||||||
if(count < 6)
|
|
||||||
return 1.0f;
|
|
||||||
|
|
||||||
if(count > 10)
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
switch(count){
|
|
||||||
case 6: return 0.75f;
|
|
||||||
case 7: return 0.57f;
|
|
||||||
case 8: return 0.44f;
|
|
||||||
case 9: return 0.33f;
|
|
||||||
case 10: return 0.25f;
|
|
||||||
default: return 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static float getMultiplier10Man(int count) {
|
|
||||||
if(count < 11)
|
|
||||||
return 1.0f;
|
|
||||||
|
|
||||||
if(count > 20)
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
switch(count){
|
|
||||||
case 11: return 0.86f;
|
|
||||||
case 12: return 0.75f;
|
|
||||||
case 13: return 0.65f;
|
|
||||||
case 14: return 0.57f;
|
|
||||||
case 15: return 0.50f;
|
|
||||||
case 16: return 0.44f;
|
|
||||||
case 17: return 0.38f;
|
|
||||||
case 18: return 0.33f;
|
|
||||||
case 19: return 0.29f;
|
|
||||||
case 20: return 0.25f;
|
|
||||||
default: return 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static float getMultiplier20Man(int count) {
|
|
||||||
if(count < 21)
|
|
||||||
return 1.0f;
|
|
||||||
|
|
||||||
if(count > 40)
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
switch (count)
|
|
||||||
{
|
|
||||||
case 21: return 0.93f;
|
|
||||||
case 22: return 0.86f;
|
|
||||||
case 23: return 0.80f;
|
|
||||||
case 24: return 0.75f;
|
|
||||||
case 25: return 0.70f;
|
|
||||||
case 26: return 0.65f;
|
|
||||||
case 27: return 0.61f;
|
|
||||||
case 28: return 0.57f;
|
|
||||||
case 29: return 0.53f;
|
|
||||||
case 30: return 0.50f;
|
|
||||||
case 31: return 0.47f;
|
|
||||||
case 32: return 0.44f;
|
|
||||||
case 33: return 0.41f;
|
|
||||||
case 34: return 0.38f;
|
|
||||||
case 35: return 0.36f;
|
|
||||||
case 36: return 0.33f;
|
|
||||||
case 37: return 0.31f;
|
|
||||||
case 38: return 0.29f;
|
|
||||||
case 39: return 0.27f;
|
|
||||||
case 40: return 0.25f;
|
|
||||||
default: return 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
public static float getMultiplier30Man(int count) {
|
|
||||||
if(count < 31)
|
|
||||||
return 1.0f;
|
|
||||||
|
|
||||||
if(count > 60)
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
switch (count)
|
|
||||||
{
|
|
||||||
case 31: return 0.95f;
|
|
||||||
case 32: return 0.91f;
|
|
||||||
case 33: return 0.86f;
|
|
||||||
case 34: return 0.82f;
|
|
||||||
case 35: return 0.79f;
|
|
||||||
case 36: return 0.75f;
|
|
||||||
case 37: return 0.72f;
|
|
||||||
case 38: return 0.68f;
|
|
||||||
case 39: return 0.65f;
|
|
||||||
case 40: return 0.63f;
|
|
||||||
case 41: return 0.60f;
|
|
||||||
case 42: return 0.57f;
|
|
||||||
case 43: return 0.55f;
|
|
||||||
case 44: return 0.52f;
|
|
||||||
case 45: return 0.50f;
|
|
||||||
case 46: return 0.48f;
|
|
||||||
case 47: return 0.46f;
|
|
||||||
case 48: return 0.44f;
|
|
||||||
case 49: return 0.42f;
|
|
||||||
case 50: return 0.40f;
|
|
||||||
case 51: return 0.38f;
|
|
||||||
case 52: return 0.37f;
|
|
||||||
case 53: return 0.35f;
|
|
||||||
case 54: return 0.33f;
|
|
||||||
case 55: return 0.32f;
|
|
||||||
case 56: return 0.30f;
|
|
||||||
case 57: return 0.29f;
|
|
||||||
case 58: return 0.28f;
|
|
||||||
case 59: return 0.26f;
|
|
||||||
case 60: return 0.25f;
|
|
||||||
default: return 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
public static float getMultiplier40Man(int count) {
|
|
||||||
if(count < 41)
|
|
||||||
return 1.0f;
|
|
||||||
|
|
||||||
if(count > 80)
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
switch (count)
|
|
||||||
{
|
|
||||||
case 41: return 0.96f;
|
|
||||||
case 42: return 0.93f;
|
|
||||||
case 43: return 0.90f;
|
|
||||||
case 44: return 0.86f;
|
|
||||||
case 45: return 0.83f;
|
|
||||||
case 46: return 0.80f;
|
|
||||||
case 47: return 0.78f;
|
|
||||||
case 48: return 0.75f;
|
|
||||||
case 49: return 0.72f;
|
|
||||||
case 50: return 0.70f;
|
|
||||||
case 51: return 0.68f;
|
|
||||||
case 52: return 0.65f;
|
|
||||||
case 53: return 0.63f;
|
|
||||||
case 54: return 0.61f;
|
|
||||||
case 55: return 0.59f;
|
|
||||||
case 56: return 0.57f;
|
|
||||||
case 57: return 0.55f;
|
|
||||||
case 58: return 0.53f;
|
|
||||||
case 59: return 0.52f;
|
|
||||||
case 60: return 0.50f;
|
|
||||||
case 61: return 0.48f;
|
|
||||||
case 62: return 0.47f;
|
|
||||||
case 63: return 0.45f;
|
|
||||||
case 64: return 0.44f;
|
|
||||||
case 65: return 0.42f;
|
|
||||||
case 66: return 0.41f;
|
|
||||||
case 67: return 0.40f;
|
|
||||||
case 68: return 0.38f;
|
|
||||||
case 69: return 0.37f;
|
|
||||||
case 70: return 0.36f;
|
|
||||||
case 71: return 0.35f;
|
|
||||||
case 72: return 0.33f;
|
|
||||||
case 73: return 0.32f;
|
|
||||||
case 74: return 0.31f;
|
|
||||||
case 75: return 0.30f;
|
|
||||||
case 76: return 0.29f;
|
|
||||||
case 77: return 0.28f;
|
|
||||||
case 78: return 0.27f;
|
|
||||||
case 79: return 0.26f;
|
|
||||||
case 80: return 0.25f;
|
|
||||||
default: return 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void MineTracker(Mine mine){
|
|
||||||
Building tower = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
|
||||||
if(tower == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
float affectedRange = MBServerStatics.CHARACTER_LOAD_RANGE * 3;
|
|
||||||
mine.zergTracker.compileCurrent(tower.loc, affectedRange);
|
|
||||||
mine.zergTracker.sortByNation();
|
|
||||||
mine.zergTracker.compileLeaveQue(tower.loc, affectedRange);
|
|
||||||
mine.zergTracker.processLeaveQue();
|
|
||||||
mine.zergTracker.applyMultiplier(mine.capSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void PrintDetailsToClient(PlayerCharacter pc){
|
|
||||||
String newline = "\r\n ";
|
|
||||||
String outstring = newline + "ZERG MANAGER DETAILS FOR: " + pc.getFirstName() + newline;
|
|
||||||
Mine attended = null;
|
|
||||||
for(Mine mine : Mine.getMines()){
|
|
||||||
Building tower = BuildingManager.getBuilding(mine.getBuildingID());
|
|
||||||
if(tower == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
float rangeSquared = (MBServerStatics.CHARACTER_LOAD_RANGE * 3) * (MBServerStatics.CHARACTER_LOAD_RANGE * 3);
|
|
||||||
|
|
||||||
if(pc.loc.distanceSquared(tower.loc) < rangeSquared){
|
|
||||||
attended = mine;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(attended != null){
|
|
||||||
outstring += "Mine Cap: " + attended.capSize + newline;
|
|
||||||
Building tower = BuildingManager.getBuilding(attended.getBuildingID());
|
|
||||||
if(tower == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
ArrayList<PlayerCharacter> stillPresent = new ArrayList<>();
|
|
||||||
ArrayList<PlayerCharacter> gonePlayers = new ArrayList<>();
|
|
||||||
for(Integer countedID : attended.mineAttendees.keySet()){
|
|
||||||
PlayerCharacter counted = PlayerCharacter.getFromCache(countedID);
|
|
||||||
if(counted != null){
|
|
||||||
if(counted.guild.getNation().equals(pc.guild.getNation())) {
|
|
||||||
Long timeGone = System.currentTimeMillis() - attended.mineAttendees.get(countedID);
|
|
||||||
if(timeGone > 5000){
|
|
||||||
//outstring += counted.getFirstName() + " GONE FOR: " + timeGone/1000 + " SECONDS" + newline;
|
|
||||||
gonePlayers.add(counted);
|
|
||||||
}else{
|
|
||||||
//outstring += counted.getFirstName() + " STILL PRESENT" + newline;
|
|
||||||
stillPresent.add(counted);
|
|
||||||
}
|
|
||||||
count ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
outstring += newline + "TOTAL NATION MEMBERS COUNTED: " + count + newline;
|
|
||||||
outstring += newline + "PLAYERS PRESENT:" + newline;
|
|
||||||
for(PlayerCharacter present : stillPresent){
|
|
||||||
outstring += present.getFirstName() + newline;
|
|
||||||
}
|
|
||||||
outstring += newline + "PLAYERS GONE:" + newline;
|
|
||||||
for(PlayerCharacter gone : gonePlayers){
|
|
||||||
Long timeGone = System.currentTimeMillis() - attended.mineAttendees.get(gone.getObjectUUID());
|
|
||||||
if(timeGone > 5000) {
|
|
||||||
outstring += gone.getFirstName() + " GONE FOR: " + timeGone / 1000 + " SECONDS" + newline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
outstring += "Mine: Not Within Mine Distance" + newline;
|
|
||||||
}
|
|
||||||
|
|
||||||
outstring += newline + "Zerg Multiplier: " + pc.ZergMultiplier + newline;
|
|
||||||
|
|
||||||
ChatManager.chatSystemInfo(pc, outstring);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,12 +19,14 @@ import engine.objects.Building;
|
|||||||
import engine.objects.City;
|
import engine.objects.City;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class contains methods and structures which
|
* Class contains methods and structures which
|
||||||
@@ -107,6 +109,20 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the number of available hotZones
|
||||||
|
// remaining in this cycle (1am)
|
||||||
|
|
||||||
|
public static int availableHotZones() {
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for (Zone zone : ZoneManager.macroZones)
|
||||||
|
if (ZoneManager.validHotZone(zone))
|
||||||
|
count = count + 1;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
// Resets the availability of hotZones
|
// Resets the availability of hotZones
|
||||||
// for this cycle
|
// for this cycle
|
||||||
|
|
||||||
@@ -201,6 +217,63 @@ public enum ZoneManager {
|
|||||||
ZoneManager.playerCityZones.add(zone);
|
ZoneManager.playerCityZones.add(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final void generateAndSetRandomHotzone() {
|
||||||
|
|
||||||
|
Zone hotZone;
|
||||||
|
ArrayList<Integer> zoneArray = new ArrayList<>();
|
||||||
|
|
||||||
|
if (ZoneManager.macroZones.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Reset hotZone availability if none are left.
|
||||||
|
|
||||||
|
if (ZoneManager.availableHotZones() == 0)
|
||||||
|
ZoneManager.resetHotZones();
|
||||||
|
|
||||||
|
for (Zone zone : ZoneManager.macroZones)
|
||||||
|
if (validHotZone(zone))
|
||||||
|
zoneArray.add(zone.getObjectUUID());
|
||||||
|
|
||||||
|
int entryIndex = ThreadLocalRandom.current().nextInt(zoneArray.size());
|
||||||
|
|
||||||
|
hotZone = ZoneManager.getZoneByUUID(zoneArray.get(entryIndex));
|
||||||
|
|
||||||
|
if (hotZone == null) {
|
||||||
|
Logger.error("Hotzone is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZoneManager.setHotZone(hotZone);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final boolean validHotZone(Zone zone) {
|
||||||
|
|
||||||
|
if (zone.getSafeZone() == (byte) 1)
|
||||||
|
return false; // no safe zone hotzones// if (this.hotzone == null)
|
||||||
|
|
||||||
|
if (zone.getNodes().isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (zone.equals(ZoneManager.seaFloor))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//no duplicate hotZones
|
||||||
|
|
||||||
|
if (zone.hasBeenHotzone == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Enforce min level
|
||||||
|
|
||||||
|
if (zone.minLvl < Integer.parseInt(ConfigManager.MB_HOTZONE_MIN_LEVEL.getValue()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (ZoneManager.hotZone != null)
|
||||||
|
return ZoneManager.hotZone.getObjectUUID() != zone.getObjectUUID();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Converts world coordinates to coordinates local to a given zone.
|
// Converts world coordinates to coordinates local to a given zone.
|
||||||
|
|
||||||
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
|
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public abstract class AbstractJob implements Runnable {
|
|||||||
this.markStopRunTime();
|
this.markStopRunTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void doJob();
|
protected abstract void doJob();
|
||||||
|
|
||||||
public void executeJob(String threadName) {
|
public void executeJob(String threadName) {
|
||||||
this.workerID.set(threadName);
|
this.workerID.set(threadName);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class AbstractScheduleJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void doJob();
|
protected abstract void doJob();
|
||||||
|
|
||||||
public void cancelJob() {
|
public void cancelJob() {
|
||||||
JobScheduler.getInstance().cancelScheduledJob(this);
|
JobScheduler.getInstance().cancelScheduledJob(this);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class JobContainer implements Comparable<JobContainer> {
|
|||||||
final long timeOfExecution;
|
final long timeOfExecution;
|
||||||
final boolean noTimer;
|
final boolean noTimer;
|
||||||
|
|
||||||
public JobContainer(AbstractJob job, long timeOfExecution) {
|
JobContainer(AbstractJob job, long timeOfExecution) {
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
throw new IllegalArgumentException("No 'null' jobs allowed.");
|
throw new IllegalArgumentException("No 'null' jobs allowed.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
package engine.job;
|
|
||||||
|
|
||||||
import engine.server.world.WorldServer;
|
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
|
||||||
|
|
||||||
public class JobThread implements Runnable {
|
|
||||||
private final AbstractJob currentJob;
|
|
||||||
private final ReentrantLock lock = new ReentrantLock();
|
|
||||||
|
|
||||||
private static Long nextThreadPrint;
|
|
||||||
|
|
||||||
public JobThread(AbstractJob job){
|
|
||||||
this.currentJob = job;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
if (this.currentJob != null) {
|
|
||||||
if (lock.tryLock(5, TimeUnit.SECONDS)) { // Timeout to prevent deadlock
|
|
||||||
try {
|
|
||||||
this.currentJob.doJob();
|
|
||||||
} finally {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Logger.warn("JobThread could not acquire lock in time, skipping job.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void startJobThread(AbstractJob job){
|
|
||||||
JobThread jobThread = new JobThread(job);
|
|
||||||
Thread thread = new Thread(jobThread);
|
|
||||||
thread.setName("JOB THREAD: " + job.getWorkerID());
|
|
||||||
thread.start();
|
|
||||||
|
|
||||||
if(JobThread.nextThreadPrint == null){
|
|
||||||
JobThread.nextThreadPrint = System.currentTimeMillis();
|
|
||||||
}else{
|
|
||||||
if(JobThread.nextThreadPrint < System.currentTimeMillis()){
|
|
||||||
JobThread.tryPrintThreads();
|
|
||||||
JobThread.nextThreadPrint = System.currentTimeMillis() + 10000L;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void tryPrintThreads(){
|
|
||||||
ThreadGroup rootGroup = Thread.currentThread().getThreadGroup();
|
|
||||||
while (rootGroup.getParent() != null) {
|
|
||||||
rootGroup = rootGroup.getParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Estimate the number of threads
|
|
||||||
int activeThreads = rootGroup.activeCount();
|
|
||||||
|
|
||||||
// Create an array to hold the threads
|
|
||||||
Thread[] threads = new Thread[activeThreads];
|
|
||||||
|
|
||||||
// Get the active threads
|
|
||||||
rootGroup.enumerate(threads, true);
|
|
||||||
|
|
||||||
int availableThreads = Runtime.getRuntime().availableProcessors();
|
|
||||||
|
|
||||||
// Print the count
|
|
||||||
if(threads.length > 30)
|
|
||||||
Logger.info("Total threads in application: " + threads.length + " / " + availableThreads);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -58,13 +58,10 @@ public class JobWorker extends ControlledRunnable {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// execute the new job..
|
// execute the new job..
|
||||||
//this.currentJob.executeJob(this.getThreadName());
|
this.currentJob.executeJob(this.getThreadName());
|
||||||
if(this.currentJob != null) {
|
this.currentJob = null;
|
||||||
JobThread.startJobThread(this.currentJob);
|
|
||||||
this.currentJob = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Thread.yield();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract void doJob();
|
protected abstract void doJob();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected abstract void _cancelJob();
|
protected abstract void _cancelJob();
|
||||||
@@ -117,7 +117,7 @@ public abstract class AbstractEffectJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void endEffect() {
|
public void endEffect() {
|
||||||
if (this.eb == null || this.power == null)
|
if (this.eb == null)
|
||||||
return;
|
return;
|
||||||
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
this.eb.endEffect(this.source, this.target, this.trains, this.power, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
City city;
|
City city;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class AttackJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
CombatManager.doCombat(this.source, slot);
|
CombatManager.doCombat(this.source, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class BaneDefaultTimeJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
//bane already set.
|
//bane already set.
|
||||||
if (this.bane.getLiveDate() != null) {
|
if (this.bane.getLiveDate() != null) {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class BasicScheduledJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (execution == null) {
|
if (execution == null) {
|
||||||
Logger.error("BasicScheduledJob executed with nothing to execute.");
|
Logger.error("BasicScheduledJob executed with nothing to execute.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class BonusCalcJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.ac != null) {
|
if (this.ac != null) {
|
||||||
this.ac.applyBonuses();
|
this.ac.applyBonuses();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class CSessionCleanupJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
SessionManager.cSessionCleanup(secKey);
|
SessionManager.cSessionCleanup(secKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class ChangeAltitudeJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.ac != null)
|
if (this.ac != null)
|
||||||
MovementManager.finishChangeAltitude(ac, targetAlt);
|
MovementManager.finishChangeAltitude(ac, targetAlt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ChantJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
if (this.aej == null || this.source == null || this.target == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
||||||
return;
|
return;
|
||||||
PlayerBonuses bonuses = null;
|
PlayerBonuses bonuses = null;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class CloseGateJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (building == null) {
|
if (building == null) {
|
||||||
Logger.error("Rungate building was null");
|
Logger.error("Rungate building was null");
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class DamageOverTimeJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.target.getObjectType().equals(GameObjectType.Building)
|
if (this.target.getObjectType().equals(GameObjectType.Building)
|
||||||
&& ((Building) this.target).isVulnerable() == false) {
|
&& ((Building) this.target).isVulnerable() == false) {
|
||||||
_cancelJob();
|
_cancelJob();
|
||||||
@@ -60,8 +60,6 @@ public class DamageOverTimeJob extends AbstractEffectJob {
|
|||||||
|
|
||||||
if (this.iteration < 0) {
|
if (this.iteration < 0) {
|
||||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(source))
|
|
||||||
eb.startEffect((AbstractCharacter) this.source, this.target, this.trains, this);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.skipSendEffect = true;
|
this.skipSendEffect = true;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class DatabaseUpdateJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.ago == null)
|
if (this.ago == null)
|
||||||
return;
|
return;
|
||||||
ago.removeDatabaseJob(this.type, false);
|
ago.removeDatabaseJob(this.type, false);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class DebugTimerJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.pc == null) {
|
if (this.pc == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class DeferredPowerJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
//Power ended with no attack, cancel weapon power boost
|
//Power ended with no attack, cancel weapon power boost
|
||||||
if (this.source != null && this.source instanceof PlayerCharacter) {
|
if (this.source != null && this.source instanceof PlayerCharacter) {
|
||||||
((PlayerCharacter) this.source).setWeaponPower(null);
|
((PlayerCharacter) this.source).setWeaponPower(null);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class DisconnectJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.origin != null) {
|
if (this.origin != null) {
|
||||||
this.origin.disconnect();
|
this.origin.disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class DoorCloseJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
int doorNumber;
|
int doorNumber;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class EndFearJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
//cancel fear for mob.
|
//cancel fear for mob.
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class FinishCooldownTimeJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
PowersManager.finishCooldownTime(this.msg, this.pc);
|
PowersManager.finishCooldownTime(this.msg, this.pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class FinishEffectTimeJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class FinishRecycleTimeJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
PowersManager.finishRecycleTime(this.msg, this.pc, false);
|
PowersManager.finishRecycleTime(this.msg, this.pc, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class FinishSpireEffectJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
PlayerCharacter pc = (PlayerCharacter) target;
|
PlayerCharacter pc = (PlayerCharacter) target;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.target == null)
|
if (this.target == null)
|
||||||
return;
|
return;
|
||||||
@@ -47,13 +47,13 @@ public class FinishSummonsJob extends AbstractScheduleJob {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// cannot summon a player in combat
|
// cannot summon a player in combat
|
||||||
//if (this.target.isCombat()) {
|
if (this.target.isCombat()) {
|
||||||
|
|
||||||
// ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
ErrorPopupMsg.sendErrorMsg(this.source, "Cannot summon player in combat.");
|
||||||
|
|
||||||
// PowersManager.finishRecycleTime(428523680, this.source, false);
|
PowersManager.finishRecycleTime(428523680, this.source, false);
|
||||||
// return;
|
return;
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
|
if (this.target.getBonuses() != null && this.target.getBonuses().getBool(ModType.BlockedPowerType, SourceType.SUMMON)) {
|
||||||
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
|
ErrorPopupMsg.sendErrorMsg(this.target, "You have been blocked from receiving summons!");
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class LoadEffectsJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.originToSend == null) {
|
if (this.originToSend == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class LogoutCharacterJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
server.logoutCharacter(this.pc);
|
server.logoutCharacter(this.pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class NoTimeJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -40,18 +40,11 @@ public class PersistentAoeJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.aej == null || this.source == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
if (this.aej == null || this.source == null || this.action == null || this.power == null || this.source == null || this.eb == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
|
||||||
if (!this.target.isAlive())
|
|
||||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
|
||||||
}catch(Exception e){
|
|
||||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.source.isAlive())
|
if (!this.source.isAlive())
|
||||||
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
PowersManager.finishEffectTime(this.source, this.target, this.action, this.trains);
|
||||||
else if (this.iteration < this.power.getChantIterations()) {
|
else if (this.iteration < this.power.getChantIterations()) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class RefreshGroupJob extends AbstractJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.pc == null || this.origin == null || grp == null) {
|
if (this.pc == null || this.origin == null || grp == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class RemoveCorpseJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.corpse != null)
|
if (this.corpse != null)
|
||||||
Corpse.removeCorpse(corpse, true);
|
Corpse.removeCorpse(corpse, true);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class SiegeSpireWithdrawlJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (spire == null)
|
if (spire == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class StuckJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
Vector3fImmutable stuckLoc;
|
Vector3fImmutable stuckLoc;
|
||||||
Building building = null;
|
Building building = null;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class SummonSendJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.source == null)
|
if (this.source == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class TeleportJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.pc == null || this.npc == null || this.origin == null)
|
if (this.pc == null || this.npc == null || this.origin == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class TrackJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.tpa == null || this.target == null || this.action == null || this.source == null || this.eb == null || !(this.source instanceof PlayerCharacter))
|
if (this.tpa == null || this.target == null || this.action == null || this.source == null || this.eb == null || !(this.source instanceof PlayerCharacter))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class TransferStatOTJob extends AbstractEffectJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
if (this.dot == null || this.target == null || this.action == null || this.source == null || this.eb == null || this.action == null || this.power == null)
|
if (this.dot == null || this.target == null || this.action == null || this.source == null || this.eb == null || this.action == null || this.power == null)
|
||||||
return;
|
return;
|
||||||
if (!this.target.isAlive()) {
|
if (!this.target.isAlive()) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class UpdateGroupJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
if (this.group == null)
|
if (this.group == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package engine.jobs;
|
package engine.jobs;
|
||||||
|
|
||||||
import engine.gameManager.ZoneManager;
|
|
||||||
import engine.job.AbstractScheduleJob;
|
import engine.job.AbstractScheduleJob;
|
||||||
import engine.objects.Building;
|
import engine.objects.Building;
|
||||||
import engine.objects.City;
|
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -22,7 +20,7 @@ public class UpgradeBuildingJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
|
|
||||||
// Must have a building to rank!
|
// Must have a building to rank!
|
||||||
@@ -43,18 +41,6 @@ public class UpgradeBuildingJob extends AbstractScheduleJob {
|
|||||||
|
|
||||||
rankingBuilding.setRank(rankingBuilding.getRank() + 1);
|
rankingBuilding.setRank(rankingBuilding.getRank() + 1);
|
||||||
|
|
||||||
if(rankingBuilding.getBlueprint().isWallPiece()){
|
|
||||||
City cityObject = ZoneManager.getCityAtLocation(rankingBuilding.loc);
|
|
||||||
if(cityObject.getTOL().getRank() == 8) {
|
|
||||||
if (rankingBuilding.getBlueprint() != null && rankingBuilding.getBlueprint().getBuildingGroup() != null && rankingBuilding.getBlueprint().isWallPiece()) {
|
|
||||||
float currentHealthRatio = rankingBuilding.getCurrentHitpoints() / rankingBuilding.healthMax;
|
|
||||||
float newMax = rankingBuilding.healthMax * 1.1f;
|
|
||||||
rankingBuilding.setMaxHitPoints(newMax);
|
|
||||||
rankingBuilding.setHealth(rankingBuilding.healthMax * currentHealthRatio);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reload the object
|
// Reload the object
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class UpgradeNPCJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
|
|
||||||
int newRank;
|
int newRank;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class UseItemJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
PowersManager.finishApplyPower(ac, target, Vector3fImmutable.ZERO, pb, trains, liveCounter);
|
PowersManager.finishApplyPower(ac, target, Vector3fImmutable.ZERO, pb, trains, liveCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class UseMobPowerJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
PowersManager.finishUseMobPower(this.msg, this.caster, casterLiveCounter, targetLiveCounter);
|
PowersManager.finishUseMobPower(this.msg, this.caster, casterLiveCounter, targetLiveCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class UsePowerJob extends AbstractScheduleJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doJob() {
|
protected void doJob() {
|
||||||
PowersManager.finishUsePower(this.msg, this.pc, casterLiveCounter, targetLiveCounter);
|
PowersManager.finishUsePower(this.msg, this.pc, casterLiveCounter, targetLiveCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,10 @@
|
|||||||
package engine.loot;
|
package engine.loot;
|
||||||
|
|
||||||
import engine.gameManager.LootManager;
|
import engine.gameManager.LootManager;
|
||||||
import org.pmw.tinylog.Logger;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
public class ItemTableEntry {
|
public class ItemTableEntry {
|
||||||
public int minRoll;
|
public int minRoll;
|
||||||
@@ -37,23 +35,11 @@ public class ItemTableEntry {
|
|||||||
List<ItemTableEntry> itemTableEntryList;
|
List<ItemTableEntry> itemTableEntryList;
|
||||||
|
|
||||||
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||||
if(itemTableEntryList != null) {
|
|
||||||
for (ItemTableEntry iteration : itemTableEntryList)
|
for (ItemTableEntry iteration : itemTableEntryList)
|
||||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
itemTableEntry = iteration;
|
itemTableEntry = iteration;
|
||||||
}
|
|
||||||
return itemTableEntry;
|
return itemTableEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getRandomItem(int itemTable) {
|
|
||||||
int id = 0;
|
|
||||||
List<ItemTableEntry> itemTableEntryList;
|
|
||||||
|
|
||||||
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
|
||||||
|
|
||||||
if(itemTableEntryList != null && itemTableEntryList.size() > 1){
|
|
||||||
id = itemTableEntryList.get(ThreadLocalRandom.current().nextInt(0, itemTableEntryList.size())).cacheID;
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ public class ModTableEntry {
|
|||||||
List<ModTableEntry> itemTableEntryList;
|
List<ModTableEntry> itemTableEntryList;
|
||||||
|
|
||||||
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||||
if(itemTableEntryList != null) {
|
|
||||||
for (ModTableEntry iteration : itemTableEntryList)
|
for (ModTableEntry iteration : itemTableEntryList)
|
||||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
modTableEntry = iteration;
|
modTableEntry = iteration;
|
||||||
}
|
|
||||||
return modTableEntry;
|
return modTableEntry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class Bounds {
|
|||||||
//player is inside building region, skip collision check. we only do collision from the outside.
|
//player is inside building region, skip collision check. we only do collision from the outside.
|
||||||
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
||||||
continue;
|
continue;
|
||||||
if (building.getBounds() == null || building.getBounds().colliders == null)
|
if (building.getBounds().colliders == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Colliders collider : building.getBounds().colliders) {
|
for (Colliders collider : building.getBounds().colliders) {
|
||||||
|
|||||||
@@ -1,266 +0,0 @@
|
|||||||
package engine.mobileAI.Behaviours;
|
|
||||||
|
|
||||||
import engine.Enum;
|
|
||||||
import engine.InterestManagement.InterestManager;
|
|
||||||
import engine.InterestManagement.WorldGrid;
|
|
||||||
import engine.math.Vector3fImmutable;
|
|
||||||
import engine.mobileAI.utilities.CombatUtilities;
|
|
||||||
import engine.mobileAI.utilities.MovementUtilities;
|
|
||||||
import engine.objects.*;
|
|
||||||
import engine.server.MBServerStatics;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
public class StandardMob {
|
|
||||||
|
|
||||||
public static void run(Mob mob){
|
|
||||||
|
|
||||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
if(inRange.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!mob.isAlive()){
|
|
||||||
CheckForRespawn(mob);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mob.isMoving()) {
|
|
||||||
mob.setLoc(mob.getMovementLoc());
|
|
||||||
mob.updateLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mob.combatTarget == null) {
|
|
||||||
if (!inRange.isEmpty()) {
|
|
||||||
CheckForAggro(mob);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
CheckToDropCombatTarget(mob);
|
|
||||||
if(mob.combatTarget == null){
|
|
||||||
CheckForAggro(mob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(MovementUtilities.canMove(mob))
|
|
||||||
CheckForMovement(mob);
|
|
||||||
|
|
||||||
if(mob.combatTarget != null && !mob.isMoving())
|
|
||||||
CheckForAttack(mob);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CheckToDropCombatTarget(Mob mob){
|
|
||||||
|
|
||||||
if(!mob.combatTarget.isAlive()){
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)){
|
|
||||||
PlayerCharacter pcTarget = (PlayerCharacter) mob.combatTarget;
|
|
||||||
if (!mob.canSee(pcTarget)) {
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mob.bindLoc.distanceSquared(mob.combatTarget.loc) > 90 * 90){
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CheckForRespawn(Mob mob){
|
|
||||||
if (mob.deathTime == 0) {
|
|
||||||
mob.setDeathTime(System.currentTimeMillis());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mob.despawned) {
|
|
||||||
if (mob.getCharItemManager().getInventoryCount() > 0) {
|
|
||||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_WITH_LOOT) {
|
|
||||||
mob.despawn();
|
|
||||||
mob.deathTime = System.currentTimeMillis();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//No items in inventory.
|
|
||||||
} else if (mob.isHasLoot()) {
|
|
||||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
|
||||||
mob.despawn();
|
|
||||||
mob.deathTime = System.currentTimeMillis();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//Mob never had Loot.
|
|
||||||
} else {
|
|
||||||
if (System.currentTimeMillis() > mob.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
|
||||||
mob.despawn();
|
|
||||||
mob.deathTime = System.currentTimeMillis();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Mob.discDroppers.contains(mob))
|
|
||||||
return;
|
|
||||||
float baseRespawnTimer = mob.spawnTime;
|
|
||||||
float reduction = (100-mob.level) * 0.01f;
|
|
||||||
float reducedRespawnTime = baseRespawnTimer * (1.0f - reduction);
|
|
||||||
float respawnTimer = reducedRespawnTime * 1000f;
|
|
||||||
if (System.currentTimeMillis() > (mob.deathTime + respawnTimer)) {
|
|
||||||
Zone.respawnQue.add(mob);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CheckForAggro(Mob mob){
|
|
||||||
|
|
||||||
if(mob == null || !mob.isAlive() || mob.playerAgroMap.isEmpty()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mob.BehaviourType.isAgressive)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.HamletGuard)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mob.hate_values == null)
|
|
||||||
mob.hate_values = new HashMap<>();
|
|
||||||
|
|
||||||
if(mob.combatTarget != null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc, 60f, MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
if(inRange.isEmpty()){
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//clear out any players who are not in hated range anymore
|
|
||||||
ArrayList<PlayerCharacter> toRemove = new ArrayList<>();
|
|
||||||
for(PlayerCharacter pc : mob.hate_values.keySet()){
|
|
||||||
if(!inRange.contains(pc))
|
|
||||||
toRemove.add(pc);
|
|
||||||
}
|
|
||||||
for(PlayerCharacter pc : toRemove){
|
|
||||||
mob.hate_values.remove(pc);
|
|
||||||
}
|
|
||||||
|
|
||||||
//find most hated target
|
|
||||||
PlayerCharacter mostHated = null;
|
|
||||||
for(AbstractWorldObject awo : inRange){
|
|
||||||
PlayerCharacter loadedPlayer = (PlayerCharacter)awo;
|
|
||||||
if (loadedPlayer == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Player is Dead, Mob no longer needs to attempt to aggro. Remove them from aggro map.
|
|
||||||
if (!loadedPlayer.isAlive())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Can't see target, skip aggro.
|
|
||||||
if (!mob.canSee(loadedPlayer))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// No aggro for this race type
|
|
||||||
if (mob.notEnemy != null && mob.notEnemy.size() > 0 && mob.notEnemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//mob has enemies and this player race is not it
|
|
||||||
if (mob.enemy != null && mob.enemy.size() > 0 && !mob.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(mostHated == null)
|
|
||||||
mostHated = loadedPlayer;
|
|
||||||
|
|
||||||
if(mob.hate_values.containsKey(loadedPlayer))
|
|
||||||
if(mob.hate_values.get(loadedPlayer) > mob.hate_values.get(mostHated))
|
|
||||||
mostHated = loadedPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mostHated != null)
|
|
||||||
mob.setCombatTarget(mostHated);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CheckForMovement(Mob mob){
|
|
||||||
|
|
||||||
if(!mob.BehaviourType.canRoam)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.combatTarget != null){
|
|
||||||
//chase player
|
|
||||||
if(!CombatUtilities.inRange2D(mob,mob.combatTarget,mob.getRange())) {
|
|
||||||
if(mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
|
||||||
PlayerCharacter target = (PlayerCharacter)mob.combatTarget;
|
|
||||||
if(target.isMoving()){
|
|
||||||
MovementUtilities.aiMove(mob, mob.combatTarget.loc, false);
|
|
||||||
return;
|
|
||||||
}else{
|
|
||||||
Vector3fImmutable smoothLoc = Vector3fImmutable.getRandomPointOnCircle(mob.combatTarget.loc,mob.getRange() -1);
|
|
||||||
MovementUtilities.aiMove(mob, smoothLoc, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MovementUtilities.aiMove(mob, mob.combatTarget.loc, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
//patrol
|
|
||||||
if (mob.isMoving()) {
|
|
||||||
mob.stopPatrolTime = System.currentTimeMillis();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(mob.stopPatrolTime + 5000L < System.currentTimeMillis()) {
|
|
||||||
Vector3fImmutable patrolPoint = Vector3fImmutable.getRandomPointOnCircle(mob.bindLoc, 40f);
|
|
||||||
MovementUtilities.aiMove(mob, patrolPoint, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CheckForAttack(Mob mob){
|
|
||||||
|
|
||||||
if(mob.isMoving())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.getLastAttackTime() > System.currentTimeMillis())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (mob.BehaviourType.callsForHelp)
|
|
||||||
MobCallForHelp(mob);
|
|
||||||
|
|
||||||
ItemBase mainHand = mob.getWeaponItemBase(true);
|
|
||||||
ItemBase offHand = mob.getWeaponItemBase(false);
|
|
||||||
|
|
||||||
if(!CombatUtilities.inRangeToAttack(mob,mob.combatTarget))
|
|
||||||
return;
|
|
||||||
|
|
||||||
InterestManager.setObjectDirty(mob);
|
|
||||||
|
|
||||||
if (mainHand == null && offHand == null) {
|
|
||||||
CombatUtilities.combatCycle(mob, mob.combatTarget, true, null);
|
|
||||||
int delay = 3000;
|
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
|
||||||
} else if (mob.getWeaponItemBase(true) != null) {
|
|
||||||
int delay = 3000;
|
|
||||||
CombatUtilities.combatCycle(mob, mob.combatTarget, true, mob.getWeaponItemBase(true));
|
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + delay);
|
|
||||||
} else if (mob.getWeaponItemBase(false) != null) {
|
|
||||||
int attackDelay = 3000;
|
|
||||||
CombatUtilities.combatCycle(mob, mob.combatTarget, false, mob.getWeaponItemBase(false));
|
|
||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void MobCallForHelp(Mob mob){
|
|
||||||
HashSet<AbstractWorldObject> mobs = WorldGrid.getObjectsInRangePartial(mob.loc,60f, MBServerStatics.MASK_MOB);
|
|
||||||
for(AbstractWorldObject awo : mobs){
|
|
||||||
Mob responder = (Mob)awo;
|
|
||||||
if(responder.combatTarget == null)
|
|
||||||
if(MovementUtilities.canMove(responder))
|
|
||||||
MovementUtilities.aiMove(responder,mob.loc,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+148
-301
@@ -9,18 +9,17 @@
|
|||||||
package engine.mobileAI;
|
package engine.mobileAI;
|
||||||
|
|
||||||
import engine.Enum;
|
import engine.Enum;
|
||||||
import engine.InterestManagement.InterestManager;
|
import engine.Enum.DispatchChannel;
|
||||||
import engine.InterestManagement.WorldGrid;
|
import engine.InterestManagement.WorldGrid;
|
||||||
import engine.gameManager.*;
|
import engine.gameManager.*;
|
||||||
import engine.math.Vector3f;
|
import engine.math.Vector3f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.mobileAI.Behaviours.StandardMob;
|
|
||||||
import engine.mobileAI.Threads.MobAIThread;
|
import engine.mobileAI.Threads.MobAIThread;
|
||||||
import engine.mobileAI.utilities.CombatUtilities;
|
import engine.mobileAI.utilities.CombatUtilities;
|
||||||
import engine.mobileAI.utilities.MovementUtilities;
|
import engine.mobileAI.utilities.MovementUtilities;
|
||||||
import engine.net.DispatchMessage;
|
import engine.net.DispatchMessage;
|
||||||
import engine.net.client.msg.PerformActionMsg;
|
import engine.net.client.msg.PerformActionMsg;
|
||||||
import engine.net.client.msg.UpdateStateMsg;
|
import engine.net.client.msg.PowerProjectileMsg;
|
||||||
import engine.objects.*;
|
import engine.objects.*;
|
||||||
import engine.powers.ActionsBase;
|
import engine.powers.ActionsBase;
|
||||||
import engine.powers.PowersBase;
|
import engine.powers.PowersBase;
|
||||||
@@ -28,7 +27,6 @@ import engine.server.MBServerStatics;
|
|||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -51,7 +49,6 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//mob casting disabled
|
|
||||||
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) {
|
if (target.getObjectType() == Enum.GameObjectType.PlayerCharacter && canCast(mob)) {
|
||||||
|
|
||||||
if (mob.isPlayerGuard() == false && MobCast(mob)) {
|
if (mob.isPlayerGuard() == false && MobCast(mob)) {
|
||||||
@@ -85,18 +82,8 @@ public class MobAI {
|
|||||||
|
|
||||||
mob.updateLocation();
|
mob.updateLocation();
|
||||||
|
|
||||||
if(mob.StrongholdGuardian || mob.StrongholdEpic){
|
|
||||||
// attempt to ground all players in attack range
|
|
||||||
for(int i : mob.playerAgroMap.keySet()){
|
|
||||||
PlayerCharacter tar = PlayerCharacter.getFromCache(i);
|
|
||||||
if(tar != null && tar.loc.distanceSquared(mob.loc) < 80){
|
|
||||||
PowersManager.applyPower(mob,tar,tar.loc, 111111,40,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,16 +96,10 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(target.getPet() != null && target.getPet().isAlive() && !target.getPet().isSiege()){
|
|
||||||
//mob.setCombatTarget(target.getPet());
|
|
||||||
//AttackTarget(mob,mob.combatTarget);
|
|
||||||
//return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (mob.BehaviourType.callsForHelp)
|
if (mob.BehaviourType.callsForHelp)
|
||||||
MobCallForHelp(mob);
|
MobCallForHelp(mob);
|
||||||
|
|
||||||
if (MovementUtilities.outOfAggroRange(mob, target)) {
|
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -135,9 +116,6 @@ public class MobAI {
|
|||||||
if (mob.isMoving() && mob.getRange() > 20)
|
if (mob.isMoving() && mob.getRange() > 20)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(target.combatStats == null)
|
|
||||||
target.combatStats = new PlayerCombatStats(target);
|
|
||||||
|
|
||||||
// add timer for last attack.
|
// add timer for last attack.
|
||||||
|
|
||||||
ItemBase mainHand = mob.getWeaponItemBase(true);
|
ItemBase mainHand = mob.getWeaponItemBase(true);
|
||||||
@@ -168,14 +146,8 @@ public class MobAI {
|
|||||||
if (target.getPet().getCombatTarget() == null && target.getPet().assist == true)
|
if (target.getPet().getCombatTarget() == null && target.getPet().assist == true)
|
||||||
target.getPet().setCombatTarget(mob);
|
target.getPet().setCombatTarget(mob);
|
||||||
|
|
||||||
try{
|
|
||||||
InterestManager.forceLoad(mob);
|
|
||||||
}catch(Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -184,9 +156,6 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(mob == null || target == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
@@ -196,8 +165,8 @@ public class MobAI {
|
|||||||
|
|
||||||
if (playercity != null)
|
if (playercity != null)
|
||||||
for (Mob guard : playercity.getParent().zoneMobSet)
|
for (Mob guard : playercity.getParent().zoneMobSet)
|
||||||
if (guard.BehaviourType != null && guard.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
|
if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||||
if (guard.getCombatTarget() == null && guard.getGuild() != null && mob.getGuild() != null && !guard.getGuild().equals(mob.getGuild()))
|
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
|
||||||
guard.setCombatTarget(mob);
|
guard.setCombatTarget(mob);
|
||||||
|
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
@@ -226,14 +195,14 @@ public class MobAI {
|
|||||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (mob.isSiege()) {
|
if (mob.isSiege()) {
|
||||||
// PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||||
// ppm.setRange(50);
|
ppm.setRange(50);
|
||||||
// DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||||
//}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,8 +215,6 @@ public class MobAI {
|
|||||||
|
|
||||||
//no weapons, default mob attack speed 3 seconds.
|
//no weapons, default mob attack speed 3 seconds.
|
||||||
|
|
||||||
//MobVsMobRetaliate(target,mob);
|
|
||||||
|
|
||||||
ItemBase mainHand = mob.getWeaponItemBase(true);
|
ItemBase mainHand = mob.getWeaponItemBase(true);
|
||||||
ItemBase offHand = mob.getWeaponItemBase(false);
|
ItemBase offHand = mob.getWeaponItemBase(false);
|
||||||
|
|
||||||
@@ -274,7 +241,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackMob" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +294,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackTarget" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,36 +308,33 @@ public class MobAI {
|
|||||||
if (mob == null)
|
if (mob == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mob.mobPowers == null || mob.mobPowers.isEmpty())
|
if(mob.isPlayerGuard == true){
|
||||||
return false;
|
|
||||||
|
|
||||||
if(mob.nextCastTime > System.currentTimeMillis())
|
int contractID;
|
||||||
return false;
|
|
||||||
|
|
||||||
mob.nextCastTime = System.currentTimeMillis() + 30000L;
|
if(mob.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion))
|
||||||
|
|
||||||
if(mob.isPlayerGuard){
|
|
||||||
|
|
||||||
int contractID = 0;
|
|
||||||
|
|
||||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion) && mob.npcOwner != null)
|
|
||||||
contractID = mob.npcOwner.contract.getContractID();
|
contractID = mob.npcOwner.contract.getContractID();
|
||||||
else if(mob.contract != null)
|
else
|
||||||
contractID = mob.contract.getContractID();
|
contractID = mob.contract.getContractID();
|
||||||
|
|
||||||
if(Enum.MinionType.ContractToMinionMap.containsKey(contractID) && !Enum.MinionType.ContractToMinionMap.get(contractID).isMage())
|
if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mob.mobPowers.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
|
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (mob.nextCastTime == 0)
|
||||||
|
mob.nextCastTime = System.currentTimeMillis();
|
||||||
|
|
||||||
return true;
|
return mob.nextCastTime <= System.currentTimeMillis();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: canCast" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: canCast" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -424,9 +388,6 @@ public class MobAI {
|
|||||||
|
|
||||||
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||||
|
|
||||||
if(mobPower.powerCategory.equals(Enum.PowerCategoryType.DEBUFF))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//check for hit-roll
|
//check for hit-roll
|
||||||
|
|
||||||
if (mobPower.requiresHitRoll)
|
if (mobPower.requiresHitRoll)
|
||||||
@@ -439,7 +400,7 @@ public class MobAI {
|
|||||||
|
|
||||||
PerformActionMsg msg;
|
PerformActionMsg msg;
|
||||||
|
|
||||||
if (!mob.StrongholdCommander && !mob.StrongholdEpic && (!mobPower.isHarmful() || mobPower.targetSelf)) {
|
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||||
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||||
} else {
|
} else {
|
||||||
@@ -448,15 +409,15 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg.setUnknown04(2);
|
msg.setUnknown04(2);
|
||||||
try {
|
|
||||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||||
}catch(Exception e) {
|
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||||
return false;
|
|
||||||
}
|
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -575,10 +536,11 @@ public class MobAI {
|
|||||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||||
|
|
||||||
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000) * MobAIThread.AI_CAST_FREQUENCY);
|
||||||
|
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -614,7 +576,7 @@ public class MobAI {
|
|||||||
mob.nextCallForHelp = System.currentTimeMillis() + 60000;
|
mob.nextCallForHelp = System.currentTimeMillis() + 60000;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCallForHelp" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCallForHelp" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,37 +584,6 @@ public class MobAI {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (HellgateManager.hellgate_mobs != null && HellgateManager.hellgate_mobs.contains(mob)) {
|
|
||||||
HellgateManager.SpecialMobAIHandler(mob);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HellgateManager.hellgate_mini_bosses != null && HellgateManager.hellgate_mini_bosses.contains(mob)) {
|
|
||||||
HellgateManager.SpecialMobAIHandler(mob);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(HellgateManager.hellgate_boss != null && mob.equals(HellgateManager.hellgate_boss)){
|
|
||||||
HellgateManager.SpecialMobAIHandler(mob);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//boolean override = true;
|
|
||||||
//switch (mob.BehaviourType) {
|
|
||||||
// case GuardCaptain:
|
|
||||||
// case GuardMinion:
|
|
||||||
// case GuardWallArcher:
|
|
||||||
// case Pet1:
|
|
||||||
// case HamletGuard:
|
|
||||||
// override = false;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//if(override){
|
|
||||||
// if(!mob.isSiege()) {
|
|
||||||
// StandardMob.run(mob);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//always check the respawn que, respawn 1 mob max per second to not flood the client
|
//always check the respawn que, respawn 1 mob max per second to not flood the client
|
||||||
|
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
@@ -694,6 +625,9 @@ public class MobAI {
|
|||||||
|
|
||||||
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
|
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
|
||||||
|
|
||||||
|
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||||
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,11 +646,7 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mob.isAlive())
|
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||||
if(!mob.getMovementLoc().equals(Vector3fImmutable.ZERO))
|
|
||||||
mob.setLoc(mob.getMovementLoc());
|
|
||||||
|
|
||||||
if(mob.isPet() == false && mob.isPlayerGuard == false)
|
|
||||||
CheckToSendMobHome(mob);
|
CheckToSendMobHome(mob);
|
||||||
|
|
||||||
if (mob.getCombatTarget() != null) {
|
if (mob.getCombatTarget() != null) {
|
||||||
@@ -742,7 +672,6 @@ public class MobAI {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//mob.refresh();
|
|
||||||
|
|
||||||
switch (mob.BehaviourType) {
|
switch (mob.BehaviourType) {
|
||||||
case GuardCaptain:
|
case GuardCaptain:
|
||||||
@@ -767,14 +696,12 @@ public class MobAI {
|
|||||||
if(mob.isAlive())
|
if(mob.isAlive())
|
||||||
RecoverHealth(mob);
|
RecoverHealth(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckForAggro(Mob aiAgent) {
|
private static void CheckForAggro(Mob aiAgent) {
|
||||||
|
|
||||||
|
|
||||||
//old system
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//looks for and sets mobs combatTarget
|
//looks for and sets mobs combatTarget
|
||||||
@@ -809,11 +736,13 @@ public class MobAI {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// No aggro for this race type
|
// No aggro for this race type
|
||||||
if (aiAgent.notEnemy.size() > 0 && aiAgent.notEnemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
|
||||||
|
if (aiAgent.notEnemy.size() > 0 && aiAgent.notEnemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()) == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//mob has enemies and this player race is not it
|
//mob has enemies and this player race is not it
|
||||||
if (aiAgent.enemy.size() > 0 && !aiAgent.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
|
||||||
|
if (aiAgent.enemy.size() > 0 && aiAgent.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()) == false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (MovementUtilities.inRangeToAggro(aiAgent, loadedPlayer)) {
|
if (MovementUtilities.inRangeToAggro(aiAgent, loadedPlayer)) {
|
||||||
@@ -842,7 +771,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForAggro" + " " + e.getMessage());
|
Logger.info(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForAggro" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,7 +832,7 @@ public class MobAI {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,38 +857,31 @@ public class MobAI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//No items in inventory.
|
//No items in inventory.
|
||||||
} else if (aiAgent.isHasLoot()) {
|
|
||||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
|
||||||
aiAgent.despawn();
|
|
||||||
aiAgent.deathTime = System.currentTimeMillis();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//Mob never had Loot.
|
|
||||||
} else {
|
} else {
|
||||||
|
//Mob's Loot has been looted.
|
||||||
|
if (aiAgent.isHasLoot()) {
|
||||||
|
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER_ONCE_LOOTED) {
|
||||||
|
aiAgent.despawn();
|
||||||
|
aiAgent.deathTime = System.currentTimeMillis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Mob never had Loot.
|
||||||
|
} else {
|
||||||
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
if (System.currentTimeMillis() > aiAgent.deathTime + MBServerStatics.DESPAWN_TIMER) {
|
||||||
aiAgent.despawn();
|
aiAgent.despawn();
|
||||||
aiAgent.deathTime = System.currentTimeMillis();
|
aiAgent.deathTime = System.currentTimeMillis();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
for(Effect eff : aiAgent.effects.values())
|
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) {
|
||||||
eff.endEffect();
|
|
||||||
|
|
||||||
if(Mob.discDroppers.contains(aiAgent))
|
if (Zone.respawnQue.contains(aiAgent) == false) {
|
||||||
return;
|
|
||||||
|
|
||||||
if(aiAgent.StrongholdGuardian || aiAgent.StrongholdEpic || aiAgent.StrongholdCommander)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (aiAgent.despawned && System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000L))) {
|
|
||||||
if (!Zone.respawnQue.contains(aiAgent)) {
|
|
||||||
Zone.respawnQue.add(aiAgent);
|
Zone.respawnQue.add(aiAgent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForRespawn" + " " + e.getMessage());
|
Logger.info(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForRespawn" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -974,10 +896,8 @@ public class MobAI {
|
|||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!mob.isCombat())
|
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
|
||||||
enterCombat(mob);
|
|
||||||
|
|
||||||
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.outOfAggroRange(mob, (PlayerCharacter) mob.getCombatTarget()) && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
|
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -985,38 +905,26 @@ public class MobAI {
|
|||||||
AttackTarget(mob, mob.getCombatTarget());
|
AttackTarget(mob, mob.getCombatTarget());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForAttack" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForAttack" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckToSendMobHome(Mob mob) {
|
private static void CheckToSendMobHome(Mob mob) {
|
||||||
|
|
||||||
if(mob.isNecroPet())
|
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//trebs dont recall
|
|
||||||
if(mob.isSiege())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)){
|
|
||||||
if(mob.loc.distanceSquared(mob.getOwner().loc) > 60 * 60)
|
|
||||||
mob.teleport(mob.getOwner().loc);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mob.BehaviourType.isAgressive) {
|
if (mob.BehaviourType.isAgressive) {
|
||||||
|
|
||||||
if (mob.isPlayerGuard()) {
|
if (mob.isPlayerGuard()) {
|
||||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
} else {
|
} else {
|
||||||
if(mob.combatTarget == null)
|
CheckForAggro(mob);
|
||||||
NewAggroMechanic(mob);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob, mob.getCombatTarget(), MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f))
|
||||||
|
return;
|
||||||
|
|
||||||
if (mob.isPlayerGuard() && !mob.despawned) {
|
if (mob.isPlayerGuard() && !mob.despawned) {
|
||||||
|
|
||||||
City current = ZoneManager.getCityAtLocation(mob.getLoc());
|
City current = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||||
@@ -1026,6 +934,7 @@ public class MobAI {
|
|||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
mob.setCombatTarget(null);
|
mob.setCombatTarget(null);
|
||||||
|
|
||||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
|
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
|
||||||
|
|
||||||
//guard captain pulls his minions home with him
|
//guard captain pulls his minions home with him
|
||||||
@@ -1036,7 +945,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!MovementUtilities.inRangeOfBindLocation(mob)) {
|
} else if (MovementUtilities.inRangeOfBindLocation(mob) == false) {
|
||||||
|
|
||||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||||
@@ -1044,22 +953,16 @@ public class MobAI {
|
|||||||
|
|
||||||
for (Entry playerEntry : mob.playerAgroMap.entrySet())
|
for (Entry playerEntry : mob.playerAgroMap.entrySet())
|
||||||
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
|
||||||
mob.setCombatTarget(null);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chaseTarget(Mob mob) {
|
private static void chaseTarget(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && !mob.canSee((PlayerCharacter)mob.combatTarget)){
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float rangeSquared = mob.getRange() * mob.getRange();
|
float rangeSquared = mob.getRange() * mob.getRange();
|
||||||
float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc());
|
float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc());
|
||||||
|
|
||||||
@@ -1090,7 +993,7 @@ public class MobAI {
|
|||||||
mob.updateMovementState();
|
mob.updateMovementState();
|
||||||
mob.updateLocation();
|
mob.updateLocation();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: chaseTarget" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: chaseTarget" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1103,7 +1006,7 @@ public class MobAI {
|
|||||||
|
|
||||||
//dont scan self.
|
//dont scan self.
|
||||||
|
|
||||||
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) || (mob.agentType.equals(Enum.AIAgentType.PET)))
|
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) == true)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Mob aggroMob = (Mob) awoMob;
|
Mob aggroMob = (Mob) awoMob;
|
||||||
@@ -1122,41 +1025,37 @@ public class MobAI {
|
|||||||
mob.setCombatTarget(aggroMob);
|
mob.setCombatTarget(aggroMob);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: SafeGuardAggro" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: SafeGuardAggro" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkToDropGuardAggro(Mob mob){
|
|
||||||
City city = mob.guardedCity;
|
|
||||||
|
|
||||||
if(city == null)
|
|
||||||
return;
|
|
||||||
if(mob.combatTarget == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//if(city._playerMemory.contains(mob.combatTarget.getObjectUUID()) && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
|
||||||
// mob.setCombatTarget(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void GuardCaptainLogic(Mob mob) {
|
public static void GuardCaptainLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkToDropGuardAggro(mob);
|
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
|
|
||||||
|
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||||
|
|
||||||
|
if (newTarget != null) {
|
||||||
|
|
||||||
|
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||||
|
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
||||||
|
mob.setCombatTarget(newTarget);
|
||||||
|
} else
|
||||||
|
mob.setCombatTarget(newTarget);
|
||||||
|
|
||||||
|
}
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCaptainLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardMinionLogic(Mob mob) {
|
public static void GuardMinionLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkToDropGuardAggro(mob);
|
|
||||||
|
|
||||||
boolean isComanded = mob.npcOwner.isAlive();
|
boolean isComanded = mob.npcOwner.isAlive();
|
||||||
if (!isComanded) {
|
if (!isComanded) {
|
||||||
GuardCaptainLogic(mob);
|
GuardCaptainLogic(mob);
|
||||||
@@ -1170,21 +1069,19 @@ public class MobAI {
|
|||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardMinionLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GuardWallArcherLogic(Mob mob) {
|
public static void GuardWallArcherLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
checkToDropGuardAggro(mob);
|
|
||||||
|
|
||||||
if (mob.getCombatTarget() == null)
|
if (mob.getCombatTarget() == null)
|
||||||
CheckForPlayerGuardAggro(mob);
|
CheckForPlayerGuardAggro(mob);
|
||||||
else
|
else
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardWallArcherLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardWallArcherLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1196,16 +1093,12 @@ public class MobAI {
|
|||||||
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
|
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
|
||||||
mob.killCharacter("no owner");
|
mob.killCharacter("no owner");
|
||||||
|
|
||||||
if(!mob.isSiege())
|
|
||||||
mob.BehaviourType.canRoam = true;
|
|
||||||
|
|
||||||
|
|
||||||
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
|
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
|
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1221,7 +1114,7 @@ public class MobAI {
|
|||||||
|
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: HamletGuardLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: HamletGuardLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1236,11 +1129,17 @@ public class MobAI {
|
|||||||
|
|
||||||
if (mob.BehaviourType.isAgressive) {
|
if (mob.BehaviourType.isAgressive) {
|
||||||
|
|
||||||
if (mob.getCombatTarget() == null) {
|
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
||||||
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
|
|
||||||
SafeGuardAggro(mob); //safehold guard
|
if (newTarget != null)
|
||||||
else
|
mob.setCombatTarget(newTarget);
|
||||||
NewAggroMechanic(mob);//CheckForAggro(mob); //normal aggro
|
else {
|
||||||
|
if (mob.getCombatTarget() == null) {
|
||||||
|
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
|
||||||
|
SafeGuardAggro(mob); //safehold guard
|
||||||
|
else
|
||||||
|
CheckForAggro(mob); //normal aggro
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1254,9 +1153,8 @@ public class MobAI {
|
|||||||
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
|
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DefaultLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1306,7 +1204,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForPlayerGuardAggro" + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckForPlayerGuardAggro" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1369,7 +1267,7 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCanAggro" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: GuardCanAggro" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1418,107 +1316,56 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: randomGuardPatrolPoints" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: randomGuardPatrolPoints" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RecoverHealth(Mob mob) {
|
public static AbstractWorldObject ChangeTargetFromHateValue(Mob mob) {
|
||||||
//recover health
|
|
||||||
try {
|
try {
|
||||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
|
||||||
|
float CurrentHateValue = 0;
|
||||||
|
|
||||||
|
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||||
|
CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
|
||||||
|
|
||||||
|
AbstractWorldObject mostHatedTarget = null;
|
||||||
|
|
||||||
|
for (Entry playerEntry : mob.playerAgroMap.entrySet()) {
|
||||||
|
|
||||||
|
PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int) playerEntry.getKey());
|
||||||
|
|
||||||
|
if (potentialTarget.equals(mob.getCombatTarget()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
|
||||||
|
CurrentHateValue = potentialTarget.getHateValue();
|
||||||
|
mostHatedTarget = potentialTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return mostHatedTarget;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: ChangeTargetFromMostHated" + " " + e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RecoverHealth(Mob mob){
|
||||||
|
//recover health
|
||||||
|
|
||||||
|
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||||
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||||
|
if (mob.getHealth() < mob.getHealthMax()) {
|
||||||
|
|
||||||
|
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||||
|
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
if (mob.getHealth() > mob.getHealthMax())
|
||||||
if (mob.getHealth() < mob.getHealthMax()) {
|
mob.setHealth(mob.getHealthMax());
|
||||||
|
}
|
||||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
|
||||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mob.getHealth() > mob.getHealthMax())
|
|
||||||
mob.setHealth(mob.getHealthMax());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
//(mob.getObjectUUID() + " " + mob.getName() + " Failed At: RecoverHealth" + " " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void enterCombat(Mob mob){
|
|
||||||
mob.setCombat(true);
|
|
||||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
|
||||||
rwss.setPlayer(mob);
|
|
||||||
DispatchMessage.sendToAllInRange(mob, rwss);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void NewAggroMechanic(Mob mob){
|
|
||||||
|
|
||||||
if(mob == null || !mob.isAlive() || mob.playerAgroMap.isEmpty()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.HamletGuard)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mob.hate_values == null)
|
|
||||||
mob.hate_values = new HashMap<>();
|
|
||||||
|
|
||||||
if(mob.combatTarget != null && mob.combatTarget.isAlive() && mob.combatTarget.loc.distanceSquared(mob.loc) < 90f)
|
|
||||||
return;
|
|
||||||
|
|
||||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc,60.0f,MBServerStatics.MASK_PLAYER);
|
|
||||||
|
|
||||||
if(inRange.isEmpty()){
|
|
||||||
mob.setCombatTarget(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//clear out any players who are not in hated range anymore
|
|
||||||
ArrayList<PlayerCharacter> toRemove = new ArrayList<>();
|
|
||||||
for(PlayerCharacter pc : mob.hate_values.keySet()){
|
|
||||||
if(!inRange.contains(pc))
|
|
||||||
toRemove.add(pc);
|
|
||||||
}
|
|
||||||
for(PlayerCharacter pc : toRemove){
|
|
||||||
mob.hate_values.remove(pc);
|
|
||||||
}
|
|
||||||
|
|
||||||
//find most hated target
|
|
||||||
PlayerCharacter mostHated = (PlayerCharacter)inRange.iterator().next();
|
|
||||||
for(AbstractWorldObject awo : inRange){
|
|
||||||
PlayerCharacter loadedPlayer = (PlayerCharacter)awo;
|
|
||||||
if (loadedPlayer == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Player is Dead, Mob no longer needs to attempt to aggro. Remove them from aggro map.
|
|
||||||
if (!loadedPlayer.isAlive())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Can't see target, skip aggro.
|
|
||||||
if (!mob.canSee(loadedPlayer))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// No aggro for this race type
|
|
||||||
if (mob.notEnemy != null && mob.notEnemy.size() > 0 && mob.notEnemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//mob has enemies and this player race is not it
|
|
||||||
if (mob.enemy != null && mob.enemy.size() > 0 && !mob.enemy.contains(loadedPlayer.getRace().getRaceType().getMonsterType()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(mob.hate_values.containsKey(loadedPlayer))
|
|
||||||
if(mob.hate_values.get(loadedPlayer) > mob.hate_values.get(mostHated))
|
|
||||||
mostHated = loadedPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mostHated != null)
|
|
||||||
mob.setCombatTarget(mostHated);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void MobVsMobRetaliate(Mob retaliator, Mob attacker){
|
|
||||||
if(CombatUtilities.inRangeToAttack(retaliator,attacker)){
|
|
||||||
CombatUtilities.combatCycle(retaliator,attacker,true,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,26 +28,18 @@ public class MobAIThread implements Runnable{
|
|||||||
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
AI_BASE_AGGRO_RANGE = (int)(60 * Float.parseFloat(ConfigManager.MB_AI_AGGRO_RANGE.getValue()));
|
||||||
while (true) {
|
while (true) {
|
||||||
for (Zone zone : ZoneManager.getAllZones()) {
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
if (zone != null && zone.zoneMobSet != null) {
|
|
||||||
synchronized (zone.zoneMobSet) {
|
for (Mob mob : zone.zoneMobSet) {
|
||||||
for (Mob mob : zone.zoneMobSet) {
|
|
||||||
try {
|
try {
|
||||||
if (mob != null) {
|
if (mob != null)
|
||||||
MobAI.DetermineAction(mob);
|
MobAI.DetermineAction(mob);
|
||||||
}
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e);
|
||||||
Logger.error("Error processing Mob [Name: {}, UUID: {}]", mob.getName(), mob.getObjectUUID(), e);
|
e.printStackTrace();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
Thread.sleep(100);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Logger.error("AI Thread interrupted", e);
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void startAIThread() {
|
public static void startAIThread() {
|
||||||
|
|||||||
@@ -11,11 +11,9 @@ package engine.mobileAI.Threads;
|
|||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
|
import engine.util.ZoneLevel;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread blocks until MagicBane dispatch messages are
|
* Thread blocks until MagicBane dispatch messages are
|
||||||
* enqueued then processes them in FIFO order. The collection
|
* enqueued then processes them in FIFO order. The collection
|
||||||
@@ -28,48 +26,102 @@ import java.util.Collection;
|
|||||||
|
|
||||||
public class MobRespawnThread implements Runnable {
|
public class MobRespawnThread implements Runnable {
|
||||||
|
|
||||||
private volatile boolean running = true;
|
|
||||||
private static final long RESPAWN_INTERVAL = 100; // Configurable interval
|
|
||||||
|
|
||||||
public MobRespawnThread() {
|
public MobRespawnThread() {
|
||||||
Logger.info("MobRespawnThread initialized.");
|
Logger.info(" MobRespawnThread thread has started!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (running) {
|
|
||||||
try {
|
|
||||||
Collection<Zone> zones = ZoneManager.getAllZones();
|
|
||||||
if (zones != null) {
|
|
||||||
for (Zone zone : zones) {
|
|
||||||
synchronized (zone) { // Optional: Synchronize on zone
|
|
||||||
if (!Zone.respawnQue.isEmpty() && Zone.lastRespawn + RESPAWN_INTERVAL < System.currentTimeMillis()) {
|
|
||||||
|
|
||||||
Mob respawner = Zone.respawnQue.iterator().next();
|
long startTime = System.currentTimeMillis();
|
||||||
if (respawner != null) {
|
long rollingKeepFraction = (Zone.rollingAvgMobsAliveDepth - 1) / Zone.rollingAvgMobsAliveDepth;
|
||||||
respawner.respawn();
|
long rollingAddFraction = 1 / Zone.rollingAvgMobsAliveDepth;
|
||||||
Zone.respawnQue.remove(respawner);
|
|
||||||
Zone.lastRespawn = System.currentTimeMillis();
|
while (true) {
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
try {
|
||||||
}
|
|
||||||
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (zone.respawnQue.size() > ZoneLevel.queueLengthToLevelUp) {
|
||||||
|
zone.setCampLvl(zone.getCamplvl() + 1);
|
||||||
|
}
|
||||||
|
else if (zone.respawnQue.isEmpty() &&
|
||||||
|
(zone.lastRespawn + ZoneLevel.msToLevelDown < System.currentTimeMillis()) &&
|
||||||
|
zone.getCamplvl() > 0) {
|
||||||
|
zone.setCampLvl(zone.getCamplvl() - 1);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
int aliveCount = 0;
|
||||||
|
int deadCount = 0;
|
||||||
|
for (Mob mob : zone.zoneMobSet) {
|
||||||
|
if (mob.isAlive()) {
|
||||||
|
aliveCount = aliveCount + 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deadCount = deadCount + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zone.rollingAvgMobsAlive =
|
||||||
|
((zone.rollingAvgMobsAlive * (Zone.rollingAvgMobsAliveDepth - 1) + aliveCount) / Zone.rollingAvgMobsAliveDepth);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (startTime + ZoneLevel.msDelayToCampLevel < System.currentTimeMillis()) {
|
||||||
|
if (aliveCount > Math.floor(zone.zoneMobSet.size() / 2.0)) {
|
||||||
|
if (zone.levelUpTimer == 0) {
|
||||||
|
zone.levelUpTimer = System.currentTimeMillis();
|
||||||
|
} else if (zone.levelUpTimer + ZoneLevel.msTolevelUp < System.currentTimeMillis()) {
|
||||||
|
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||||
|
|
||||||
|
zone.levelUpTimer = 0;
|
||||||
|
}
|
||||||
|
} else if (aliveCount == 0) {
|
||||||
|
|
||||||
|
if (zone.levelDownTimer == 0) {
|
||||||
|
zone.levelDownTimer = System.currentTimeMillis();
|
||||||
|
} else if (zone.levelDownTimer + ZoneLevel.msToLevelDown < System.currentTimeMillis()) {
|
||||||
|
if (zone.getCampLvl() > 0) {
|
||||||
|
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||||
|
|
||||||
|
zone.levelDownTimer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
zone.levelUpTimer = 0;
|
||||||
|
zone.levelDownTimer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
Thread.sleep(100); // Prevent busy-waiting
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
// Manage mob respawn
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
if (!Zone.respawnQue.isEmpty() && Zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||||
|
|
||||||
|
Mob respawner = Zone.respawnQue.iterator().next();
|
||||||
|
|
||||||
|
if (respawner == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
respawner.respawn();
|
||||||
|
Zone.respawnQue.remove(respawner);
|
||||||
|
Zone.lastRespawn = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Error in MobRespawnThread", e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Logger.info("MobRespawnThread stopped.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
|
||||||
running = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void startRespawnThread() {
|
public static void startRespawnThread() {
|
||||||
Thread respawnThread = new Thread(new MobRespawnThread());
|
Thread respawnThread;
|
||||||
|
respawnThread = new Thread(new MobRespawnThread());
|
||||||
respawnThread.setName("respawnThread");
|
respawnThread.setName("respawnThread");
|
||||||
respawnThread.start();
|
respawnThread.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import org.pmw.tinylog.Logger;
|
|||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
import static engine.math.FastMath.sqr;
|
import static engine.math.FastMath.sqr;
|
||||||
|
import static java.lang.Math.pow;
|
||||||
|
|
||||||
public class CombatUtilities {
|
public class CombatUtilities {
|
||||||
|
|
||||||
@@ -100,18 +101,9 @@ public class CombatUtilities {
|
|||||||
if (!target.isAlive())
|
if (!target.isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(agent.isPet()){
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
try{
|
|
||||||
damage *= agent.getOwner().ZergMultiplier;
|
|
||||||
}catch(Exception ignored){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
|
||||||
//damage = Resists.handleFortitude((AbstractCharacter) target,DamageType.Crush,damage);
|
|
||||||
trueDamage = ((AbstractCharacter) target).modifyHealth(-damage, agent, false);
|
trueDamage = ((AbstractCharacter) target).modifyHealth(-damage, agent, false);
|
||||||
}else if (target.getObjectType() == GameObjectType.Building)
|
else if (target.getObjectType() == GameObjectType.Building)
|
||||||
trueDamage = ((Building) target).modifyHealth(-damage, agent);
|
trueDamage = ((Building) target).modifyHealth(-damage, agent);
|
||||||
|
|
||||||
//Don't send 0 damage kay thanx.
|
//Don't send 0 damage kay thanx.
|
||||||
@@ -132,8 +124,6 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canSwing(Mob agent) {
|
public static boolean canSwing(Mob agent) {
|
||||||
if(!CombatUtilities.inRange2D(agent,agent.combatTarget,agent.getRange()))
|
|
||||||
return false;
|
|
||||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None));
|
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,32 +139,37 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean triggerDefense(Mob agent, AbstractWorldObject target) {
|
public static boolean triggerDefense(Mob agent, AbstractWorldObject target) {
|
||||||
int defense = 0;
|
int defenseScore = 0;
|
||||||
int atr = agent.mobBase.getAtr();
|
int attackScore = agent.getAtrHandOne();
|
||||||
if(agent.getBonuses() != null){
|
|
||||||
atr += agent.getBonuses().getFloat(ModType.OCV,SourceType.None);
|
|
||||||
atr *= 1 + agent.getBonuses().getFloatPercentAll(ModType.OCV,SourceType.None);
|
|
||||||
}
|
|
||||||
switch (target.getObjectType()) {
|
switch (target.getObjectType()) {
|
||||||
case PlayerCharacter:
|
case PlayerCharacter:
|
||||||
PlayerCharacter pc = (PlayerCharacter)target;
|
defenseScore = ((AbstractCharacter) target).getDefenseRating();
|
||||||
if(pc.combatStats == null)
|
|
||||||
pc.combatStats = new PlayerCombatStats(pc);
|
|
||||||
pc.combatStats.calculateDefense();
|
|
||||||
defense = pc.combatStats.defense;
|
|
||||||
break;
|
break;
|
||||||
case Mob:
|
case Mob:
|
||||||
|
|
||||||
Mob mob = (Mob) target;
|
Mob mob = (Mob) target;
|
||||||
if (mob.isSiege())
|
if (mob.isSiege())
|
||||||
defense = atr;
|
defenseScore = attackScore;
|
||||||
else
|
|
||||||
defense = ((Mob) target).mobBase.getDefense();
|
|
||||||
break;
|
break;
|
||||||
case Building:
|
case Building:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !CombatManager.LandHit(atr,defense);
|
|
||||||
|
int hitChance;
|
||||||
|
if (attackScore > defenseScore || defenseScore == 0)
|
||||||
|
hitChance = 94;
|
||||||
|
else if (attackScore == defenseScore && target.getObjectType() == GameObjectType.Mob)
|
||||||
|
hitChance = 10;
|
||||||
|
else {
|
||||||
|
float dif = attackScore / defenseScore;
|
||||||
|
if (dif <= 0.8f)
|
||||||
|
hitChance = 4;
|
||||||
|
else
|
||||||
|
hitChance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||||
|
if (target.getObjectType() == GameObjectType.Building)
|
||||||
|
hitChance = 100;
|
||||||
|
}
|
||||||
|
return ThreadLocalRandom.current().nextInt(100) > hitChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean triggerBlock(Mob agent, AbstractWorldObject ac) {
|
public static boolean triggerBlock(Mob agent, AbstractWorldObject ac) {
|
||||||
@@ -212,10 +207,12 @@ public class CombatUtilities {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int anim = 75;
|
int anim = 75;
|
||||||
|
float speed;
|
||||||
|
|
||||||
//handle the retaliate here because even if the mob misses you can still retaliate
|
if (mainHand)
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
speed = agent.getSpeedHandOne();
|
||||||
CombatManager.handleRetaliate((AbstractCharacter) target, agent);
|
else
|
||||||
|
speed = agent.getSpeedHandTwo();
|
||||||
|
|
||||||
DamageType dt = DamageType.Crush;
|
DamageType dt = DamageType.Crush;
|
||||||
|
|
||||||
@@ -270,12 +267,12 @@ public class CombatUtilities {
|
|||||||
if (agent.getEquip().get(1) != null && agent.getEquip().get(2) != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
if (agent.getEquip().get(1) != null && agent.getEquip().get(2) != null && agent.getEquip().get(2).getItemBase().isShield() == false) {
|
||||||
//mob is duel wielding and should conduct an attack for each hand
|
//mob is duel wielding and should conduct an attack for each hand
|
||||||
ItemBase weapon1 = agent.getEquip().get(1).getItemBase();
|
ItemBase weapon1 = agent.getEquip().get(1).getItemBase();
|
||||||
double range1 = getMaxDmg(agent) - getMinDmg(agent);
|
double range1 = getMaxDmg(weapon1.getMinDamage(), agent, weapon1) - getMinDmg(weapon1.getMinDamage(), agent, weapon1);
|
||||||
double damage1 = getMinDmg(agent) + ((ThreadLocalRandom.current().nextFloat() * range1) + (ThreadLocalRandom.current().nextFloat() * range1)) / 2;
|
double damage1 = getMinDmg(weapon1.getMinDamage(), agent, weapon1) + ((ThreadLocalRandom.current().nextFloat() * range1) + (ThreadLocalRandom.current().nextFloat() * range1)) / 2;
|
||||||
swingIsDamage(agent, target, (float) damage1, CombatManager.getSwingAnimation(weapon1, null, true));
|
swingIsDamage(agent, target, (float) damage1, CombatManager.getSwingAnimation(weapon1, null, true));
|
||||||
ItemBase weapon2 = agent.getEquip().get(2).getItemBase();
|
ItemBase weapon2 = agent.getEquip().get(2).getItemBase();
|
||||||
double range2 = getMaxDmg(agent) - getMinDmg(agent);
|
double range2 = getMaxDmg(weapon2.getMinDamage(), agent, weapon2) - getMinDmg(weapon2.getMinDamage(), agent, weapon2);
|
||||||
double damage2 = getMinDmg(agent) + ((ThreadLocalRandom.current().nextFloat() * range2) + (ThreadLocalRandom.current().nextFloat() * range2)) / 2;
|
double damage2 = getMinDmg(weapon2.getMinDamage(), agent, weapon2) + ((ThreadLocalRandom.current().nextFloat() * range2) + (ThreadLocalRandom.current().nextFloat() * range2)) / 2;
|
||||||
swingIsDamage(agent, target, (float) damage2, CombatManager.getSwingAnimation(weapon1, null, false));
|
swingIsDamage(agent, target, (float) damage2, CombatManager.getSwingAnimation(weapon1, null, false));
|
||||||
} else {
|
} else {
|
||||||
swingIsDamage(agent, target, determineDamage(agent), anim);
|
swingIsDamage(agent, target, determineDamage(agent), anim);
|
||||||
@@ -297,6 +294,11 @@ public class CombatUtilities {
|
|||||||
if (((Mob) target).isSiege())
|
if (((Mob) target).isSiege())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//handle the retaliate
|
||||||
|
|
||||||
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
|
CombatManager.handleRetaliate((AbstractCharacter) target, agent);
|
||||||
|
|
||||||
if (target.getObjectType() == GameObjectType.Mob) {
|
if (target.getObjectType() == GameObjectType.Mob) {
|
||||||
Mob targetMob = (Mob) target;
|
Mob targetMob = (Mob) target;
|
||||||
if (targetMob.isSiege())
|
if (targetMob.isSiege())
|
||||||
@@ -320,9 +322,9 @@ public class CombatUtilities {
|
|||||||
float damage = 0;
|
float damage = 0;
|
||||||
|
|
||||||
DamageType dt = getDamageType(agent);
|
DamageType dt = getDamageType(agent);
|
||||||
if (agent.BehaviourType.equals(MobBehaviourType.Pet1)) {
|
if ((agent.agentType.equals(AIAgentType.PET)) == true || agent.isPet() == true || agent.isNecroPet() == true) {
|
||||||
damage = calculateMobDamage(agent);
|
damage = calculatePetDamage(agent);
|
||||||
} else if (agent.isPlayerGuard()) {
|
} else if (agent.isPlayerGuard() == true) {
|
||||||
//damage = calculateGuardDamage(agent);
|
//damage = calculateGuardDamage(agent);
|
||||||
damage = calculateMobDamage(agent);
|
damage = calculateMobDamage(agent);
|
||||||
} else if (agent.getLevel() > 80) {
|
} else if (agent.getLevel() > 80) {
|
||||||
@@ -331,9 +333,9 @@ public class CombatUtilities {
|
|||||||
damage = calculateMobDamage(agent);
|
damage = calculateMobDamage(agent);
|
||||||
}
|
}
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
if (AbstractWorldObject.IsAbstractCharacter(target)) {
|
||||||
//if (((AbstractCharacter) target).isSit()) {
|
if (((AbstractCharacter) target).isSit()) {
|
||||||
// damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
//}
|
}
|
||||||
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, damage, 0));
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, damage, 0));
|
||||||
}
|
}
|
||||||
if (target.getObjectType() == GameObjectType.Building) {
|
if (target.getObjectType() == GameObjectType.Building) {
|
||||||
@@ -362,8 +364,8 @@ public class CombatUtilities {
|
|||||||
float min = 40;
|
float min = 40;
|
||||||
float max = 60;
|
float max = 60;
|
||||||
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
double minDmg = getMinDmg(agent);
|
double minDmg = getMinDmg(min, agent, null);
|
||||||
double maxDmg = getMaxDmg(agent);
|
double maxDmg = getMaxDmg(max, agent, null);
|
||||||
dmgMultiplier += agent.getLevel() * 0.1f;
|
dmgMultiplier += agent.getLevel() * 0.1f;
|
||||||
range = (float) (maxDmg - minDmg);
|
range = (float) (maxDmg - minDmg);
|
||||||
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
@@ -379,8 +381,8 @@ public class CombatUtilities {
|
|||||||
|
|
||||||
double minDmg = weapon.getMinDamage();
|
double minDmg = weapon.getMinDamage();
|
||||||
double maxDmg = weapon.getMaxDamage();
|
double maxDmg = weapon.getMaxDamage();
|
||||||
double min = getMinDmg(agent);
|
double min = getMinDmg(minDmg, agent, weapon);
|
||||||
double max = getMaxDmg(agent);
|
double max = getMaxDmg(maxDmg, agent, weapon);
|
||||||
|
|
||||||
DamageType dt = weapon.getDamageType();
|
DamageType dt = weapon.getDamageType();
|
||||||
|
|
||||||
@@ -421,48 +423,92 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int calculateMobDamage(Mob agent) {
|
public static int calculateMobDamage(Mob agent) {
|
||||||
double minDmg = getMinDmg(agent);
|
ItemBase weapon = null;
|
||||||
double maxDmg = getMaxDmg(agent);
|
double minDmg;
|
||||||
DamageType dt = getDamageType(agent);
|
double maxDmg;
|
||||||
|
DamageType dt;
|
||||||
|
|
||||||
|
//main hand or offhand damage
|
||||||
|
|
||||||
|
if (agent.getEquip().get(1) != null)
|
||||||
|
weapon = agent.getEquip().get(1).getItemBase();
|
||||||
|
else if (agent.getEquip().get(2) != null)
|
||||||
|
weapon = agent.getEquip().get(2).getItemBase();
|
||||||
|
|
||||||
|
if (weapon != null) {
|
||||||
|
minDmg = getMinDmg(weapon.getMinDamage(), agent, weapon);
|
||||||
|
maxDmg = getMaxDmg(weapon.getMaxDamage(), agent, weapon);
|
||||||
|
dt = weapon.getDamageType();
|
||||||
|
} else {
|
||||||
|
minDmg = agent.getMobBase().getDamageMin();
|
||||||
|
maxDmg = agent.getMobBase().getDamageMax();
|
||||||
|
dt = DamageType.Crush;
|
||||||
|
}
|
||||||
|
|
||||||
AbstractWorldObject target = agent.getCombatTarget();
|
AbstractWorldObject target = agent.getCombatTarget();
|
||||||
|
|
||||||
double damage = ThreadLocalRandom.current().nextInt((int)minDmg,(int)maxDmg + 1);
|
float dmgMultiplier = 1 + agent.getBonuses().getFloatPercentAll(ModType.MeleeDamageModifier, SourceType.None);
|
||||||
|
double range = maxDmg - minDmg;
|
||||||
|
double damage = minDmg + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
|
||||||
|
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
if (((AbstractCharacter) target).isSit())
|
if (((AbstractCharacter) target).isSit())
|
||||||
damage *= 2.5f; //increase damage if sitting
|
damage *= 2.5f; //increase damage if sitting
|
||||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||||
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0));
|
return (int) (((AbstractCharacter) target).getResists().getResistedDamage(agent, (AbstractCharacter) target, dt, (float) damage, 0) * dmgMultiplier);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMinDmg(Mob agent) {
|
public static double getMinDmg(double min, Mob agent, ItemBase weapon) {
|
||||||
if(agent.getEquip() != null){
|
|
||||||
if(agent.getEquip().get(ItemSlotType.RHELD) != null){
|
int primary = agent.getStatStrCurrent();
|
||||||
return agent.minDamageHandOne;
|
int secondary = agent.getStatDexCurrent();
|
||||||
}else if(agent.getEquip().get(ItemSlotType.LHELD) != null){
|
int focusLevel = 0;
|
||||||
return agent.getMinDamageHandTwo();
|
int masteryLevel = 0;
|
||||||
}else{
|
|
||||||
return agent.minDamageHandOne;
|
if (weapon != null) {
|
||||||
|
if (weapon.isStrBased() == true) {
|
||||||
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired())) {
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
}
|
||||||
|
if (agent.getSkills().containsKey(weapon.getMastery())) {
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
return agent.minDamageHandOne;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getMaxDmg(Mob agent) {
|
public static double getMaxDmg(double max, Mob agent, ItemBase weapon) {
|
||||||
if(agent.getEquip() != null){
|
|
||||||
if(agent.getEquip().get(ItemSlotType.RHELD) != null){
|
int primary = agent.getStatStrCurrent();
|
||||||
return agent.maxDamageHandOne;
|
int secondary = agent.getStatDexCurrent();
|
||||||
}else if(agent.getEquip().get(ItemSlotType.LHELD) != null){
|
int focusLevel = 0;
|
||||||
return agent.getMaxDamageHandTwo();
|
int masteryLevel = 0;
|
||||||
}else{
|
|
||||||
return agent.maxDamageHandOne;
|
if (weapon != null) {
|
||||||
}
|
|
||||||
}else{
|
if (weapon.isStrBased() == true) {
|
||||||
return agent.maxDamageHandOne;
|
primary = agent.getStatStrCurrent();
|
||||||
|
secondary = agent.getStatDexCurrent();
|
||||||
|
} else {
|
||||||
|
primary = agent.getStatDexCurrent();
|
||||||
|
secondary = agent.getStatStrCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
focusLevel = (int) agent.getSkills().get(weapon.getSkillRequired()).getModifiedAmount();
|
||||||
|
|
||||||
|
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||||
|
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||||
|
|
||||||
|
}
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import engine.Enum;
|
|||||||
import engine.Enum.GameObjectType;
|
import engine.Enum.GameObjectType;
|
||||||
import engine.Enum.ModType;
|
import engine.Enum.ModType;
|
||||||
import engine.Enum.SourceType;
|
import engine.Enum.SourceType;
|
||||||
import engine.InterestManagement.InterestManager;
|
|
||||||
import engine.mobileAI.Threads.MobAIThread;
|
import engine.mobileAI.Threads.MobAIThread;
|
||||||
import engine.exception.MsgSendException;
|
import engine.exception.MsgSendException;
|
||||||
import engine.gameManager.MovementManager;
|
import engine.gameManager.MovementManager;
|
||||||
@@ -99,24 +98,20 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean outOfAggroRange(Mob agent, AbstractCharacter target) {
|
public static boolean inRangeDropAggro(Mob agent, AbstractCharacter target) {
|
||||||
|
|
||||||
Vector3fImmutable sl = agent.getLoc();
|
Vector3fImmutable sl = agent.getLoc();
|
||||||
Vector3fImmutable tl = target.getLoc();
|
Vector3fImmutable tl = target.getLoc();
|
||||||
|
|
||||||
float disSq = sl.distanceSquared(tl);
|
float distanceSquaredToTarget = sl.distanceSquared2D(tl) - sqr(agent.calcHitBox() + target.calcHitBox()); //distance to center of target
|
||||||
|
|
||||||
float range = agent.getRange() + 150;
|
float range = agent.getRange() + 150;
|
||||||
|
|
||||||
|
|
||||||
//float distanceSquaredToTarget = sl.distanceSquared2D(tl) - sqr(agent.calcHitBox() + target.calcHitBox()); //distance to center of target
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (range > 200)
|
if (range > 200)
|
||||||
range = 200;
|
range = 200;
|
||||||
|
|
||||||
|
|
||||||
return disSq > (range * range);
|
return distanceSquaredToTarget < sqr(range);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +189,6 @@ public class MovementUtilities {
|
|||||||
|
|
||||||
public static void aiMove(Mob agent, Vector3fImmutable vect, boolean isWalking) {
|
public static void aiMove(Mob agent, Vector3fImmutable vect, boolean isWalking) {
|
||||||
|
|
||||||
//InterestManager.forceLoad(agent);
|
|
||||||
//update our walk/run state.
|
//update our walk/run state.
|
||||||
if (isWalking && !agent.isWalk()) {
|
if (isWalking && !agent.isWalk()) {
|
||||||
agent.setWalkMode(true);
|
agent.setWalkMode(true);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user