Merge branch 'lakebane-zerg' into lakebane-master

# Conflicts:
#	src/engine/InterestManagement/InterestManager.java
#	src/engine/gameManager/SimulationManager.java
#	src/engine/mobileAI/MobAI.java
#	src/engine/objects/CharacterItemManager.java
#	src/engine/objects/Mine.java
#	src/engine/objects/PlayerCharacter.java
This commit is contained in:
2024-02-22 18:53:48 -06:00
64 changed files with 1502 additions and 1332 deletions
+6 -5
View File
@@ -520,9 +520,10 @@ public enum BuildingManager {
if (building.getBlueprintUUID() == 0)
return false;
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size()) {
Logger.error("failed at addHireling with contract: " + contract.getContractID());
return false;
}
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
if (item.getChargesRemaining() > 0)
@@ -535,7 +536,7 @@ public enum BuildingManager {
if (NPC.ISWallArcher(contract)) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
if (mob == null)
return false;
@@ -547,7 +548,7 @@ public enum BuildingManager {
if (NPC.ISGuardCaptain(contract.getContractID())) {
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
if (mob == null)
return false;
@@ -559,7 +560,7 @@ public enum BuildingManager {
if (contract.getContractID() == 910) {
//guard dog
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
if (mob == null)
return false;
+5 -1
View File
@@ -814,6 +814,9 @@ public enum CombatManager {
else
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
damage *= ((PlayerCharacter)ac).ZergMultiplier;
}
float d = 0f;
errorTrack = 12;
@@ -826,7 +829,8 @@ public enum CombatManager {
damage *= 2.5f; //increase damage if sitting
if (tarAc.getObjectType() == GameObjectType.Mob) {
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter))
((Mob)tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
((Mob) tarAc).handleDirectAggro(ac);
}
+1 -1
View File
@@ -180,7 +180,7 @@ public enum DevCmdManager {
//kill any commands not available to everyone on production server
//only admin level can run dev commands on production
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false) {
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
return false;
}
+133 -54
View File
@@ -17,6 +17,7 @@ import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.concurrent.ThreadLocalRandom;
@@ -34,6 +35,11 @@ public enum LootManager {
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
public static ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510}));
public static ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27570,188900,188910,188920,188930,188940,188950,189500}));
public static ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27550,27560,189100,189110,189120,189130,189140,189150}));
public static ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27600,188700,188720,189550,189560}));
// Drop Rates
public static float NORMAL_DROP_RATE;
@@ -75,16 +81,13 @@ public enum LootManager {
public static void GenerateMobLoot(Mob mob) {
//determine if mob is in hotzone
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
//iterate the booty sets
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob);
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
RunBootySet(_bootySetMap.get(mob.bootySet), mob);
//lastly, check mobs inventory for godly or disc runes to send a server announcement
for (Item it : mob.getInventory()) {
@@ -102,38 +105,40 @@ public enum LootManager {
}
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob) {
boolean hotzoneWasRan = false;
float dropRate = 1.0f;
float dropRate = NORMAL_DROP_RATE;
// Iterate all entries in this bootySet and process accordingly
for (BootySetEntry bse : entries) {
switch (bse.bootyType) {
case "GOLD":
GenerateGoldDrop(mob, bse, inHotzone);
GenerateGoldDrop(mob, bse);
break;
case "LOOT":
if (mob.getSafeZone() == false)
dropRate = LootManager.NORMAL_DROP_RATE;
if (inHotzone == true)
dropRate = LootManager.HOTZONE_DROP_RATE;
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
// Generate hotzone loot if in hotzone
// Only one bite at the hotzone apple per bootyset.
if (inHotzone == true && hotzoneWasRan == false)
if (_genTables.containsKey(bse.genTable + 1) && ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) {
GenerateLootDrop(mob, bse.genTable + 1, true); //generate loot drop from hotzone table
hotzoneWasRan = true;
GenerateLootDrop(mob, bse.genTable); //generate normal loot drop
if(ThreadLocalRandom.current().nextInt(1,101) < mob.level && mob.parentZone.getSafeZone() == 0) {
if (ThreadLocalRandom.current().nextInt(1, 10000) < mob.level) {
if (_genTables.containsKey(bse.genTable + 1)) {
int roll = ThreadLocalRandom.current().nextInt(1, 101);
MobLoot extraLoot = null;
if (roll >= 1 && roll <= 50) {
extraLoot = rollForContract(bse.genTable, mob);
}
if (roll >= 51 && roll <= 94) {
extraLoot = rollForRune(bse.genTable, mob);
}
if (roll >= 95) {
extraLoot = rollForGlass(mob);
}
if (extraLoot != null) {
mob.getCharItemManager().addItemToInventory(extraLoot);
}
}
}
}
break;
case "ITEM":
GenerateInventoryDrop(mob, bse);
@@ -142,14 +147,14 @@ public enum LootManager {
}
}
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob) {
if (mob == null || _genTables.containsKey(genTableID) == false)
return null;
MobLoot outItem;
int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1);
int genRoll = ThreadLocalRandom.current().nextInt(1,94 + 1);
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
@@ -167,7 +172,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) { //52 = player character
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
itemTableRoll = TableRoll(mob.level, inHotzone);
itemTableRoll = TableRoll(mob.level);
}
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
if (tableRow == null)
@@ -179,6 +184,9 @@ public enum LootManager {
return null;
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
int chance = ThreadLocalRandom.current().nextInt(1,101);
if(chance > 5)
return null;
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
}
@@ -189,7 +197,7 @@ public enum LootManager {
if(selectedRow.pModTable != 0){
try {
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll);
outItem.setIsID(false);
} catch (Exception e) {
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
@@ -197,7 +205,7 @@ public enum LootManager {
}
if(selectedRow.sModTable != 0){
try {
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll);
outItem.setIsID(false);
} catch (Exception e) {
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
@@ -206,7 +214,7 @@ public enum LootManager {
return outItem;
}
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
@@ -223,7 +231,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) {
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
prefixTableRoll = TableRoll(mob.level, inHotzone);
prefixTableRoll = TableRoll(mob.level);
}
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
@@ -238,7 +246,7 @@ public enum LootManager {
return inItem;
}
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
@@ -255,7 +263,7 @@ public enum LootManager {
if(mob.getObjectType().ordinal() == 52) {
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
} else{
suffixTableRoll = TableRoll(mob.level, inHotzone);
suffixTableRoll = TableRoll(mob.level);
}
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
@@ -270,7 +278,7 @@ public enum LootManager {
return inItem;
}
public static int TableRoll(int mobLevel, Boolean inHotzone) {
public static int TableRoll(int mobLevel) {
if (mobLevel > 65)
mobLevel = 65;
@@ -285,15 +293,12 @@ public enum LootManager {
if (min < 70)
min = 70;
if (inHotzone)
min += mobLevel;
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
return roll;
}
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse, Boolean inHotzone) {
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse) {
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
@@ -304,14 +309,9 @@ public enum LootManager {
//determine and add gold to mob inventory
int high = bse.highGold;
int low = bse.lowGold;
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
if (inHotzone == true)
gold = (int) (gold * HOTZONE_GOLD_RATE);
else
gold = (int) (gold * NORMAL_GOLD_RATE);
int high = (int)(bse.highGold * NORMAL_GOLD_RATE);
int low = (int)(bse.lowGold * NORMAL_GOLD_RATE);
int gold = ThreadLocalRandom.current().nextInt(low, high);
if (gold > 0) {
MobLoot goldAmount = new MobLoot(mob, gold);
@@ -320,15 +320,16 @@ public enum LootManager {
}
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
public static void GenerateLootDrop(Mob mob, int tableID) {
try {
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
MobLoot toAdd = getGenTableItem(tableID, mob);
if (toAdd != null)
if (toAdd != null) {
toAdd.setIsID(true);
mob.getCharItemManager().addItemToInventory(toAdd);
}
} catch (Exception e) {
//TODO chase down loot generation error, affects roughly 2% of drops
int i = 0;
@@ -350,8 +351,24 @@ public enum LootManager {
if (equipmentRoll > dropChance)
continue;
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
ItemBase genericIB = me.getItemBase();
if(genericIB.isVorg()){
if(genericIB.isClothArmor()){
//get random cloth piece
genericIB = ItemBase.getItemBase(vorg_cloth_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_cloth_uuids.size() - 1)));
} else if(genericIB.isHeavyArmor()){
//get random heavy armor piece
genericIB = ItemBase.getItemBase(vorg_ha_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ha_uuids.size() - 1)));
} else if(genericIB.isMediumArmor()){
//get random medium armor piece
genericIB = ItemBase.getItemBase(vorg_ma_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ma_uuids.size() - 1)));
} else if(genericIB.isLightArmor()){
//get random light armor piece
genericIB = ItemBase.getItemBase(vorg_la_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_la_uuids.size() - 1)));
}
mob.spawnTime = ThreadLocalRandom.current().nextInt(300,2700);
}
MobLoot ml = new MobLoot(mob, genericIB, false);
if (ml != null && dropCount < 1) {
ml.setIsID(true);
@@ -461,4 +478,66 @@ public enum LootManager {
itemMan.addItemToInventory(playerWinnings);
itemMan.updateInventory();
}
public static MobLoot rollForContract(int table, Mob mob){
GenTableEntry selectedRow = GenTableEntry.rollTable(table, 99, 1.0f);
if (selectedRow == null)
return null;
int itemTableId = selectedRow.itemTableID;
if (_itemTables.containsKey(itemTableId) == false)
return null;
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(1,321));
if (tableRow == null)
return null;
int itemUUID = tableRow.cacheID;
if (itemUUID == 0)
return null;
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
if(outItem != null)
return outItem;
return null;
}
public static MobLoot rollForRune(int table, Mob mob){
GenTableEntry selectedRow = GenTableEntry.rollTable(table, 97, 1.0f);
if (selectedRow == null)
return null;
int itemTableId = selectedRow.itemTableID;
if (_itemTables.containsKey(itemTableId) == false)
return null;
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(1,321));
if (tableRow == null)
return null;
int itemUUID = tableRow.cacheID;
if (itemUUID == 0)
return null;
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
if(outItem != null)
return outItem;
return null;
}
public static MobLoot rollForGlass( Mob mob){
ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(1,321));
if (tableRow == null)
return null;
int itemUUID = tableRow.cacheID;
if (itemUUID == 0)
return null;
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
if(outItem != null)
return outItem;
return null;
}
}
+14 -7
View File
@@ -39,7 +39,7 @@ public enum MaintenanceManager {
// Build list of buildings to apply maintenance on.
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.Building));
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.City));
maintList = buildMaintList(buildingList);
// Deduct upkeep and build list of buildings
@@ -53,7 +53,10 @@ public enum MaintenanceManager {
// Reset maintenance dates for these buildings
for (Building building : maintList) {
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
if(derankList.contains(building) == false)
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
else
setMaintDateTime(building, LocalDateTime.now().plusDays(1));
}
// Derak or destroy buildings that did not
@@ -74,7 +77,10 @@ public enum MaintenanceManager {
for (AbstractGameObject gameObject : buildingList) {
Building building = (Building) gameObject;
Building building = ((City)gameObject).getTOL();//(Building) gameObject;
if(building == null)
continue;
// No maintenance on NPC owned buildings (Cache loaded)
@@ -154,7 +160,8 @@ public enum MaintenanceManager {
// Cache maintenance cost value
maintCost = building.getMaintCost();
//maintCost = building.getMaintCost();
maintCost = 3000000;
// Something went wrong. Missing buildinggroup from switch?
@@ -225,9 +232,9 @@ public enum MaintenanceManager {
// 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 ((building.getRank() > 1) && (building.getRank() < 8)) {
// building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
//}
return false; // Early exit for having failed to meet maintenance
}
+67 -13
View File
@@ -23,14 +23,6 @@ public enum NPCManager {
NPC_MANAGER;
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
public static void LoadAllRuneSets() {
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
}
public static void LoadAllBootySets() {
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
}
public static void applyRuneSetEffects(Mob mob) {
// Early exit
@@ -127,10 +119,12 @@ public enum NPCManager {
DbManager.removeFromCache(necroPet);
PlayerCharacter petOwner = necroPet.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
if (petOwner != null) {
necroPet.setOwner(null);
necroPet.guardCaptain = null;
petOwner.setPet(null);
if (updateOwner == false)
@@ -228,12 +222,14 @@ public enum NPCManager {
WorldGrid.removeObject(toRemove);
DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = toRemove.getOwner();
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
if (petOwner != null) {
petOwner.setPet(null);
toRemove.setOwner(null);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
@@ -340,10 +336,19 @@ public enum NPCManager {
else
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
// Override slot for siege engines
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
Mob siegeMobile = (Mob) abstractCharacter;
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
}
if (buildingSlot == -1)
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
// Pets are regular mobiles not hirelings (Siege engines)
if (abstractCharacter.contract != null)
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
// Override bind and location for this npc derived
// from BuildingManager slot location data.
@@ -370,4 +375,53 @@ public enum NPCManager {
return buildingSlot;
}
public static int getMaxMinions(Mob guardCaptain) {
int maxSlots;
switch (guardCaptain.getRank()) {
case 3:
maxSlots = 2;
break;
case 4:
case 5:
maxSlots = 3;
break;
case 6:
maxSlots = 4;
break;
case 7:
maxSlots = 5;
break;
case 1:
case 2:
default:
maxSlots = 1;
}
return maxSlots;
}
public static void AssignPatrolPoints(Mob mob) {
mob.patrolPoints = new ArrayList<>();
for (int i = 0; i < 5; ++i) {
float patrolRadius = mob.getSpawnRadius();
if (patrolRadius > 256)
patrolRadius = 256;
if (patrolRadius < 60)
patrolRadius = 60;
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
mob.patrolPoints.add(newPatrolPoint);
if (i == 1) {
mob.loc = newPatrolPoint;
mob.endLoc = newPatrolPoint;
}
}
}
}
+26 -9
View File
@@ -300,15 +300,15 @@ public enum PowersManager {
int time = pb.getRecycleTime(trains);
// verify player is in correct mode (combat/nonCombat)
if (playerCharacter.isCombat()) {
if (!pb.allowedInCombat())
//if (playerCharacter.isCombat()) {
// if (!pb.allowedInCombat())
// ChatManager.chatPowerError(pc,
// "This power is not allowed in combat mode.");
return true;
} else if (!pb.allowedOutOfCombat())
// return true;
//} else if (!pb.allowedOutOfCombat())
// ChatManager.chatPowerError(pc,
// "You must be in combat mode to use this power.");
return true;
// return true;
// verify player is not stunned or prohibited from casting
PlayerBonuses bonus = playerCharacter.getBonuses();
@@ -842,8 +842,6 @@ public enum PowersManager {
return;
}
playerCharacter.setHateValue(pb.getHateValue(trains));
//Send Cast Message.
// PerformActionMsg castMsg = new PerformActionMsg(msg);
// castMsg.setNumTrains(9999);
@@ -894,8 +892,6 @@ public enum PowersManager {
//Power is aiding a target, handle aggro if combat target is a Mob.
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
PlayerCharacter pcTarget = (PlayerCharacter) target;
if (!pb.isHarmful())
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
}
// update target of used power timer
@@ -1468,6 +1464,27 @@ public enum PowersManager {
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
allTargets, playerCharacter, maxTargets);
trackChars = new HashSet<>();
HashSet<AbstractWorldObject> allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER);
ArrayList<Guild> nationsInRange = new ArrayList<>();
//first round to add players in range
for(AbstractWorldObject trackChar : allInRange){
if(allInRange.contains(trackChar)) {
trackChars.add((AbstractCharacter)trackChar);
Guild nation = ((AbstractCharacter)trackChar).guild.getNation();
if(nationsInRange.contains(nation) == false)
nationsInRange.add(nation);
}
}
//second round add all others in window if they share a nation with a current
for(AbstractWorldObject trackChar : allInRange) {
Guild nation = ((AbstractCharacter) trackChar).guild.getNation();
if (allInRange.contains(trackChar) == true && nationsInRange.add(nation) == true && trackChars.contains(trackChar) == false)
trackChars.add((AbstractCharacter) trackChar);
else if(((AbstractCharacter) trackChar).guild.getNation().equals(playerCharacter.guild.getNation()))
trackChars.add((AbstractCharacter) trackChar);
}
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
// send track window
+19 -39
View File
@@ -10,7 +10,6 @@ package engine.gameManager;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.math.Vector3fImmutable;
import engine.objects.*;
import org.pmw.tinylog.Logger;
@@ -31,7 +30,6 @@ public enum SimulationManager {
SERVERHEARTBEAT;
private static final long CITY_PULSE = 2000;
private static final long MINE_PULSE = 2000;
private static final long RUNEGATE_PULSE = 3000;
private static final long UPDATE_PULSE = 1000;
private static final long FlIGHT_PULSE = 100;
@@ -39,7 +37,7 @@ public enum SimulationManager {
public static Duration executionMax = Duration.ofNanos(1);
private static SimulationManager instance = null;
private long _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
private long _minePulseTime = System.currentTimeMillis() + MINE_PULSE;
private long _minePulseTime = System.currentTimeMillis() + CITY_PULSE;
private long _runegatePulseTime = System.currentTimeMillis()
+ RUNEGATE_PULSE;
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
@@ -132,18 +130,7 @@ public enum SimulationManager {
pulseMines();
} catch (Exception e) {
Logger.error(
"Fatal error in City Pulse: DISABLED. Error Message : "
+ e.getMessage());
e.printStackTrace();
}
try {
if ((_minePulseTime != 0)
&& (System.currentTimeMillis() > _minePulseTime))
pulseMines();
} catch (Exception e) {
Logger.error(
"Fatal error in City Pulse: DISABLED. Error Message : "
"Fatal error in Mine Pulse: DISABLED. Error Message : "
+ e.getMessage());
e.printStackTrace();
@@ -175,8 +162,6 @@ public enum SimulationManager {
if (player == null)
continue;
player.update();
}
@@ -226,31 +211,9 @@ public enum SimulationManager {
city = (City) cityObject;
city.onEnter();
}
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
}
private void pulseMines() {
Mine mine;
// *** Refactor: Need a list cached somewhere as it doesn't change very
// often at all. Have a cityListIsDirty boolean that gets set if it
// needs an update. Will speed up this method a great deal.
Collection<AbstractGameObject> mineList = DbManager.getList(Enum.GameObjectType.Mine);
if (mineList == null) {
Logger.info("City List null");
return;
}
for (AbstractGameObject mineObject : mineList) {
mine = (Mine) mineObject;
mine.onEnter();
}
_minePulseTime = System.currentTimeMillis() + MINE_PULSE;
}
/*
* Method runs proximity collision detection for all active portals on the
* game's Runegates
@@ -264,4 +227,21 @@ public enum SimulationManager {
_runegatePulseTime = System.currentTimeMillis() + RUNEGATE_PULSE;
}
private void pulseMines(){
Mine mine;
Collection<AbstractGameObject> mineList = DbManager.getList(Enum.GameObjectType.Mine);
if (mineList == null) {
Logger.info("Mine List null");
return;
}
for (AbstractGameObject mineObject : mineList) {
mine = (Mine) mineObject;
if(mine.isActive)
mine.onEnter();
}
_minePulseTime = System.currentTimeMillis() + CITY_PULSE;
}
}
+166
View File
@@ -0,0 +1,166 @@
package engine.gameManager;
public class ZergManager {
public static float getMultiplier5Man(int count){
float multiplier = 1.0f;
switch(count){
case 1:
case 2:
multiplier += 0.0f;
break;
case 3:
multiplier += 0.55f;
break;
case 4:
multiplier += 0.2f;
break;
case 5:
multiplier += 0.0f;
break;
case 6:
multiplier -= 0.2f;
break;
case 7:
multiplier -= 0.35f;
break;
case 8:
multiplier -= 0.50f;
break;
case 9:
multiplier -= 0.750f;
break;
default:
multiplier -= 1.0f;
break;
}
return multiplier;
}
public static float getMultiplier10Man(int count){
float multiplier = 1.0f;
if(count <=4)
return 0.0f;
switch(count){
case 5:
multiplier += 0.5f;
break;
case 6:
multiplier += 0.4f;
break;
case 7:
multiplier += 0.3f;
break;
case 8:
multiplier += 0.2f;
break;
case 9:
multiplier += 0.1f;
break;
case 10:
multiplier += 0.0f;
break;
case 11:
multiplier -= 0.1f;
break;
case 12:
multiplier -= 0.2f;
break;
case 13:
multiplier -= 0.3f;
break;
case 14:
multiplier -= 0.4f;
break;
case 15:
multiplier -= 0.5f;
break;
case 16:
multiplier -= 0.65f;
break;
case 17:
multiplier -= 0.75f;
break;
case 18:
multiplier -= 0.85f;
break;
default:
multiplier -= 1.0f;
break;
}
return multiplier;
}
public static float getMultiplier20Man(int count){
float multiplier = 1.0f;
if(count < 10){
multiplier += 1.25f;
}else {
switch (count) {
case 10:
multiplier += 0.8f;
break;
case 11:
multiplier += 0.65f;
break;
case 12:
multiplier += 0.54f;
break;
case 13:
multiplier += 0.46f;
break;
case 14:
multiplier += 0.36f;
break;
case 15:
multiplier += 0.28f;
break;
case 16:
multiplier += 0.21f;
break;
case 17:
multiplier += 0.15f;
break;
case 18:
multiplier += 0.09f;
break;
case 19:
multiplier += 0.04f;
break;
case 20:
multiplier += 0.00f;
break;
case 21:
multiplier -= 0.04f;
break;
case 22:
multiplier -= 0.09f;
break;
case 23:
multiplier -= 0.15f;
break;
case 24:
multiplier -= 0.21f;
break;
case 25:
multiplier -= 0.28f;
break;
case 26:
multiplier -= 0.36f;
break;
case 27:
multiplier -= 0.46f;
break;
case 28:
multiplier -= 0.54f;
break;
case 29:
multiplier -= 0.65f;
break;
default:
multiplier -= 0.75f;
break;
}
}
return multiplier;
}
}