Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5bbc9eee0 | |||
| 4092f7f38f | |||
| a4eea2173d | |||
| d193a12554 | |||
| 96387aa4f4 | |||
| 785a5eb736 | |||
| dd4f4bffe9 | |||
| 2cdeaa4d66 | |||
| 0430fb3e42 | |||
| 5c34853293 | |||
| d991a4f2d8 | |||
| d87d3e2f41 | |||
| edf11f166f | |||
| e5c1dc7bcb | |||
| 9542034e32 |
@@ -2855,8 +2855,7 @@ public class Enum {
|
|||||||
GuardWallArcher(null, false, true, false, false, false),
|
GuardWallArcher(null, false, true, false, false, false),
|
||||||
Wanderer(null, false, true, true, false, false),
|
Wanderer(null, false, true, true, false, false),
|
||||||
HamletGuard(null, false, true, false, false, false),
|
HamletGuard(null, false, true, false, false, false),
|
||||||
AggroWanderer(null, false, false, true, false, false),
|
AggroWanderer(null, false, false, true, false, false);
|
||||||
Siege(null, false, false, false, false, false);
|
|
||||||
|
|
||||||
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
||||||
public MobBehaviourType BehaviourHelperType;
|
public MobBehaviourType BehaviourHelperType;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -71,30 +70,28 @@ public class AddNPCCmd extends AbstractDevCmd {
|
|||||||
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
|
||||||
|
|||||||
@@ -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'";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,10 @@ import engine.server.world.WorldServer;
|
|||||||
import engine.session.Session;
|
import engine.session.Session;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public enum ChatManager {
|
public enum ChatManager {
|
||||||
|
|
||||||
@@ -186,53 +189,6 @@ public enum ChatManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(text.startsWith("./junk")){
|
|
||||||
//junk command
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)player;
|
|
||||||
for(Item i : pc.getCharItemManager().getInventory()){
|
|
||||||
ItemBase ib = i.getItemBase();
|
|
||||||
if(ib.isGlass() || ib.getType().equals(Enum.ItemType.CONTRACT) || ib.isVorg() || ib.getType().equals(Enum.ItemType.RUNE)
|
|
||||||
|| ib.getType().equals(Enum.ItemType.SCROLL) || ib.getType().equals(Enum.ItemType.POTION) || ib.getType().equals(Enum.ItemType.RESOURCE)
|
|
||||||
|| ib.getType().equals(Enum.ItemType.OFFERING) || ib.getType().equals(Enum.ItemType.REALMCHARTER))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int value = ib.getBaseValue();
|
|
||||||
if(pc.getCharItemManager().getGoldInventory().getNumOfItems() + value > MBServerStatics.PLAYER_GOLD_LIMIT)
|
|
||||||
continue; // cannot hold gold value
|
|
||||||
|
|
||||||
pc.getCharItemManager().addGoldToInventory(value,false);
|
|
||||||
pc.getCharItemManager().junk(i);
|
|
||||||
}
|
|
||||||
pc.getCharItemManager().updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(text.startsWith("./stackresources")){
|
|
||||||
HashMap<Integer,Integer> resources = new HashMap<>();
|
|
||||||
PlayerCharacter pc = (PlayerCharacter)player;
|
|
||||||
for(Item i : pc.getCharItemManager().getInventory()){
|
|
||||||
ItemBase ib = i.getItemBase();
|
|
||||||
if(ib.getType().equals(Enum.ItemType.RESOURCE)){
|
|
||||||
if(resources.containsKey(ib.getUUID())){
|
|
||||||
//already logged this resource, add to count
|
|
||||||
int count = resources.get(ib.getUUID());
|
|
||||||
count += i.getNumOfItems();
|
|
||||||
resources.put(ib.getUUID(),count);
|
|
||||||
}else{
|
|
||||||
//have not logged this resource yet
|
|
||||||
resources.put(ib.getUUID(),i.getNumOfItems());
|
|
||||||
}
|
|
||||||
pc.getCharItemManager().junk(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int id : resources.keySet()){
|
|
||||||
ItemBase ib = ItemBase.getItemBase(id);
|
|
||||||
MobLoot ml = new MobLoot(pc,ib,resources.get(id),false);
|
|
||||||
Item i = ml.promoteToItem(pc);
|
|
||||||
pc.getCharItemManager().addItemToInventory(i);
|
|
||||||
}
|
|
||||||
pc.getCharItemManager().updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ChatManager.isDevCommand(text) == true) {
|
if (ChatManager.isDevCommand(text) == true) {
|
||||||
ChatManager.processDevCommand(player, text);
|
ChatManager.processDevCommand(player, text);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -763,14 +763,9 @@ public enum CombatManager {
|
|||||||
|
|
||||||
//return if passive (Block, Parry, Dodge) fired
|
//return if passive (Block, Parry, Dodge) fired
|
||||||
|
|
||||||
if (passiveFired) {
|
if (passiveFired)
|
||||||
try {
|
|
||||||
handleRetaliate(tarAc, ac);
|
|
||||||
}catch(Exception ignored){
|
|
||||||
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
errorTrack = 9;
|
errorTrack = 9;
|
||||||
|
|
||||||
//Hit and no passives
|
//Hit and no passives
|
||||||
|
|||||||
@@ -143,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());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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.util.ZoneLevel;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -100,6 +101,16 @@ public enum LootManager {
|
|||||||
boolean hotzoneWasRan = false;
|
boolean hotzoneWasRan = false;
|
||||||
float dropRate = 1.0f;
|
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
|
||||||
|
|
||||||
for (BootySetEntry bse : entries) {
|
for (BootySetEntry bse : entries) {
|
||||||
@@ -109,12 +120,6 @@ public enum LootManager {
|
|||||||
break;
|
break;
|
||||||
case "LOOT":
|
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))
|
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
|
||||||
|
|
||||||
@@ -171,10 +176,6 @@ public enum LootManager {
|
|||||||
if (itemUUID == 0)
|
if (itemUUID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(itemUUID == 980103 || itemUUID == 980104 || itemUUID == 980110 || itemUUID == 980111){
|
|
||||||
itemUUID = 980100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||||
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);
|
||||||
@@ -200,6 +201,9 @@ public enum LootManager {
|
|||||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We don't want to bother with identifying gear
|
||||||
|
outItem.setIsID(true);
|
||||||
return outItem;
|
return outItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,6 +314,9 @@ public enum LootManager {
|
|||||||
else
|
else
|
||||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
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);
|
||||||
mob.getCharItemManager().addItemToInventory(goldAmount);
|
mob.getCharItemManager().addItemToInventory(goldAmount);
|
||||||
@@ -323,10 +330,8 @@ public enum LootManager {
|
|||||||
|
|
||||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||||
|
|
||||||
if (toAdd != null) {
|
if (toAdd != null)
|
||||||
toAdd.setIsID(true);
|
|
||||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||||
@@ -337,6 +342,7 @@ public enum LootManager {
|
|||||||
public static void GenerateEquipmentDrop(Mob mob) {
|
public static void GenerateEquipmentDrop(Mob mob) {
|
||||||
|
|
||||||
//do equipment here
|
//do equipment here
|
||||||
|
int dropCount = 0;
|
||||||
if (mob.getEquip() != null)
|
if (mob.getEquip() != null)
|
||||||
for (MobEquipment me : mob.getEquip().values()) {
|
for (MobEquipment me : mob.getEquip().values()) {
|
||||||
|
|
||||||
@@ -351,10 +357,12 @@ public enum LootManager {
|
|||||||
|
|
||||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||||
|
|
||||||
if (ml != null){
|
if (ml != null && dropCount < 1) {
|
||||||
ml.setIsID(true);
|
ml.setIsID(true);
|
||||||
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||||
mob.getCharItemManager().addItemToInventory(ml);
|
mob.getCharItemManager().addItemToInventory(ml);
|
||||||
|
dropCount = 1;
|
||||||
|
//break; // Exit on first successful roll.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -685,8 +685,6 @@ public class MobAI {
|
|||||||
break;
|
break;
|
||||||
case Pet1:
|
case Pet1:
|
||||||
PetLogic(mob);
|
PetLogic(mob);
|
||||||
case Siege:
|
|
||||||
PetLogic(mob);
|
|
||||||
break;
|
break;
|
||||||
case HamletGuard:
|
case HamletGuard:
|
||||||
HamletGuardLogic(mob);
|
HamletGuardLogic(mob);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +26,6 @@ import org.pmw.tinylog.Logger;
|
|||||||
|
|
||||||
public class MobRespawnThread implements Runnable {
|
public class MobRespawnThread implements Runnable {
|
||||||
|
|
||||||
|
|
||||||
public MobRespawnThread() {
|
public MobRespawnThread() {
|
||||||
Logger.info(" MobRespawnThread thread has started!");
|
Logger.info(" MobRespawnThread thread has started!");
|
||||||
|
|
||||||
@@ -34,23 +34,85 @@ public class MobRespawnThread implements Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
long rollingKeepFraction = (Zone.rollingAvgMobsAliveDepth - 1) / Zone.rollingAvgMobsAliveDepth;
|
||||||
|
long rollingAddFraction = 1 / Zone.rollingAvgMobsAliveDepth;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
for (Zone zone : ZoneManager.getAllZones()) {
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
|
|
||||||
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
/*
|
||||||
|
if (zone.respawnQue.size() > ZoneLevel.queueLengthToLevelUp) {
|
||||||
Mob respawner = zone.respawnQue.iterator().next();
|
zone.setCampLvl(zone.getCamplvl() + 1);
|
||||||
|
|
||||||
if (respawner == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
respawner.respawn();
|
|
||||||
zone.respawnQue.remove(respawner);
|
|
||||||
zone.lastRespawn = System.currentTimeMillis();
|
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
// 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(e);
|
Logger.error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,40 +560,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (!itemManager.inventoryContains(i))
|
if (!itemManager.inventoryContains(i))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (i.isCanDestroy()) {
|
if (i.isCanDestroy())
|
||||||
if (itemManager.delete(i)) {
|
if (itemManager.delete(i) == true) {
|
||||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ItemBase ib = i.getItemBase();
|
|
||||||
|
|
||||||
if(ib == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(ib.getUUID() == 7) // don't allow gold to junk for gold
|
|
||||||
return;
|
|
||||||
|
|
||||||
int value = ib.getBaseValue();
|
|
||||||
|
|
||||||
Item gold = itemManager.getGoldInventory();
|
|
||||||
int curAmt;
|
|
||||||
if (gold == null)
|
|
||||||
curAmt = 0;
|
|
||||||
else
|
|
||||||
curAmt = gold.getNumOfItems();
|
|
||||||
|
|
||||||
if ((curAmt + value) > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
|
||||||
ChatManager.chatSystemInfo(sourcePlayer, "This would place your inventory over " + MBServerStatics.PLAYER_GOLD_LIMIT + " gold.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
itemManager.addGoldToInventory(value, false);
|
|
||||||
|
|
||||||
itemManager.updateInventory();
|
|
||||||
|
|
||||||
//test
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
||||||
@@ -1287,7 +1259,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
cost *= profit;
|
cost *= profit;
|
||||||
|
|
||||||
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
if (gold.getNumOfItems() + cost > 10000000) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
|||||||
Building shrineBuilding;
|
Building shrineBuilding;
|
||||||
Shrine shrine;
|
Shrine shrine;
|
||||||
|
|
||||||
if (!npc.getGuild().getNation().equals(player.getGuild().getNation()))
|
if (npc.getGuild() != player.getGuild())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
shrineBuilding = npc.getBuilding();
|
shrineBuilding = npc.getBuilding();
|
||||||
|
|||||||
@@ -335,16 +335,13 @@ public class Blueprint {
|
|||||||
availableSlots = 3;
|
availableSlots = 3;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
availableSlots = 3;
|
availableSlots = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
availableSlots = 0;
|
availableSlots = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
|
||||||
availableSlots += 1;
|
|
||||||
}
|
|
||||||
return availableSlots;
|
return availableSlots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -970,6 +970,7 @@ public class CharacterItemManager {
|
|||||||
// if (i.getObjectType() != GameObjectType.MobLoot)
|
// if (i.getObjectType() != GameObjectType.MobLoot)
|
||||||
// CharacterItemManager.junkedItems.add(i);
|
// CharacterItemManager.junkedItems.add(i);
|
||||||
|
|
||||||
|
|
||||||
calculateWeights();
|
calculateWeights();
|
||||||
|
|
||||||
if (updateInventory)
|
if (updateInventory)
|
||||||
@@ -2334,7 +2335,7 @@ public class CharacterItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > 10000000) {
|
||||||
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
||||||
if (pc.getClientConnection() != null)
|
if (pc.getClientConnection() != null)
|
||||||
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
||||||
@@ -2342,7 +2343,7 @@ public class CharacterItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > 10000000) {
|
||||||
PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter;
|
PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter;
|
||||||
if (pc.getClientConnection() != null)
|
if (pc.getClientConnection() != null)
|
||||||
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
||||||
|
|||||||
@@ -86,12 +86,6 @@ public class Contract extends AbstractGameObject {
|
|||||||
this.iconID = rs.getInt("iconID");
|
this.iconID = rs.getInt("iconID");
|
||||||
this.vendorID = rs.getInt("vendorID");
|
this.vendorID = rs.getInt("vendorID");
|
||||||
this.allowedBuildings = EnumBitSet.asEnumBitSet(rs.getLong("allowedBuildingTypeID"), Enum.BuildingGroup.class);
|
this.allowedBuildings = EnumBitSet.asEnumBitSet(rs.getLong("allowedBuildingTypeID"), Enum.BuildingGroup.class);
|
||||||
switch(this.contractID){
|
|
||||||
case 866: //banker
|
|
||||||
case 865: //siege engineer
|
|
||||||
case 899: //alchemist
|
|
||||||
this.allowedBuildings.add(Enum.BuildingGroup.TOL);
|
|
||||||
}
|
|
||||||
this.equipmentSet = rs.getInt("equipSetID");
|
this.equipmentSet = rs.getInt("equipSetID");
|
||||||
this.inventorySet = rs.getInt("inventorySet");
|
this.inventorySet = rs.getInt("inventorySet");
|
||||||
|
|
||||||
|
|||||||
@@ -914,8 +914,4 @@ public class ItemBase {
|
|||||||
public void setAutoID(boolean autoID) {
|
public void setAutoID(boolean autoID) {
|
||||||
this.autoID = autoID;
|
this.autoID = autoID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVorg(){
|
|
||||||
return (this.name.contains("Vorgrim") || this.name.contains("Bellugh") || this.name.contains("Crimson Circle"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,9 @@ public class Mine extends AbstractGameObject {
|
|||||||
if (treeRank < 1)
|
if (treeRank < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (guildUnderMineLimit(playerGuild.getNation(), treeRank) == false) {
|
// We check the limit against only the player guild right now
|
||||||
|
// each guild (even within a nation) is limited by the nation tree
|
||||||
|
if (guildUnderMineLimit(playerGuild, treeRank) == false) {
|
||||||
ErrorPopupMsg.sendErrorMsg(playerCharacter, "Your nation cannot support another mine.");
|
ErrorPopupMsg.sendErrorMsg(playerCharacter, "Your nation cannot support another mine.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -304,10 +306,11 @@ public class Mine extends AbstractGameObject {
|
|||||||
|
|
||||||
mineCnt += Mine.getMinesForGuild(playerGuild.getObjectUUID()).size();
|
mineCnt += Mine.getMinesForGuild(playerGuild.getObjectUUID()).size();
|
||||||
|
|
||||||
for (Guild guild : playerGuild.getSubGuildList())
|
// Only count mines for a specific guild
|
||||||
mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
|
//for (Guild guild : playerGuild.getSubGuildList())
|
||||||
|
// mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
|
||||||
|
|
||||||
return mineCnt <= tolRank;
|
return mineCnt <= (tolRank * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean changeProductionType(Resource resource) {
|
public boolean changeProductionType(Resource resource) {
|
||||||
@@ -381,22 +384,8 @@ public class Mine extends AbstractGameObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean validForMine(Resource r) {
|
public boolean validForMine(Resource r) {
|
||||||
//check expacs individually
|
|
||||||
switch(this.getObjectUUID()){
|
|
||||||
case 58:
|
|
||||||
case 59:
|
|
||||||
return (MineProduction.MAGIC.resources.containsKey(r.UUID) || r.UUID == Resource.BLOODSTONE.UUID);
|
|
||||||
case 60:
|
|
||||||
return (MineProduction.LUMBER.resources.containsKey(r.UUID) || r.UUID == Resource.WORMWOOD.UUID);
|
|
||||||
case 61:
|
|
||||||
return (MineProduction.GOLD.resources.containsKey(r.UUID) || r.UUID == Resource.GALVOR.UUID);
|
|
||||||
case 62:
|
|
||||||
return (MineProduction.ORE.resources.containsKey(r.UUID) || r.UUID == Resource.OBSIDIAN.UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.mineType == null)
|
if (this.mineType == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return this.mineType.validForMine(r, this.isExpansion());
|
return this.mineType.validForMine(r, this.isExpansion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,6 +559,22 @@ public class Mine extends AbstractGameObject {
|
|||||||
}
|
}
|
||||||
//add base production on top;
|
//add base production on top;
|
||||||
totalModded += baseProduction;
|
totalModded += baseProduction;
|
||||||
|
//skip distance check for expansion.
|
||||||
|
if (this.isExpansion())
|
||||||
|
return (int) totalModded;
|
||||||
|
|
||||||
|
if (this.owningGuild.isEmptyGuild() == false) {
|
||||||
|
if (this.owningGuild.getOwnedCity() != null) {
|
||||||
|
float distanceSquared = this.owningGuild.getOwnedCity().getLoc().distanceSquared2D(mineBuilding.getLoc());
|
||||||
|
|
||||||
|
if (distanceSquared > sqr(10000 * 3))
|
||||||
|
totalModded *= .25f;
|
||||||
|
else if (distanceSquared > sqr(10000 * 2))
|
||||||
|
totalModded *= .50f;
|
||||||
|
else if (distanceSquared > sqr(10000))
|
||||||
|
totalModded *= .75f;
|
||||||
|
}
|
||||||
|
}
|
||||||
return (int) totalModded;
|
return (int) totalModded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+38
-59
@@ -31,6 +31,7 @@ import engine.net.client.msg.PlaceAssetMsg;
|
|||||||
import engine.powers.EffectsBase;
|
import engine.powers.EffectsBase;
|
||||||
import engine.powers.MobPowerEntry;
|
import engine.powers.MobPowerEntry;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
import engine.util.ZoneLevel;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
@@ -41,7 +42,6 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
import static engine.math.FastMath.acos;
|
import static engine.math.FastMath.acos;
|
||||||
@@ -102,6 +102,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
private DateTime upgradeDateTime = null;
|
private DateTime upgradeDateTime = null;
|
||||||
private boolean lootSync = false;
|
private boolean lootSync = false;
|
||||||
|
|
||||||
|
private String originalFirstName;
|
||||||
|
private String originalLastName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No Id Constructor
|
* No Id Constructor
|
||||||
@@ -130,6 +132,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.lastName = "the " + contract.getName();
|
this.lastName = "the " + contract.getName();
|
||||||
}
|
}
|
||||||
clearStatic();
|
clearStatic();
|
||||||
|
|
||||||
|
originalFirstName = this.firstName;
|
||||||
|
originalLastName = this.lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,6 +156,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.building = building;
|
this.building = building;
|
||||||
initializeMob(false, false, false);
|
initializeMob(false, false, false);
|
||||||
clearStatic();
|
clearStatic();
|
||||||
|
|
||||||
|
originalFirstName = this.firstName;
|
||||||
|
originalLastName = this.lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,6 +175,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.BehaviourType = Enum.MobBehaviourType.Pet1;
|
this.BehaviourType = Enum.MobBehaviourType.Pet1;
|
||||||
initializeMob(true, false, false);
|
initializeMob(true, false, false);
|
||||||
clearStatic();
|
clearStatic();
|
||||||
|
|
||||||
|
originalFirstName = this.firstName;
|
||||||
|
originalLastName = this.lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//SIEGE CONSTRUCTOR
|
//SIEGE CONSTRUCTOR
|
||||||
@@ -181,6 +192,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
this.equip = new HashMap<>();
|
this.equip = new HashMap<>();
|
||||||
initializeMob(false, true, isPlayerGuard);
|
initializeMob(false, true, isPlayerGuard);
|
||||||
clearStatic();
|
clearStatic();
|
||||||
|
|
||||||
|
originalFirstName = this.firstName;
|
||||||
|
originalLastName = this.lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -289,6 +303,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
Logger.error("Mobile:" + this.dbID + ": " + e);
|
Logger.error("Mobile:" + this.dbID + ": " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
originalFirstName = this.firstName;
|
||||||
|
originalLastName = this.lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
|
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
|
||||||
@@ -849,7 +865,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
owner.getSiegeMinionMap().put(mob, slot);
|
owner.getSiegeMinionMap().put(mob, slot);
|
||||||
|
|
||||||
mob.setNpcOwner(owner);
|
mob.setNpcOwner(owner);
|
||||||
mob.BehaviourType = MobBehaviourType.Siege;
|
mob.BehaviourType = MobBehaviourType.Pet1;
|
||||||
|
mob.BehaviourType.canRoam = false;
|
||||||
return mob;
|
return mob;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1242,58 +1259,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
killCleanup();
|
killCleanup();
|
||||||
|
|
||||||
if (attacker.getObjectType() == GameObjectType.PlayerCharacter) {
|
|
||||||
autoLoot((PlayerCharacter)attacker, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(MobEquipment equip : this.equip.values()){
|
|
||||||
if(equip.getItemBase().getName().contains("vorg") || equip.getItemBase().getName().contains("crimson circle") || equip.getItemBase().getName().contains("bellugh")){
|
|
||||||
if(equip.getDropChance() > 0){
|
|
||||||
this.spawnTime = ThreadLocalRandom.current().nextInt(600,2700);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void autoLoot(PlayerCharacter pc, Mob mob){
|
|
||||||
for (Item loot : mob.charItemManager.getInventory(true)) {
|
|
||||||
try {
|
|
||||||
if (loot != null && loot.getObjectType() == GameObjectType.MobLoot) {
|
|
||||||
if (loot.getItemBaseID() == 7) {
|
|
||||||
if (GroupManager.getGroup(pc) != null && GroupManager.getGroup(pc).getSplitGold()) {
|
|
||||||
GroupManager.goldSplit(pc, loot, pc.getClientConnection(), mob);
|
|
||||||
} else {
|
|
||||||
if (mob.charItemManager.getGoldInventory().getNumOfItems() > 0) {
|
|
||||||
if (pc.charItemManager.getGoldInventory().getNumOfItems() + loot.getNumOfItems() <= MBServerStatics.PLAYER_GOLD_LIMIT) {
|
|
||||||
pc.charItemManager.addGoldToInventory(loot.getNumOfItems(), false);
|
|
||||||
mob.charItemManager.delete(loot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (pc.charItemManager.hasRoomInventory(loot.getItemBase().getWeight())) {
|
|
||||||
Item convert = ((MobLoot) loot).promoteToItem(pc);
|
|
||||||
if (convert != null) {
|
|
||||||
pc.charItemManager.addItemToInventory(convert);
|
|
||||||
if (GroupManager.getGroup(pc) != null && GroupManager.getGroup(pc).getSplitGold()) {
|
|
||||||
String name = loot.getName();
|
|
||||||
String text = pc.getFirstName() + " has looted " + name + '.';
|
|
||||||
ChatManager.chatGroupInfoCanSee(pc, text);
|
|
||||||
}
|
|
||||||
mob.charItemManager.delete(loot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}catch(Exception ignored){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pc.charItemManager.updateInventory();
|
|
||||||
mob.charItemManager.updateInventory();
|
|
||||||
//if(mob.charItemManager.getInventory().size() < 1)
|
|
||||||
// mob.despawn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLocation() {
|
public void updateLocation() {
|
||||||
@@ -1434,6 +1399,12 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
NPCManager.applyRuneSetEffects(this);
|
NPCManager.applyRuneSetEffects(this);
|
||||||
|
|
||||||
|
// Set Name based on parent zone level
|
||||||
|
Zone camp = this.getParentZone();
|
||||||
|
this.lastName = this.originalLastName + ZoneLevel.getNameSuffix(camp);
|
||||||
|
|
||||||
|
//PowersManager.applyPower(this, this, this.getLoc(), "CMP-001", camp.getCamplvl(), false);
|
||||||
|
|
||||||
this.recalculateStats();
|
this.recalculateStats();
|
||||||
this.setHealth(this.healthMax);
|
this.setHealth(this.healthMax);
|
||||||
|
|
||||||
@@ -1509,11 +1480,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
calculateAtrDefenseDamage();
|
calculateAtrDefenseDamage();
|
||||||
if(this.BehaviourType.equals(MobBehaviourType.GuardWallArcher)){
|
|
||||||
this.atrHandOne = 0;
|
|
||||||
this.atrHandTwo = this.getRank() * 250;
|
|
||||||
this.defenseRating = this.getRank() * 200;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(this.getMobBaseID() + " /" + e.getMessage());
|
Logger.error(this.getMobBaseID() + " /" + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -1552,6 +1518,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
|
s *= (1 + this.bonuses.getFloatPercentAll(ModType.StaminaFull, SourceType.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Modify max health based on camp level - bad, we need to use effects for this
|
||||||
|
Zone camp = this.getParentZone();
|
||||||
|
h = h * ZoneLevel.getMaxHealthPctModifier(camp);
|
||||||
|
|
||||||
// Set max health, mana and stamina
|
// Set max health, mana and stamina
|
||||||
|
|
||||||
if (h > 0)
|
if (h > 0)
|
||||||
@@ -1652,6 +1622,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
Logger.error("Error: missing bonuses");
|
Logger.error("Error: missing bonuses");
|
||||||
|
|
||||||
defense = (defense < 1) ? 1 : defense;
|
defense = (defense < 1) ? 1 : defense;
|
||||||
|
|
||||||
|
// Modify defense for camp level - bad, we need to use effects for this
|
||||||
|
Zone camp = this.getParentZone();
|
||||||
|
defense = defense * ZoneLevel.getDefPctModifier(camp);
|
||||||
|
|
||||||
this.defenseRating = (short) (defense + 0.5f);
|
this.defenseRating = (short) (defense + 0.5f);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info("Mobbase ID " + this.getMobBaseID() + " returned an error. Setting to Default Defense." + e.getMessage());
|
Logger.info("Mobbase ID " + this.getMobBaseID() + " returned an error. Setting to Default Defense." + e.getMessage());
|
||||||
@@ -1853,6 +1828,10 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
atr *= (1 + neg_Bonus);
|
atr *= (1 + neg_Bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Modify atr for camp level - bad, we need to use effects for this
|
||||||
|
Zone camp = this.getParentZone();
|
||||||
|
atr = atr * ZoneLevel.getAtrPctModifier(camp);
|
||||||
|
|
||||||
atr = (atr < 1) ? 1 : atr;
|
atr = (atr < 1) ? 1 : atr;
|
||||||
|
|
||||||
// set atr
|
// set atr
|
||||||
|
|||||||
@@ -1061,10 +1061,6 @@ public class NPC extends AbstractCharacter {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ItemBase itemBase;
|
ItemBase itemBase;
|
||||||
if (this.contract.getVendorID() == 104) { // bowyer
|
|
||||||
fullItemList.add(7000514); //Shadow Bow
|
|
||||||
fullItemList.add(7000515); //Beastman's Bow
|
|
||||||
}
|
|
||||||
for (Integer itemID : fullItemList) {
|
for (Integer itemID : fullItemList) {
|
||||||
itemBase = ItemBase.getItemBase(itemID);
|
itemBase = ItemBase.getItemBase(itemID);
|
||||||
boolean exclude = itemBase.getPercentRequired() == 0 && itemBase.getType() == ItemType.WEAPON;
|
boolean exclude = itemBase.getPercentRequired() == 0 && itemBase.getType() == ItemType.WEAPON;
|
||||||
|
|||||||
@@ -32,12 +32,9 @@ public class Runegate {
|
|||||||
|
|
||||||
// Chaos, Khar and Oblivion are on by default
|
// Chaos, Khar and Oblivion are on by default
|
||||||
|
|
||||||
//_portals[Enum.PortalType.CHAOS.ordinal()].activate(false);
|
_portals[Enum.PortalType.CHAOS.ordinal()].activate(false);
|
||||||
//_portals[Enum.PortalType.OBLIV.ordinal()].activate(false);
|
_portals[Enum.PortalType.OBLIV.ordinal()].activate(false);
|
||||||
//_portals[Enum.PortalType.MERCHANT.ordinal()].activate(false);
|
_portals[Enum.PortalType.MERCHANT.ordinal()].activate(false);
|
||||||
for(Portal portal : _portals){
|
|
||||||
portal.activate(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ import engine.math.Bounds;
|
|||||||
import engine.math.Vector2f;
|
import engine.math.Vector2f;
|
||||||
import engine.math.Vector3fImmutable;
|
import engine.math.Vector3fImmutable;
|
||||||
import engine.net.ByteBufferWriter;
|
import engine.net.ByteBufferWriter;
|
||||||
|
import engine.net.DispatchMessage;
|
||||||
|
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||||
import engine.server.MBServerStatics;
|
import engine.server.MBServerStatics;
|
||||||
|
import engine.util.ZoneLevel;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -61,6 +64,13 @@ public class Zone extends AbstractGameObject {
|
|||||||
//public static ArrayList<Mob> respawnQue = new ArrayList<>();
|
//public static ArrayList<Mob> respawnQue = new ArrayList<>();
|
||||||
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||||
public static long lastRespawn = 0;
|
public static long lastRespawn = 0;
|
||||||
|
|
||||||
|
private int campLvl = 0;
|
||||||
|
public long levelUpTimer = 0;
|
||||||
|
public long levelDownTimer = 0;
|
||||||
|
public int rollingAvgMobsAlive = 0;
|
||||||
|
public static final int rollingAvgMobsAliveDepth = 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
*/
|
*/
|
||||||
@@ -100,8 +110,33 @@ public class Zone extends AbstractGameObject {
|
|||||||
|
|
||||||
if (hash == null)
|
if (hash == null)
|
||||||
setHash();
|
setHash();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCampLvl(int level)
|
||||||
|
{
|
||||||
|
this.campLvl = level;
|
||||||
|
|
||||||
|
if (this.campLvl > ZoneLevel.campMaxLvl)
|
||||||
|
{
|
||||||
|
this.campLvl = ZoneLevel.campMaxLvl;
|
||||||
|
}
|
||||||
|
else if (this.campLvl < 0)
|
||||||
|
{
|
||||||
|
this.campLvl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
|
||||||
|
{
|
||||||
|
ChatSystemMsg chatMsg = new ChatSystemMsg(null, this.getName() + " has reached camp level " + this.campLvl + "! Will anyone contest?!");
|
||||||
|
chatMsg.setMessageType(2);
|
||||||
|
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||||
|
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCampLvl()
|
||||||
|
{
|
||||||
|
return this.campLvl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ public class MBServerStatics {
|
|||||||
// hit box
|
// hit box
|
||||||
// calcs
|
// calcs
|
||||||
public static final boolean PRINT_INCOMING_OPCODES = false; // print
|
public static final boolean PRINT_INCOMING_OPCODES = false; // print
|
||||||
public static final int BANK_GOLD_LIMIT = 50000000;
|
public static final int BANK_GOLD_LIMIT = 25000000;
|
||||||
// incoming
|
// incoming
|
||||||
// opcodes to
|
// opcodes to
|
||||||
// console
|
// console
|
||||||
public static final int PLAYER_GOLD_LIMIT = 20000000;
|
public static final int PLAYER_GOLD_LIMIT = 10000000;
|
||||||
// buildings, npcs
|
// buildings, npcs
|
||||||
/*
|
/*
|
||||||
* Login cache flags
|
* Login cache flags
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ public class WorldServer {
|
|||||||
|
|
||||||
private boolean init() {
|
private boolean init() {
|
||||||
|
|
||||||
|
Logger.info("Server Code: [NovaTest] Branch");
|
||||||
Logger.info("MAGICBANE SERVER GREETING:");
|
Logger.info("MAGICBANE SERVER GREETING:");
|
||||||
Logger.info(ConfigManager.MB_WORLD_GREETING.getValue());
|
Logger.info(ConfigManager.MB_WORLD_GREETING.getValue());
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package engine.util;
|
||||||
|
|
||||||
|
import engine.objects.Zone;
|
||||||
|
|
||||||
|
public class ZoneLevel {
|
||||||
|
|
||||||
|
private static final float healthPctPerLevel = (float)0.2;
|
||||||
|
private static final float atrPctPerLevel = (float)0.2;
|
||||||
|
private static final float defPctPerLevel = (float)0.2;
|
||||||
|
private static final float lootPctPerLevel = (float)0.1;
|
||||||
|
private static final float goldPctPerLevel = (float)0.2;
|
||||||
|
|
||||||
|
public static final int campLvlAnnounceThreshold = 5;
|
||||||
|
public static final int campMaxLvl = 10;
|
||||||
|
|
||||||
|
public static final int queueLengthToLevelUp = 5;
|
||||||
|
public static final int msToLevelDown = 60 * 1000;
|
||||||
|
public static final int msTolevelUp = 60 * 1000;
|
||||||
|
public static final long msDelayToCampLevel = 60 * 1000;
|
||||||
|
|
||||||
|
private static final String[] nameMap =
|
||||||
|
{
|
||||||
|
"",
|
||||||
|
" I",
|
||||||
|
" II",
|
||||||
|
" III",
|
||||||
|
" IV",
|
||||||
|
" V",
|
||||||
|
" VI",
|
||||||
|
" VII",
|
||||||
|
" VIII",
|
||||||
|
" IX",
|
||||||
|
" X"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static String getNameSuffix(Zone zone)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return nameMap[zone.getCampLvl()];
|
||||||
|
}
|
||||||
|
catch (Exception ignored)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getMaxHealthPctModifier(Zone zone)
|
||||||
|
{
|
||||||
|
return getGenericModifier(zone, healthPctPerLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getAtrPctModifier(Zone zone)
|
||||||
|
{
|
||||||
|
return getGenericModifier(zone, atrPctPerLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getDefPctModifier(Zone zone)
|
||||||
|
{
|
||||||
|
return getGenericModifier(zone, defPctPerLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getLootDropModifier(Zone zone)
|
||||||
|
{
|
||||||
|
return getGenericModifier(zone, lootPctPerLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getGoldDropModifier(Zone zone)
|
||||||
|
{
|
||||||
|
return getGenericModifier(zone, goldPctPerLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float getGenericModifier(Zone zone, float modifierPerLevel)
|
||||||
|
{
|
||||||
|
float modifier = (float)1.0;
|
||||||
|
|
||||||
|
if (zone != null)
|
||||||
|
{
|
||||||
|
modifier += zone.getCampLvl() * modifierPerLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return modifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -128,10 +128,12 @@ public class HourlyJobThread implements Runnable {
|
|||||||
if (mine.isActive == false)
|
if (mine.isActive == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Logger.info(mine.getZoneName() + "'s Mine is now Closing");
|
||||||
|
|
||||||
Building mineBuilding = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
Building mineBuilding = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
||||||
|
|
||||||
if (mineBuilding == null) {
|
if (mineBuilding == null) {
|
||||||
Logger.debug("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
|
Logger.info("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +141,8 @@ public class HourlyJobThread implements Runnable {
|
|||||||
// We can early exit here.
|
// We can early exit here.
|
||||||
|
|
||||||
if (mineBuilding.getRank() > 0) {
|
if (mineBuilding.getRank() > 0) {
|
||||||
|
Logger.info("Mine still standing when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID());
|
||||||
|
|
||||||
mine.setActive(false);
|
mine.setActive(false);
|
||||||
mine.lastClaimer = null;
|
mine.lastClaimer = null;
|
||||||
return true;
|
return true;
|
||||||
@@ -149,6 +153,8 @@ public class HourlyJobThread implements Runnable {
|
|||||||
// and keep the window open.
|
// and keep the window open.
|
||||||
|
|
||||||
if (!Mine.validateClaimer(mine.lastClaimer)) {
|
if (!Mine.validateClaimer(mine.lastClaimer)) {
|
||||||
|
Logger.info("Mine has no valid claimer when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID());
|
||||||
|
|
||||||
mine.lastClaimer = null;
|
mine.lastClaimer = null;
|
||||||
mine.updateGuildOwner(null);
|
mine.updateGuildOwner(null);
|
||||||
mine.setActive(true);
|
mine.setActive(true);
|
||||||
@@ -157,6 +163,8 @@ public class HourlyJobThread implements Runnable {
|
|||||||
|
|
||||||
//Update ownership to map
|
//Update ownership to map
|
||||||
|
|
||||||
|
Logger.info("Mine ownership changing when closing window. Mine Object UUID: " + mine.getObjectUUID() + " Building Id: " + mine.getBuildingID() + " new owning guild: " + mine.getOwningGuild().getObjectUUID());
|
||||||
|
|
||||||
mine.guildName = mine.getOwningGuild().getName();
|
mine.guildName = mine.getOwningGuild().getName();
|
||||||
mine.guildTag = mine.getOwningGuild().getGuildTag();
|
mine.guildTag = mine.getOwningGuild().getGuildTag();
|
||||||
Guild nation = mine.getOwningGuild().getNation();
|
Guild nation = mine.getOwningGuild().getNation();
|
||||||
|
|||||||
Reference in New Issue
Block a user