Compare commits

..

2 Commits

Author SHA1 Message Date
Preston b944847b8a Added fear mechanic. 2025-08-17 17:14:17 -05:00
Preston cdf6465f60 Add initial workspace configuration file. Add fear mechanic. 2025-08-17 17:06:10 -05:00
26 changed files with 280 additions and 175 deletions
+2 -2
View File
@@ -24,5 +24,5 @@
hs_err_pid* hs_err_pid*
replay_pid* replay_pid*
.idea/ *.code-workspace
*.iml
+1
View File
@@ -1196,6 +1196,7 @@ public class Enum {
Durability, Durability,
ExclusiveDamageCap, ExclusiveDamageCap,
Fade, Fade,
Fear,
Fly, Fly,
Health, Health,
HealthFull, HealthFull,
@@ -280,6 +280,9 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
case Stunned: case Stunned:
abstractEffectModifier = new StunnedEffectModifier(rs); abstractEffectModifier = new StunnedEffectModifier(rs);
break; break;
case Fear:
abstractEffectModifier = new FearEffectModifier(rs);
break;
case Value: case Value:
abstractEffectModifier = new ValueEffectModifier(rs); abstractEffectModifier = new ValueEffectModifier(rs);
if (effectBase != null) { if (effectBase != null) {
+3 -4
View File
@@ -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;
} }
+16 -52
View File
@@ -16,7 +16,6 @@ import engine.devcmd.AbstractDevCmd;
import engine.gameManager.DbManager; import engine.gameManager.DbManager;
import engine.objects.*; import engine.objects.*;
import engine.powers.EffectsBase; import engine.powers.EffectsBase;
import engine.server.MBServerStatics;
import java.util.ArrayList; import java.util.ArrayList;
@@ -32,82 +31,47 @@ public class MakeItemCmd extends AbstractDevCmd {
@Override @Override
protected void _doCmd(PlayerCharacter pc, String[] words, protected void _doCmd(PlayerCharacter pc, String[] words,
AbstractGameObject target) { AbstractGameObject target) {
if (words[0].equals("resources")) { if (words[0].equals("resources")) {
int resourceAmount = 1000;
if (words.length > 1) {
try {
resourceAmount = Integer.parseInt(words[1]);
} catch (NumberFormatException e) {
throwbackError(pc, "Resource amount must be a number.");
return;
}
}
if (resourceAmount < 1)
resourceAmount = 1;
resourceAmount = Math.min(
resourceAmount,
MBServerStatics.RESOURCE_STACK_LIMIT
);
for (int ibID : Warehouse.getMaxResources().keySet()) { for (int ibID : Warehouse.getMaxResources().keySet()) {
if (ibID == 7) if (ibID == 7)
continue; continue;
ItemBase ib = ItemBase.getItemBase(ibID); ItemBase ib = ItemBase.getItemBase(ibID);
if (ib == null)
continue;
short weight = ib.getWeight(); short weight = ib.getWeight();
if (!pc.getCharItemManager().hasRoomInventory(weight)) { if (!pc.getCharItemManager().hasRoomInventory(weight)) {
throwbackError(pc, "Not enough room in inventory for any more resources."); throwbackError(pc, "Not enough room in inventory for any more of this item");
pc.getCharItemManager().updateInventory(); pc.getCharItemManager().updateInventory();
return; return;
} }
Item item = new Item( boolean worked = false;
ib, Item item = new Item(ib, pc.getObjectUUID(),
pc.getObjectUUID(), OwnerType.PlayerCharacter, (byte) 0, (byte) 0, (short) ib.getDurability(), (short) ib.getDurability(),
OwnerType.PlayerCharacter, true, false, ItemContainerType.INVENTORY, (byte) 0,
(byte) 0, new ArrayList<>(), "");
(byte) 0,
(short) ib.getDurability(),
(short) ib.getDurability(),
true,
false,
ItemContainerType.INVENTORY,
(byte) 0,
new ArrayList<>(),
""
);
item.setNumOfItems(resourceAmount); item.setNumOfItems(Warehouse.getMaxResources().get(ibID));
try { try {
item = DbManager.ItemQueries.ADD_ITEM(item); item = DbManager.ItemQueries.ADD_ITEM(item);
worked = true;
} catch (Exception e) { } catch (Exception e) {
throwbackError( throwbackError(pc, "DB error 1: Unable to create item. " + e.getMessage());
pc,
"Unable to create resource " + ib.getName() + ": " + e.getMessage()
);
return; return;
} }
if (item == null) { if (item == null || !worked) {
throwbackError(pc, "Unable to create resource " + ib.getName() + "."); throwbackError(pc, "DB error 2: Unable to create item.");
return; return;
} }
//add item to inventory
pc.getCharItemManager().addItemToInventory(item); pc.getCharItemManager().addItemToInventory(item);
} }
pc.getCharItemManager().updateInventory();
return; return;
} }
if (words.length < 3 || words.length > 5) { if (words.length < 3 || words.length > 5) {
@@ -136,7 +100,7 @@ public class MakeItemCmd extends AbstractDevCmd {
return; return;
} }
numItems = (numItems < 1) ? 1 : numItems; numItems = (numItems < 1) ? 1 : numItems;
numItems = Math.min(numItems, MBServerStatics.RESOURCE_STACK_LIMIT); numItems = (numItems > 5000) ? 5000 : numItems;
} }
int itembaseID; int itembaseID;
-7
View File
@@ -39,13 +39,6 @@ public class SlotTestCmd extends AbstractDevCmd {
Building building = (Building) target; Building building = (Building) target;
outString += "Rank: " + building.getRank() + "\r\n";
outString += "MaxSlots: " + building.getBlueprint().getMaxSlots() + "\r\n";
outString += "SlotsForRank: "
+ building.getBlueprint().getSlotsForRank(building.getRank())
+ "\r\n";
outString += "Hireling Count: " + building.getHirelings().size() + "\r\n\r\n";
buildingLocations = BuildingManager._slotLocations.get(building.meshUUID); buildingLocations = BuildingManager._slotLocations.get(building.meshUUID);
if (buildingLocations == null) { if (buildingLocations == null) {
@@ -289,34 +289,6 @@ public enum BuildingManager {
// Method transfers ownership of all hirelings in a building // Method transfers ownership of all hirelings in a building
public static void reslotHirelings(Building building) {
if (building == null)
return;
ArrayList<AbstractCharacter> hirelings =
new ArrayList<>(building.getHirelings().keySet());
building.getHirelings().clear();
for (AbstractCharacter hireling : hirelings) {
int newSlot = NPCManager.slotCharacterInBuilding(hireling);
if (newSlot == -1) {
Logger.error("Unable to re-slot hireling "
+ hireling.getObjectUUID()
+ " for building "
+ building.getObjectUUID());
continue;
}
hireling.setLoc(hireling.getBindLoc());
WorldGrid.updateObject(hireling);
InterestManager.setObjectDirty(hireling);
}
}
public static void refreshHirelings(Building building) { public static void refreshHirelings(Building building) {
if (building == null) if (building == null)
@@ -433,6 +433,11 @@ public enum CombatManager {
if (bonus != null && bonus.getBool(ModType.Stunned, SourceType.None)) if (bonus != null && bonus.getBool(ModType.Stunned, SourceType.None))
attackFailure = true; 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 //Get Range of weapon
float range; float range;
@@ -79,6 +79,11 @@ public enum MovementManager {
return; 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) if (msg.getEndLat() > MBServerStatics.MAX_WORLD_WIDTH)
msg.setEndLat((float) MBServerStatics.MAX_WORLD_WIDTH); msg.setEndLat((float) MBServerStatics.MAX_WORLD_WIDTH);
@@ -407,6 +412,10 @@ public enum MovementManager {
PlayerBonuses bonus = member.getBonuses(); PlayerBonuses bonus = member.getBonuses();
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None)) if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
continue; continue;
//don't move if player is feared
if (bonus.getBool(ModType.Fear, SourceType.None))
continue;
member.update(); member.update();
+18
View File
@@ -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))) if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
return true; return true;
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
return true;
// if moving make sure spell valid for movement // if moving make sure spell valid for movement
Vector3fImmutable endLoc = playerCharacter.getEndLoc(); Vector3fImmutable endLoc = playerCharacter.getEndLoc();
@@ -595,6 +598,9 @@ public enum PowersManager {
SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); 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))) if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
return true; return true;
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
return true;
// if moving make sure spell valid for movement // if moving make sure spell valid for movement
// if flying, make sure spell valid for flying. // if flying, make sure spell valid for flying.
@@ -761,6 +767,11 @@ public enum PowersManager {
finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true); finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true);
return; return;
} }
if (bonus.getBool(ModType.Fear, SourceType.None)) {
finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true);
return;
}
} }
// get target loc // get target loc
@@ -1042,6 +1053,9 @@ public enum PowersManager {
return; return;
} }
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
return;
msg.setNumTrains(9999); msg.setNumTrains(9999);
msg.setUnknown04(2); msg.setUnknown04(2);
DispatchMessage.sendToAllInRange(caster, msg); DispatchMessage.sendToAllInRange(caster, msg);
@@ -2565,6 +2579,10 @@ public enum PowersManager {
} }
public static void cancelOnFear(AbstractCharacter ac) {
}
private static PowersBase getLastPower(AbstractCharacter ac) { private static PowersBase getLastPower(AbstractCharacter ac) {
if (ac == null) if (ac == null)
return null; return null;
+42
View File
@@ -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);
}
}
@@ -124,7 +124,7 @@ public class CombatUtilities {
} }
public static boolean canSwing(Mob agent) { 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) { 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())) if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
return false; 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) { public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
+1 -1
View File
@@ -1259,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;
} }
+24
View File
@@ -1653,6 +1653,30 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
PowersManager.cancelOnStun(this); 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 //Call to apply any new effects to player
public synchronized void applyBonuses() { public synchronized void applyBonuses() {
PlayerCharacter player; PlayerCharacter player;
+1 -1
View File
@@ -335,7 +335,7 @@ public class Blueprint {
availableSlots = 3; availableSlots = 3;
break; break;
case 8: case 8:
availableSlots = Math.min(3, this.maxSlots); availableSlots = 1;
break; break;
default: default:
availableSlots = 0; availableSlots = 0;
-4
View File
@@ -427,10 +427,6 @@ public class Building extends AbstractWorldObject {
BuildingManager.cleanupHirelings(this); BuildingManager.cleanupHirelings(this);
if (this.getBlueprint().getBuildingGroup() == BuildingGroup.TOL
&& this.rank == 8)
BuildingManager.reslotHirelings(this);
this.isDeranking.compareAndSet(true, false); this.isDeranking.compareAndSet(true, false);
} }
+3 -2
View File
@@ -2335,14 +2335,15 @@ 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);
return false; return false;
} }
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);
+9
View File
@@ -48,6 +48,7 @@ public class Effect {
private boolean cancelOnTerritoryClaim; private boolean cancelOnTerritoryClaim;
private boolean cancelOnUnEquip; private boolean cancelOnUnEquip;
private boolean cancelOnStun; private boolean cancelOnStun;
private boolean cancelOnFear;
private boolean bakedInStat = false; private boolean bakedInStat = false;
private boolean isStatic = false; private boolean isStatic = false;
private int effectSourceType = 0; private int effectSourceType = 0;
@@ -80,6 +81,7 @@ public class Effect {
this.cancelOnTerritoryClaim = false; this.cancelOnTerritoryClaim = false;
this.cancelOnUnEquip = false; this.cancelOnUnEquip = false;
this.cancelOnStun = false; this.cancelOnStun = false;
this.cancelOnFear = false;
this.eb = eb; this.eb = eb;
this.trains = trains; this.trains = trains;
} }
@@ -99,6 +101,7 @@ public class Effect {
this.cancelOnTerritoryClaim = false; this.cancelOnTerritoryClaim = false;
this.cancelOnUnEquip = false; this.cancelOnUnEquip = false;
this.cancelOnStun = false; this.cancelOnStun = false;
this.cancelOnFear = false;
this.eb = eb; this.eb = eb;
this.trains = trains; this.trains = trains;
this.isStatic = isStatic; this.isStatic = isStatic;
@@ -581,6 +584,12 @@ public class Effect {
return this.cancelOnStun; return this.cancelOnStun;
} }
public boolean cancelOnFear() {
if (this.eb == null)
return true;
return this.cancelOnFear;
}
public boolean cancelOnTakeDamage() { public boolean cancelOnTakeDamage() {
if (this.eb == null) if (this.eb == null)
return true; return true;
+40 -39
View File
@@ -674,6 +674,46 @@ public class Item extends AbstractWorldObject {
public static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType) { public static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType) {
return newGoldItem(awo, ib, containerType, true); return newGoldItem(awo, ib, containerType, true);
} }
//used for vault!
public static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType) {
return newGoldItem(accountID, ib, containerType, true);
}
private static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) {
int ownerID;
OwnerType ownerType;
ownerID = accountID;
ownerType = OwnerType.Account;
Item newGold = new Item(ib, ownerID, ownerType,
(byte) 0, (byte) 0, (short) 0, (short) 0, true, false, containerType, (byte) 0,
new ArrayList<>(), "");
synchronized (newGold) {
newGold.numberOfItems = 0;
}
if (persist) {
try {
newGold = DbManager.ItemQueries.ADD_ITEM(newGold);
if (newGold != null) {
synchronized (newGold) {
newGold.numberOfItems = 0;
}
}
} catch (Exception e) {
Logger.error(e);
}
DbManager.ItemQueries.ZERO_ITEM_STACK(newGold);
}
return newGold;
}
private static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) { private static Item newGoldItem(AbstractWorldObject awo, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) {
int ownerID; int ownerID;
@@ -731,49 +771,10 @@ public class Item extends AbstractWorldObject {
} }
DbManager.ItemQueries.ZERO_ITEM_STACK(newGold); DbManager.ItemQueries.ZERO_ITEM_STACK(newGold);
} }
newGold.containerType = containerType; newGold.containerType = containerType;
return newGold; return newGold;
} }
//used for vault!
public static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType) {
return newGoldItem(accountID, ib, containerType, true);
}
private static Item newGoldItem(int accountID, ItemBase ib, Enum.ItemContainerType containerType, boolean persist) {
int ownerID;
OwnerType ownerType;
ownerID = accountID;
ownerType = OwnerType.Account;
Item newGold = new Item(ib, ownerID, ownerType,
(byte) 0, (byte) 0, (short) 0, (short) 0, true, false, containerType, (byte) 0,
new ArrayList<>(), "");
synchronized (newGold) {
newGold.numberOfItems = 0;
}
if (persist) {
try {
newGold = DbManager.ItemQueries.ADD_ITEM(newGold);
if (newGold != null) {
synchronized (newGold) {
newGold.numberOfItems = 0;
}
}
} catch (Exception e) {
Logger.error(e);
}
DbManager.ItemQueries.ZERO_ITEM_STACK(newGold);
}
return newGold;
}
// This is to be used for trades - the new item is not stored in the database // This is to be used for trades - the new item is not stored in the database
public static Item newGoldItemTemp(AbstractWorldObject awo, ItemBase ib) { public static Item newGoldItemTemp(AbstractWorldObject awo, ItemBase ib) {
+1 -1
View File
@@ -1249,7 +1249,7 @@ public class Mob extends AbstractIntelligenceAgent {
if (!this.isMoving()) if (!this.isMoving())
return; 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 //Target is stunned or rooted. Don't move
this.stopMovement(this.getMovementLoc()); this.stopMovement(this.getMovementLoc());
+15 -6
View File
@@ -1239,17 +1239,12 @@ public class PlayerCharacter extends AbstractCharacter {
playerCharacter.deactivateCharacter(); playerCharacter.deactivateCharacter();
return null; return null;
} }
// Ebonreach: give new characters starter gold.
Item starterGold = Item.newGoldItem(playerCharacter, ItemBase.getItemBase(7), Enum.ItemContainerType.INVENTORY);
if (starterGold != null)
DbManager.ItemQueries.UPDATE_GOLD(starterGold, 10000);
// Get any new skills that belong to the player // Get any new skills that belong to the player
playerCharacter.calculateSkills(); playerCharacter.calculateSkills();
a.setLastCharacter(playerCharacter.getObjectUUID()); a.setLastCharacter(playerCharacter.getObjectUUID());
playerCharacter.getCharItemManager().load(); playerCharacter.charItemManager.load();
playerCharacter.activateCharacter(); playerCharacter.activateCharacter();
@@ -4412,6 +4407,10 @@ public class PlayerCharacter extends AbstractCharacter {
if (this.bonuses.getBool(ModType.Stunned, SourceType.None)) if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
return 0f; return 0f;
if (this.bonuses.getBool(
ModType.Fear, SourceType.None))
return 0f;
// Get base skill amount // Get base skill amount
CharacterSkill sk = this.skills.get(type); CharacterSkill sk = this.skills.get(type);
float amount; float amount;
@@ -4441,6 +4440,10 @@ public class PlayerCharacter extends AbstractCharacter {
// must not be stunned // must not be stunned
if (this.bonuses.getBool(ModType.Stunned, SourceType.None)) if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
return 0f; return 0f;
if (this.bonuses.getBool(ModType.Fear, SourceType.None))
return 0f;
// Get base skill amount // Get base skill amount
CharacterSkill sk = this.skills.get(sourceType.name()); CharacterSkill sk = this.skills.get(sourceType.name());
@@ -4902,6 +4905,12 @@ public class PlayerCharacter extends AbstractCharacter {
this.region = AbstractWorldObject.GetRegionByWorldObject(this); this.region = AbstractWorldObject.GetRegionByWorldObject(this);
return; 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())) { if (newLoc.equals(this.getEndLoc())) {
this.stopMovement(newLoc); this.stopMovement(newLoc);
this.region = AbstractWorldObject.GetRegionByWorldObject(this); this.region = AbstractWorldObject.GetRegionByWorldObject(this);
+23 -23
View File
@@ -99,29 +99,29 @@ public class Warehouse extends AbstractWorldObject {
public static ConcurrentHashMap<Integer, Integer> getMaxResources() { public static ConcurrentHashMap<Integer, Integer> getMaxResources() {
if (maxResources.size() != 23) { if (maxResources.size() != 23) {
maxResources.put(7, 1000000000); maxResources.put(7, 100000000);
maxResources.put(1580000, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580000, 10000);
maxResources.put(1580001, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580001, 2000);
maxResources.put(1580002, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580002, 2000);
maxResources.put(1580003, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580003, 1000);
maxResources.put(1580004, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580004, 10000);
maxResources.put(1580005, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580005, 3000);
maxResources.put(1580006, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580006, 3000);
maxResources.put(1580007, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580007, 1000);
maxResources.put(1580008, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580008, 3000);
maxResources.put(1580009, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580009, 2000);
maxResources.put(1580010, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580010, 2000);
maxResources.put(1580011, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580011, 1000);
maxResources.put(1580012, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580012, 2000);
maxResources.put(1580013, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580013, 3000);
maxResources.put(1580014, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580014, 1000);
maxResources.put(1580015, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580015, 1000);
maxResources.put(1580016, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580016, 1000);
maxResources.put(1580017, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580017, 500);
maxResources.put(1580018, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580018, 500);
maxResources.put(1580019, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580019, 500);
maxResources.put(1580020, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580020, 500);
maxResources.put(1580021, MBServerStatics.RESOURCE_STACK_LIMIT); maxResources.put(1580021, 500);
} }
return maxResources; return maxResources;
+2
View File
@@ -247,6 +247,8 @@ public class ActionsBase {
//TODO make this more efficient then testing strings //TODO make this more efficient then testing strings
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun)) if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
return true; //Currently stun immune. Skip 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)) else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
return true; //Currently snare immune. Skip snare return true; //Currently snare immune. Skip snare
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind)) 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) {}
}
+2 -3
View File
@@ -33,16 +33,15 @@ 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 = 1000000000; public static final int BANK_GOLD_LIMIT = 25000000;
// incoming // incoming
// opcodes to // opcodes to
// console // console
public static final int PLAYER_GOLD_LIMIT = 500000000; public static final int PLAYER_GOLD_LIMIT = 10000000;
// buildings, npcs // buildings, npcs
/* /*
* Login cache flags * Login cache flags
*/ */
public static final int RESOURCE_STACK_LIMIT = 1000000000;
public static final boolean SKIP_CACHE_LOGIN = false; // skip caching // login server public static final boolean SKIP_CACHE_LOGIN = false; // skip caching // login server
public static final boolean SKIP_CACHE_LOGIN_PLAYER = false; // skip caching // on login public static final boolean SKIP_CACHE_LOGIN_PLAYER = false; // skip caching // on login
public static final boolean SKIP_CACHE_LOGIN_ITEM = false; // skip caching public static final boolean SKIP_CACHE_LOGIN_ITEM = false; // skip caching