Compare commits

...

21 Commits

Author SHA1 Message Date
FatBoy-DOTC b8f3c4b240 stack resources command 1 month ago
FatBoy-DOTC 1ecdcf60a5 handle retaliate even when missed 1 month ago
FatBoy-DOTC cc09fb04ce add more exclusions to junk command 1 month ago
FatBoy-DOTC 68d525f91c remove distance reduction for mine production 1 month ago
FatBoy-DOTC b26a260bf3 allow xpac mines to change production 1 month ago
FatBoy-DOTC ec736f03be fixed bug with vorg rates being WAY too low because of equip drop limits 1 month ago
FatBoy-DOTC 1f88bb38fc increase player gold and bank gold limits 1 month ago
FatBoy-DOTC 27946e695c all player inventory gold limit checks to use MBServerStatics.PLAYER_GOLD_LIMIT 1 month ago
FatBoy-DOTC 72a72e6bde add ranger and assassin bow to rollable items on bowyer 1 month ago
FatBoy-DOTC ad45a17abe ToL gets an additional NPC slot 1 month ago
FatBoy-DOTC 4fdbf12691 allow banker, siege engineer and alchemist on ToL 1 month ago
FatBoy-DOTC 9b6c75d170 runegates are always open all the time 1 month ago
FatBoy-DOTC b6546b437b random vorg timers 1 month ago
FatBoy-DOTC d4d320264c autoloot 2 months ago
FatBoy-DOTC f66902753c junk from inventory 2 months ago
FatBoy-DOTC 849e30841c junk from inventory 2 months ago
FatBoy-DOTC da28279fc1 test 2 months ago
FatBoy-DOTC e8e43185aa test 2 months ago
FatBoy-DOTC b334399e65 test 2 months ago
FatBoy-DOTC 5225898434 create system allowing players to delete items form inventory for gold value (junk hut in bag) 2 months ago
FatBoy-DOTC bcdaa81357 create system allowing players to delete items form inventory for gold value (junk hut in bag) 2 months ago
  1. 7
      src/engine/devcmd/cmds/AddGoldCmd.java
  2. 52
      src/engine/gameManager/ChatManager.java
  3. 9
      src/engine/gameManager/CombatManager.java
  4. 9
      src/engine/gameManager/LootManager.java
  5. 34
      src/engine/net/client/ClientMessagePump.java
  6. 5
      src/engine/objects/Blueprint.java
  7. 5
      src/engine/objects/CharacterItemManager.java
  8. 6
      src/engine/objects/Contract.java
  9. 4
      src/engine/objects/ItemBase.java
  10. 30
      src/engine/objects/Mine.java
  11. 53
      src/engine/objects/Mob.java
  12. 4
      src/engine/objects/NPC.java
  13. 9
      src/engine/objects/Runegate.java
  14. 4
      src/engine/server/MBServerStatics.java

7
src/engine/devcmd/cmds/AddGoldCmd.java

@ -14,6 +14,7 @@ import engine.gameManager.ChatManager; @@ -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 { @@ -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;
}

52
src/engine/gameManager/ChatManager.java

@ -29,10 +29,7 @@ import engine.server.world.WorldServer; @@ -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 { @@ -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;

9
src/engine/gameManager/CombatManager.java

@ -763,9 +763,14 @@ public enum CombatManager { @@ -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

9
src/engine/gameManager/LootManager.java

@ -319,8 +319,10 @@ public enum LootManager { @@ -319,8 +319,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 +333,6 @@ public enum LootManager { @@ -331,7 +333,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 +347,10 @@ public enum LootManager { @@ -346,12 +347,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.
}
}
}

34
src/engine/net/client/ClientMessagePump.java

@ -560,12 +560,40 @@ public class ClientMessagePump implements NetMsgHandler { @@ -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 { @@ -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;
}

5
src/engine/objects/Blueprint.java

@ -335,13 +335,16 @@ public class Blueprint { @@ -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;
}

5
src/engine/objects/CharacterItemManager.java

@ -970,7 +970,6 @@ public class CharacterItemManager { @@ -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 { @@ -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 { @@ -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);

6
src/engine/objects/Contract.java

@ -86,6 +86,12 @@ public class Contract extends AbstractGameObject { @@ -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");

4
src/engine/objects/ItemBase.java

@ -914,4 +914,8 @@ public class ItemBase { @@ -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"));
}
}

30
src/engine/objects/Mine.java

@ -381,8 +381,22 @@ public class Mine extends AbstractGameObject { @@ -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 { @@ -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;
}

53
src/engine/objects/Mob.java

@ -41,6 +41,7 @@ import java.util.HashMap; @@ -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;
@ -1242,6 +1243,58 @@ public class Mob extends AbstractIntelligenceAgent { @@ -1242,6 +1243,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() {

4
src/engine/objects/NPC.java

@ -1061,6 +1061,10 @@ public class NPC extends AbstractCharacter { @@ -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;

9
src/engine/objects/Runegate.java

@ -32,9 +32,12 @@ public class Runegate { @@ -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);
}
}

4
src/engine/server/MBServerStatics.java

@ -33,11 +33,11 @@ public class MBServerStatics { @@ -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

Loading…
Cancel
Save