Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b944847b8a | |||
| cdf6465f60 |
@@ -24,3 +24,5 @@
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
*.code-workspace
|
||||
|
||||
|
||||
@@ -1196,6 +1196,7 @@ public class Enum {
|
||||
Durability,
|
||||
ExclusiveDamageCap,
|
||||
Fade,
|
||||
Fear,
|
||||
Fly,
|
||||
Health,
|
||||
HealthFull,
|
||||
@@ -2855,8 +2856,7 @@ 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),
|
||||
Siege(null, false, false, false, false, false);
|
||||
AggroWanderer(null, false, false, true, false, false);
|
||||
|
||||
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
||||
public MobBehaviourType BehaviourHelperType;
|
||||
|
||||
@@ -280,6 +280,9 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
|
||||
case Stunned:
|
||||
abstractEffectModifier = new StunnedEffectModifier(rs);
|
||||
break;
|
||||
case Fear:
|
||||
abstractEffectModifier = new FearEffectModifier(rs);
|
||||
break;
|
||||
case Value:
|
||||
abstractEffectModifier = new ValueEffectModifier(rs);
|
||||
if (effectBase != null) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Item;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
@@ -47,10 +46,10 @@ public class AddGoldCmd extends AbstractDevCmd {
|
||||
throwbackError(pc, "Quantity must be a number, " + words[0] + " is invalid");
|
||||
return;
|
||||
}
|
||||
if (amt < 1 || amt > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
throwbackError(pc, "Quantity must be between 1 and " + MBServerStatics.PLAYER_GOLD_LIMIT);
|
||||
if (amt < 1 || amt > 10000000) {
|
||||
throwbackError(pc, "Quantity must be between 1 and 10000000 (10 million)");
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ 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;
|
||||
|
||||
@@ -71,30 +70,28 @@ 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 = (Building)target;
|
||||
Building parentBuilding = (Building) target;
|
||||
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
|
||||
return;
|
||||
}
|
||||
NPC created;
|
||||
Guild guild = null;
|
||||
Vector3fImmutable loc;
|
||||
if(building != null){
|
||||
guild = building.getGuild();
|
||||
loc = building.loc;
|
||||
} else{
|
||||
loc = pc.loc;
|
||||
|
||||
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);
|
||||
}
|
||||
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,7 +29,10 @@ import engine.server.world.WorldServer;
|
||||
import engine.session.Session;
|
||||
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 {
|
||||
|
||||
@@ -186,53 +189,6 @@ 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;
|
||||
|
||||
@@ -433,6 +433,11 @@ public enum CombatManager {
|
||||
if (bonus != null && bonus.getBool(ModType.Stunned, SourceType.None))
|
||||
attackFailure = true;
|
||||
|
||||
//see if attacker is feared. If so, stop here
|
||||
|
||||
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||
attackFailure = true;
|
||||
|
||||
//Get Range of weapon
|
||||
|
||||
float range;
|
||||
@@ -763,14 +768,9 @@ public enum CombatManager {
|
||||
|
||||
//return if passive (Block, Parry, Dodge) fired
|
||||
|
||||
if (passiveFired) {
|
||||
try {
|
||||
handleRetaliate(tarAc, ac);
|
||||
}catch(Exception ignored){
|
||||
|
||||
}
|
||||
if (passiveFired)
|
||||
return;
|
||||
}
|
||||
|
||||
errorTrack = 9;
|
||||
|
||||
//Hit and no passives
|
||||
|
||||
@@ -171,10 +171,6 @@ 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);
|
||||
@@ -323,10 +319,8 @@ public enum LootManager {
|
||||
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
|
||||
if (toAdd != null) {
|
||||
toAdd.setIsID(true);
|
||||
if (toAdd != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||
@@ -337,6 +331,7 @@ 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()) {
|
||||
|
||||
@@ -351,10 +346,12 @@ public enum LootManager {
|
||||
|
||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||
|
||||
if (ml != null){
|
||||
if (ml != null && dropCount < 1) {
|
||||
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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,11 @@ public enum MovementManager {
|
||||
return;
|
||||
}
|
||||
|
||||
// Will this prevent movement at all or only player input for movement?
|
||||
if (toMove.getBonuses().getBool(ModType.Fear, SourceType.None)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg.getEndLat() > MBServerStatics.MAX_WORLD_WIDTH)
|
||||
msg.setEndLat((float) MBServerStatics.MAX_WORLD_WIDTH);
|
||||
|
||||
@@ -407,6 +412,10 @@ public enum MovementManager {
|
||||
PlayerBonuses bonus = member.getBonuses();
|
||||
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
||||
continue;
|
||||
|
||||
//don't move if player is feared
|
||||
if (bonus.getBool(ModType.Fear, SourceType.None))
|
||||
continue;
|
||||
|
||||
member.update();
|
||||
|
||||
|
||||
@@ -313,6 +313,9 @@ public enum PowersManager {
|
||||
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
||||
return true;
|
||||
|
||||
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||
return true;
|
||||
|
||||
// if moving make sure spell valid for movement
|
||||
Vector3fImmutable endLoc = playerCharacter.getEndLoc();
|
||||
|
||||
@@ -595,6 +598,9 @@ public enum PowersManager {
|
||||
SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
|
||||
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
||||
return true;
|
||||
|
||||
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||
return true;
|
||||
|
||||
// if moving make sure spell valid for movement
|
||||
// if flying, make sure spell valid for flying.
|
||||
@@ -761,6 +767,11 @@ public enum PowersManager {
|
||||
finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bonus.getBool(ModType.Fear, SourceType.None)) {
|
||||
finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// get target loc
|
||||
@@ -1042,6 +1053,9 @@ public enum PowersManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||
return;
|
||||
|
||||
msg.setNumTrains(9999);
|
||||
msg.setUnknown04(2);
|
||||
DispatchMessage.sendToAllInRange(caster, msg);
|
||||
@@ -2565,6 +2579,10 @@ public enum PowersManager {
|
||||
|
||||
}
|
||||
|
||||
public static void cancelOnFear(AbstractCharacter ac) {
|
||||
|
||||
}
|
||||
|
||||
private static PowersBase getLastPower(AbstractCharacter ac) {
|
||||
if (ac == null)
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package engine.jobs;
|
||||
|
||||
import engine.job.AbstractJob;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class FearWanderJob extends AbstractJob {
|
||||
private final AbstractCharacter target;
|
||||
private final Random rand = new Random();
|
||||
|
||||
public FearWanderJob(AbstractCharacter target) {
|
||||
super();
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doJob() {
|
||||
// Only wander if still feared
|
||||
if (target == null || !target.getBonuses().getBool(engine.Enum.ModType.Fear, engine.Enum.SourceType.None))
|
||||
return;
|
||||
|
||||
// Pick a random direction and distance
|
||||
float angle = rand.nextFloat() * (float)Math.PI * 2f;
|
||||
float distance = 5f + rand.nextFloat() * 10f; // 5-15 units
|
||||
|
||||
Vector3fImmutable current = target.getLoc();
|
||||
float newX = current.x + (float)Math.cos(angle) * distance;
|
||||
float newZ = current.z + (float)Math.sin(angle) * distance;
|
||||
|
||||
// Clamp to world bounds if needed
|
||||
newX = (float) Math.max(0, Math.min(newX, MBServerStatics.MAX_WORLD_WIDTH));
|
||||
newZ = (float) Math.max(0, Math.min(newZ, MBServerStatics.MAX_WORLD_HEIGHT));
|
||||
|
||||
Vector3fImmutable dest = new Vector3fImmutable(newX, current.y, newZ);
|
||||
|
||||
// Issue movement (implement setEndLoc or similar in your AbstractCharacter)
|
||||
target.setEndLoc(dest);
|
||||
}
|
||||
}
|
||||
@@ -685,8 +685,6 @@ public class MobAI {
|
||||
break;
|
||||
case Pet1:
|
||||
PetLogic(mob);
|
||||
case Siege:
|
||||
PetLogic(mob);
|
||||
break;
|
||||
case HamletGuard:
|
||||
HamletGuardLogic(mob);
|
||||
|
||||
@@ -124,7 +124,7 @@ public class CombatUtilities {
|
||||
}
|
||||
|
||||
public static boolean canSwing(Mob agent) {
|
||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None));
|
||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.Fear, SourceType.None));
|
||||
}
|
||||
|
||||
public static void swingIsMiss(Mob agent, AbstractWorldObject target, int animation) {
|
||||
|
||||
@@ -169,7 +169,7 @@ public class MovementUtilities {
|
||||
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
|
||||
return false;
|
||||
|
||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.Fear, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||
}
|
||||
|
||||
public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
|
||||
|
||||
@@ -560,40 +560,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (!itemManager.inventoryContains(i))
|
||||
return;
|
||||
|
||||
if (i.isCanDestroy()) {
|
||||
if (itemManager.delete(i)) {
|
||||
if (i.isCanDestroy())
|
||||
if (itemManager.delete(i) == true) {
|
||||
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) {
|
||||
@@ -1287,7 +1259,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
cost *= profit;
|
||||
|
||||
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
if (gold.getNumOfItems() + cost > 10000000) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
Building shrineBuilding;
|
||||
Shrine shrine;
|
||||
|
||||
if (!npc.getGuild().getNation().equals(player.getGuild().getNation()))
|
||||
if (npc.getGuild() != player.getGuild())
|
||||
return;
|
||||
|
||||
shrineBuilding = npc.getBuilding();
|
||||
|
||||
@@ -1653,6 +1653,30 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
PowersManager.cancelOnStun(this);
|
||||
}
|
||||
|
||||
public final void cancelOnFear() {
|
||||
boolean changed = false;
|
||||
for (String s : this.effects.keySet()) {
|
||||
Effect eff = this.effects.get(s);
|
||||
if (eff == null)
|
||||
continue;
|
||||
if (eff.cancelOnFear() && eff.cancel()) {
|
||||
eff.cancelJob();
|
||||
this.effects.remove(s);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
JobContainer wanderJob = this.getTimers().get("FearWander");
|
||||
if (wanderJob != null) {
|
||||
wanderJob.cancelJob();
|
||||
this.getTimers().remove("FearWander");
|
||||
}
|
||||
if (changed) {
|
||||
applyBonuses();
|
||||
}
|
||||
PowersManager.cancelOnFear(this);
|
||||
}
|
||||
|
||||
//Call to apply any new effects to player
|
||||
public synchronized void applyBonuses() {
|
||||
PlayerCharacter player;
|
||||
|
||||
@@ -335,16 +335,13 @@ public class Blueprint {
|
||||
availableSlots = 3;
|
||||
break;
|
||||
case 8:
|
||||
availableSlots = 3;
|
||||
availableSlots = 1;
|
||||
break;
|
||||
default:
|
||||
availableSlots = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||
availableSlots += 1;
|
||||
}
|
||||
return availableSlots;
|
||||
}
|
||||
|
||||
|
||||
@@ -970,6 +970,7 @@ public class CharacterItemManager {
|
||||
// if (i.getObjectType() != GameObjectType.MobLoot)
|
||||
// CharacterItemManager.junkedItems.add(i);
|
||||
|
||||
|
||||
calculateWeights();
|
||||
|
||||
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;
|
||||
if (pc.getClientConnection() != null)
|
||||
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;
|
||||
if (pc.getClientConnection() != null)
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 202);
|
||||
|
||||
@@ -86,12 +86,6 @@ 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");
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class Effect {
|
||||
private boolean cancelOnTerritoryClaim;
|
||||
private boolean cancelOnUnEquip;
|
||||
private boolean cancelOnStun;
|
||||
private boolean cancelOnFear;
|
||||
private boolean bakedInStat = false;
|
||||
private boolean isStatic = false;
|
||||
private int effectSourceType = 0;
|
||||
@@ -80,6 +81,7 @@ public class Effect {
|
||||
this.cancelOnTerritoryClaim = false;
|
||||
this.cancelOnUnEquip = false;
|
||||
this.cancelOnStun = false;
|
||||
this.cancelOnFear = false;
|
||||
this.eb = eb;
|
||||
this.trains = trains;
|
||||
}
|
||||
@@ -99,6 +101,7 @@ public class Effect {
|
||||
this.cancelOnTerritoryClaim = false;
|
||||
this.cancelOnUnEquip = false;
|
||||
this.cancelOnStun = false;
|
||||
this.cancelOnFear = false;
|
||||
this.eb = eb;
|
||||
this.trains = trains;
|
||||
this.isStatic = isStatic;
|
||||
@@ -581,6 +584,12 @@ public class Effect {
|
||||
return this.cancelOnStun;
|
||||
}
|
||||
|
||||
public boolean cancelOnFear() {
|
||||
if (this.eb == null)
|
||||
return true;
|
||||
return this.cancelOnFear;
|
||||
}
|
||||
|
||||
public boolean cancelOnTakeDamage() {
|
||||
if (this.eb == null)
|
||||
return true;
|
||||
|
||||
@@ -914,8 +914,4 @@ 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,22 +381,8 @@ 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());
|
||||
}
|
||||
|
||||
@@ -570,6 +556,22 @@ 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,7 +41,6 @@ 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;
|
||||
@@ -849,7 +848,8 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
owner.getSiegeMinionMap().put(mob, slot);
|
||||
|
||||
mob.setNpcOwner(owner);
|
||||
mob.BehaviourType = MobBehaviourType.Siege;
|
||||
mob.BehaviourType = MobBehaviourType.Pet1;
|
||||
mob.BehaviourType.canRoam = false;
|
||||
return mob;
|
||||
}
|
||||
|
||||
@@ -1242,58 +1242,6 @@ 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() {
|
||||
@@ -1301,7 +1249,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
if (!this.isMoving())
|
||||
return;
|
||||
|
||||
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
|
||||
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.Fear, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
|
||||
//Target is stunned or rooted. Don't move
|
||||
|
||||
this.stopMovement(this.getMovementLoc());
|
||||
@@ -1509,11 +1457,6 @@ 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,10 +1061,6 @@ 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;
|
||||
|
||||
@@ -4407,6 +4407,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
|
||||
return 0f;
|
||||
|
||||
if (this.bonuses.getBool(
|
||||
ModType.Fear, SourceType.None))
|
||||
return 0f;
|
||||
|
||||
// Get base skill amount
|
||||
CharacterSkill sk = this.skills.get(type);
|
||||
float amount;
|
||||
@@ -4436,6 +4440,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
// must not be stunned
|
||||
if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
|
||||
return 0f;
|
||||
|
||||
if (this.bonuses.getBool(ModType.Fear, SourceType.None))
|
||||
return 0f;
|
||||
|
||||
|
||||
// Get base skill amount
|
||||
CharacterSkill sk = this.skills.get(sourceType.name());
|
||||
@@ -4897,6 +4905,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
return;
|
||||
}
|
||||
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Fear, SourceType.None)) {
|
||||
//Target is feared. Don't move
|
||||
this.stopMovement(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
return;
|
||||
}
|
||||
if (newLoc.equals(this.getEndLoc())) {
|
||||
this.stopMovement(newLoc);
|
||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||
|
||||
@@ -32,12 +32,9 @@ 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);
|
||||
for(Portal portal : _portals){
|
||||
portal.activate(false);
|
||||
}
|
||||
_portals[Enum.PortalType.CHAOS.ordinal()].activate(false);
|
||||
_portals[Enum.PortalType.OBLIV.ordinal()].activate(false);
|
||||
_portals[Enum.PortalType.MERCHANT.ordinal()].activate(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -247,6 +247,8 @@ public class ActionsBase {
|
||||
//TODO make this more efficient then testing strings
|
||||
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
|
||||
return true; //Currently stun immune. Skip stun
|
||||
else if (this.stackType.equals("Fear") && bonus.getBool(ModType.ImmuneTo, SourceType.Fear))
|
||||
return true; //Currently fear immune. Skip fear
|
||||
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
|
||||
return true; //Currently snare immune. Skip snare
|
||||
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.powers.effectmodifiers;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.jobs.FearWanderJob;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.AbstractEffectJob;
|
||||
import engine.objects.*;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class FearEffectModifier extends AbstractEffectModifier {
|
||||
|
||||
public FearEffectModifier(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
|
||||
// Optional: custom logic when fear is applied
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBonus(AbstractCharacter ac, int trains) {
|
||||
PlayerBonuses bonus = ac.getBonuses();
|
||||
|
||||
bonus.setBool(this.modType, this.sourceType, true);
|
||||
ac.cancelOnFear();
|
||||
ac.setIsCasting(false);
|
||||
ac.stopMovement(ac.getLoc());
|
||||
|
||||
// Schedule the wander job if not already scheduled
|
||||
if (ac.getTimers().get("FearWander") == null) {
|
||||
JobContainer wanderJob = JobScheduler.getInstance().scheduleJob(
|
||||
new FearWanderJob(ac), 2000
|
||||
);
|
||||
|
||||
ac.getTimers().put("FearWander", wanderJob);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBonus(Item item, int trains) {}
|
||||
@Override
|
||||
public void applyBonus(Building building, int trains) {}
|
||||
}
|
||||
@@ -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 = 50000000;
|
||||
public static final int BANK_GOLD_LIMIT = 25000000;
|
||||
// incoming
|
||||
// opcodes to
|
||||
// console
|
||||
public static final int PLAYER_GOLD_LIMIT = 20000000;
|
||||
public static final int PLAYER_GOLD_LIMIT = 10000000;
|
||||
// buildings, npcs
|
||||
/*
|
||||
* Login cache flags
|
||||
|
||||
Reference in New Issue
Block a user