forked from MagicBane/Server
Compare commits
29 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 |
@@ -2307,8 +2307,8 @@ public class Enum {
|
||||
public enum CityBoundsType {
|
||||
|
||||
GRID(640),
|
||||
ZONE(675),
|
||||
PLACEMENT(677);
|
||||
ZONE(875),
|
||||
PLACEMENT(876);
|
||||
|
||||
public final float extents;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -19,19 +19,15 @@ import engine.net.AbstractNetMsg;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.ClientConnectionManager;
|
||||
import engine.net.client.msg.LoadCharacterMsg;
|
||||
import engine.net.client.msg.LoadStructureMsg;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
import engine.net.client.msg.login.CharSelectScreenMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.session.Session;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static engine.math.FastMath.sqr;
|
||||
@@ -217,9 +213,6 @@ public enum InterestManager implements Runnable {
|
||||
if (!playerCharacter.isEnteredWorld())
|
||||
continue;
|
||||
|
||||
if(playerCharacter.level < 10)
|
||||
playerCharacter.setLevel((short)10);
|
||||
|
||||
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
||||
|
||||
try {
|
||||
@@ -526,29 +519,12 @@ public enum InterestManager implements Runnable {
|
||||
if (origin == null)
|
||||
return;
|
||||
|
||||
int currentConnections = 0;
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(pc.isActive() && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(player.getClientConnection().machineID)){
|
||||
currentConnections++;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (currentConnections >= 3) {
|
||||
Session s = SessionManager.getSession(player);
|
||||
if (s.getAccount() != null) {
|
||||
CharSelectScreenMsg cssm = new CharSelectScreenMsg(s, false);
|
||||
s.getConn().sendMsg(cssm);
|
||||
}
|
||||
}
|
||||
}catch(Exception ex){
|
||||
|
||||
}
|
||||
// Update loaded upbjects lists
|
||||
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
|
||||
}
|
||||
|
||||
public synchronized void HandleLoadForTeleport(PlayerCharacter playerCharacter) {
|
||||
|
||||
@@ -32,8 +32,6 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
String type = rs.getString("type");
|
||||
switch (type) {
|
||||
case "zone":
|
||||
if(rs.getInt("isPlayerCity") == 0 && Zone.skipZone(rs.getString("Name")))
|
||||
break;
|
||||
Zone zone = new Zone(rs);
|
||||
DbManager.addToCache(zone);
|
||||
list.add(zone);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -520,10 +520,9 @@ public enum BuildingManager {
|
||||
if (building.getBlueprintUUID() == 0)
|
||||
return false;
|
||||
|
||||
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size()) {
|
||||
Logger.error("failed at addHireling with contract: " + contract.getContractID());
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
return false;
|
||||
}
|
||||
|
||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
|
||||
if (item.getChargesRemaining() > 0)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -180,7 +180,7 @@ public enum DevCmdManager {
|
||||
//kill any commands not available to everyone on production server
|
||||
//only admin level can run dev commands on production
|
||||
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false && a.getUname().toLowerCase().equals("sinmara#1") == false) {
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -35,13 +34,6 @@ public enum LootManager {
|
||||
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
||||
|
||||
public static ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510}));
|
||||
public static ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27570,188900,188910,188920,188930,188940,188950,189500}));
|
||||
public static ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27550,27560,189100,189110,189120,189130,189140,189150}));
|
||||
public static ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(new Integer[]{27600,188700,188720,189550,189560}));
|
||||
public static ArrayList<Integer> racial_stewards = new ArrayList<>(Arrays.asList(new Integer[]{974,1064,1172,1267,1368,1468,1520,1528,1553,1578,1617,1667,1712}));
|
||||
public static ArrayList<Integer> undead_guards = new ArrayList<>(Arrays.asList(new Integer[]{980100,980101,980102,980110,980111}));
|
||||
|
||||
// Drop Rates
|
||||
|
||||
public static float NORMAL_DROP_RATE;
|
||||
@@ -76,30 +68,6 @@ public enum LootManager {
|
||||
|
||||
public static void GenerateMobLoot(Mob mob) {
|
||||
|
||||
if(mob == null)
|
||||
return;
|
||||
|
||||
if(mob.level == 85){
|
||||
MobLoot mithril = new MobLoot(mob, ItemBase.getItemBase(1580021), 1, true);
|
||||
mob.getCharItemManager().addItemToInventory(mithril);
|
||||
|
||||
try{
|
||||
int stewardRoll = ThreadLocalRandom.current().nextInt(1,racial_stewards.size() + 1);
|
||||
MobLoot steward = new MobLoot(mob, ItemBase.getItemBase((Integer) racial_stewards.toArray()[stewardRoll]), true);
|
||||
mob.getCharItemManager().addItemToInventory(steward);
|
||||
}catch(Exception ex){
|
||||
|
||||
}
|
||||
try{
|
||||
int guardRoll = ThreadLocalRandom.current().nextInt(1,undead_guards.size() + 1);
|
||||
MobLoot guard = new MobLoot(mob, ItemBase.getItemBase((Integer) undead_guards.toArray()[guardRoll]), true);
|
||||
mob.getCharItemManager().addItemToInventory(guard);
|
||||
}catch(Exception ex){
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//determine if mob is in hotzone
|
||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
||||
|
||||
@@ -117,18 +85,12 @@ public enum LootManager {
|
||||
ItemBase ib = it.getItemBase();
|
||||
if(ib == null)
|
||||
break;
|
||||
if (ib.getName().toLowerCase().contains("of the gods")) {
|
||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
if(ib.isDiscRune()){
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -167,7 +129,7 @@ public enum LootManager {
|
||||
|
||||
break;
|
||||
case "ITEM":
|
||||
GenerateInventoryDrop(mob, bse, inHotzone);
|
||||
GenerateInventoryDrop(mob, bse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -209,7 +171,11 @@ public enum LootManager {
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal() && itemUUID != 1580021) {
|
||||
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);
|
||||
}
|
||||
@@ -234,9 +200,6 @@ public enum LootManager {
|
||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||
}
|
||||
}
|
||||
if(outItem.getName().toLowerCase().contains("of the gods") && inHotzone == false)
|
||||
return null;
|
||||
|
||||
return outItem;
|
||||
}
|
||||
|
||||
@@ -360,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
|
||||
@@ -372,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()) {
|
||||
|
||||
@@ -384,36 +348,18 @@ public enum LootManager {
|
||||
|
||||
if (equipmentRoll > dropChance)
|
||||
continue;
|
||||
ItemBase genericIB = me.getItemBase();
|
||||
//if(genericIB.isVorg()){
|
||||
if(vorg_cloth_uuids.contains(genericIB.getUUID())){
|
||||
//get random cloth piece
|
||||
genericIB = ItemBase.getItemBase(vorg_cloth_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_cloth_uuids.size() - 1)));
|
||||
} else if(vorg_ha_uuids.contains(genericIB.getUUID())){
|
||||
//get random heavy armor piece
|
||||
genericIB = ItemBase.getItemBase(vorg_ha_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ha_uuids.size() - 1)));
|
||||
} else if(vorg_ma_uuids.contains(genericIB.getUUID())){
|
||||
//get random medium armor piece
|
||||
genericIB = ItemBase.getItemBase(vorg_ma_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ma_uuids.size() - 1)));
|
||||
} else if(vorg_la_uuids.contains(genericIB.getUUID())){
|
||||
//get random light armor piece
|
||||
genericIB = ItemBase.getItemBase(vorg_la_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_la_uuids.size() - 1)));
|
||||
}
|
||||
mob.spawnTime = ThreadLocalRandom.current().nextInt(300,2700);
|
||||
//}
|
||||
MobLoot ml = new MobLoot(mob, genericIB, false);
|
||||
|
||||
if (ml != null && dropCount < 1) {
|
||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse, boolean inHotzone) {
|
||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
||||
|
||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
|
||||
@@ -422,23 +368,12 @@ public enum LootManager {
|
||||
if (chanceRoll > bse.dropChance)
|
||||
return;
|
||||
|
||||
ItemBase ib = ItemBase.getItemBase(bse.itemBase);
|
||||
if (ib == null)
|
||||
return;
|
||||
|
||||
if (ib.isDiscRune()) {
|
||||
ItemBase newDisc = ItemBase.getItemBase(ThreadLocalRandom.current().nextInt(3001, 3049 + 1));
|
||||
if (newDisc != null) {
|
||||
//mob.getInventory().add(new MobLoot(mob, newDisc, true));
|
||||
mob.getCharItemManager().addItemToInventory(new MobLoot(mob, newDisc, true));
|
||||
return;
|
||||
}
|
||||
}
|
||||
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
||||
|
||||
if (lootItem != null)
|
||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||
}
|
||||
|
||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||
|
||||
//get table ID for the itembase ID
|
||||
|
||||
@@ -685,6 +685,8 @@ public class MobAI {
|
||||
break;
|
||||
case Pet1:
|
||||
PetLogic(mob);
|
||||
case Siege:
|
||||
PetLogic(mob);
|
||||
break;
|
||||
case HamletGuard:
|
||||
HamletGuardLogic(mob);
|
||||
@@ -874,7 +876,7 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (System.currentTimeMillis() > aiAgent.deathTime + (aiAgent.spawnTime * 1000)) {
|
||||
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) {
|
||||
|
||||
if (Zone.respawnQue.contains(aiAgent) == false) {
|
||||
Zone.respawnQue.add(aiAgent);
|
||||
@@ -1030,10 +1032,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
public static void GuardCaptainLogic(Mob mob) {
|
||||
if(mob.guardedCity.getBane() == null){
|
||||
CheckMobMovement(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (mob.getCombatTarget() == null)
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
@@ -1057,10 +1056,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
public static void GuardMinionLogic(Mob mob) {
|
||||
if(mob.guardedCity.getBane() == null){
|
||||
CheckMobMovement(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
boolean isComanded = mob.npcOwner.isAlive();
|
||||
if (!isComanded) {
|
||||
@@ -1080,10 +1076,7 @@ public class MobAI {
|
||||
}
|
||||
|
||||
public static void GuardWallArcherLogic(Mob mob) {
|
||||
if(mob.guardedCity.getBane() == null){
|
||||
CheckMobMovement(mob);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (mob.getCombatTarget() == null)
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
|
||||
@@ -560,15 +560,40 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (!itemManager.inventoryContains(i))
|
||||
return;
|
||||
|
||||
if (i.isCanDestroy())
|
||||
if (itemManager.delete(i) == true) {
|
||||
int value = i.getItemBase().getBaseValue();
|
||||
sourcePlayer.getCharItemManager().addGoldToInventory(value,false);
|
||||
sourcePlayer.getCharItemManager().updateInventory();
|
||||
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) {
|
||||
@@ -1262,7 +1287,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
cost *= profit;
|
||||
|
||||
if (gold.getNumOfItems() + cost > 10000000) {
|
||||
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,21 +57,6 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (contract.canSlotinBuilding(building))
|
||||
ItemLists.add(hirelings);
|
||||
|
||||
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
|
||||
if(contract.getContractID() == 899)//alchemist
|
||||
ItemLists.add(hirelings);
|
||||
|
||||
if(contract.getContractID() == 866)//banker
|
||||
ItemLists.add(hirelings);
|
||||
|
||||
if(contract.getContractID() == 865)//siege engineer
|
||||
ItemLists.add(hirelings);
|
||||
}
|
||||
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)){
|
||||
if(contract.getContractID() == 865)//siege engineer
|
||||
ItemLists.add(hirelings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,20 +78,13 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (building.getBlueprint().getSlotsForRank(building.getRank()) == building.getHirelings().size())
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
return false;
|
||||
|
||||
Item contractItem = Item.getFromCache(msg.getContractItem());
|
||||
|
||||
if (contractItem == null)
|
||||
return false;
|
||||
if (msg.getContractItem() == 850) {//runemaster
|
||||
for (AbstractCharacter abs : building.getHirelings().keySet()) {
|
||||
NPC npc = (NPC) abs;
|
||||
if (npc.contract.getContractID() == 850)
|
||||
return false; //can only have 1 runemaster
|
||||
}
|
||||
}
|
||||
|
||||
if (!player.getCharItemManager().doesCharOwnThisItem(contractItem.getObjectUUID())) {
|
||||
Logger.error(player.getName() + "has attempted to place Hireling : " + contractItem.getName() + "without a valid contract!");
|
||||
@@ -126,29 +104,10 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
|
||||
// Check if contract can be slotted in this building
|
||||
//Logger.error("inserting contract: " + contract.getContractID());
|
||||
if (contract.canSlotinBuilding(building) == false) {
|
||||
boolean override = false;
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)) {
|
||||
if (contract.getContractID() == 899)//alchemist
|
||||
override = true;
|
||||
|
||||
if (contract.getContractID() == 866)//banker
|
||||
override = true;
|
||||
if (contract.canSlotinBuilding(building) == false)
|
||||
return false;
|
||||
|
||||
if (contract.getContractID() == 865)//siege engineer
|
||||
override = true;
|
||||
}
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SIEGETENT)) {
|
||||
if (contract.getContractID() == 865)//siege engineer
|
||||
override = true;
|
||||
}
|
||||
if(override == false) {
|
||||
Logger.error("failed at override with contract: " + contract.getContractID());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//Logger.error("override successful: " + contract.getContractID());
|
||||
if (!BuildingManager.addHireling(building, player, zone, contract, contractItem))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Owner is obviously allowed to upgrade his own buildings
|
||||
|
||||
if (building.getOwner() != null && building.getOwner().equals(player)) {
|
||||
if (building.getOwner().equals(player)) {
|
||||
|
||||
// Players cannot destroy or transfer a TOL.
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -99,10 +98,6 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
private static void requestHermitBlessing(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
|
||||
|
||||
|
||||
if(DateTime.now().getHourOfDay() < 18 || DateTime.now().getHourOfDay() > 21){
|
||||
ChatManager.chatSystemInfo(player, "Blessing can only be received between 6:00 pm and 10:00 pm");
|
||||
}
|
||||
Guild guild;
|
||||
Realm realm;
|
||||
City city;
|
||||
@@ -152,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();
|
||||
|
||||
@@ -123,11 +123,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
if (resourceValue < 15)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
|
||||
|
||||
if (resourceValue < 1)
|
||||
hasResources = false;
|
||||
|
||||
if (hasResources == false) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 184); // Insufficient gold or resources to upgrade to capital
|
||||
return false;
|
||||
@@ -185,16 +180,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.mithrilIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 1) == true) {
|
||||
warehouse.getResources().put(Warehouse.mithrilIB, resourceValue - 1);
|
||||
warehouse.AddTransactionToWarehouse(engine.Enum.GameObjectType.Building, tol.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.MITHRIL, 1);
|
||||
} else {
|
||||
Logger.error("wormwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return false;
|
||||
}
|
||||
|
||||
realm.claimRealmForCity(city, charterUUID);
|
||||
|
||||
tol.setRank(8);
|
||||
|
||||
@@ -212,6 +212,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
for (AbstractCharacter guard : building.getHirelings().keySet()) {
|
||||
if (guard.getObjectType() == GameObjectType.Mob)
|
||||
((Mob) guard).setPatrolPointIndex(0);
|
||||
}
|
||||
} else if (building.getPatrolPoints() != null)
|
||||
ClearPatrolPoints(building.getObjectUUID());
|
||||
|
||||
@@ -219,6 +223,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
|
||||
} else if (building.getSentryPoints() != null)
|
||||
ClearSentryPoints(building.getObjectUUID());
|
||||
|
||||
// Dispatch dispatch = Dispatch.borrow(pc, msg);
|
||||
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
|
||||
@@ -533,7 +541,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
|
||||
|
||||
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
|
||||
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
|
||||
|
||||
if (mob == null)
|
||||
return true;
|
||||
|
||||
@@ -81,7 +81,6 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
cities = City.getCitiesToTeleportTo(player);
|
||||
else
|
||||
cities = City.getCitiesToRepledgeTo(player);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,390 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.ItemContainerType;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.ClientMessagePump;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.util.ByteUtils;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class Account extends AbstractGameObject {
|
||||
|
||||
public static ConcurrentHashMap<String, Integer> AccountsMap = new ConcurrentHashMap<>();
|
||||
private final String uname;
|
||||
public String discordAccount;
|
||||
public HashMap<Integer, PlayerCharacter> characterMap = new HashMap<>();
|
||||
public Item vaultGold = null;
|
||||
public long lastPasswordCheck = 0;
|
||||
public Enum.AccountStatus status;
|
||||
private String passwd;
|
||||
private int lastCharIDUsed;
|
||||
private String salt;
|
||||
private byte loginAttempts = 0;
|
||||
private long lastLoginFailure = System.currentTimeMillis();
|
||||
private ArrayList<Item> vault = new ArrayList<>();
|
||||
|
||||
public Account(ResultSet resultSet) throws SQLException {
|
||||
super(resultSet);
|
||||
|
||||
this.uname = resultSet.getString("acct_uname");
|
||||
this.passwd = resultSet.getString("acct_passwd");
|
||||
this.lastCharIDUsed = resultSet.getInt("acct_lastCharUID");
|
||||
this.salt = resultSet.getString("acct_salt");
|
||||
this.discordAccount = resultSet.getString("discordAccount");
|
||||
this.status = Enum.AccountStatus.valueOf(resultSet.getString("status"));
|
||||
}
|
||||
|
||||
public ArrayList<Item> getVault() {
|
||||
return vault;
|
||||
}
|
||||
|
||||
public String getUname() {
|
||||
return uname;
|
||||
}
|
||||
|
||||
public String getPasswd() {
|
||||
return passwd;
|
||||
}
|
||||
|
||||
public String getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public int getLastCharIDUsed() {
|
||||
return lastCharIDUsed;
|
||||
}
|
||||
|
||||
public void setLastCharIDUsed(int lastCharIDUsed) {
|
||||
this.lastCharIDUsed = lastCharIDUsed;
|
||||
}
|
||||
|
||||
public byte getLoginAttempts() {
|
||||
return loginAttempts;
|
||||
}
|
||||
|
||||
public long getLastLoginFailure() {
|
||||
return this.lastLoginFailure;
|
||||
}
|
||||
|
||||
public void setLastLoginFailure() {
|
||||
this.lastLoginFailure = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void setLastCharacter(int uuid) {
|
||||
this.lastCharIDUsed = uuid;
|
||||
// this.updateDatabase();
|
||||
}
|
||||
|
||||
public void incrementLoginAttempts() {
|
||||
++this.loginAttempts;
|
||||
this.setLastLoginFailure();
|
||||
}
|
||||
|
||||
public void resetLoginAttempts() {
|
||||
this.loginAttempts = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* on successfully matching the password, this method additionally calls to
|
||||
* associateIpToAccount for IPAddress tracking. dokks
|
||||
*/
|
||||
public boolean passIsValid(String pw, String ip, String machineID) throws IllegalArgumentException {
|
||||
boolean result = false;
|
||||
// see if it was entered in plain text first, if the plain text matches,
|
||||
// hash it and save to the database.
|
||||
try {
|
||||
pw = ByteUtils.byteArrayToSafeStringHex(MessageDigest
|
||||
.getInstance("md5").digest(pw.getBytes("UTF-8")))
|
||||
+ salt;
|
||||
pw = ByteUtils.byteArrayToSafeStringHex(MessageDigest
|
||||
.getInstance("md5").digest(pw.getBytes()));
|
||||
result = this.passwd.equals(pw);
|
||||
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
|
||||
if (result) {
|
||||
// TODO: should use an executor here so that we can
|
||||
// fire and forget this update.
|
||||
// this is a valid user, so let's also update the
|
||||
// database with login time and IP.
|
||||
if ((ip == null) || (ip.length() == 0)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ClientConnection getClientConnection() {
|
||||
return SessionManager.getClientConnection(this);
|
||||
}
|
||||
|
||||
public PlayerCharacter getPlayerCharacter() {
|
||||
return SessionManager.getPlayerCharacter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDatabase() {
|
||||
DbManager.AccountQueries.updateDatabase(this);
|
||||
}
|
||||
|
||||
//this should be called to handle any after load functions.
|
||||
|
||||
public void runAfterLoad() {
|
||||
|
||||
try {
|
||||
|
||||
if (ConfigManager.serverType.equals(Enum.ServerType.LOGINSERVER)) {
|
||||
ArrayList<PlayerCharacter> playerList = DbManager.PlayerCharacterQueries.GET_CHARACTERS_FOR_ACCOUNT(this.getObjectUUID());
|
||||
|
||||
for (PlayerCharacter player : playerList) {
|
||||
PlayerCharacter.initializePlayer(player);
|
||||
this.characterMap.putIfAbsent(player.getObjectUUID(), player);
|
||||
}
|
||||
|
||||
playerList.clear();
|
||||
}
|
||||
|
||||
if (ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) {
|
||||
this.vault = DbManager.ItemQueries.GET_ITEMS_FOR_ACCOUNT(this.getObjectUUID());
|
||||
|
||||
for (Item item : this.vault) {
|
||||
if (item.getItemBase().getUUID() == 7) {
|
||||
this.vaultGold = item;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.vaultGold == null) {
|
||||
this.vaultGold = Item.newGoldItem(this.getObjectUUID(), ItemBase.getItemBase(7), ItemContainerType.VAULT);
|
||||
|
||||
if (this.vaultGold != null)
|
||||
this.vault.add(this.vaultGold);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void transferItemFromInventoryToVault(TransferItemFromInventoryToVaultMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player = origin.getPlayerCharacter();
|
||||
Dispatch dispatch;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!ClientMessagePump.NPCVaultBankRangeCheck(player, origin, "vault")) {
|
||||
ClientMessagePump.forceTransferFromVaultToInventory(msg, origin, "You are out of range of the vault.");
|
||||
return;
|
||||
}
|
||||
|
||||
int uuid = msg.getUUID();
|
||||
Item item = Item.getFromCache(uuid);
|
||||
|
||||
if (item == null) {
|
||||
ClientMessagePump.forceTransferFromVaultToInventory(msg, origin, "Can't find the item.");
|
||||
return;
|
||||
}
|
||||
|
||||
//dupe check
|
||||
if (!item.validForInventory(origin, player, player.getCharItemManager()))
|
||||
return;
|
||||
|
||||
if (item.containerType == Enum.ItemContainerType.INVENTORY && player.getCharItemManager().isVaultOpen()) {
|
||||
if (!player.getCharItemManager().hasRoomVault(item.getItemBase().getWeight())) {
|
||||
ClientMessagePump.forceTransferFromVaultToInventory(msg, origin, "There is no room in your vault.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getCharItemManager().moveItemToVault(item)) {
|
||||
this.vault.add(item);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
} else
|
||||
ClientMessagePump.forceTransferFromVaultToInventory(msg, origin, "Failed to transfer item.");
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void transferItemFromVaultToInventory(TransferItemFromVaultToInventoryMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player = origin.getPlayerCharacter();
|
||||
Dispatch dispatch;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!ClientMessagePump.NPCVaultBankRangeCheck(player, origin, "vault")) {
|
||||
ClientMessagePump.forceTransferFromInventoryToVault(msg, origin, "You are out of range of the vault.");
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
|
||||
if (itemManager == null) {
|
||||
ClientMessagePump.forceTransferFromInventoryToVault(msg, origin, "Can't find your item manager.");
|
||||
return;
|
||||
}
|
||||
|
||||
Item item = Item.getFromCache(msg.getUUID());
|
||||
|
||||
if (item == null) {
|
||||
ClientMessagePump.forceTransferFromInventoryToVault(msg, origin, "Can't find the item.");
|
||||
return;
|
||||
}
|
||||
|
||||
//dupe check
|
||||
if (!item.validForVault(origin, player, itemManager))
|
||||
return;
|
||||
|
||||
if (item.containerType == Enum.ItemContainerType.VAULT && itemManager.isVaultOpen()) {
|
||||
if (!itemManager.hasRoomInventory(item.getItemBase().getWeight())) {
|
||||
ClientMessagePump.forceTransferFromInventoryToVault(msg, origin, "There is no room in your inventory.");
|
||||
return;
|
||||
}
|
||||
if (itemManager.moveItemToInventory(item)) {
|
||||
this.vault.remove(item);
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
} else
|
||||
ClientMessagePump.forceTransferFromInventoryToVault(msg, origin, "Failed to transfer item.");
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void transferGoldFromVaultToInventory(TransferGoldFromVaultToInventoryMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player = origin.getPlayerCharacter();
|
||||
Dispatch dispatch;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Account account = player.getAccount();
|
||||
|
||||
if (account == null)
|
||||
return;
|
||||
|
||||
if (!ClientMessagePump.NPCVaultBankRangeCheck(player, origin, "vault"))
|
||||
return;
|
||||
|
||||
NPC npc = player.getLastNPCDialog();
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
|
||||
if (itemManager.isVaultOpen() == false)
|
||||
return;
|
||||
|
||||
if (itemManager.moveGoldToInventory(itemManager.getGoldVault(), msg.getAmount()) == false)
|
||||
return;
|
||||
|
||||
OpenVaultMsg open = new OpenVaultMsg(player, npc);
|
||||
ShowVaultInventoryMsg show = new ShowVaultInventoryMsg(player, account, npc); // 37??
|
||||
|
||||
UpdateGoldMsg ugm = new UpdateGoldMsg(player);
|
||||
ugm.configure();
|
||||
dispatch = Dispatch.borrow(player, ugm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
UpdateVaultMsg uvm = new UpdateVaultMsg(account);
|
||||
dispatch = Dispatch.borrow(player, uvm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
dispatch = Dispatch.borrow(player, open);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
dispatch = Dispatch.borrow(player, show);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
|
||||
public synchronized void transferGoldFromInventoryToVault(TransferGoldFromInventoryToVaultMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player = origin.getPlayerCharacter();
|
||||
Dispatch dispatch;
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Account account = player.getAccount();
|
||||
|
||||
if (account == null)
|
||||
return;
|
||||
|
||||
if (!ClientMessagePump.NPCVaultBankRangeCheck(player, origin, "vault"))
|
||||
return;
|
||||
|
||||
CharacterItemManager itemManager = player.getCharItemManager();
|
||||
|
||||
if (itemManager == null)
|
||||
return;
|
||||
|
||||
NPC npc = player.getLastNPCDialog();
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
// Cannot have bank and vault open concurrently
|
||||
// Dupe prevention
|
||||
|
||||
if (itemManager.isVaultOpen() == false)
|
||||
return;
|
||||
|
||||
// Something went horribly wrong. Should be log this?
|
||||
|
||||
if (itemManager.moveGoldToVault(itemManager.getGoldInventory(), msg.getAmount()) == false)
|
||||
return;
|
||||
|
||||
UpdateGoldMsg ugm = new UpdateGoldMsg(player);
|
||||
ugm.configure();
|
||||
dispatch = Dispatch.borrow(player, ugm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
UpdateVaultMsg uvm = new UpdateVaultMsg(account);
|
||||
dispatch = Dispatch.borrow(player, uvm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
OpenVaultMsg open = new OpenVaultMsg(player, npc);
|
||||
dispatch = Dispatch.borrow(player, open);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
//
|
||||
//
|
||||
ShowVaultInventoryMsg show = new ShowVaultInventoryMsg(player, account, npc); // 37??
|
||||
dispatch = Dispatch.borrow(player, show);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class Blueprint {
|
||||
|
||||
maintCost = (9730 * rank) + 1890;
|
||||
|
||||
return maintCost * 2;
|
||||
return maintCost;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
@@ -313,10 +313,10 @@ public class Blueprint {
|
||||
|
||||
// Early exit for buildings with single or no slots
|
||||
|
||||
if (this.maxSlots <= 1 && this.buildingGroup.equals(BuildingGroup.TOL) == false)
|
||||
if (this.maxSlots <= 1)
|
||||
return maxSlots;
|
||||
|
||||
if (this.maxRank == 1 && currentRank == 1&& this.buildingGroup.equals(BuildingGroup.TOL) == false)
|
||||
if (this.maxRank == 1 && currentRank == 1)
|
||||
return getMaxSlots();
|
||||
|
||||
switch (currentRank) {
|
||||
@@ -328,9 +328,9 @@ public class Blueprint {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
availableSlots = 2;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
availableSlots = 3;
|
||||
break;
|
||||
@@ -341,6 +341,7 @@ public class Blueprint {
|
||||
availableSlots = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||
availableSlots += 1;
|
||||
}
|
||||
@@ -494,19 +495,54 @@ public class Blueprint {
|
||||
// Select equation for rank time based upon the
|
||||
// buildings current Maintenance BuildingGroup. These values
|
||||
// are expressed in hours
|
||||
if(this.getBuildingGroup().equals(BuildingGroup.TOL))
|
||||
switch(targetRank){
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return 6;
|
||||
case 6:
|
||||
case 7:
|
||||
return 36;
|
||||
}
|
||||
|
||||
return 5;
|
||||
switch (this.buildingGroup) {
|
||||
|
||||
case GENERICNOUPGRADE:
|
||||
break; // Cannot be upgraded
|
||||
case VILLA:
|
||||
case ESTATE:
|
||||
case FORTRESS:
|
||||
case CITADEL:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case TOL:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case BARRACK:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case CHURCH:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case FORGE:
|
||||
case INN:
|
||||
case TAILOR:
|
||||
case MAGICSHOP:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
case SPIRE:
|
||||
rankTime = (4 * targetRank) + 4;
|
||||
break;
|
||||
case AMAZONHALL:
|
||||
case CATHEDRAL:
|
||||
case GREATHALL:
|
||||
case KEEP:
|
||||
case THIEFHALL:
|
||||
case TEMPLEHALL:
|
||||
case WIZARDHALL:
|
||||
case ELVENHALL:
|
||||
case ELVENSANCTUM:
|
||||
case IREKEIHALL:
|
||||
case FORESTHALL:
|
||||
rankTime = (7 * targetRank) - 7;
|
||||
break;
|
||||
default:
|
||||
Logger.error("Attempt to retrieve ranktime without MaintGroup");
|
||||
break;
|
||||
}
|
||||
|
||||
return rankTime;
|
||||
}
|
||||
|
||||
public Vector2f getExtents() {
|
||||
|
||||
@@ -784,7 +784,7 @@ public class Building extends AbstractWorldObject {
|
||||
|
||||
// Add cost for building structure
|
||||
|
||||
maintCost += this.getBlueprint().getMaintCost(rank) * 2;
|
||||
maintCost += this.getBlueprint().getMaintCost(rank);
|
||||
|
||||
// Add costs associated with hirelings
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -75,6 +75,9 @@ public class City extends AbstractWorldObject {
|
||||
private byte isCapital = 0;
|
||||
private byte isSafeHold;
|
||||
private boolean forceRename = false;
|
||||
private boolean noTeleport = false; //used by npc cities
|
||||
private boolean noRepledge = false; //used by npc cities
|
||||
private boolean isOpen = false;
|
||||
private int treeOfLifeID;
|
||||
private Vector3fImmutable location = Vector3fImmutable.ZERO;
|
||||
|
||||
@@ -139,6 +142,14 @@ public class City extends AbstractWorldObject {
|
||||
this.forceRename = rs.getInt("forceRename") == 1;
|
||||
this.open = rs.getInt("open") == 1;
|
||||
|
||||
if (this.cityName.equals("Perdition") || this.cityName.equals("Bastion")) {
|
||||
this.noTeleport = true;
|
||||
this.noRepledge = true;
|
||||
} else {
|
||||
this.noTeleport = false;
|
||||
this.noRepledge = false;
|
||||
}
|
||||
|
||||
this.hash = rs.getString("hash");
|
||||
|
||||
if (this.motto.isEmpty()) {
|
||||
@@ -345,6 +356,9 @@ public class City extends AbstractWorldObject {
|
||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
||||
City city = (City) ago;
|
||||
|
||||
if (city.noTeleport)
|
||||
continue;
|
||||
|
||||
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
||||
|
||||
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
|
||||
@@ -398,6 +412,8 @@ public class City extends AbstractWorldObject {
|
||||
for (AbstractGameObject ago : worldCities.values()) {
|
||||
if (ago.getObjectType().equals(GameObjectType.City)) {
|
||||
City city = (City) ago;
|
||||
if (city.noRepledge)
|
||||
continue;
|
||||
|
||||
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import engine.Enum.DamageType;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.LootManager;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -917,21 +916,6 @@ public class ItemBase {
|
||||
}
|
||||
|
||||
public boolean isVorg(){
|
||||
return LootManager.vorg_ha_uuids.contains(this.uuid) || LootManager.vorg_ma_uuids.contains(this.uuid) || LootManager.vorg_la_uuids.contains(this.uuid) || LootManager.vorg_cloth_uuids.contains(this.uuid);
|
||||
}
|
||||
|
||||
public String[] getVorgStats() {
|
||||
if(this.isLightArmor() || this.isMediumArmor() || this.isHeavyArmor() || this.isClothArmor()){
|
||||
if(this.getValidSlot() == MBServerStatics.SLOT_FEET) {
|
||||
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007","SUF-150"};
|
||||
}else {
|
||||
return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"};
|
||||
}
|
||||
|
||||
} else if(this.isShield()){//shield
|
||||
return new String[]{"SUF-265","PRE-123","PRE-232", "PRE-212", "PRE-222"};
|
||||
} else{//weapon
|
||||
return new String[]{"PRE-020","PRE-033",};
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
+59
-13
@@ -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());
|
||||
}
|
||||
@@ -1970,13 +2027,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
try {
|
||||
NPCManager.applyRuneSetEffects(this);
|
||||
recalculateStats();
|
||||
if(this.mobBase.getLevel() > 80){
|
||||
if(this.getMobBaseID() == 14319){//ithriana
|
||||
this.healthMax = 5400000;
|
||||
} else{
|
||||
this.healthMax = 1500000;
|
||||
}
|
||||
}
|
||||
this.setHealth(this.healthMax);
|
||||
|
||||
// Set bounds for this mobile
|
||||
@@ -2027,10 +2077,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
|
||||
this.deathTime = 0;
|
||||
|
||||
if(this.getName().equals("Chaos Chimera") || this.getName().equals("Taint Horror"))
|
||||
this.level -= 10;
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(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;
|
||||
@@ -1074,8 +1078,8 @@ public class NPC extends AbstractCharacter {
|
||||
filteredItemList.add(910010 + subID);
|
||||
}
|
||||
|
||||
//if (this.getRank() == 7)
|
||||
// filteredItemList.add(910018);
|
||||
if (this.getRank() == 7)
|
||||
filteredItemList.add(910018);
|
||||
}
|
||||
|
||||
return filteredItemList;
|
||||
@@ -1152,13 +1156,9 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
upgradeTime = Integer.MAX_VALUE;
|
||||
|
||||
if (this.getRank() < 7) {
|
||||
if(this.contract.getName().contains("Trainer") == false){
|
||||
return 5;
|
||||
}else{
|
||||
return this.getRank() * 8;
|
||||
}
|
||||
}
|
||||
if (this.getRank() < 7)
|
||||
return (this.getRank() * 8);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import static engine.InterestManagement.RealmMap.getRealmAtLocation;
|
||||
|
||||
|
||||
public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
@@ -4813,18 +4811,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
updateBlessingMessage();
|
||||
|
||||
this.safeZone = this.isInSafeZone();
|
||||
Realm currentRealm = getRealmAtLocation(this.getLoc());
|
||||
if(currentRealm != null) {
|
||||
boolean forbiddenRealm = false;
|
||||
if (Realm.overridePlacement(currentRealm.getRealmName()))
|
||||
forbiddenRealm = true;
|
||||
if (forbiddenRealm && this.containsEffect(1672601862) == false) {//Deathshroud
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
}
|
||||
}
|
||||
//if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding
|
||||
// PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false);
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
|
||||
@@ -76,40 +76,18 @@ public class Realm {
|
||||
this.mapG = (float) (mapColor.getGreen() * 0.00392156863);
|
||||
this.mapB = (float) (mapColor.getBlue() * 0.00392156863);
|
||||
this.mapA = 1;
|
||||
if (overridePlacement(rs.getString("realmName"))) {
|
||||
this.canBeClaimed = false;
|
||||
this.canPlaceCities = false;
|
||||
this.numCities = 0;
|
||||
this.rulingCityUUID = 0;
|
||||
this.charterType = 0;
|
||||
this.realmName = "Plagued Land";
|
||||
} else {
|
||||
|
||||
this.canPlaceCities = rs.getBoolean("canPlaceCities");
|
||||
this.numCities = rs.getInt("numCities");
|
||||
if(this.numCities > 0){
|
||||
this.canBeClaimed = true;
|
||||
}else{
|
||||
this.canBeClaimed = false;
|
||||
}
|
||||
this.rulingCityUUID = rs.getInt("rulingCityUID");
|
||||
if (this.rulingCityUUID != 0) {
|
||||
this.charterType = rs.getInt("charterType");
|
||||
} else {
|
||||
this.charterType = 0;
|
||||
}
|
||||
this.realmName = rs.getString("realmName");
|
||||
}
|
||||
|
||||
this.canBeClaimed = rs.getBoolean("canBeClaimed");
|
||||
this.canPlaceCities = rs.getBoolean("canPlaceCities");
|
||||
this.numCities = rs.getInt("numCities");
|
||||
this.realmName = rs.getString("realmName");
|
||||
this.rulingCityUUID = rs.getInt("rulingCityUID");
|
||||
this.charterType = rs.getInt("charterType");
|
||||
|
||||
java.sql.Timestamp ruledTimeStamp = rs.getTimestamp("ruledSince");
|
||||
|
||||
if (ruledTimeStamp != null){
|
||||
if (ruledTimeStamp != null)
|
||||
this.ruledSince = LocalDateTime.ofInstant(ruledTimeStamp.toInstant(), ZoneId.systemDefault());
|
||||
}else {
|
||||
this.rulingCityUUID = 0;
|
||||
this.charterType = 0;
|
||||
}
|
||||
|
||||
this.mapY1 = rs.getFloat("mapY1");
|
||||
this.mapX1 = rs.getFloat("mapX1");
|
||||
this.mapY2 = rs.getFloat("mapY2");
|
||||
@@ -122,21 +100,6 @@ public class Realm {
|
||||
this.hash = rs.getString("hash");
|
||||
}
|
||||
|
||||
public static boolean overridePlacement(String realm){
|
||||
switch(realm.toLowerCase()) {
|
||||
case "neshraa":
|
||||
case "adduram":
|
||||
case "letharuun":
|
||||
case "kralgaard":
|
||||
//case "ecklund":
|
||||
case "nordenthol":
|
||||
case "thollmar":
|
||||
case "haldorn isles":
|
||||
case "hregenlund":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static void configureAllRealms() {
|
||||
|
||||
for (Realm realm : Realm._realms.values()) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -74,11 +74,7 @@ public class Zone extends AbstractGameObject {
|
||||
this.zCoord = rs.getFloat("ZCoord");
|
||||
this.yCoord = rs.getFloat("YOffset");
|
||||
this.loadNum = rs.getInt("LoadNum");
|
||||
if(overrideSafety(rs.getString("Name"))){
|
||||
this.safeZone = (byte) 0;
|
||||
}else {
|
||||
this.safeZone = rs.getByte("SafeZone");
|
||||
}
|
||||
this.safeZone = rs.getByte("SafeZone");
|
||||
this.Icon1 = rs.getString("Icon1");
|
||||
this.Icon2 = rs.getString("Icon2");
|
||||
this.Icon3 = rs.getString("Icon3");
|
||||
@@ -107,44 +103,7 @@ public class Zone extends AbstractGameObject {
|
||||
|
||||
|
||||
}
|
||||
public static boolean skipZone(String name){
|
||||
switch(name){
|
||||
case "Kralgar Holm":
|
||||
case "Doomhorn Skrae":
|
||||
case "Ymur's Crown":
|
||||
case "Ecklund Wilds":
|
||||
case "Ragnir Holm":
|
||||
case "Aurrochs Skrae":
|
||||
case "Hregerend Wildlands":
|
||||
case "The Blood Sands":
|
||||
case "Vale of Nar Addad":
|
||||
case "Kharsoom":
|
||||
case "Leth'khalivar Desert":
|
||||
case "Thollok Marsh":
|
||||
case "The Black Bog":
|
||||
case "sevaath Mere":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean overrideSafety(String name){
|
||||
switch(name){
|
||||
case"Sanctuary":
|
||||
case "All-Father's Rest":
|
||||
case "Hamlet of Hothor's Doom":
|
||||
case"Hamlet of Hrimdal":
|
||||
case "Hamlet of Valkirch":
|
||||
case "Hamlet of Scraefahl":
|
||||
case "Hamlet of Hengest":
|
||||
case "Starkholm":
|
||||
case "Aeldreth Havens":
|
||||
case "Erkeng Hold":
|
||||
case "Sea Dog's Rest":
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
||||
|
||||
if (zone.loadNum == 0 && zone.playerCityID == 0)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,7 +15,6 @@ import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.MinionType;
|
||||
import engine.Enum.SupportMsgType;
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
@@ -711,6 +710,7 @@ public class WorldServer {
|
||||
}
|
||||
player.getTimestamps().put("logout", System.currentTimeMillis());
|
||||
player.setEnteredWorld(false);
|
||||
|
||||
// remove from simulation and zero current loc
|
||||
|
||||
WorldGrid.RemoveWorldObject(player);
|
||||
|
||||
Reference in New Issue
Block a user