Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38983cbcc6 | |||
| 0258fd8c7d | |||
| 96e63f769c | |||
| cc740a97fc | |||
| a62197d32d | |||
| 96fc6e741d | |||
| b8f3c4b240 | |||
| 1ecdcf60a5 | |||
| cc09fb04ce | |||
| 68d525f91c | |||
| b26a260bf3 | |||
| ec736f03be | |||
| 1f88bb38fc | |||
| 27946e695c | |||
| 72a72e6bde | |||
| ad45a17abe | |||
| 4fdbf12691 | |||
| 9b6c75d170 | |||
| b6546b437b | |||
| d4d320264c | |||
| f66902753c | |||
| 849e30841c | |||
| da28279fc1 | |||
| e8e43185aa | |||
| b334399e65 | |||
| 5225898434 | |||
| bcdaa81357 | |||
| 3649c629b7 | |||
| 1c31070fc8 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
@@ -2855,7 +2855,8 @@ public class Enum {
|
||||
GuardWallArcher(null, false, true, false, false, false),
|
||||
Wanderer(null, false, true, true, 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<>();
|
||||
public MobBehaviourType BehaviourHelperType;
|
||||
|
||||
@@ -14,6 +14,7 @@ import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
@@ -46,10 +47,10 @@ public class AddGoldCmd extends AbstractDevCmd {
|
||||
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
|
||||
return;
|
||||
}
|
||||
if (amt < 1 || amt > 10000000) {
|
||||
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
|
||||
if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT);
|
||||
return;
|
||||
} else if ((curAmt + amt) > 10000000) {
|
||||
} else if ((curAmt + amt) > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
throwbackError(pc, "This would place your inventory over 10,000,000 gold.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -70,28 +71,30 @@ public class AddNPCCmd extends AbstractDevCmd {
|
||||
throwbackError(pc, "Failed to find zone to place npc in.");
|
||||
return;
|
||||
}
|
||||
|
||||
Building building = null;
|
||||
if (target != null)
|
||||
if (target.getObjectType() == GameObjectType.Building) {
|
||||
Building parentBuilding = (Building) target;
|
||||
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
|
||||
return;
|
||||
building = (Building)target;
|
||||
}
|
||||
|
||||
NPC npc = NPC.createNPC(name, contractID,
|
||||
pc.getLoc(), null, zone, (short) level, null);
|
||||
|
||||
if (npc != null) {
|
||||
WorldGrid.addObject(npc, pc);
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"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);
|
||||
NPC created;
|
||||
Guild guild = null;
|
||||
Vector3fImmutable loc;
|
||||
if(building != null){
|
||||
guild = building.getGuild();
|
||||
loc = building.loc;
|
||||
} else{
|
||||
loc = pc.loc;
|
||||
}
|
||||
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
|
||||
|
||||
@@ -29,10 +29,7 @@ import engine.server.world.WorldServer;
|
||||
import engine.session.Session;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public enum ChatManager {
|
||||
|
||||
@@ -189,6 +186,53 @@ public enum ChatManager {
|
||||
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) {
|
||||
ChatManager.processDevCommand(player, text);
|
||||
return;
|
||||
|
||||
@@ -763,9 +763,14 @@ public enum CombatManager {
|
||||
|
||||
//return if passive (Block, Parry, Dodge) fired
|
||||
|
||||
if (passiveFired)
|
||||
return;
|
||||
if (passiveFired) {
|
||||
try {
|
||||
handleRetaliate(tarAc, ac);
|
||||
}catch(Exception ignored){
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
errorTrack = 9;
|
||||
|
||||
//Hit and no passives
|
||||
|
||||
@@ -171,6 +171,10 @@ public enum LootManager {
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
if(itemUUID == 980103 || itemUUID == 980104 || itemUUID == 980110 || itemUUID == 980111){
|
||||
itemUUID = 980100;
|
||||
}
|
||||
|
||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||
@@ -319,8 +323,10 @@ public enum LootManager {
|
||||
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
|
||||
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
|
||||
@@ -331,7 +337,6 @@ public enum LootManager {
|
||||
public static void GenerateEquipmentDrop(Mob mob) {
|
||||
|
||||
//do equipment here
|
||||
int dropCount = 0;
|
||||
if (mob.getEquip() != null)
|
||||
for (MobEquipment me : mob.getEquip().values()) {
|
||||
|
||||
@@ -346,12 +351,10 @@ public enum LootManager {
|
||||
|
||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||
|
||||
if (ml != null && dropCount < 1) {
|
||||
if (ml != null){
|
||||
ml.setIsID(true);
|
||||
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||
mob.getCharItemManager().addItemToInventory(ml);
|
||||
dropCount = 1;
|
||||
//break; // Exit on first successful roll.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,6 +685,8 @@ public class MobAI {
|
||||
break;
|
||||
case Pet1:
|
||||
PetLogic(mob);
|
||||
case Siege:
|
||||
PetLogic(mob);
|
||||
break;
|
||||
case HamletGuard:
|
||||
HamletGuardLogic(mob);
|
||||
@@ -693,6 +695,8 @@ public class MobAI {
|
||||
DefaultLogic(mob);
|
||||
break;
|
||||
}
|
||||
if(mob.isAlive())
|
||||
RecoverHealth(mob);
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||
}
|
||||
@@ -808,7 +812,7 @@ public class MobAI {
|
||||
chaseTarget(mob);
|
||||
break;
|
||||
case GuardMinion:
|
||||
if (!mob.npcOwner.isAlive() || ((Mob) mob.npcOwner).despawned)
|
||||
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null)
|
||||
randomGuardPatrolPoint(mob);
|
||||
else {
|
||||
if (mob.getCombatTarget() != null) {
|
||||
@@ -827,6 +831,7 @@ public class MobAI {
|
||||
chaseTarget(mob);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||
@@ -1043,7 +1048,6 @@ public class MobAI {
|
||||
mob.setCombatTarget(newTarget);
|
||||
|
||||
}
|
||||
|
||||
CheckMobMovement(mob);
|
||||
CheckForAttack(mob);
|
||||
} catch (Exception e) {
|
||||
@@ -1054,24 +1058,9 @@ public class MobAI {
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
|
||||
try {
|
||||
if (!mob.npcOwner.isAlive()) {
|
||||
|
||||
if (mob.getCombatTarget() == null) {
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
GuardCaptainLogic(mob);
|
||||
}else {
|
||||
if (mob.npcOwner.getCombatTarget() != null)
|
||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||
@@ -1110,22 +1099,6 @@ public class MobAI {
|
||||
CheckMobMovement(mob);
|
||||
|
||||
CheckForAttack(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());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||
}
|
||||
@@ -1379,4 +1352,22 @@ public class MobAI {
|
||||
}
|
||||
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());
|
||||
|
||||
if (mob.getHealth() > mob.getHealthMax())
|
||||
mob.setHealth(mob.getHealthMax());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,12 +560,40 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (!itemManager.inventoryContains(i))
|
||||
return;
|
||||
|
||||
if (i.isCanDestroy())
|
||||
if (itemManager.delete(i) == true) {
|
||||
if (i.isCanDestroy()) {
|
||||
if (itemManager.delete(i)) {
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
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) {
|
||||
@@ -1259,7 +1287,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
cost *= profit;
|
||||
|
||||
if (gold.getNumOfItems() + cost > 10000000) {
|
||||
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
Building shrineBuilding;
|
||||
Shrine shrine;
|
||||
|
||||
if (npc.getGuild() != player.getGuild())
|
||||
if (!npc.getGuild().getNation().equals(player.getGuild().getNation()))
|
||||
return;
|
||||
|
||||
shrineBuilding = npc.getBuilding();
|
||||
|
||||
@@ -335,13 +335,16 @@ public class Blueprint {
|
||||
availableSlots = 3;
|
||||
break;
|
||||
case 8:
|
||||
availableSlots = 1;
|
||||
availableSlots = 3;
|
||||
break;
|
||||
default:
|
||||
availableSlots = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||
availableSlots += 1;
|
||||
}
|
||||
return availableSlots;
|
||||
}
|
||||
|
||||
|
||||
@@ -970,7 +970,6 @@ public class CharacterItemManager {
|
||||
// if (i.getObjectType() != GameObjectType.MobLoot)
|
||||
// CharacterItemManager.junkedItems.add(i);
|
||||
|
||||
|
||||
calculateWeights();
|
||||
|
||||
if (updateInventory)
|
||||
@@ -2335,7 +2334,7 @@ public class CharacterItemManager {
|
||||
}
|
||||
|
||||
|
||||
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > 10000000) {
|
||||
if (this.getGoldInventory().getNumOfItems() + goldFrom2 > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
||||
if (pc.getClientConnection() != null)
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
||||
@@ -2343,7 +2342,7 @@ public class CharacterItemManager {
|
||||
}
|
||||
|
||||
|
||||
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > 10000000) {
|
||||
if (tradingWith.getGoldInventory().getNumOfItems() + goldFrom1 > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
PlayerCharacter pc = (PlayerCharacter) tradingWith.absCharacter;
|
||||
if (pc.getClientConnection() != null)
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
||||
|
||||
@@ -86,6 +86,12 @@ public class Contract extends AbstractGameObject {
|
||||
this.iconID = rs.getInt("iconID");
|
||||
this.vendorID = rs.getInt("vendorID");
|
||||
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.inventorySet = rs.getInt("inventorySet");
|
||||
|
||||
|
||||
@@ -914,4 +914,8 @@ public class ItemBase {
|
||||
public void setAutoID(boolean autoID) {
|
||||
this.autoID = autoID;
|
||||
}
|
||||
|
||||
public boolean isVorg(){
|
||||
return (this.name.contains("Vorgrim") || this.name.contains("Bellugh") || this.name.contains("Crimson Circle"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,8 +381,22 @@ public class Mine extends AbstractGameObject {
|
||||
}
|
||||
|
||||
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)
|
||||
return false;
|
||||
|
||||
return this.mineType.validForMine(r, this.isExpansion());
|
||||
}
|
||||
|
||||
@@ -556,22 +570,6 @@ public class Mine extends AbstractGameObject {
|
||||
}
|
||||
//add base production on top;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import static engine.math.FastMath.acos;
|
||||
@@ -848,8 +849,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
owner.getSiegeMinionMap().put(mob, slot);
|
||||
|
||||
mob.setNpcOwner(owner);
|
||||
mob.BehaviourType = MobBehaviourType.Pet1;
|
||||
mob.BehaviourType.canRoam = false;
|
||||
mob.BehaviourType = MobBehaviourType.Siege;
|
||||
return mob;
|
||||
}
|
||||
|
||||
@@ -1242,6 +1242,58 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
}
|
||||
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() {
|
||||
@@ -1457,6 +1509,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
try {
|
||||
calculateAtrDefenseDamage();
|
||||
if(this.BehaviourType.equals(MobBehaviourType.GuardWallArcher)){
|
||||
this.atrHandOne = 0;
|
||||
this.atrHandTwo = this.getRank() * 250;
|
||||
this.defenseRating = this.getRank() * 200;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(this.getMobBaseID() + " /" + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1061,6 +1061,10 @@ public class NPC extends AbstractCharacter {
|
||||
break;
|
||||
}
|
||||
ItemBase itemBase;
|
||||
if (this.contract.getVendorID() == 104) { // bowyer
|
||||
fullItemList.add(7000514); //Shadow Bow
|
||||
fullItemList.add(7000515); //Beastman's Bow
|
||||
}
|
||||
for (Integer itemID : fullItemList) {
|
||||
itemBase = ItemBase.getItemBase(itemID);
|
||||
boolean exclude = itemBase.getPercentRequired() == 0 && itemBase.getType() == ItemType.WEAPON;
|
||||
|
||||
@@ -32,9 +32,12 @@ public class Runegate {
|
||||
|
||||
// Chaos, Khar and Oblivion are on by default
|
||||
|
||||
_portals[Enum.PortalType.CHAOS.ordinal()].activate(false);
|
||||
_portals[Enum.PortalType.OBLIV.ordinal()].activate(false);
|
||||
_portals[Enum.PortalType.MERCHANT.ordinal()].activate(false);
|
||||
//_portals[Enum.PortalType.CHAOS.ordinal()].activate(false);
|
||||
//_portals[Enum.PortalType.OBLIV.ordinal()].activate(false);
|
||||
//_portals[Enum.PortalType.MERCHANT.ordinal()].activate(false);
|
||||
for(Portal portal : _portals){
|
||||
portal.activate(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ public class MBServerStatics {
|
||||
// hit box
|
||||
// calcs
|
||||
public static final boolean PRINT_INCOMING_OPCODES = false; // print
|
||||
public static final int BANK_GOLD_LIMIT = 25000000;
|
||||
public static final int BANK_GOLD_LIMIT = 50000000;
|
||||
// incoming
|
||||
// opcodes to
|
||||
// console
|
||||
public static final int PLAYER_GOLD_LIMIT = 10000000;
|
||||
public static final int PLAYER_GOLD_LIMIT = 20000000;
|
||||
// buildings, npcs
|
||||
/*
|
||||
* Login cache flags
|
||||
|
||||
Reference in New Issue
Block a user