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 |
+16
-47
@@ -139,8 +139,8 @@ public class Enum {
|
||||
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
||||
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.MALE, 1.1f),
|
||||
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.FEMALE, 1.1f),
|
||||
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
|
||||
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
||||
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
||||
@@ -152,9 +152,7 @@ public class Enum {
|
||||
NEPHFEMALE(2026, MonsterType.Nephilim, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
||||
HALFGIANTFEMALE(2027, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.15f),
|
||||
VAMPMALE(2028, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||
SAETOR(1999, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 0.80000001f),
|
||||
LIZARDMAN(1998, MonsterType.Reptile, RunSpeed.STANDARD, CharacterSex.MALE, 1.05f);
|
||||
VAMPFEMALE(2029, MonsterType.Vampire, RunSpeed.STANDARD, CharacterSex.FEMALE, 1);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static HashMap<Integer, RaceType> _raceTypeByID = new HashMap<>();
|
||||
@@ -210,7 +208,6 @@ public class Enum {
|
||||
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
||||
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
||||
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
||||
IREKEI(6.35f, 15.25f, 4.2199998f, 14.5f, 6.3299999f, 18.379999f, 6.5f),
|
||||
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
|
||||
|
||||
private float walkStandard;
|
||||
@@ -963,17 +960,7 @@ public class Enum {
|
||||
SourceType returnMod;
|
||||
if (modName.isEmpty())
|
||||
return SourceType.None;
|
||||
switch(modName) {
|
||||
case "Piercing":
|
||||
modName = "Pierce";
|
||||
break;
|
||||
case "Crushing":
|
||||
modName = "Crush";
|
||||
break;
|
||||
case "Slashing":
|
||||
modName = "Slash";
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
returnMod = SourceType.valueOf(modName.replace(",", ""));
|
||||
} catch (Exception e) {
|
||||
@@ -1665,24 +1652,6 @@ public class Enum {
|
||||
return extents;
|
||||
}
|
||||
|
||||
public boolean isTrainerBuilding(){
|
||||
switch(this){
|
||||
case AMAZONHALL:
|
||||
case CATHEDRAL:
|
||||
case GREATHALL:
|
||||
case KEEP:
|
||||
case THIEFHALL:
|
||||
case TEMPLEHALL:
|
||||
case WIZARDHALL:
|
||||
case ELVENHALL:
|
||||
case ELVENSANCTUM:
|
||||
case IREKEIHALL:
|
||||
case FORESTHALL:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum UpdateType {
|
||||
@@ -2338,8 +2307,8 @@ public class Enum {
|
||||
public enum CityBoundsType {
|
||||
|
||||
GRID(640),
|
||||
ZONE(680),
|
||||
PLACEMENT(681);
|
||||
ZONE(875),
|
||||
PLACEMENT(876);
|
||||
|
||||
public final float extents;
|
||||
|
||||
@@ -2853,6 +2822,7 @@ public class Enum {
|
||||
|
||||
public enum MobBehaviourType {
|
||||
None(null, false, false, false, false, false),
|
||||
//Power
|
||||
Power(null, false, true, true, true, false),
|
||||
PowerHelpee(Power, false, true, true, false, true),
|
||||
PowerHelpeeWimpy(Power, true, false, true, false, false),
|
||||
@@ -2877,7 +2847,6 @@ public class Enum {
|
||||
//Independent Types
|
||||
SimpleStandingGuard(null, false, false, false, false, false),
|
||||
Pet1(null, false, false, true, false, false),
|
||||
SiegeEngine(null, false, false, false, false, false),
|
||||
Simple(null, false, false, true, false, false),
|
||||
Helpee(null, false, true, true, false, true),
|
||||
HelpeeWimpy(null, true, false, true, false, false),
|
||||
@@ -2886,14 +2855,16 @@ 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);
|
||||
|
||||
public final MobBehaviourType BehaviourHelperType;
|
||||
public final boolean isWimpy;
|
||||
public final boolean isAgressive;
|
||||
public final boolean canRoam;
|
||||
public final boolean callsForHelp;
|
||||
public final boolean respondsToCallForHelp;
|
||||
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
|
||||
public MobBehaviourType BehaviourHelperType;
|
||||
public boolean isWimpy;
|
||||
public boolean isAgressive;
|
||||
public boolean canRoam;
|
||||
public boolean callsForHelp;
|
||||
public boolean respondsToCallForHelp;
|
||||
|
||||
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
|
||||
this.BehaviourHelperType = helpeebehaviourType;
|
||||
@@ -2910,8 +2881,6 @@ public class Enum {
|
||||
MOBILE,
|
||||
PET,
|
||||
CHARMED,
|
||||
|
||||
SIEGEENGINE,
|
||||
GUARD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.net.client.msg.UnloadObjectsMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.BoxTracker;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -110,7 +109,7 @@ public enum InterestManager implements Runnable {
|
||||
origin.sendMsg(moveMsg);
|
||||
}
|
||||
|
||||
public static void reloadCharacter(AbstractCharacter absChar, boolean sendToSelf) {
|
||||
public static void reloadCharacter(AbstractCharacter absChar) {
|
||||
|
||||
UnloadObjectsMsg uom = new UnloadObjectsMsg();
|
||||
uom.addObject(absChar);
|
||||
@@ -211,7 +210,7 @@ public enum InterestManager implements Runnable {
|
||||
if (origin == null)
|
||||
continue;
|
||||
|
||||
if (!playerCharacter.enteredWorld)
|
||||
if (!playerCharacter.isEnteredWorld())
|
||||
continue;
|
||||
|
||||
if (playerCharacter.getTeleportLock().readLock().tryLock()) {
|
||||
@@ -468,7 +467,7 @@ public enum InterestManager implements Runnable {
|
||||
if (awonpc.despawned == true)
|
||||
continue;
|
||||
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||
((Mob) awonpc).setCombatTarget(null);
|
||||
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
|
||||
|
||||
@@ -481,7 +480,7 @@ public enum InterestManager implements Runnable {
|
||||
if (!awonpc.isAlive())
|
||||
continue;
|
||||
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
|
||||
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
|
||||
|
||||
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
|
||||
((Mob) awonpc).setCombatTarget(null);
|
||||
@@ -525,7 +524,6 @@ public enum InterestManager implements Runnable {
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
BoxTracker.addPlayer(origin.machineID,player);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -73,14 +73,6 @@ public class dbBlueprintHandler extends dbHandlerBase {
|
||||
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(3), thisBlueprint);
|
||||
Blueprint._meshLookup.putIfAbsent(thisBlueprint.getMeshForRank(7), thisBlueprint);
|
||||
|
||||
if(thisBlueprint.getName().contains("Vampire Shrine")){
|
||||
Blueprint saetorShrine = new Blueprint(rs);
|
||||
saetorShrine.setBlueprintUUID(1720000);
|
||||
saetorShrine.rank1UUID = 1720000;
|
||||
saetorShrine.rank3UUID = 1720000;
|
||||
saetorShrine.rank7UUID = 1720000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import engine.gameManager.DbManager;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.CharacterSkill;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.SkillsBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
|
||||
@@ -63,9 +63,6 @@ public abstract class dbHandlerBase {
|
||||
} else {
|
||||
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||
DbManager.addToCache(toAdd);
|
||||
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
|
||||
continue;
|
||||
}
|
||||
objectList.add((T) toAdd);
|
||||
|
||||
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
||||
|
||||
@@ -28,67 +28,10 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
||||
|
||||
public void LOAD_BAKEDINSTATS(ItemBase itemBase) {
|
||||
|
||||
int itemBaseID = itemBase.getUUID();
|
||||
switch(itemBaseID){
|
||||
case 27550://bow
|
||||
case 27560://dagger
|
||||
case 27570://hammer
|
||||
case 27580://axe
|
||||
case 27590://sword
|
||||
//return new String[]{"PRE-010","SUF-260"};
|
||||
itemBaseID = 8000000;
|
||||
break;
|
||||
case 27600://staff
|
||||
//return new String[]{"PRE-334","PRE-315"};
|
||||
itemBaseID = 8000010;
|
||||
break;
|
||||
|
||||
case 188500://HA chest
|
||||
case 188510://HA arms
|
||||
case 188520://HA legs
|
||||
case 188530://HA gloves
|
||||
case 188550://HA helm
|
||||
case 188720://CC hood
|
||||
case 188900://MA chest
|
||||
case 188910://MA Sleeves
|
||||
case 188920://MA Legs
|
||||
case 188930://MA gloves
|
||||
case 188950://MA helm
|
||||
case 189100://la chest
|
||||
case 189110://la arms
|
||||
case 189120://la legs
|
||||
case 189130://la gloves
|
||||
case 189150://la helm
|
||||
case 189550://CC gloves
|
||||
//return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222", "SUF-007"};
|
||||
itemBaseID = 8000020;
|
||||
break;
|
||||
|
||||
case 188540://HA boots
|
||||
case 188940://MA boots
|
||||
case 189140://LA boots
|
||||
case 189560://CC boots
|
||||
//return new String[]{"PRE-133", "PRE-230", "PRE-210", "PRE-220", "SUF-003","SUF-150"};
|
||||
itemBaseID = 8000030;
|
||||
break;
|
||||
|
||||
case 188700://CC robe
|
||||
//return new String[]{"PRE-130", "PRE-232", "PRE-212", "PRE-222","SUF-317","SUF-317","SUF-317"};
|
||||
itemBaseID = 8000040;
|
||||
break;
|
||||
|
||||
case 189500://MA shield
|
||||
case 189510://HA shield
|
||||
//return new String[]{"PRE-125","PRE-125","PRE-125", "PRE-230", "PRE-210", "PRE-220"};
|
||||
itemBaseID = 8000050;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_bakedinstat` WHERE `itemID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, itemBaseID);
|
||||
preparedStatement.setInt(1, itemBase.getUUID());
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
@@ -144,19 +87,12 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
||||
recordsRead++;
|
||||
itemBase = new ItemBase(rs);
|
||||
ItemBase.addToCache(itemBase);
|
||||
|
||||
//copy the vampire shrine for saetor and change uuid and name
|
||||
if(itemBase.getName().contains("Vampire Shrine")){
|
||||
ItemBase saetorShrine = new ItemBase(rs);
|
||||
saetorShrine.setUUID(1035);
|
||||
saetorShrine.setName(saetorShrine.getName().replace("Vampire","Saetor"));
|
||||
ItemBase.addToCache(saetorShrine);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
||||
}
|
||||
|
||||
|
||||
@@ -135,11 +135,7 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
try {
|
||||
worked = rs.getBoolean("result");
|
||||
}catch(Exception e){
|
||||
return true;
|
||||
}
|
||||
worked = rs.getBoolean("result");
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
@@ -354,11 +350,7 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
try {
|
||||
worked = rs.getBoolean("result");
|
||||
} catch(Exception e){
|
||||
worked = true;
|
||||
}
|
||||
worked = rs.getBoolean("result");
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
@@ -504,18 +496,4 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean UPDATE_NUM_ITEMS(final Item item, int newValue) {
|
||||
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
||||
return false;
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
||||
preparedStatement.setInt(1, newValue);
|
||||
preparedStatement.setLong(2, item.getObjectUUID());
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,12 @@
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.MineProduction;
|
||||
import engine.objects.Resource;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@@ -34,24 +32,8 @@ public class dbMineHandler extends dbHandlerBase {
|
||||
|
||||
if (id == 0)
|
||||
return null;
|
||||
|
||||
Mine mine = (Mine) DbManager.getFromCache(Enum.GameObjectType.Mine, id);
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_mine;")) {
|
||||
|
||||
//preparedStatement.setInt(1, id);
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
while(rs.next()){
|
||||
if(rs.getInt("UID") == id){
|
||||
int towerUID = rs.getInt("mine_buildingUID");
|
||||
mine = Mine.getMineFromTower(towerUID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
if (mine != null)
|
||||
return mine;
|
||||
@@ -74,27 +56,13 @@ public class dbMineHandler extends dbHandlerBase {
|
||||
|
||||
ArrayList<Mine> mines = new ArrayList<>();
|
||||
|
||||
//try (Connection connection = DbManager.getConnection();
|
||||
// PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`")) {
|
||||
|
||||
// ResultSet rs = preparedStatement.executeQuery();
|
||||
// mines = getObjectsFromRs(rs, 1000);
|
||||
|
||||
// } catch (SQLException e) {
|
||||
// Logger.error(e);
|
||||
//}
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_mine;")) {
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
while(rs.next()){
|
||||
if(BuildingManager.getBuildingFromCache(rs.getInt("mine_buildingUID")) == null)
|
||||
continue;
|
||||
mines = getObjectsFromRs(rs, 1000);
|
||||
|
||||
mines.add(new Mine(rs));
|
||||
}
|
||||
|
||||
} catch (SQLException | UnknownHostException e) {
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
return mines;
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class dbMobBaseHandler extends dbHandlerBase {
|
||||
|
||||
@@ -113,25 +112,6 @@ public class dbMobBaseHandler extends dbHandlerBase {
|
||||
return mobBaseStats;
|
||||
}
|
||||
|
||||
public void LOAD_ALL_MOBBASE_RACES() {
|
||||
MobBase.mobbase_race_types = new HashMap<>();
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase`;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
int id = rs.getInt("loadID");
|
||||
if(MobBase.mobbase_race_types.containsKey(id) == false){
|
||||
MobBase.mobbase_race_types.put(id,rs.getString("raceType"));
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_ALL_MOBBASE_SPEEDS(MobBase mobBase) {
|
||||
|
||||
if (mobBase.getLoadID() == 0)
|
||||
|
||||
@@ -28,26 +28,31 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
|
||||
}
|
||||
|
||||
public Mob PERSIST(Mob toAdd) {
|
||||
public Mob ADD_MOB(Mob toAdd) {
|
||||
|
||||
Mob mobile = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
|
||||
|
||||
preparedStatement.setLong(1, toAdd.parentZoneUUID);
|
||||
preparedStatement.setInt(2, toAdd.loadID);
|
||||
preparedStatement.setInt(3, toAdd.guildUUID);
|
||||
preparedStatement.setFloat(4, toAdd.bindLoc.x);
|
||||
preparedStatement.setFloat(5, toAdd.bindLoc.y);
|
||||
preparedStatement.setFloat(6, toAdd.bindLoc.z);
|
||||
preparedStatement.setLong(1, toAdd.getParentZoneID());
|
||||
preparedStatement.setInt(2, toAdd.getMobBaseID());
|
||||
preparedStatement.setInt(3, toAdd.getGuildUUID());
|
||||
preparedStatement.setFloat(4, toAdd.getSpawnX());
|
||||
preparedStatement.setFloat(5, toAdd.getSpawnY());
|
||||
preparedStatement.setFloat(6, toAdd.getSpawnZ());
|
||||
preparedStatement.setInt(7, 0);
|
||||
preparedStatement.setFloat(8, toAdd.spawnRadius);
|
||||
preparedStatement.setInt(9, toAdd.spawnTime);
|
||||
preparedStatement.setInt(10, toAdd.contractUUID);
|
||||
preparedStatement.setInt(11, toAdd.buildingUUID);
|
||||
preparedStatement.setInt(12, toAdd.level);
|
||||
preparedStatement.setString(13, toAdd.firstName);
|
||||
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
|
||||
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
|
||||
|
||||
if (toAdd.getContract() != null)
|
||||
preparedStatement.setInt(10, toAdd.getContract().getContractID());
|
||||
else
|
||||
preparedStatement.setInt(10, 0);
|
||||
|
||||
preparedStatement.setInt(11, toAdd.getBuildingID());
|
||||
preparedStatement.setInt(12, toAdd.getLevel());
|
||||
preparedStatement.setString(13, toAdd.getFirstName());
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
@@ -101,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
|
||||
return row_count;
|
||||
}
|
||||
|
||||
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
|
||||
public void LOAD_PATROL_POINTS(Mob captain) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
|
||||
preparedStatement.setInt(1, captain.getObjectUUID());
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
String minionName = rs.getString("name");
|
||||
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
|
||||
String name = rs.getString("name");
|
||||
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
|
||||
|
||||
if (toCreate == null)
|
||||
return;
|
||||
|
||||
@@ -23,25 +23,7 @@ public class dbResistHandler extends dbHandlerBase {
|
||||
public dbResistHandler() {
|
||||
|
||||
}
|
||||
public void LOAD_RESISTS_FOR_MOBS() {
|
||||
|
||||
Resists resists = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mob_resists`;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while(rs.next()){
|
||||
resists = new Resists(rs);
|
||||
if(!Resists.mobResists.containsKey(rs.getInt("ID")))
|
||||
Resists.mobResists.put(rs.getInt("ID"),resists);
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
public Resists GET_RESISTS_FOR_MOB(int resistID) {
|
||||
|
||||
Resists resists = null;
|
||||
|
||||
@@ -59,43 +59,6 @@ public class dbRuneBaseHandler extends dbHandlerBase {
|
||||
rb.setLevelRequired(rs.getInt("requiredRuneID"));
|
||||
break;
|
||||
}
|
||||
int id = rs.getInt("runeID");
|
||||
switch(id) {
|
||||
case 3001:
|
||||
case 3002:
|
||||
case 3003:
|
||||
case 3004:
|
||||
case 3007:
|
||||
case 3008:
|
||||
case 3009:
|
||||
case 3013:
|
||||
case 3014:
|
||||
case 3016:
|
||||
case 3017:
|
||||
case 3018:
|
||||
case 3019:
|
||||
case 3020:
|
||||
case 3021:
|
||||
case 3026:
|
||||
case 3030:
|
||||
case 3031:
|
||||
case 3033:
|
||||
case 3037:
|
||||
case 3040:
|
||||
case 3045:
|
||||
case 3046:
|
||||
case 3047:
|
||||
case 3048:
|
||||
case 2514:
|
||||
rb.getRace().put(1999, true);
|
||||
break;
|
||||
case 3035:
|
||||
rb.getBaseClass().put(2501,true);
|
||||
break;
|
||||
case 3049:
|
||||
rb.getRace().clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
|
||||
@@ -143,13 +143,6 @@ public class dbSkillBaseHandler extends dbHandlerBase {
|
||||
|
||||
SkillsBase.runeSkillsCache.get(runeID).put(token, amount);
|
||||
}
|
||||
//add saetor skills
|
||||
HashMap<Integer, Integer> skills = new HashMap<>();
|
||||
skills.put(71438003,15); // staff
|
||||
skills.put(-61022283,10); // staff mastery
|
||||
skills.put(95961104,10); // parry
|
||||
SkillsBase.runeSkillsCache.put(1999,skills);
|
||||
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
MobBase mb = (MobBase) mobbaseAGO;
|
||||
int loadID = mb.getObjectUUID();
|
||||
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
|
||||
null, zone, null, null, "", 1);
|
||||
null, true, zone, null, 0, "", 1);
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
this.setResult(String.valueOf(mob.getDBID()));
|
||||
@@ -84,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
Mob mob = Mob.createMob(loadID, pc.getLoc(),
|
||||
null, zone, null, null, "", 1);
|
||||
null, true, zone, null, 0, "", 1);
|
||||
if (mob != null) {
|
||||
mob.updateDatabase();
|
||||
ChatManager.chatSayInfo(pc,
|
||||
|
||||
@@ -11,7 +11,6 @@ package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
import engine.powers.EffectsBase;
|
||||
|
||||
public class EnchantCmd extends AbstractDevCmd {
|
||||
|
||||
@@ -56,9 +55,21 @@ public class EnchantCmd extends AbstractDevCmd {
|
||||
this.setResult(String.valueOf(item.getObjectUUID()));
|
||||
} else {
|
||||
int cnt = words.length;
|
||||
String enchant = words[1];
|
||||
enchant = EffectsBase.getItemEffectsByName(enchant.toLowerCase());
|
||||
item.addPermanentEnchantmentForDev(enchant, 0);
|
||||
for (int i = 1; i < cnt; i++) {
|
||||
String enchant = words[i];
|
||||
boolean valid = true;
|
||||
for (Effect eff : item.getEffects().values()) {
|
||||
if (eff.getEffectsBase().getIDString().equals(enchant)) {
|
||||
throwbackError(pc, "This item already has that enchantment");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (valid) {
|
||||
item.addPermanentEnchantmentForDev(enchant, rank);
|
||||
this.setResult(String.valueOf(item.getObjectUUID()));
|
||||
} else
|
||||
throwbackError(pc, "Invalid Enchantment. Enchantment must consist of SUF-001 to SUF-328 or PRE-001 to PRE-334. Sent " + enchant + '.');
|
||||
}
|
||||
cim.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class FlashMsgCmd extends AbstractDevCmd {
|
||||
this.sendUsage(pcSender);
|
||||
return;
|
||||
}
|
||||
ChatManager.chatSystemFlash(String.join(" ", args));
|
||||
ChatManager.chatSystemFlash(args[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -280,7 +280,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += newline;
|
||||
output += "Inventory Weight:" + (targetPC.getCharItemManager().getInventoryWeight() + targetPC.getCharItemManager().getEquipWeight());
|
||||
output += newline;
|
||||
output += "Max Inventory Weight:" + targetPC.getInventoryCapacity();
|
||||
output += "Max Inventory Weight:" + ((int) targetPC.statStrBase * 3);
|
||||
output += newline;
|
||||
output += "ALTITUDE :" + targetPC.getAltitude();
|
||||
output += newline;
|
||||
@@ -336,9 +336,8 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
|
||||
output += "Swimming : " + targetPC.isSwimming();
|
||||
output += newline;
|
||||
output += "isMoving : " + targetPC.isMoving() + newline;
|
||||
output += "Zerg Multiplier: " + targetPC.ZergMultiplier + newline;
|
||||
output += "isBoxed: " + targetPC.isBoxed + newline;
|
||||
output += "isMoving : " + targetPC.isMoving();
|
||||
|
||||
break;
|
||||
|
||||
case NPC:
|
||||
@@ -441,9 +440,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "isSummonedPet: true";
|
||||
else
|
||||
output += "isSummonedPet: false";
|
||||
|
||||
|
||||
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
|
||||
PlayerCharacter owner = targetMob.getOwner();
|
||||
if (owner != null)
|
||||
output += " owner: " + owner.getObjectUUID();
|
||||
output += newline;
|
||||
@@ -526,7 +523,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
ConcurrentHashMap<String, Effect> effects = item.getEffects();
|
||||
for (String name : effects.keySet()) {
|
||||
Effect eff = effects.get(name);
|
||||
output += eff.getEffectsBase().getIDString() + " Static:" + eff.isStatic();
|
||||
output += eff.getEffectsBase().getIDString();
|
||||
output += newline;
|
||||
// output += eff.getEffectToken() + (eff.bakedInStat() ? " (baked in)" : "") + newline;
|
||||
}
|
||||
|
||||
@@ -65,10 +65,6 @@ public class MakeItemCmd extends AbstractDevCmd {
|
||||
|
||||
if (item == null || !worked) {
|
||||
throwbackError(pc, "DB error 2: Unable to create item.");
|
||||
if(item == null)
|
||||
throwbackError(pc, "Item Null");
|
||||
else
|
||||
throwbackError(pc, "Worked = false");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -226,10 +222,6 @@ public class MakeItemCmd extends AbstractDevCmd {
|
||||
|
||||
if (item == null || !worked) {
|
||||
throwbackError(pc, "DB error 2: Unable to create item.");
|
||||
if(item == null)
|
||||
throwbackError(pc, "Item Null");
|
||||
else
|
||||
throwbackError(pc, "Worked = false");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.workthreads.HourlyJobThread;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -40,10 +41,10 @@ public class MineActiveCmd extends AbstractDevCmd {
|
||||
String trigger = args[0];
|
||||
switch (trigger) {
|
||||
case "true":
|
||||
Mine.mineWindowOpen(mine);
|
||||
HourlyJobThread.mineWindowOpen(mine);
|
||||
break;
|
||||
case "false":
|
||||
Mine.mineWindowClose(mine);
|
||||
HourlyJobThread.mineWindowClose(mine);
|
||||
break;
|
||||
default:
|
||||
this.sendUsage(pcSender);
|
||||
|
||||
@@ -39,9 +39,6 @@ public class PrintResistsCmd extends AbstractDevCmd {
|
||||
if (mb != null)
|
||||
name = mb.getFirstName();
|
||||
type = "Mob";
|
||||
throwbackInfo(pc, "Server resists for " + type + ' ' + name);
|
||||
tar.getResists().printResistsToClient(pc);
|
||||
return;
|
||||
} else if (tar instanceof NPC) {
|
||||
NPC npc = (NPC) tar;
|
||||
Contract contract = npc.getContract();
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.objects.*;
|
||||
|
||||
@@ -56,7 +55,6 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
||||
tar.calculateMaxHealthManaStamina();
|
||||
String newline = "\r\n ";
|
||||
String out = "Server stats for Player " + tar.getFirstName() + newline;
|
||||
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
||||
@@ -74,11 +72,6 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
||||
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
|
||||
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||
out += "Health Regen: " + tar.getRegenModifier(Enum.ModType.HealthRecoverRate) + newline;
|
||||
out += "Stamina Regen: " + tar.getRegenModifier(Enum.ModType.StaminaRecoverRate) + newline;
|
||||
out += "Mana Regen: " + tar.getRegenModifier(Enum.ModType.ManaRecoverRate) + newline;
|
||||
out += "Zerg Multiplier: " + tar.ZergMultiplier + newline;
|
||||
|
||||
throwbackInfo(pc, out);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
@@ -151,7 +151,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
|
||||
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
|
||||
@@ -154,7 +154,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
mobA = (Mob) ac;
|
||||
|
||||
if (npc != null) {
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
//Mob.getRespawnMap().remove(mob);
|
||||
@@ -209,7 +209,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
||||
if (npc.building != null)
|
||||
npc.building.getHirelings().remove(npc);
|
||||
|
||||
for (Mob mob : npc.siegeMinionMap.keySet()) {
|
||||
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
|
||||
WorldGrid.RemoveWorldObject(mob);
|
||||
WorldGrid.removeObject(mob, pc);
|
||||
if (mob.getParentZone() != null)
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SetAdminRuneCmd extends AbstractDevCmd {
|
||||
if (worked) {
|
||||
ChatManager.chatSayInfo(pcSender,
|
||||
"rune of ID " + runeID + " removed");
|
||||
InterestManager.reloadCharacter(pcSender,false);
|
||||
InterestManager.reloadCharacter(pcSender);
|
||||
} else
|
||||
throwbackError(pcSender, "Failed to remove the rune of type "
|
||||
+ runeID);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SetBaseClassCmd extends AbstractDevCmd {
|
||||
this.setTarget(pc); //for logging
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"BaseClass changed to " + classID);
|
||||
InterestManager.reloadCharacter(pc,false);
|
||||
InterestManager.reloadCharacter(pc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
public class SetLevelCmd extends AbstractDevCmd {
|
||||
|
||||
@@ -47,7 +46,7 @@ public class SetLevelCmd extends AbstractDevCmd {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
if (level < 1 || level > MBServerStatics.LEVELCAP) {
|
||||
if (level < 1 || level > 75) {
|
||||
this.sendHelp(pc);
|
||||
return;
|
||||
}
|
||||
@@ -58,12 +57,12 @@ public class SetLevelCmd extends AbstractDevCmd {
|
||||
tar.setLevel((short) level);
|
||||
this.setTarget(tar); //for logging
|
||||
ChatManager.chatSayInfo(pc, tar.getFirstName() + " level changed to " + level);
|
||||
InterestManager.reloadCharacter(tar,false);
|
||||
InterestManager.reloadCharacter(tar);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets your character's level to 'amount'. 'amount' must be between 1-" + MBServerStatics.LEVELCAP;
|
||||
return "Sets your character's level to 'amount'. 'amount' must be between 1-75";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SetPromotionClassCmd extends AbstractDevCmd {
|
||||
pc.setPromotionClass(classID);
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"PromotionClass changed to " + classID);
|
||||
InterestManager.reloadCharacter(pc,false);
|
||||
InterestManager.reloadCharacter(pc);
|
||||
this.setTarget(pc); //for logging
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SetRuneCmd extends AbstractDevCmd {
|
||||
if (worked) {
|
||||
ChatManager.chatSayInfo(pcSender,
|
||||
"rune of ID " + runeID + " removed");
|
||||
InterestManager.reloadCharacter(pcSender,false);
|
||||
InterestManager.reloadCharacter(pcSender);
|
||||
} else
|
||||
throwbackError(pcSender, "Failed to remove the rune of type "
|
||||
+ runeID);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.LootManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.loot.BootySetEntry;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -28,9 +26,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
String output;
|
||||
|
||||
output = "Booty Simulation:" + newline;
|
||||
if(target.getObjectType().equals(Enum.GameObjectType.Mob) == false){
|
||||
return;//ugh what?
|
||||
}
|
||||
|
||||
Mob mob = (Mob) target;
|
||||
output += "Name: " + mob.getName() + newline;
|
||||
output += "Special Loot:" + newline;
|
||||
@@ -55,7 +51,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
int failures = 0;
|
||||
int goldAmount = 0;
|
||||
|
||||
for (int i = 0; i < 10000; ++i) {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
|
||||
try {
|
||||
mob.loadInventory();
|
||||
@@ -83,19 +79,12 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
goldAmount += lootItem.getNumOfItems();
|
||||
break;
|
||||
default:
|
||||
if(Warehouse.maxResources.containsKey(lootItem.getItemBaseID())){
|
||||
Resources.add(lootItem);
|
||||
} else {
|
||||
OtherDrops.add(lootItem);
|
||||
}
|
||||
OtherDrops.add(lootItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
failures++;
|
||||
//throwbackError(playerCharacter,ex.getLocalizedMessage());
|
||||
//Logger.error(ex.fillInStackTrace());
|
||||
//return;
|
||||
}
|
||||
if (mob.getEquip() != null) {
|
||||
for (MobEquipment me : mob.getEquip().values()) {
|
||||
@@ -142,17 +131,8 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
}
|
||||
|
||||
output += "GLASS DROPS: " + GlassItems.size() + newline;
|
||||
for(Item glass : GlassItems){
|
||||
output += " " + glass.getName() + newline;
|
||||
}
|
||||
output += "RUNE DROPS: " + Runes.size() + newline;
|
||||
for(Item rune : Runes){
|
||||
output += " " + rune.getName() + newline;
|
||||
}
|
||||
output += "CONTRACTS DROPS: " + Contracts.size() + newline;
|
||||
for(Item contract : Contracts){
|
||||
output += " " + contract.getName() + newline;
|
||||
}
|
||||
output += "RESOURCE DROPS: " + Resources.size() + newline;
|
||||
output += "OFFERINGS DROPPED: " + Offerings.size() + newline;
|
||||
output += "ENCHANTED ITEMS DROPPED: " + OtherDrops.size() + newline;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SlotTestCmd extends AbstractDevCmd {
|
||||
outString += "Hirelings List:";
|
||||
|
||||
for (AbstractCharacter hireling : building.getHirelings().keySet())
|
||||
outString += "\r\n" + hireling.getName() + "(" + hireling.getObjectUUID() + ") slot : " + building.getHirelings().get(hireling);
|
||||
outString += "\r\n" + hireling.getName() + " slot : " + building.getHirelings().get(hireling);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
|
||||
|
||||
mobile = Mob.createMob(_mobileUUID,
|
||||
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
|
||||
null, serverZone, null, null, "", 1);
|
||||
null, true, serverZone, null, 0, "", 1);
|
||||
|
||||
if (mobile != null) {
|
||||
mobile.updateDatabase();
|
||||
|
||||
@@ -11,10 +11,8 @@ package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Mob;
|
||||
import engine.objects.MobBase;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -58,47 +56,38 @@ public class aiInfoCmd extends AbstractDevCmd {
|
||||
Mob mob = (Mob) target;
|
||||
output = "Mob AI Information:" + newline;
|
||||
output += mob.getName() + newline;
|
||||
if (mob.behaviourType != null) {
|
||||
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
|
||||
if (mob.behaviourType.BehaviourHelperType != null) {
|
||||
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline;
|
||||
if (mob.BehaviourType != null) {
|
||||
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
|
||||
if (mob.BehaviourType.BehaviourHelperType != null) {
|
||||
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
|
||||
} else {
|
||||
output += "Behaviour Helper Type: NULL" + newline;
|
||||
}
|
||||
output += "Wimpy: " + mob.behaviourType.isWimpy + newline;
|
||||
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
|
||||
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
|
||||
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
|
||||
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
|
||||
} else {
|
||||
output += "BehaviourType: NULL" + newline;
|
||||
}
|
||||
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
|
||||
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
|
||||
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
|
||||
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
|
||||
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
|
||||
} else {
|
||||
output += "BehaviourType: NULL" + newline;
|
||||
}
|
||||
output += "Aggro Range: " + mob.getAggroRange() + newline;
|
||||
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
|
||||
if (mob.playerAgroMap.size() > 0) {
|
||||
output += "Players Loaded:" + newline;
|
||||
}
|
||||
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
|
||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
|
||||
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
|
||||
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
|
||||
}
|
||||
if (mob.getCombatTarget() != null)
|
||||
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
|
||||
else
|
||||
output += "Current Target: NULL" + newline;
|
||||
|
||||
if (mob.guardedCity != null)
|
||||
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
|
||||
|
||||
output += "Powers:" + newline;
|
||||
|
||||
for (int token : mob.mobPowers.keySet())
|
||||
output += PowersManager.getPowerByToken(token).getName() + newline;
|
||||
output += token + newline;
|
||||
|
||||
output += "Race type: " + MobBase.mobbase_race_types.get(mob.getMobBaseID());
|
||||
throwbackInfo(playerCharacter, output);
|
||||
|
||||
throwbackInfo(playerCharacter, "Race Types: " + MobBase.mobbase_race_types.size());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.*;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/**
|
||||
* @author Eighty
|
||||
*/
|
||||
public class setProfit extends AbstractDevCmd {
|
||||
|
||||
public setProfit() {
|
||||
super("setprofit");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
if (words.length < 2) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
float updateValue;
|
||||
try {
|
||||
updateValue = Float.parseFloat(words[1]);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc,
|
||||
"Failed to parse supplied contractID or level to an Integer.");
|
||||
return; // NaN
|
||||
}
|
||||
if(target.getObjectType().equals(GameObjectType.NPC) == false){
|
||||
|
||||
return;
|
||||
}
|
||||
NPC npc = (NPC)target;
|
||||
if(words[0].toLowerCase().equals("buy")){
|
||||
npc.buyPercent = updateValue;
|
||||
npc.updateDatabase();
|
||||
return;
|
||||
}
|
||||
if(words[0].toLowerCase().equals("sell")){
|
||||
npc.sellPercent = updateValue;
|
||||
npc.updateDatabase();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Sets profit margin of targeted NPC";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "' /setprofit buy/sell VALUE(1.0)'";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
@@ -536,7 +535,7 @@ public enum BuildingManager {
|
||||
|
||||
if (NPC.ISWallArcher(contract)) {
|
||||
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||
|
||||
if (mob == null)
|
||||
return false;
|
||||
@@ -548,7 +547,7 @@ public enum BuildingManager {
|
||||
|
||||
if (NPC.ISGuardCaptain(contract.getContractID())) {
|
||||
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||
|
||||
if (mob == null)
|
||||
return false;
|
||||
@@ -560,7 +559,7 @@ public enum BuildingManager {
|
||||
if (contract.getContractID() == 910) {
|
||||
|
||||
//guard dog
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank);
|
||||
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
|
||||
|
||||
if (mob == null)
|
||||
return false;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -528,7 +528,7 @@ public enum CombatManager {
|
||||
float atr;
|
||||
int minDamage, maxDamage;
|
||||
int errorTrack = 0;
|
||||
int subTrack = 0;
|
||||
|
||||
try {
|
||||
|
||||
if (ac == null)
|
||||
@@ -645,24 +645,22 @@ public enum CombatManager {
|
||||
errorTrack = 4;
|
||||
|
||||
//Get hit chance
|
||||
float constant = (atr+defense)*0.315f;
|
||||
float atrChance = atr - constant;
|
||||
float defChance = defense - constant + atrChance;
|
||||
float smallChance = atrChance/defChance;
|
||||
int chance = (int)(smallChance * 100);
|
||||
|
||||
int chance;
|
||||
float dif = atr - defense;
|
||||
|
||||
if (dif > 100)
|
||||
chance = 94;
|
||||
else if (dif < -100)
|
||||
chance = 4;
|
||||
else
|
||||
chance = (int) ((0.45 * dif) + 49);
|
||||
|
||||
errorTrack = 5;
|
||||
|
||||
if(chance < 5){
|
||||
chance = 5;
|
||||
}
|
||||
if(chance > 95){
|
||||
chance = 95;
|
||||
}
|
||||
|
||||
//calculate hit/miss
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(1,101);
|
||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||
DeferredPowerJob dpj = null;
|
||||
|
||||
if (roll < chance) {
|
||||
@@ -765,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
|
||||
@@ -811,7 +814,11 @@ public enum CombatManager {
|
||||
|
||||
float damage;
|
||||
|
||||
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||
if (wb != null)
|
||||
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||
else
|
||||
damage = calculateDamage(ac, tarAc, minDamage, maxDamage, damageType, resists);
|
||||
|
||||
float d = 0f;
|
||||
|
||||
errorTrack = 12;
|
||||
@@ -819,41 +826,27 @@ public enum CombatManager {
|
||||
//Subtract Damage from target's health
|
||||
|
||||
if (tarAc != null) {
|
||||
if (tarAc.isSit())
|
||||
damage *= 2.5f; //increase damage if sitting
|
||||
|
||||
if (tarAc.isSit())
|
||||
damage *= 2.5f; //increase damage if sitting
|
||||
|
||||
subTrack = 1;
|
||||
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
|
||||
((Mob) tarAc).handleDirectAggro(ac);
|
||||
}
|
||||
|
||||
if (tarAc.getHealth() > 0)
|
||||
d = tarAc.modifyHealth(-damage, ac, false);
|
||||
|
||||
if (tarAc.getObjectType() == GameObjectType.Mob) {
|
||||
Mob mobTarget = (Mob) tarAc;
|
||||
if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
subTrack = 2;
|
||||
if (mobTarget.playerAgroMap.containsKey(ac.getObjectUUID())) {
|
||||
subTrack = 3;
|
||||
float hateValue = damage + mobTarget.playerAgroMap.get(ac.getObjectUUID());
|
||||
mobTarget.playerAgroMap.put(ac.getObjectUUID(), hateValue);
|
||||
} else {
|
||||
mobTarget.playerAgroMap.put(ac.getObjectUUID(), damage);
|
||||
}
|
||||
subTrack = 4;
|
||||
}
|
||||
mobTarget.handleDirectAggro(ac);
|
||||
}
|
||||
if (tarAc.getHealth() > 0)
|
||||
d = tarAc.modifyHealth(-damage, ac, false);
|
||||
subTrack = 5;
|
||||
} else if (target.getObjectType().equals(GameObjectType.Building)) {
|
||||
subTrack = 6;
|
||||
|
||||
if (BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) {
|
||||
ac.setCombatTarget(null);
|
||||
subTrack = 7;
|
||||
return;
|
||||
}
|
||||
subTrack = 8;
|
||||
|
||||
if (target.getHealth() > 0)
|
||||
d = ((Building) target).modifyHealth(-damage, ac);
|
||||
subTrack = 9;
|
||||
}
|
||||
|
||||
errorTrack = 13;
|
||||
@@ -954,8 +947,7 @@ public enum CombatManager {
|
||||
ac.cancelOnAttack();
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(ac.getName() + ' ' + "ErrorTrack: " + errorTrack + " ErrorSubTrack = " + subTrack + e);
|
||||
Logger.error(e.getMessage());
|
||||
Logger.error(ac.getName() + ' ' + errorTrack + ' ' + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,9 +1026,7 @@ public enum CombatManager {
|
||||
damage += minDamage;
|
||||
|
||||
//calculate resists in if any
|
||||
if(source.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
damage *= ((PlayerCharacter)source).ZergMultiplier;
|
||||
}
|
||||
|
||||
if (resists != null)
|
||||
return resists.getResistedDamage(source, target, damageType, damage, 0);
|
||||
else
|
||||
@@ -1275,13 +1265,6 @@ public enum CombatManager {
|
||||
|
||||
range += (calcHitBox(ac) + calcHitBox(target));
|
||||
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
range += ((PlayerCharacter)ac).getCharacterHeight() * 0.5f;
|
||||
if(ac.isMoving()){
|
||||
range += ((PlayerCharacter) ac).getCharacterHeight();
|
||||
}
|
||||
}
|
||||
|
||||
float magnitudeSquared = tl.distanceSquared(sl);
|
||||
|
||||
return magnitudeSquared > range * range;
|
||||
|
||||
@@ -11,8 +11,6 @@ package engine.gameManager;
|
||||
import engine.Enum;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.devcmd.cmds.*;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Account;
|
||||
import engine.objects.PlayerCharacter;
|
||||
@@ -121,7 +119,6 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new PurgeObjectsCmd());
|
||||
DevCmdManager.registerDevCmd(new SplatMobCmd());
|
||||
DevCmdManager.registerDevCmd(new SlotNpcCmd());
|
||||
DevCmdManager.registerDevCmd(new setProfit());
|
||||
DevCmdManager.registerDevCmd(new GateInfoCmd());
|
||||
DevCmdManager.registerDevCmd(new ShowOffsetCmd());
|
||||
DevCmdManager.registerDevCmd(new RealmInfoCmd());
|
||||
@@ -182,17 +179,8 @@ public enum DevCmdManager {
|
||||
|
||||
//kill any commands not available to everyone on production server
|
||||
//only admin level can run dev commands on production
|
||||
if((cmd.toLowerCase().equals("printstats") || cmd.toLowerCase().equals("printresists")) && target.equals(pcSender)){
|
||||
// execute command;
|
||||
try {
|
||||
adc.doCmd(pcSender, argString, target);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false && a.getUname().toLowerCase().equals("fatboy") == false) {
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||
return false;
|
||||
}
|
||||
@@ -216,11 +204,6 @@ public enum DevCmdManager {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, pcName + " from account: " + accName + " has used Dev Command: " + cmd);
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,9 @@ import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -36,11 +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}));
|
||||
|
||||
// Drop Rates
|
||||
|
||||
public static float NORMAL_DROP_RATE;
|
||||
@@ -75,13 +68,16 @@ public enum LootManager {
|
||||
|
||||
public static void GenerateMobLoot(Mob mob) {
|
||||
|
||||
//determine if mob is in hotzone
|
||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
||||
|
||||
//iterate the booty sets
|
||||
|
||||
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
|
||||
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob);
|
||||
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
||||
|
||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
|
||||
RunBootySet(_bootySetMap.get(mob.bootySet), mob);
|
||||
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
||||
|
||||
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
||||
for (Item it : mob.getInventory()) {
|
||||
@@ -89,7 +85,7 @@ 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());
|
||||
@@ -99,105 +95,54 @@ public enum LootManager {
|
||||
|
||||
}
|
||||
|
||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob) {
|
||||
mob.runeCounter++;
|
||||
mob.contractCounter++;
|
||||
float dropRate = NORMAL_DROP_RATE;
|
||||
//roll the geenric world drop table
|
||||
if(mob.parentZone.getSafeZone() == 0) {
|
||||
GenerateLootDrop(mob, 1300);
|
||||
if(ThreadLocalRandom.current().nextInt(1, 10000) == 5000) {
|
||||
MobLoot extraLoot = rollForGlass(mob);
|
||||
if (extraLoot != null) {
|
||||
mob.getCharItemManager().addItemToInventory(extraLoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
||||
|
||||
boolean hotzoneWasRan = false;
|
||||
float dropRate = 1.0f;
|
||||
|
||||
// Iterate all entries in this bootySet and process accordingly
|
||||
|
||||
for (BootySetEntry bse : entries) {
|
||||
switch (bse.bootyType) {
|
||||
case "GOLD":
|
||||
GenerateGoldDrop(mob, bse);
|
||||
GenerateGoldDrop(mob, bse, inHotzone);
|
||||
break;
|
||||
case "LOOT":
|
||||
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
|
||||
GenerateLootDrop(mob, bse.genTable); //generate normal loot drop
|
||||
if(ThreadLocalRandom.current().nextInt(1,100) == 50){
|
||||
MobLoot extraLoot = rollForContract(bse.genTable, mob);
|
||||
if (extraLoot != null) {
|
||||
mob.getCharItemManager().addItemToInventory(extraLoot);
|
||||
|
||||
if (mob.getSafeZone() == false)
|
||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||
|
||||
if (inHotzone == true)
|
||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
||||
|
||||
if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate))
|
||||
GenerateLootDrop(mob, bse.genTable, false); //generate normal loot drop
|
||||
|
||||
// Generate hotzone loot if in hotzone
|
||||
// Only one bite at the hotzone apple per bootyset.
|
||||
|
||||
if (inHotzone == true && hotzoneWasRan == false)
|
||||
if (_genTables.containsKey(bse.genTable + 1) && ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) {
|
||||
GenerateLootDrop(mob, bse.genTable + 1, true); //generate loot drop from hotzone table
|
||||
hotzoneWasRan = true;
|
||||
}
|
||||
}
|
||||
if(ThreadLocalRandom.current().nextInt(1,100) == 50){
|
||||
MobLoot extraLoot = rollForRune(bse.genTable, mob);
|
||||
if (extraLoot != null) {
|
||||
mob.getCharItemManager().addItemToInventory(extraLoot);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "ITEM":
|
||||
GenerateInventoryDrop(mob, bse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
MobLoot specialDrop = null;
|
||||
switch(mob.getObjectUUID()) {
|
||||
case 22595://elf 1
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252134),true);
|
||||
mob.setFirstName("Melandrach The Blood-Mage");
|
||||
break;
|
||||
case 22432: //elf 2
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252135),true);
|
||||
mob.setFirstName("Kyrtaar The Blood-Mage");
|
||||
break;
|
||||
case 22537: //elf 3
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252136),true);
|
||||
mob.setFirstName("Vamir The Blood-Mage");
|
||||
break;
|
||||
case 16387: //human 4 DONE
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252129),true);
|
||||
mob.setFirstName("Alatar The Blood-Mage");
|
||||
break;
|
||||
case 32724:// human 5 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252130),true);
|
||||
mob.setFirstName("Elphaba The Blood-Mage");
|
||||
break;
|
||||
case 23379: //human 1 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252131),true);
|
||||
mob.setFirstName("Bavmorda The Blood-Mage");
|
||||
break;
|
||||
case 10826: //human 2 REDO
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252132),true);
|
||||
mob.setFirstName("Draco The Blood-Mage");
|
||||
break;
|
||||
case 15929: //human 3 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252133),true);
|
||||
mob.setFirstName("Atlantes The Blood-Mage");
|
||||
break;
|
||||
}
|
||||
if(specialDrop != null) {
|
||||
mob.setLevel((short) 65);
|
||||
mob.setSpawnTime(10800);
|
||||
mob.healthMax = (7500);
|
||||
mob.setHealth(7500);
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
mob.getCharItemManager().addItemToInventory(specialDrop);
|
||||
mob.setResists(new Resists("Dropper"));
|
||||
}
|
||||
}
|
||||
|
||||
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob) {
|
||||
public static MobLoot getGenTableItem(int genTableID, AbstractCharacter mob, Boolean inHotzone) {
|
||||
|
||||
if (mob == null || _genTables.containsKey(genTableID) == false)
|
||||
return null;
|
||||
|
||||
MobLoot outItem;
|
||||
|
||||
int genRoll = ThreadLocalRandom.current().nextInt(1,94 + 1);
|
||||
int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1);
|
||||
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
||||
|
||||
@@ -215,7 +160,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) { //52 = player character
|
||||
itemTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
itemTableRoll = TableRoll(mob.level);
|
||||
itemTableRoll = TableRoll(mob.level, inHotzone);
|
||||
}
|
||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, itemTableRoll);
|
||||
if (tableRow == null)
|
||||
@@ -226,11 +171,12 @@ public enum LootManager {
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
if(itemUUID == 980103 || itemUUID == 980104 || itemUUID == 980110 || itemUUID == 980111){
|
||||
itemUUID = 980100;
|
||||
}
|
||||
|
||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||
int chance = ThreadLocalRandom.current().nextInt(1,101);
|
||||
if(chance > 10)
|
||||
return null;
|
||||
int amount = ThreadLocalRandom.current().nextInt((int)(tableRow.minSpawn * 0.5f), (int)((tableRow.maxSpawn + 1) * 0.5f));
|
||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||
}
|
||||
|
||||
@@ -240,7 +186,7 @@ public enum LootManager {
|
||||
|
||||
if(selectedRow.pModTable != 0){
|
||||
try {
|
||||
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll);
|
||||
outItem = GeneratePrefix(mob, outItem, genTableID, genRoll, inHotzone);
|
||||
outItem.setIsID(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed to GeneratePrefix for item: " + outItem.getName());
|
||||
@@ -248,7 +194,7 @@ public enum LootManager {
|
||||
}
|
||||
if(selectedRow.sModTable != 0){
|
||||
try {
|
||||
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll);
|
||||
outItem = GenerateSuffix(mob, outItem, genTableID, genRoll, inHotzone);
|
||||
outItem.setIsID(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||
@@ -257,7 +203,7 @@ public enum LootManager {
|
||||
return outItem;
|
||||
}
|
||||
|
||||
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
|
||||
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
|
||||
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
||||
|
||||
@@ -274,7 +220,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) {
|
||||
prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
prefixTableRoll = TableRoll(mob.level);
|
||||
prefixTableRoll = TableRoll(mob.level, inHotzone);
|
||||
}
|
||||
ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll);
|
||||
|
||||
@@ -289,7 +235,7 @@ public enum LootManager {
|
||||
return inItem;
|
||||
}
|
||||
|
||||
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll) {
|
||||
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
|
||||
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
|
||||
|
||||
@@ -306,7 +252,7 @@ public enum LootManager {
|
||||
if(mob.getObjectType().ordinal() == 52) {
|
||||
suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1);
|
||||
} else{
|
||||
suffixTableRoll = TableRoll(mob.level);
|
||||
suffixTableRoll = TableRoll(mob.level, inHotzone);
|
||||
}
|
||||
ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll);
|
||||
|
||||
@@ -321,7 +267,7 @@ public enum LootManager {
|
||||
return inItem;
|
||||
}
|
||||
|
||||
public static int TableRoll(int mobLevel) {
|
||||
public static int TableRoll(int mobLevel, Boolean inHotzone) {
|
||||
|
||||
if (mobLevel > 65)
|
||||
mobLevel = 65;
|
||||
@@ -336,12 +282,15 @@ public enum LootManager {
|
||||
if (min < 70)
|
||||
min = 70;
|
||||
|
||||
if (inHotzone)
|
||||
min += mobLevel;
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(min, max + 1);
|
||||
|
||||
return roll;
|
||||
}
|
||||
|
||||
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse) {
|
||||
public static void GenerateGoldDrop(Mob mob, BootySetEntry bse, Boolean inHotzone) {
|
||||
|
||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
|
||||
@@ -352,9 +301,14 @@ public enum LootManager {
|
||||
|
||||
//determine and add gold to mob inventory
|
||||
|
||||
int high = (int)(bse.highGold * NORMAL_GOLD_RATE);
|
||||
int low = (int)(bse.lowGold * NORMAL_GOLD_RATE);
|
||||
int gold = ThreadLocalRandom.current().nextInt(low, high);
|
||||
int high = bse.highGold;
|
||||
int low = bse.lowGold;
|
||||
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
|
||||
|
||||
if (inHotzone == true)
|
||||
gold = (int) (gold * HOTZONE_GOLD_RATE);
|
||||
else
|
||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
@@ -363,33 +317,26 @@ public enum LootManager {
|
||||
|
||||
}
|
||||
|
||||
public static void GenerateLootDrop(Mob mob, int tableID) {
|
||||
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
||||
|
||||
try {
|
||||
if(mob.parentZone.getSafeZone() == 1) {
|
||||
return;
|
||||
}
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob);
|
||||
if(toAdd.getItemBase().getType().equals(Enum.ItemType.CONTRACT) || toAdd.getItemBase().getType().equals(Enum.ItemType.RUNE))
|
||||
return;//block all contracts and runes that drop outside the confines of the new system
|
||||
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
|
||||
if (toAdd != null) {
|
||||
toAdd.setIsID(true);
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||
int i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateEquipmentDrop(Mob mob) {
|
||||
|
||||
if(mob.parentZone.getSafeZone() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
//do equipment here
|
||||
int dropCount = 0;
|
||||
if (mob.getEquip() != null)
|
||||
for (MobEquipment me : mob.getEquip().values()) {
|
||||
|
||||
@@ -398,64 +345,23 @@ public enum LootManager {
|
||||
|
||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
float dropChance = me.getDropChance() * 100;
|
||||
|
||||
if (equipmentRoll > dropChance)
|
||||
continue;
|
||||
ItemBase genericIB = me.getItemBase();
|
||||
if(genericIB.isVorg()){
|
||||
if(genericIB.isClothArmor()){
|
||||
//get random cloth piece
|
||||
genericIB = getRandomVorgCloth();//ItemBase.getItemBase(vorg_cloth_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_cloth_uuids.size() - 1)));
|
||||
} else if(genericIB.isHeavyArmor()){
|
||||
//get random heavy armor piece
|
||||
genericIB = getRandomVorgHA();//ItemBase.getItemBase(vorg_ha_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ha_uuids.size() - 1)));
|
||||
} else if(genericIB.isMediumArmor()){
|
||||
//get random medium armor piece
|
||||
genericIB = getRandomVorgMA();//ItemBase.getItemBase(vorg_ma_uuids.get(ThreadLocalRandom.current().nextInt(0,vorg_ma_uuids.size() - 1)));
|
||||
} else if(genericIB.isLightArmor()){
|
||||
//get random light armor piece
|
||||
genericIB = getRandomVorgLA();//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 && genericIB.isVorg() == false) {
|
||||
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.
|
||||
}
|
||||
if(ml != null && genericIB.isVorg() && mob.getMobBaseID() != 14062){
|
||||
ml.setIsID(true);
|
||||
ml.setDurabilityCurrent(ml.getDurabilityMax());
|
||||
mob.getCharItemManager().addItemToInventory(ml);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
||||
|
||||
if(ItemBase.getItemBase(bse.itemBase).isDiscRune()) {
|
||||
if(!Mob.disciplineDroppers.contains(mob))
|
||||
Mob.disciplineDroppers.add(mob);
|
||||
|
||||
mob.setResists(new Resists("Dropper"));
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ItemBase.getItemBase(bse.itemBase).getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
|
||||
//if((bse.itemBase == 3040 || bse.itemBase == 3021) && mob.level < 80){
|
||||
// chance = 100;
|
||||
//}
|
||||
|
||||
if(mob.parentZone.getSafeZone() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 99);
|
||||
int chanceRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
|
||||
//early exit, failed to hit minimum chance roll
|
||||
|
||||
@@ -551,164 +457,4 @@ public enum LootManager {
|
||||
itemMan.addItemToInventory(playerWinnings);
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
|
||||
public static MobLoot rollForContract(int table, Mob mob){
|
||||
|
||||
int roll = 99;
|
||||
if (table == 1900 || table == 1500)
|
||||
roll = 73;
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f);
|
||||
if (selectedRow == null)
|
||||
return null;
|
||||
|
||||
int itemTableId = selectedRow.itemTableID;
|
||||
|
||||
if (_itemTables.containsKey(itemTableId) == false)
|
||||
return null;
|
||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(75,321));
|
||||
if (tableRow == null)
|
||||
return null;
|
||||
|
||||
int itemUUID = tableRow.cacheID;
|
||||
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||
if(outItem != null) {
|
||||
mob.contractCounter = ThreadLocalRandom.current().nextInt(200);
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " looks like he found something special");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToInterestArea(mob,chatMsg, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE,false,false);
|
||||
return outItem;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static MobLoot rollForRune(int table, Mob mob){
|
||||
int roll = 97;
|
||||
if(table == 1900 || table == 1500){
|
||||
roll = 77;
|
||||
}
|
||||
GenTableEntry selectedRow = GenTableEntry.rollTable(table, roll, 1.0f);
|
||||
if (selectedRow == null)
|
||||
return null;
|
||||
|
||||
int itemTableId = selectedRow.itemTableID;
|
||||
|
||||
if (_itemTables.containsKey(itemTableId) == false)
|
||||
return null;
|
||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(75,321));
|
||||
if (tableRow == null)
|
||||
return null;
|
||||
|
||||
int itemUUID = tableRow.cacheID;
|
||||
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||
if(outItem != null) {
|
||||
mob.runeCounter = ThreadLocalRandom.current().nextInt(200);
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " looks like he found something special");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToInterestArea(mob,chatMsg, Enum.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE,false,false);
|
||||
return outItem;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static MobLoot rollForGlass( Mob mob){
|
||||
ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(220,321));
|
||||
if (tableRow == null)
|
||||
return null;
|
||||
|
||||
int itemUUID = tableRow.cacheID;
|
||||
|
||||
if (itemUUID == 0)
|
||||
return null;
|
||||
|
||||
MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||
if(outItem != null)
|
||||
return outItem;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemBase getRandomVorgCloth(){
|
||||
int random = ThreadLocalRandom.current().nextInt(100);
|
||||
if(random < 20)
|
||||
return ItemBase.getItemBase(27600);
|
||||
if(random > 20 && random < 40)
|
||||
return ItemBase.getItemBase(188700);
|
||||
if(random > 40 && random < 60)
|
||||
return ItemBase.getItemBase(188720);
|
||||
if(random > 60 && random < 80)
|
||||
return ItemBase.getItemBase(189550);
|
||||
if(random > 80)
|
||||
return ItemBase.getItemBase(189560);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemBase getRandomVorgLA(){
|
||||
int random = ThreadLocalRandom.current().nextInt(160);
|
||||
if(random < 20)
|
||||
return ItemBase.getItemBase(27550);
|
||||
if(random > 20 && random < 40)
|
||||
return ItemBase.getItemBase(27560);
|
||||
if(random > 40 && random < 60)
|
||||
return ItemBase.getItemBase(189100);
|
||||
if(random > 60 && random < 80)
|
||||
return ItemBase.getItemBase(189110);
|
||||
if(random > 80 && random < 100)
|
||||
return ItemBase.getItemBase(189120);
|
||||
if(random > 100 && random < 120)
|
||||
return ItemBase.getItemBase(189130);
|
||||
if(random > 120 && random < 140)
|
||||
return ItemBase.getItemBase(189140);
|
||||
if(random > 140)
|
||||
return ItemBase.getItemBase(189150);
|
||||
return null;
|
||||
}
|
||||
public static ItemBase getRandomVorgMA(){
|
||||
int random = ThreadLocalRandom.current().nextInt(160);
|
||||
if(random < 20)
|
||||
return ItemBase.getItemBase(27570);
|
||||
if(random > 20 && random < 40)
|
||||
return ItemBase.getItemBase(188900);
|
||||
if(random > 40 && random < 60)
|
||||
return ItemBase.getItemBase(188910);
|
||||
if(random > 60 && random < 80)
|
||||
return ItemBase.getItemBase(188920);
|
||||
if(random > 80 && random < 100)
|
||||
return ItemBase.getItemBase(188930);
|
||||
if(random > 100 && random < 120)
|
||||
return ItemBase.getItemBase(188940);
|
||||
if(random > 120 && random < 140)
|
||||
return ItemBase.getItemBase(188950);
|
||||
if(random > 140)
|
||||
return ItemBase.getItemBase(189500);
|
||||
return null;
|
||||
}
|
||||
public static ItemBase getRandomVorgHA(){
|
||||
int random = ThreadLocalRandom.current().nextInt(180);
|
||||
if(random < 20)
|
||||
return ItemBase.getItemBase(27580);
|
||||
if(random > 20 && random < 40)
|
||||
return ItemBase.getItemBase(27590);
|
||||
if(random > 40 && random < 60)
|
||||
return ItemBase.getItemBase(188500);
|
||||
if(random > 60 && random < 80)
|
||||
return ItemBase.getItemBase(188510);
|
||||
if(random > 80 && random < 100)
|
||||
return ItemBase.getItemBase(188520);
|
||||
if(random > 100 && random < 120)
|
||||
return ItemBase.getItemBase(188530);
|
||||
if(random > 120 && random < 140)
|
||||
return ItemBase.getItemBase(188540);
|
||||
if(random > 140 && random < 160)
|
||||
return ItemBase.getItemBase(188550);
|
||||
if(random > 160)
|
||||
return ItemBase.getItemBase(189510);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,206 +5,320 @@
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
package engine.gameManager;
|
||||
|
||||
// Defines static methods which comprise the magicbane
|
||||
// building maintenance system.
|
||||
|
||||
import engine.Enum;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public enum MaintenanceManager {
|
||||
|
||||
MAINTENANCEMANAGER;
|
||||
|
||||
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
||||
|
||||
building.maintDateTime = maintDate;
|
||||
DbManager.BuildingQueries.updateMaintDate(building);
|
||||
|
||||
}
|
||||
|
||||
public static void processBuildingMaintenance() {
|
||||
|
||||
ArrayList<AbstractGameObject> buildingList;
|
||||
ArrayList<Building> maintList;
|
||||
ArrayList<Building> derankList = new ArrayList<>();
|
||||
|
||||
Logger.info("Starting Maintenance on Player Buildings");
|
||||
|
||||
// Build list of buildings to apply maintenance on.
|
||||
|
||||
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.Building));
|
||||
maintList = buildMaintList(buildingList);
|
||||
|
||||
// Deduct upkeep and build list of buildings
|
||||
// which did not have funds available
|
||||
|
||||
for (Building building : maintList) {
|
||||
|
||||
if (chargeUpkeep(building) == false)
|
||||
derankList.add(building);
|
||||
}
|
||||
// Reset maintenance dates for these buildings
|
||||
|
||||
for (Building building : maintList) {
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||
|
||||
}
|
||||
// Derak or destroy buildings that did not
|
||||
// have funds available.
|
||||
|
||||
for (Building building : derankList)
|
||||
building.destroyOrDerank(null);
|
||||
|
||||
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
||||
}
|
||||
|
||||
// Iterate over all buildings in game and apply exclusion rules
|
||||
// returning a list of building for which maintenance is due.
|
||||
|
||||
private static ArrayList<Building> buildMaintList(ArrayList<AbstractGameObject> buildingList) {
|
||||
|
||||
ArrayList<Building> maintList = new ArrayList<>();
|
||||
|
||||
for (AbstractGameObject gameObject : buildingList) {
|
||||
|
||||
Building building = (Building) gameObject;
|
||||
|
||||
// No maintenance on NPC owned buildings (Cache loaded)
|
||||
|
||||
if (building.getProtectionState() == Enum.ProtectionState.NPC)
|
||||
continue;
|
||||
|
||||
// No maintenance on constructing meshes
|
||||
|
||||
if (building.getRank() < 1)
|
||||
continue;
|
||||
|
||||
// No Maintenance on furniture
|
||||
|
||||
if (building.parentBuildingID != 0)
|
||||
continue;
|
||||
|
||||
// No Blueprint?
|
||||
|
||||
if (building.getBlueprint() == null) {
|
||||
Logger.error("Blueprint missing for uuid: " + building.getObjectUUID());
|
||||
continue;
|
||||
}
|
||||
|
||||
// No maintenance on banestones omfg
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
|
||||
continue;
|
||||
|
||||
// no maintenance on Mines omfg
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.MINE))
|
||||
continue;
|
||||
|
||||
// Null Maintenance date?
|
||||
|
||||
if (building.maintDateTime == null) {
|
||||
Logger.error("Null maint date for building UUID: " + building.getObjectUUID());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Maintenance date is in the future
|
||||
|
||||
if (building.maintDateTime.isAfter(LocalDateTime.now()))
|
||||
continue;
|
||||
|
||||
|
||||
//no maintenance if day of week doesnt match
|
||||
if (LocalDateTime.now().getDayOfWeek().ordinal() != building.maintDateTime.getDayOfWeek().ordinal()) {
|
||||
continue;
|
||||
}
|
||||
// Add building to maintenance queue
|
||||
|
||||
maintList.add(building);
|
||||
}
|
||||
|
||||
return maintList;
|
||||
}
|
||||
|
||||
// Method removes the appropriate amount of gold/resources from
|
||||
// a building according to it's maintenance schedule. True/False
|
||||
// is returned indicating if the building had enough funds to cover.
|
||||
|
||||
public static boolean chargeUpkeep(Building building) {
|
||||
|
||||
City city = null;
|
||||
Warehouse warehouse = null;
|
||||
int maintCost = 0;
|
||||
int overDraft = 0;
|
||||
boolean hasFunds = false;
|
||||
boolean hasResources = false;
|
||||
int resourceValue = 0;
|
||||
|
||||
city = building.getCity();
|
||||
|
||||
if (city != null)
|
||||
warehouse = city.getWarehouse();
|
||||
|
||||
// Cache maintenance cost value
|
||||
|
||||
maintCost = building.getMaintCost();
|
||||
|
||||
// Something went wrong. Missing buildinggroup from switch?
|
||||
|
||||
if (maintCost == 0) {
|
||||
Logger.error("chargeUpkeep", "Error retrieving rankcost for " + building.getName() + " uuid:" + building.getObjectUUID() + "buildinggroup:" + building.getBlueprint().getBuildingGroup().name());
|
||||
// check if there is enough gold on the building
|
||||
return true;
|
||||
}
|
||||
|
||||
if (building.getStrongboxValue() >= maintCost)
|
||||
hasFunds = true;
|
||||
|
||||
// If we cannot cover with just the strongbox
|
||||
// see if there is a warehouse that will cover
|
||||
// the overdraft for us.
|
||||
|
||||
|
||||
if (hasFunds == false && (building.assetIsProtected() || building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.WAREHOUSE)) {
|
||||
overDraft = maintCost - building.getStrongboxValue();
|
||||
}
|
||||
|
||||
if ((overDraft > 0))
|
||||
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
|
||||
(warehouse != null) && building.assetIsProtected() == true &&
|
||||
(warehouse.getResources().get(ItemBase.GOLD_ITEM_BASE)) >= overDraft) {
|
||||
hasFunds = true;
|
||||
}
|
||||
|
||||
// If this is an R8 tree, validate that we can
|
||||
// cover the resources required
|
||||
|
||||
if (building.getRank() == 8) {
|
||||
|
||||
hasResources = true;
|
||||
|
||||
if (warehouse == null)
|
||||
hasResources = false;
|
||||
else {
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
|
||||
if (resourceValue < 1500)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
|
||||
if (resourceValue < 1500)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
|
||||
if (resourceValue < 5)
|
||||
hasResources = false;
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
|
||||
if (resourceValue < 5)
|
||||
hasResources = false;
|
||||
|
||||
}
|
||||
}
|
||||
// Validation completed but has failed. We can derank
|
||||
// the target building and early exit
|
||||
|
||||
if ((hasFunds == false) ||
|
||||
((building.getRank() == 8) && !hasResources)) {
|
||||
|
||||
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
||||
// and it's not an R8 deranking
|
||||
|
||||
if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
||||
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
||||
}
|
||||
|
||||
return false; // Early exit for having failed to meet maintenance
|
||||
}
|
||||
|
||||
// Remove cash and resources
|
||||
|
||||
// withdraw what we can from the building
|
||||
|
||||
building.setStrongboxValue(building.getStrongboxValue() - (maintCost - overDraft));
|
||||
|
||||
// withdraw overdraft from the whorehouse
|
||||
|
||||
if (overDraft > 0) {
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.goldIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateGold(warehouse, resourceValue - overDraft) == true) {
|
||||
warehouse.getResources().put(Warehouse.goldIB, resourceValue - overDraft);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GOLD, overDraft);
|
||||
} else {
|
||||
Logger.error("gold update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Early exit as we're done if we're not an R8 tree
|
||||
|
||||
if (building.getRank() < 8)
|
||||
return true;
|
||||
|
||||
// Now for the resources if it's an R8 tree
|
||||
|
||||
// Withdraw Stone
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateStone(warehouse, resourceValue - 1500) == true) {
|
||||
warehouse.getResources().put(Warehouse.stoneIB, resourceValue - 1500);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.STONE, 1500);
|
||||
} else {
|
||||
Logger.error("stone update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Withdraw Lumber
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateLumber(warehouse, resourceValue - 1500) == true) {
|
||||
warehouse.getResources().put(Warehouse.lumberIB, resourceValue - 1500);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.LUMBER, 1500);
|
||||
} else {
|
||||
Logger.error("lumber update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Withdraw Galvor
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateGalvor(warehouse, resourceValue - 5) == true) {
|
||||
warehouse.getResources().put(Warehouse.galvorIB, resourceValue - 5);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.GALVOR, 5);
|
||||
} else {
|
||||
Logger.error("galvor update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
resourceValue = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
|
||||
if (DbManager.WarehouseQueries.updateWormwood(warehouse, resourceValue - 5) == true) {
|
||||
warehouse.getResources().put(Warehouse.wormwoodIB, resourceValue - 5);
|
||||
warehouse.AddTransactionToWarehouse(Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Resource.WORMWOOD, 5);
|
||||
} else {
|
||||
Logger.error("wyrmwood update failed for warehouse of UUID:" + warehouse.getObjectUUID());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void dailyMaintenance() {
|
||||
|
||||
Logger.info("Maintenance has started");
|
||||
|
||||
// Run maintenance on player buildings
|
||||
|
||||
if (ConfigManager.MB_WORLD_MAINTENANCE.getValue().equalsIgnoreCase("true"))
|
||||
processMaintenance();
|
||||
processBuildingMaintenance();
|
||||
else
|
||||
Logger.info("Maintenance Costings: DISABLED");
|
||||
|
||||
Logger.info("Maintenance has completed!");
|
||||
}
|
||||
public static void processMaintenance() {
|
||||
//create list of all cities
|
||||
ConcurrentHashMap<Integer, AbstractGameObject> worldCities = DbManager.getMap(Enum.GameObjectType.City);
|
||||
//loop all cities
|
||||
for (AbstractGameObject ago : worldCities.values()) {
|
||||
if (ago.getObjectType().equals(Enum.GameObjectType.City)) {
|
||||
City city = (City) ago;
|
||||
if(city == null || !city.getParent().isPlayerCity())
|
||||
continue;
|
||||
Building tol = city.getTOL();
|
||||
if(tol == null)
|
||||
continue;
|
||||
LocalDateTime maintenanceDueDate = tol.maintDateTime.withHour(1).withMinute(0).withSecond(0);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if(now.isAfter(maintenanceDueDate))
|
||||
processTolMaintenance(tol, city.getWarehouse());
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void processTolMaintenance(Building tol, Warehouse warehouse){
|
||||
if(tol == null)
|
||||
return;
|
||||
if(tol.getRank() == 8)
|
||||
handleR8(tol,warehouse);
|
||||
else
|
||||
handleNormal(tol,warehouse);
|
||||
}
|
||||
public static void handleNormal(Building tol, Warehouse warehouse){
|
||||
//handle r7 and lower ToL maintenance
|
||||
int goldDue = 3000000;
|
||||
//enough on strongbox alone to pay
|
||||
if (tol.getStrongboxValue() >= goldDue) {
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(7);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.setStrongboxValue(tol.getStrongboxValue() - goldDue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int newStrongboxValue = tol.getStrongboxValue();
|
||||
int newWarehouseGold = 0;
|
||||
if(warehouse != null && warehouse.getResources().get(ItemBase.getItemBase(7)) != null) {
|
||||
newWarehouseGold = warehouse.getResources().get(ItemBase.getItemBase(7));
|
||||
} else{
|
||||
//wasnt enough on strongbox and gold in warehouse is empty
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//some on strongbox to pay
|
||||
if (tol.getStrongboxValue() > 0) {
|
||||
newStrongboxValue = 0;
|
||||
goldDue -= tol.getStrongboxValue();
|
||||
}
|
||||
if(newWarehouseGold < goldDue){
|
||||
//not enough gold to pay, you miss maintenance
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
newWarehouseGold -= goldDue;
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(7);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol) && DbManager.WarehouseQueries.updateGold(warehouse,newWarehouseGold)) {
|
||||
warehouse.getResources().put(ItemBase.getItemBase(7), newWarehouseGold);
|
||||
tol.setStrongboxValue(newStrongboxValue);
|
||||
}
|
||||
}
|
||||
public static void handleR8(Building tol, Warehouse warehouse){
|
||||
//handle r8 ToL maintenance
|
||||
//cannot pay r8 maintenance without a warehouse
|
||||
if(warehouse == null && DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
return;
|
||||
}
|
||||
//handle resource processing
|
||||
int goldDue = 3000000;
|
||||
int galvorDue = 5;
|
||||
int wormwoodDue = 5;
|
||||
int stoneDue = 5000;
|
||||
int lumberDue = 5000;
|
||||
int goldStrongBox = tol.getStrongboxValue();
|
||||
int goldWarehouse = 0;
|
||||
int galvorWarehouse;
|
||||
int wormwoodWarehouse;
|
||||
int stoneWarehouse;
|
||||
int lumberWarehouse;
|
||||
if(warehouse.getResources().get(Warehouse.galvorIB) != null) {
|
||||
galvorWarehouse = warehouse.getResources().get(Warehouse.galvorIB);
|
||||
}else {
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(warehouse.getResources().get(Warehouse.stoneIB) != null) {
|
||||
stoneWarehouse = warehouse.getResources().get(Warehouse.stoneIB);
|
||||
}else {
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(warehouse.getResources().get(Warehouse.wormwoodIB) != null) {
|
||||
wormwoodWarehouse = warehouse.getResources().get(Warehouse.wormwoodIB);
|
||||
}else {
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(warehouse.getResources().get(Warehouse.lumberIB) != null) {
|
||||
lumberWarehouse = warehouse.getResources().get(Warehouse.lumberIB);
|
||||
}else {
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
boolean canPay = true;
|
||||
if(goldStrongBox >= goldDue){
|
||||
goldStrongBox -= goldDue;
|
||||
goldDue = 0;
|
||||
}
|
||||
if (tol.getStrongboxValue() > 0) {
|
||||
goldStrongBox = 0;
|
||||
goldDue -= tol.getStrongboxValue();
|
||||
}
|
||||
if(warehouse.getResources().get(Warehouse.goldIB) != null) {
|
||||
goldWarehouse = warehouse.getResources().get(Warehouse.goldIB);
|
||||
}else if(goldDue > 0){
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(wormwoodDue > wormwoodWarehouse)
|
||||
canPay = false;
|
||||
if(galvorDue > galvorWarehouse)
|
||||
canPay = false;
|
||||
if(lumberDue > lumberWarehouse)
|
||||
canPay = false;
|
||||
if(stoneDue > stoneWarehouse)
|
||||
canPay = false;
|
||||
if(goldDue > goldWarehouse)
|
||||
canPay = false;
|
||||
if(!canPay){
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
tol.destroyOrDerank(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
tol.setStrongboxValue(goldStrongBox);
|
||||
if(DbManager.WarehouseQueries.updateGold(warehouse,goldWarehouse - goldDue)){
|
||||
if(DbManager.WarehouseQueries.updateStone(warehouse,stoneWarehouse - stoneDue)){
|
||||
if(DbManager.WarehouseQueries.updateLumber(warehouse,lumberWarehouse - lumberDue)){
|
||||
if(DbManager.WarehouseQueries.updateGalvor(warehouse,galvorWarehouse - galvorDue)){
|
||||
if(DbManager.WarehouseQueries.updateWormwood(warehouse,wormwoodWarehouse - wormwoodDue)){
|
||||
tol.maintDateTime = LocalDateTime.now().plusDays(1);
|
||||
if(DbManager.BuildingQueries.updateMaintDate(tol)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +69,9 @@ public enum MovementManager {
|
||||
if (toMove.getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
if (((PlayerCharacter) toMove).isCasting())
|
||||
((PlayerCharacter) toMove).update();
|
||||
if(((PlayerCharacter) toMove).isFlying() && toMove.getEffects().containsKey("MoveBuff"))
|
||||
PlayerCharacter.GroundPlayer(((PlayerCharacter) toMove));
|
||||
}
|
||||
|
||||
|
||||
toMove.setIsCasting(false);
|
||||
toMove.setItemCasting(false);
|
||||
|
||||
|
||||
@@ -23,6 +23,14 @@ public enum NPCManager {
|
||||
NPC_MANAGER;
|
||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
||||
|
||||
public static void LoadAllRuneSets() {
|
||||
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||
}
|
||||
|
||||
public static void LoadAllBootySets() {
|
||||
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
|
||||
}
|
||||
|
||||
public static void applyRuneSetEffects(Mob mob) {
|
||||
|
||||
// Early exit
|
||||
@@ -119,12 +127,10 @@ public enum NPCManager {
|
||||
|
||||
DbManager.removeFromCache(necroPet);
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
|
||||
PlayerCharacter petOwner = necroPet.getOwner();
|
||||
|
||||
if (petOwner != null) {
|
||||
|
||||
necroPet.guardCaptain = null;
|
||||
necroPet.setOwner(null);
|
||||
petOwner.setPet(null);
|
||||
|
||||
if (updateOwner == false)
|
||||
@@ -222,14 +228,12 @@ public enum NPCManager {
|
||||
WorldGrid.removeObject(toRemove);
|
||||
DbManager.removeFromCache(toRemove);
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
PlayerCharacter petOwner = toRemove.getOwner();
|
||||
|
||||
if (petOwner != null) {
|
||||
|
||||
petOwner.setPet(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
toRemove.setOwner(null);
|
||||
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
@@ -336,19 +340,10 @@ public enum NPCManager {
|
||||
else
|
||||
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
|
||||
|
||||
// Override slot for siege engines
|
||||
|
||||
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
|
||||
Mob siegeMobile = (Mob) abstractCharacter;
|
||||
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
|
||||
}
|
||||
|
||||
if (buildingSlot == -1)
|
||||
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
|
||||
|
||||
// Pets are regular mobiles not hirelings (Siege engines)
|
||||
if (abstractCharacter.contract != null)
|
||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
|
||||
|
||||
// Override bind and location for this npc derived
|
||||
// from BuildingManager slot location data.
|
||||
@@ -375,53 +370,4 @@ public enum NPCManager {
|
||||
|
||||
return buildingSlot;
|
||||
}
|
||||
|
||||
public static int getMaxMinions(Mob guardCaptain) {
|
||||
|
||||
int maxSlots;
|
||||
|
||||
switch (guardCaptain.getRank()) {
|
||||
case 3:
|
||||
maxSlots = 2;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
maxSlots = 3;
|
||||
break;
|
||||
case 6:
|
||||
maxSlots = 4;
|
||||
break;
|
||||
case 7:
|
||||
maxSlots = 5;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
default:
|
||||
maxSlots = 1;
|
||||
|
||||
}
|
||||
return maxSlots;
|
||||
}
|
||||
|
||||
public static void AssignPatrolPoints(Mob mob) {
|
||||
mob.patrolPoints = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
float patrolRadius = mob.getSpawnRadius();
|
||||
|
||||
if (patrolRadius > 256)
|
||||
patrolRadius = 256;
|
||||
|
||||
if (patrolRadius < 60)
|
||||
patrolRadius = 60;
|
||||
|
||||
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
|
||||
mob.patrolPoints.add(newPatrolPoint);
|
||||
|
||||
if (i == 1) {
|
||||
mob.loc = newPatrolPoint;
|
||||
mob.endLoc = newPatrolPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.objects.*;
|
||||
import engine.powers.*;
|
||||
import engine.powers.effectmodifiers.SeeInvisibleEffectModifier;
|
||||
import engine.powers.poweractions.AbstractPowerAction;
|
||||
import engine.powers.poweractions.TrackPowerAction;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -57,22 +56,6 @@ public enum PowersManager {
|
||||
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
|
||||
private static JobScheduler js;
|
||||
|
||||
public static String[] siegeBuffs = new String[]{"ART-004A","ARM-112A"};
|
||||
public static String[] siegeDeBuffs = new String[]{"ACM-003A","WRT-003A"};
|
||||
|
||||
public static ArrayList<PowerQueObject> static_power_que = new ArrayList<>();
|
||||
|
||||
public static class PowerQueObject{
|
||||
public PowerQueObject(PerformActionMsg inmsg,ClientConnection inorigin,boolean insendCastToSelf){
|
||||
this.msg = inmsg;
|
||||
this.origin = inorigin;
|
||||
this.sendCastToSelf = insendCastToSelf;
|
||||
}
|
||||
public PerformActionMsg msg;
|
||||
public ClientConnection origin;
|
||||
public boolean sendCastToSelf;
|
||||
}
|
||||
|
||||
private PowersManager() {
|
||||
|
||||
}
|
||||
@@ -182,9 +165,11 @@ public enum PowersManager {
|
||||
|
||||
if (usePowerA(msg, origin, sendCastToSelf)) {
|
||||
// Cast failed for some reason, reset timer
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
// Send Fail to cast message
|
||||
PlayerCharacter pc = SessionManager
|
||||
.getPlayerCharacter(origin);
|
||||
@@ -218,8 +203,6 @@ public enum PowersManager {
|
||||
if (playerCharacter == null)
|
||||
return false;
|
||||
|
||||
boolean skipCheck = false;
|
||||
|
||||
boolean CSRCast = false;
|
||||
|
||||
|
||||
@@ -232,67 +215,10 @@ public enum PowersManager {
|
||||
+ Integer.toHexString(msg.getPowerUsedID()) + " ("
|
||||
+ msg.getPowerUsedID() + ')');
|
||||
}
|
||||
Boolean earlyExit = false;
|
||||
|
||||
//Sending recycle message to player if died while casting.
|
||||
if (!playerCharacter.isAlive() && msg.getPowerUsedID() != 428589216) { //succor
|
||||
|
||||
earlyExit = true;
|
||||
}
|
||||
|
||||
if(msg.getPowerUsedID() == 430628895){ // group teleport
|
||||
|
||||
Boolean activeBane = false;
|
||||
|
||||
if(ZoneManager.getCityAtLocation(playerCharacter.loc) != null && ZoneManager.getCityAtLocation(playerCharacter.loc).getBane() != null)
|
||||
activeBane = ZoneManager.getCityAtLocation(playerCharacter.loc).getBane().getSiegePhase().equals(SiegePhase.WAR);
|
||||
|
||||
Zone currentZone = ZoneManager.findSmallestZone(playerCharacter.loc);
|
||||
if(currentZone == null)
|
||||
earlyExit = true;
|
||||
|
||||
if(currentZone.isPlayerCity() && !activeBane)
|
||||
earlyExit = true;
|
||||
|
||||
if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) {
|
||||
for (Building building : currentZone.zoneBuildingSet) {
|
||||
if (Mine.getMineFromTower(building.getObjectUUID()) != null) {
|
||||
Mine currentMine = Mine.getMineFromTower(building.getObjectUUID());
|
||||
if (currentMine.isActive == false) {
|
||||
earlyExit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vector3fImmutable endLoc = new Vector3fImmutable(msg.getTargetX(),msg.getTargetY(),msg.getTargetZ());
|
||||
currentZone = ZoneManager.findSmallestZone(endLoc);
|
||||
|
||||
if(currentZone == null)
|
||||
earlyExit = true;
|
||||
|
||||
if(currentZone.isPlayerCity() && !activeBane)
|
||||
earlyExit = true;
|
||||
|
||||
if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) {
|
||||
for (Building building : currentZone.zoneBuildingSet) {
|
||||
if (Mine.getMineFromTower(building.getObjectUUID()) != null) {
|
||||
Mine currentMine = Mine.getMineFromTower(building.getObjectUUID());
|
||||
if (currentMine.isActive == false) {
|
||||
earlyExit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// get power
|
||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||
|
||||
if(pb.description.equals("Personal Movement Buff") && playerCharacter.isFlying()) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You cannot use movement speed buffs while flying");
|
||||
earlyExit = true;
|
||||
}
|
||||
|
||||
if (earlyExit) {
|
||||
|
||||
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
@@ -300,6 +226,7 @@ public enum PowersManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// if (!pc.getPowers().contains(msg.getPowerUsedID())) {
|
||||
// sendPowerMsg(pc, 10, msg);
|
||||
// return false;
|
||||
@@ -312,6 +239,8 @@ public enum PowersManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get power
|
||||
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
|
||||
if (pb == null) {
|
||||
ChatManager.chatSayInfo(playerCharacter,
|
||||
"This power is not implemented yet.");
|
||||
@@ -322,18 +251,15 @@ public enum PowersManager {
|
||||
return true;
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (playerCharacter.getLastPower() != null)
|
||||
return true;
|
||||
|
||||
//Check if Power Target is allowed to cast.
|
||||
|
||||
|
||||
// Check powers for normal users
|
||||
|
||||
if(msg.getPowerUsedID() == 429399948)
|
||||
for(CharacterRune cr : playerCharacter.getRunes())
|
||||
if(cr.getRuneBaseID() == 3029)
|
||||
skipCheck = true;
|
||||
if (!skipCheck && (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID())))
|
||||
if (playerCharacter.getPowers() == null || !playerCharacter.getPowers().containsKey(msg.getPowerUsedID()))
|
||||
if (!playerCharacter.isCSR()) {
|
||||
if (!MBServerStatics.POWERS_DEBUG) {
|
||||
// ChatManager.chatSayInfo(pc, "You may not cast that spell!");
|
||||
@@ -346,31 +272,18 @@ public enum PowersManager {
|
||||
|
||||
// get numTrains for power
|
||||
int trains = msg.getNumTrains();
|
||||
int token = pb.token;
|
||||
int overrideTrains = 0;
|
||||
int overrideRecycle = 0;
|
||||
if(token == 429420458){
|
||||
overrideTrains = 40;
|
||||
overrideRecycle = 300000;
|
||||
}
|
||||
|
||||
// can't go over the max trains for the power, unless CSR
|
||||
if (trains > pb.getMaxTrains() && !playerCharacter.isCSR()) {
|
||||
trains = pb.getMaxTrains();
|
||||
msg.setNumTrains(trains);
|
||||
}
|
||||
|
||||
// can't go over total trains by player
|
||||
if (playerCharacter.getPowers() != null && playerCharacter.getPowers().containsKey(msg.getPowerUsedID())) {
|
||||
CharacterPower cp = playerCharacter.getPowers().get(msg.getPowerUsedID());
|
||||
if (cp != null) {
|
||||
int tot = cp.getTotalTrains();
|
||||
switch(token){
|
||||
case 430596127:
|
||||
if(playerCharacter.getPromotionClass().getName().equals("Wizard"))
|
||||
tot = 40; //single teleport granted at 40 for wizard
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (tot == 0 && !playerCharacter.isCSR())
|
||||
return false;
|
||||
if (trains != tot && !playerCharacter.isCSR()) {
|
||||
@@ -379,19 +292,27 @@ public enum PowersManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(overrideTrains > 0)
|
||||
msg.setNumTrains(overrideTrains);
|
||||
|
||||
// get recycle time in ms
|
||||
int time = pb.getRecycleTime(trains);
|
||||
|
||||
if(overrideRecycle > 0)
|
||||
time = overrideRecycle;
|
||||
// verify player is in correct mode (combat/nonCombat)
|
||||
if (playerCharacter.isCombat()) {
|
||||
if (!pb.allowedInCombat())
|
||||
// ChatManager.chatPowerError(pc,
|
||||
// "This power is not allowed in combat mode.");
|
||||
return true;
|
||||
} else if (!pb.allowedOutOfCombat())
|
||||
// ChatManager.chatPowerError(pc,
|
||||
// "You must be in combat mode to use this power.");
|
||||
return true;
|
||||
|
||||
// verify player is not stunned or prohibited from casting
|
||||
PlayerBonuses bonus = playerCharacter.getBonuses();
|
||||
SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
|
||||
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
||||
return true;
|
||||
|
||||
// if moving make sure spell valid for movement
|
||||
Vector3fImmutable endLoc = playerCharacter.getEndLoc();
|
||||
|
||||
@@ -417,43 +338,35 @@ public enum PowersManager {
|
||||
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
|
||||
if (pb.isAOE()) {
|
||||
if (!pb.usePointBlank()) {
|
||||
AbstractWorldObject target;
|
||||
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||
target = pet;
|
||||
}else{
|
||||
target = getTarget(msg);
|
||||
}
|
||||
AbstractWorldObject target = getTarget(msg);
|
||||
|
||||
|
||||
if (target != null && target.getObjectType() == GameObjectType.Building && !pb.targetBuilding()) {
|
||||
PowersManager.sendPowerMsg(playerCharacter, 9, new PerformActionMsg(msg));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
if (playerCharacter.getLoc().distanceSquared2D(msg.getTargetLoc()) > sqr(pb
|
||||
.getRange()))
|
||||
return true;
|
||||
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange())) {
|
||||
} else if (verifyInvalidRange(playerCharacter, target, pb.getRange()))
|
||||
// pc.getLoc().distance(target.getLoc()) >
|
||||
// pb.getRange())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
// get target
|
||||
AbstractWorldObject target;
|
||||
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||
target = pet;
|
||||
}else{
|
||||
target = getTarget(msg);
|
||||
}
|
||||
if (target == null) {
|
||||
AbstractWorldObject target = getTarget(msg);
|
||||
|
||||
if (target == null)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!target.isAlive() && target.getObjectType().equals(GameObjectType.Building) == false && msg.getPowerUsedID() != 428589216)
|
||||
return true;
|
||||
|
||||
float range = pb.getRange();
|
||||
// verify target is in range
|
||||
|
||||
@@ -462,13 +375,16 @@ public enum PowersManager {
|
||||
// (pc.getLoc().distance(target.getLoc()) > pb.getRange()) {
|
||||
// TODO send message that target is out of range
|
||||
return true;
|
||||
|
||||
// verify target is valid type
|
||||
if (!validateTarget(target, playerCharacter, pb))
|
||||
return true;
|
||||
|
||||
|
||||
if (AbstractWorldObject.IsAbstractCharacter(target))
|
||||
targetLiveCounter = ((AbstractCharacter) target).getLiveCounter();
|
||||
}
|
||||
|
||||
// verify regular player can cast spell, otherwise authenticate
|
||||
if (!pb.regularPlayerCanCast()) {
|
||||
Account a = SessionManager.getAccount(playerCharacter);
|
||||
@@ -478,6 +394,7 @@ public enum PowersManager {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// verify player has proper effects applied to use power
|
||||
if (pb.getEffectPrereqs().size() > 0 && playerCharacter.getEffects() != null) {
|
||||
|
||||
@@ -491,9 +408,11 @@ public enum PowersManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!passed)
|
||||
return true;
|
||||
}
|
||||
|
||||
//verify player has proper equipment to use power
|
||||
if (pb.getEquipPrereqs().size() > 0) {
|
||||
|
||||
@@ -612,13 +531,6 @@ public enum PowersManager {
|
||||
// get cast time in ms.
|
||||
time = pb.getCastTime(trains);
|
||||
|
||||
|
||||
if(pb.token == 430596127)
|
||||
time = 5000;
|
||||
|
||||
if(pb.name.equals("Summon") && playerCharacter.getRace().getName().contains("Vampire"))
|
||||
time = 60000;
|
||||
|
||||
// set player is casting for regens
|
||||
|
||||
|
||||
@@ -630,10 +542,6 @@ public enum PowersManager {
|
||||
|
||||
playerCharacter.setLastMovementState(playerCharacter.getMovementState());
|
||||
|
||||
if(msg.getPowerUsedID() == 429495514 && playerCharacter.getRace().getName().contains("Shade")){
|
||||
copyMsg.setPowerUsedID(429397210);//intercept shade using hide and cast sneak instead
|
||||
}
|
||||
|
||||
// run timer job to end cast
|
||||
if (time < 1) // run immediately
|
||||
finishUsePower(copyMsg, playerCharacter, casterLiveCounter, targetLiveCounter);
|
||||
@@ -699,13 +607,7 @@ public enum PowersManager {
|
||||
if (pb.targetFromLastTarget() || pb.targetPet()) // use msg's target
|
||||
if (pb.isAOE()) {
|
||||
if (!pb.usePointBlank()) {
|
||||
AbstractWorldObject target;
|
||||
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||
target = pet;
|
||||
}else{
|
||||
target = getTarget(msg);
|
||||
}
|
||||
AbstractWorldObject target = getTarget(msg);
|
||||
|
||||
|
||||
if (target == null) {
|
||||
@@ -720,13 +622,7 @@ public enum PowersManager {
|
||||
}
|
||||
} else {
|
||||
// get target
|
||||
AbstractWorldObject target;
|
||||
if(msg.getTargetType() == 37 && Mob.dynamic_pets.get(msg.getTargetID()) != null){
|
||||
Mob pet = Mob.dynamic_pets.get(msg.getTargetID());
|
||||
target = pet;
|
||||
}else{
|
||||
target = getTarget(msg);
|
||||
}
|
||||
AbstractWorldObject target = getTarget(msg);
|
||||
|
||||
if (target == null)
|
||||
return true;
|
||||
@@ -943,6 +839,8 @@ public enum PowersManager {
|
||||
return;
|
||||
}
|
||||
|
||||
playerCharacter.setHateValue(pb.getHateValue(trains));
|
||||
|
||||
//Send Cast Message.
|
||||
// PerformActionMsg castMsg = new PerformActionMsg(msg);
|
||||
// castMsg.setNumTrains(9999);
|
||||
@@ -993,6 +891,8 @@ public enum PowersManager {
|
||||
//Power is aiding a target, handle aggro if combat target is a Mob.
|
||||
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
|
||||
PlayerCharacter pcTarget = (PlayerCharacter) target;
|
||||
if (!pb.isHarmful())
|
||||
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
|
||||
}
|
||||
|
||||
// update target of used power timer
|
||||
@@ -1331,8 +1231,9 @@ public enum PowersManager {
|
||||
if (pc == null)
|
||||
return;
|
||||
|
||||
PlayerCharacter target = SessionManager.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
||||
if (target == null || target.equals(pc) || target.isCombat() || target.getGuild().getNation().equals(pc.getGuild().getNation()) == false) {
|
||||
PlayerCharacter target = SessionManager
|
||||
.getPlayerCharacterByLowerCaseName(msg.getTargetName());
|
||||
if (target == null || target.equals(pc) || target.isCombat()) {
|
||||
|
||||
if (target == null) // Player not found. Send not found message
|
||||
ChatManager.chatInfoError(pc,
|
||||
@@ -1341,10 +1242,7 @@ public enum PowersManager {
|
||||
ChatManager.chatInfoError(pc,
|
||||
"Cannot summon player in combat.");
|
||||
// else trying to summon self, just fail
|
||||
if(target != null && target.getGuild().getNation().equals(pc.getGuild().getNation()) == false){
|
||||
ChatManager.chatInfoError(pc,
|
||||
"Cannot summon outside of nation.");
|
||||
}
|
||||
|
||||
// recycle summon
|
||||
sendRecyclePower(msg.getPowerToken(), origin);
|
||||
|
||||
@@ -1376,7 +1274,7 @@ public enum PowersManager {
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
long tooLate = pc.getSummoner(source.getObjectUUID()) + 45000;
|
||||
long tooLate = pc.getSummoner(source.getObjectUUID());
|
||||
if (tooLate < System.currentTimeMillis()) {
|
||||
ChatManager.chatInfoError(pc, "You waited too long to " + (msg.accepted() ? "accept" : "decline") + " the summons.");
|
||||
pc.removeSummoner(source.getObjectUUID());
|
||||
@@ -1438,15 +1336,7 @@ public enum PowersManager {
|
||||
duration = 15000; // Healer Summons, 15 seconds
|
||||
else
|
||||
duration = 45000; // Belgosh Summons, 45 seconds
|
||||
if(pc.inSafeZone() == false) {
|
||||
for (AbstractWorldObject absChar : WorldGrid.getObjectsInRangePartial(pc.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)) {
|
||||
PlayerCharacter player = (PlayerCharacter) absChar;
|
||||
if (player.guild.getNation().equals(pc.guild.getNation()) == false) {
|
||||
duration += 60000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Teleport to summoners location
|
||||
FinishSummonsJob fsj = new FinishSummonsJob(source, pc);
|
||||
@@ -1575,41 +1465,6 @@ public enum PowersManager {
|
||||
HashSet<AbstractCharacter> trackChars = RangeBasedAwo.getTrackList(
|
||||
allTargets, playerCharacter, maxTargets);
|
||||
|
||||
trackChars = new HashSet<>();
|
||||
HashSet<AbstractWorldObject> allInRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER);
|
||||
//ArrayList<Guild> nationsInRange = new ArrayList<>();
|
||||
ArrayList<AbstractWorldObject> purgeList = new ArrayList<>();
|
||||
for(AbstractWorldObject trackChar : allInRange) {
|
||||
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
|
||||
purgeList.add(trackChar);
|
||||
}
|
||||
|
||||
allInRange.removeAll(purgeList);
|
||||
|
||||
//first round to add players in range
|
||||
for(AbstractWorldObject trackChar : allInRange){
|
||||
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
|
||||
continue;
|
||||
if(allInRange.contains(trackChar)) {
|
||||
trackChars.add((AbstractCharacter)trackChar);
|
||||
}
|
||||
}
|
||||
|
||||
//track full range for chaining nation members
|
||||
ArrayList<Guild> nationsInRange = new ArrayList<>();
|
||||
for(AbstractCharacter pc : trackChars){
|
||||
if(nationsInRange.contains(pc.guild.getNation()) == false)
|
||||
nationsInRange.add(pc.guild.getNation());
|
||||
}
|
||||
HashSet<AbstractWorldObject> fullRange = WorldGrid.getObjectsInRangePartial(playerCharacter.loc,1024,MBServerStatics.MASK_PLAYER);
|
||||
for(AbstractWorldObject trackChar : fullRange) {
|
||||
if(trackChar.equals(playerCharacter) || !trackChar.isAlive() || !((PlayerCharacter)trackChar).isActive())
|
||||
continue;
|
||||
if(nationsInRange.contains(((PlayerCharacter) trackChar).guild.getNation()) && trackChars.contains(trackChar) == false)
|
||||
trackChars.add((AbstractCharacter)trackChar);
|
||||
}
|
||||
|
||||
|
||||
TrackWindowMsg trackWindowMsg = new TrackWindowMsg(msg);
|
||||
|
||||
// send track window
|
||||
@@ -1785,8 +1640,7 @@ public enum PowersManager {
|
||||
ac.setItemCasting(false);
|
||||
if (ac == null || target == null || pb == null)
|
||||
return;
|
||||
if(pb.targetSelf)
|
||||
target = ac;
|
||||
|
||||
ac.clearTimer(Integer.toString(pb.getToken()));
|
||||
if (liveCounter == ac.getLiveCounter())
|
||||
finishApplyPowerA(ac, target, targetLoc, pb, trains, false);
|
||||
@@ -2367,9 +2221,9 @@ public enum PowersManager {
|
||||
|
||||
int type = msg.getTargetType();
|
||||
int UUID = msg.getTargetID();
|
||||
if (type == -1 || type == 0 || UUID == -1 || UUID == 0) {
|
||||
|
||||
if (type == -1 || type == 0 || UUID == -1 || UUID == 0)
|
||||
return null;
|
||||
}
|
||||
|
||||
return (AbstractWorldObject) DbManager.getObject(GameObjectType.values()[type], UUID);
|
||||
}
|
||||
@@ -2392,11 +2246,17 @@ public enum PowersManager {
|
||||
ChatManager.chatSystemInfo(pc, smsg);
|
||||
}
|
||||
|
||||
float constant = (atr+defense)*0.315f;
|
||||
float atrChance = atr - constant;
|
||||
float defChance = defense - constant + atrChance;
|
||||
float smallChance = atrChance/defChance;
|
||||
int chance = (int)(smallChance * 100);
|
||||
int chance;
|
||||
|
||||
if (atr > defense || defense == 0)
|
||||
chance = 94;
|
||||
else {
|
||||
float dif = atr / defense;
|
||||
if (dif <= 0.8f)
|
||||
chance = 4;
|
||||
else
|
||||
chance = ((int) (450 * (dif - 0.8f)) + 4);
|
||||
}
|
||||
|
||||
// calculate hit/miss
|
||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
||||
@@ -2604,11 +2464,11 @@ public enum PowersManager {
|
||||
ChatManager.chatSystemInfo(pc, outmsg);
|
||||
return false; // can't target player, stop here
|
||||
} // target is mob
|
||||
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == false)
|
||||
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0)
|
||||
return pb.targetMob();
|
||||
|
||||
// target is pet
|
||||
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_MOB) != 0 && ((Mob)target).isPet() == true)
|
||||
else if ((target.getObjectTypeMask() & MBServerStatics.MASK_PET) != 0)
|
||||
return pb.targetPet();
|
||||
|
||||
// target is Building
|
||||
@@ -2687,7 +2547,7 @@ public enum PowersManager {
|
||||
|
||||
PowersBase power = getLastPower(ac);
|
||||
|
||||
if (power != null && power.cancelOnTakeDamage() && power.getName().equals("Translocate") == false)
|
||||
if (power != null && power.cancelOnTakeDamage())
|
||||
cancelPower(ac, true);
|
||||
cancelItems(ac, false, true);
|
||||
ac.cancelTimer("Stuck");
|
||||
@@ -2847,12 +2707,7 @@ public enum PowersManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void applyZergBuff(AbstractGameObject obj){
|
||||
|
||||
}
|
||||
public static void removeZergBuff(HashSet<Integer> playersIDs){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,12 +10,10 @@ package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.db.archive.MineRecord;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Runegate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -24,7 +22,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
|
||||
/*
|
||||
@@ -36,14 +33,13 @@ public enum SimulationManager {
|
||||
SERVERHEARTBEAT;
|
||||
|
||||
private static final long CITY_PULSE = 2000;
|
||||
private static final long RUNEGATE_PULSE = 500;
|
||||
private static final long RUNEGATE_PULSE = 3000;
|
||||
private static final long UPDATE_PULSE = 1000;
|
||||
private static final long FlIGHT_PULSE = 100;
|
||||
public static Duration executionTime = Duration.ofNanos(1);
|
||||
public static Duration executionMax = Duration.ofNanos(1);
|
||||
private static SimulationManager instance = null;
|
||||
private long _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
private long _minePulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
private long _runegatePulseTime = System.currentTimeMillis()
|
||||
+ RUNEGATE_PULSE;
|
||||
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
|
||||
@@ -73,8 +69,6 @@ public enum SimulationManager {
|
||||
return popString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Update the simulation. *** Important: Whatever you do in here, do it damn
|
||||
* quick!
|
||||
@@ -132,17 +126,7 @@ public enum SimulationManager {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
//try {
|
||||
// if ((_minePulseTime != 0)
|
||||
// && (System.currentTimeMillis() > _minePulseTime))
|
||||
// pulseMines();
|
||||
//} catch (Exception e) {
|
||||
// Logger.error(
|
||||
// "Fatal error in Mine Pulse: DISABLED. Error Message : "
|
||||
// + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
|
||||
//}
|
||||
SimulationManager.executionTime = Duration.between(startTime, Instant.now());
|
||||
|
||||
if (executionTime.compareTo(executionMax) > 0)
|
||||
@@ -219,6 +203,7 @@ public enum SimulationManager {
|
||||
city = (City) cityObject;
|
||||
city.onEnter();
|
||||
}
|
||||
|
||||
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package engine.gameManager;
|
||||
|
||||
import engine.objects.Guild;
|
||||
|
||||
public class ZergManager {
|
||||
|
||||
public static int getBaneCap(Guild guild) {
|
||||
|
||||
if(guild.getOwnedCity() == null || guild.getOwnedCity().getTOL() == null)
|
||||
return 0;
|
||||
|
||||
int cityRank = guild.getOwnedCity().getTOL().getRank();
|
||||
return (cityRank == 8) ? 20 : ((guild.getNation().getSubGuildList().size() + 1 <= 4) ? 10 : 20);
|
||||
}
|
||||
|
||||
public static float getCurrentMultiplier(int count, int maxCount){
|
||||
switch(maxCount) {
|
||||
case 3:
|
||||
return getMultiplier3Man(count);
|
||||
case 5:
|
||||
return getMultiplier5Man(count);
|
||||
case 10:
|
||||
return getMultiplier10Man(count);
|
||||
case 20:
|
||||
return getMultiplier20Man(count);
|
||||
default:
|
||||
return getMultiplier40Man(count);
|
||||
}
|
||||
}
|
||||
public static float getMultiplier(int count, int maxCount, float[] thresholds) {
|
||||
if (count <= maxCount) return 1.0f;
|
||||
if (count > thresholds.length) return 0.0f;
|
||||
return 1.0f - thresholds[count - maxCount - 1];
|
||||
}
|
||||
|
||||
public static float getMultiplier3Man(int count) {
|
||||
float[] thresholds = {0.37f, 0.60f, 0.75f};
|
||||
return getMultiplier(count, 3, thresholds);
|
||||
}
|
||||
|
||||
public static float getMultiplier5Man(int count) {
|
||||
float[] thresholds = {0.25f, 0.43f, 0.56f, 0.67f, 0.75f};
|
||||
return getMultiplier(count, 5, thresholds);
|
||||
}
|
||||
|
||||
public static float getMultiplier10Man(int count) {
|
||||
float[] thresholds = {0.14f, 0.25f, 0.35f, 0.43f, 0.50f, 0.56f, 0.62f, 0.67f, 0.71f, 0.75f};
|
||||
return getMultiplier(count, 10, thresholds);
|
||||
}
|
||||
|
||||
public static float getMultiplier20Man(int count) {
|
||||
return getMultiplier10Man(count * 2);
|
||||
}
|
||||
|
||||
public static float getMultiplier40Man(int count) {
|
||||
return getMultiplier10Man(count * 4);
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,9 @@ import engine.gameManager.DbManager;
|
||||
import engine.job.AbstractScheduleJob;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.Bane;
|
||||
import engine.objects.City;
|
||||
import engine.workthreads.ZergMechanicThread;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import static engine.workthreads.ZergMechanicThread.startZergThreadBane;
|
||||
|
||||
public class ActivateBaneJob extends AbstractScheduleJob {
|
||||
|
||||
private final int cityUUID;
|
||||
@@ -71,10 +67,6 @@ public class ActivateBaneJob extends AbstractScheduleJob {
|
||||
msg.setChannel(ChatChannelType.SYSTEM.getChannelID());
|
||||
|
||||
DispatchMessage.dispatchMsgToAll(msg);
|
||||
|
||||
if(city.getBane() != null) {
|
||||
startZergThreadBane(city.getBane());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
|
||||
package engine.jobs;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.job.AbstractJob;
|
||||
import engine.objects.AbstractCharacter;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class AttackJob extends AbstractJob {
|
||||
|
||||
@@ -31,9 +29,6 @@ public class AttackJob extends AbstractJob {
|
||||
@Override
|
||||
protected void doJob() {
|
||||
CombatManager.doCombat(this.source, slot);
|
||||
if(this.source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
|
||||
if(((PlayerCharacter)this.source).getHidden() > 0)
|
||||
this.source.removeEffectBySource(Enum.EffectSourceType.Invisibility,41,true);
|
||||
}
|
||||
|
||||
public boolean success() {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
|
||||
if (this.target == null || (!(this.target instanceof Mob)))
|
||||
return;
|
||||
|
||||
((Mob) this.target).fearedObject = null;
|
||||
((Mob) this.target).setFearedObject(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
|
||||
if (this.target == null || (!(this.target instanceof Mob)))
|
||||
return;
|
||||
|
||||
((Mob) this.target).fearedObject = null;
|
||||
((Mob) this.target).setFearedObject(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,15 +34,10 @@ public class ModTableEntry {
|
||||
|
||||
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||
|
||||
if(itemTableEntryList == null)
|
||||
return null;
|
||||
|
||||
for (ModTableEntry iteration : itemTableEntryList) {
|
||||
if (iteration == null)
|
||||
continue;
|
||||
for (ModTableEntry iteration : itemTableEntryList)
|
||||
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||
modTableEntry = iteration;
|
||||
}
|
||||
|
||||
return modTableEntry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ public class Bounds {
|
||||
//player is inside building region, skip collision check. we only do collision from the outside.
|
||||
if (player.region != null && player.region.parentBuildingID == building.getObjectUUID())
|
||||
continue;
|
||||
if (building.getBounds() == null || building.getBounds().colliders == null)
|
||||
if (building.getBounds().colliders == null)
|
||||
continue;
|
||||
|
||||
for (Colliders collider : building.getBounds().colliders) {
|
||||
|
||||
+470
-203
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ public class MobAIThread implements Runnable{
|
||||
public static int AI_DROP_AGGRO_RANGE = 60;
|
||||
public static int AI_PULSE_MOB_THRESHOLD = 200;
|
||||
public static int AI_PATROL_DIVISOR = 15;
|
||||
public static float AI_CAST_FREQUENCY = 1.0f;
|
||||
public static float AI_CAST_FREQUENCY;
|
||||
// Thread constructor
|
||||
|
||||
public MobAIThread() {
|
||||
|
||||
@@ -12,20 +12,13 @@ package engine.mobileAI.utilities;
|
||||
import engine.Enum.*;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.CombatManager;
|
||||
import engine.gameManager.PowersManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.MobAI;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.msg.PerformActionMsg;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.objects.*;
|
||||
import engine.powers.ActionsBase;
|
||||
import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import static engine.math.FastMath.sqr;
|
||||
@@ -55,7 +48,7 @@ public class CombatUtilities {
|
||||
}
|
||||
|
||||
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
|
||||
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
|
||||
return entity1.getLoc().distance2D(entity2.getLoc()) < range;
|
||||
}
|
||||
|
||||
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
|
||||
@@ -311,6 +304,7 @@ public class CombatUtilities {
|
||||
if (targetMob.isSiege())
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static float determineDamage(Mob agent) {
|
||||
@@ -486,9 +480,8 @@ public class CombatUtilities {
|
||||
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||
}
|
||||
}
|
||||
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||
}
|
||||
return agent.getMinDamageHandOne();
|
||||
return min * (pow(0.0048 * primary + .049 * (primary - 0.75), 0.5) + pow(0.0066 * secondary + 0.064 * (secondary - 0.75), 0.5) + +0.01 * (focusLevel + masteryLevel));
|
||||
}
|
||||
|
||||
public static double getMaxDmg(double max, Mob agent, ItemBase weapon) {
|
||||
@@ -514,214 +507,8 @@ public class CombatUtilities {
|
||||
if (agent.getSkills().containsKey(weapon.getSkillRequired()))
|
||||
masteryLevel = (int) agent.getSkills().get(weapon.getMastery()).getModifiedAmount();
|
||||
|
||||
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||
}
|
||||
return agent.getMaxDamageHandOne();
|
||||
return max * (pow(0.0124 * primary + 0.118 * (primary - 0.75), 0.5) + pow(0.0022 * secondary + 0.028 * (secondary - 0.75), 0.5) + 0.0075 * (focusLevel + masteryLevel));
|
||||
}
|
||||
|
||||
public static boolean MobCast(Mob mob) {
|
||||
|
||||
try {
|
||||
// Method picks a random spell from a mobile's list of powers
|
||||
// and casts it on the current target (or itself). Validation
|
||||
// (including empty lists) is done previously within canCast();
|
||||
|
||||
ArrayList<Integer> powerTokens;
|
||||
ArrayList<Integer> purgeTokens;
|
||||
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.behaviourType.callsForHelp)
|
||||
MobAI.MobCallForHelp(mob);
|
||||
|
||||
// Generate a list of tokens from the mob powers for this mobile.
|
||||
|
||||
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||
purgeTokens = new ArrayList<>();
|
||||
|
||||
// If player has this effect on them currently then remove
|
||||
// this token from our list.
|
||||
|
||||
for (int powerToken : powerTokens) {
|
||||
|
||||
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||
|
||||
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||
|
||||
String stackType = actionBase.stackType;
|
||||
|
||||
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||
purgeTokens.add(powerToken);
|
||||
}
|
||||
}
|
||||
|
||||
powerTokens.removeAll(purgeTokens);
|
||||
|
||||
// Sanity check
|
||||
|
||||
if (powerTokens.isEmpty())
|
||||
return false;
|
||||
|
||||
// Pick random spell from our list of powers
|
||||
|
||||
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||
int powerRank = mob.mobPowers.get(powerToken);
|
||||
|
||||
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||
|
||||
//check for hit-roll
|
||||
|
||||
if (mobPower.requiresHitRoll)
|
||||
if (triggerDefense(mob, mob.getCombatTarget()))
|
||||
return false;
|
||||
|
||||
// Cast the spell
|
||||
|
||||
if (inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
|
||||
|
||||
PerformActionMsg msg;
|
||||
|
||||
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||
} else {
|
||||
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||
}
|
||||
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean GuardCast(Mob mob) {
|
||||
|
||||
try {
|
||||
// Method picks a random spell from a mobile's list of powers
|
||||
// and casts it on the current target (or itself). Validation
|
||||
// (including empty lists) is done previously within canCast();
|
||||
|
||||
ArrayList<Integer> powerTokens;
|
||||
ArrayList<Integer> purgeTokens;
|
||||
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
|
||||
|
||||
if (mob.behaviourType.callsForHelp)
|
||||
MobAI.MobCallForHelp(mob);
|
||||
|
||||
// Generate a list of tokens from the mob powers for this mobile.
|
||||
|
||||
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
|
||||
purgeTokens = new ArrayList<>();
|
||||
|
||||
// If player has this effect on them currently then remove
|
||||
// this token from our list.
|
||||
|
||||
for (int powerToken : powerTokens) {
|
||||
|
||||
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
|
||||
|
||||
for (ActionsBase actionBase : powerBase.getActions()) {
|
||||
|
||||
String stackType = actionBase.stackType;
|
||||
|
||||
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
|
||||
purgeTokens.add(powerToken);
|
||||
}
|
||||
}
|
||||
|
||||
powerTokens.removeAll(purgeTokens);
|
||||
|
||||
// Sanity check
|
||||
|
||||
if (powerTokens.isEmpty())
|
||||
return false;
|
||||
|
||||
int powerToken;
|
||||
int nukeRoll = ThreadLocalRandom.current().nextInt(1,100);
|
||||
|
||||
if (nukeRoll < 55) {
|
||||
|
||||
//use direct damage spell
|
||||
powerToken = powerTokens.get(powerTokens.size() - 1);
|
||||
|
||||
} else {
|
||||
//use random spell
|
||||
powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
|
||||
}
|
||||
|
||||
int powerRank = 1;
|
||||
|
||||
switch(mob.getRank()){
|
||||
case 1:
|
||||
powerRank = 10;
|
||||
break;
|
||||
case 2:
|
||||
powerRank = 15;
|
||||
break;
|
||||
case 3:
|
||||
powerRank = 20;
|
||||
break;
|
||||
case 4:
|
||||
powerRank = 25;
|
||||
break;
|
||||
case 5:
|
||||
powerRank = 30;
|
||||
break;
|
||||
case 6:
|
||||
powerRank = 35;
|
||||
break;
|
||||
case 7:
|
||||
powerRank = 40;
|
||||
break;
|
||||
}
|
||||
|
||||
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
|
||||
|
||||
//check for hit-roll
|
||||
|
||||
if (mobPower.requiresHitRoll)
|
||||
if (triggerDefense(mob, mob.getCombatTarget()))
|
||||
return false;
|
||||
|
||||
// Cast the spell
|
||||
|
||||
if (inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
|
||||
|
||||
PerformActionMsg msg;
|
||||
|
||||
if (!mobPower.isHarmful() || mobPower.targetSelf) {
|
||||
|
||||
if (mobPower.category.equals("DISPEL")) {
|
||||
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||
} else {
|
||||
PowersManager.useMobPower(mob, mob, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
|
||||
}
|
||||
} else {
|
||||
PowersManager.useMobPower(mob, target, mobPower, powerRank);
|
||||
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
|
||||
}
|
||||
|
||||
msg.setUnknown04(2);
|
||||
|
||||
PowersManager.finishUseMobPower(msg, mob, 0, 0);
|
||||
|
||||
long randomCooldown = (long)((ThreadLocalRandom.current().nextInt(10,15) * 1000L) * MobAIThread.AI_CAST_FREQUENCY);
|
||||
mob.nextCastTime = System.currentTimeMillis() + randomCooldown;
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: MobCast" + " " + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.MovementManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
import engine.net.client.msg.MoveToPointMsg;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -38,7 +38,7 @@ public class MovementUtilities {
|
||||
if (agent.getContract() != null)
|
||||
guardCaptain = agent;
|
||||
else
|
||||
guardCaptain = (Mob) agent.guardCaptain;
|
||||
guardCaptain = (Mob) agent.npcOwner;
|
||||
|
||||
if (guardCaptain != null) {
|
||||
Building barracks = guardCaptain.building;
|
||||
@@ -115,8 +115,39 @@ public class MovementUtilities {
|
||||
|
||||
}
|
||||
|
||||
public static Vector3fImmutable GetMoveLocation(Mob aiAgent, AbstractCharacter aggroTarget) {
|
||||
|
||||
// Player isnt moving and neither is mob. Just return
|
||||
// the mobile's current location. Ain't goin nowhere!
|
||||
// *** Refactor: Check to ensure methods calling us
|
||||
// all don't sent move messages when not moving.
|
||||
|
||||
if ((aggroTarget.isMoving() == false))
|
||||
return aggroTarget.getLoc();
|
||||
|
||||
if (aggroTarget.getEndLoc().x != 0) {
|
||||
|
||||
float aggroTargetDistanceSquared = aggroTarget.getLoc().distanceSquared2D(aggroTarget.getEndLoc());
|
||||
float aiAgentDistanceSquared = aiAgent.getLoc().distanceSquared2D(aggroTarget.getEndLoc());
|
||||
|
||||
if (aiAgentDistanceSquared >= aggroTargetDistanceSquared)
|
||||
return aggroTarget.getEndLoc();
|
||||
else {
|
||||
float distanceToMove = sqrt(aggroTargetDistanceSquared + aiAgentDistanceSquared) * .5f;
|
||||
|
||||
return aggroTarget.getFaceDir().scaleAdd(distanceToMove, aggroTarget.getLoc());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// One of us is moving so let's calculate our destination loc for this
|
||||
// simulation frame. We will simply project our position onto the
|
||||
// character's movement vector and return the closest point.
|
||||
|
||||
return aiAgent.getLoc().ClosestPointOnLine(aggroTarget.getLoc(), aggroTarget.getEndLoc());
|
||||
}
|
||||
|
||||
public static void moveToLocation(Mob agent, Vector3fImmutable newLocation, float offset) {
|
||||
agent.resetLastSetLocUpdate();
|
||||
try {
|
||||
|
||||
//don't move farther than 30 units from player.
|
||||
@@ -141,8 +172,32 @@ public class MovementUtilities {
|
||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||
}
|
||||
|
||||
public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
|
||||
|
||||
//Determing where I want to move.
|
||||
return new Vector3fImmutable((center.x - radius) + ((ThreadLocalRandom.current().nextFloat() + .1f * 2) * radius),
|
||||
center.y,
|
||||
(center.z - radius) + ((ThreadLocalRandom.current().nextFloat() + .1f * 2) * radius));
|
||||
}
|
||||
|
||||
public static Long estimateMovementTime(Mob agent) {
|
||||
if (agent.getEndLoc().x == 0 && agent.getEndLoc().y == 0)
|
||||
return 0L;
|
||||
|
||||
return (long) ((agent.getLoc().distance2D(agent.getEndLoc()) * 1000) / agent.getSpeed());
|
||||
}
|
||||
|
||||
public static void aiMove(Mob agent, Vector3fImmutable vect, boolean isWalking) {
|
||||
|
||||
//update our walk/run state.
|
||||
if (isWalking && !agent.isWalk()) {
|
||||
agent.setWalkMode(true);
|
||||
MovementManager.sendRWSSMsg(agent);
|
||||
} else if (!isWalking && agent.isWalk()) {
|
||||
agent.setWalkMode(false);
|
||||
MovementManager.sendRWSSMsg(agent);
|
||||
}
|
||||
|
||||
MoveToPointMsg msg = new MoveToPointMsg();
|
||||
|
||||
|
||||
@@ -218,4 +273,23 @@ public class MovementUtilities {
|
||||
return character.getLoc();
|
||||
}
|
||||
|
||||
public static boolean updateMovementToCharacter(Mob aiAgent, AbstractCharacter aggroTarget) {
|
||||
|
||||
if (aiAgent.destination.equals(Vector3fImmutable.ZERO))
|
||||
return true;
|
||||
|
||||
if (!aiAgent.isMoving())
|
||||
return true;
|
||||
|
||||
|
||||
if (aggroTarget.isMoving()) {
|
||||
return !aiAgent.destination.equals(aggroTarget.getEndLoc()) && !aiAgent.destination.equals(aggroTarget.getLoc());
|
||||
} else {
|
||||
if (aiAgent.destination.equals(aggroTarget.getLoc()))
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class NetMsgFactory {
|
||||
// if (MBServerStatics.worldServerName.equals("Grief"))
|
||||
Logger.error("Invalid protocol msg for player " + player.getFirstName() + " : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||
} else
|
||||
Logger.error("PROTOCOL ERROR: Player: " + ((ClientConnection) origin).getPlayerCharacter().getName() + " Account: " + ((ClientConnection) origin).getPlayerCharacter().getAccount().getUname() + "Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||
Logger.error("Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.net.client;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.exception.MsgSendException;
|
||||
@@ -123,7 +122,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (pc.isSit()) {
|
||||
pc.setCombat(false);
|
||||
pc.cancelOnSit();
|
||||
pc.stopMovement(pc.loc);
|
||||
}
|
||||
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
@@ -224,11 +222,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if(msg.getSlotNumber() == 11 && pc.getRaceID() == 1999){
|
||||
forceTransferFromEquipToInventory(msg, origin, "Saetor cannot wear shoes.");
|
||||
return;
|
||||
}
|
||||
|
||||
int uuid = msg.getUUID();
|
||||
int slot = msg.getSlotNumber();
|
||||
//System.out.println("loading to slot: " + slot);
|
||||
@@ -561,32 +554,46 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (i == null)
|
||||
return;
|
||||
|
||||
if(i.getItemBaseID() == 7)
|
||||
return; //cant delete gold
|
||||
|
||||
if (!itemManager.doesCharOwnThisItem(i.getObjectUUID()))
|
||||
return;
|
||||
|
||||
if (!itemManager.inventoryContains(i))
|
||||
return;
|
||||
|
||||
if(i.getItemBaseID() == 980066)
|
||||
return;
|
||||
|
||||
if (i.canDestroy) {
|
||||
int value = i.getItemBase().value;
|
||||
if(i.getItemBase().isRune())
|
||||
value = 500000;
|
||||
if(sourcePlayer.getCharItemManager().getGoldInventory().getNumOfItems() + value > 10000000){
|
||||
return;
|
||||
}
|
||||
if (itemManager.delete(i) == true) {
|
||||
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) {
|
||||
@@ -1280,7 +1287,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
cost *= profit;
|
||||
|
||||
if (gold.getNumOfItems() + cost > 10000000) {
|
||||
if (gold.getNumOfItems() + cost > MBServerStatics.PLAYER_GOLD_LIMIT) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1379,171 +1386,219 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
}
|
||||
|
||||
private static void buyFromNPC(BuyFromNPCMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (sourcePlayer == null)
|
||||
return;
|
||||
|
||||
if (origin.buyLock.tryLock()) {
|
||||
|
||||
try {
|
||||
CharacterItemManager itemMan = sourcePlayer.getCharItemManager();
|
||||
if (itemMan == null) {
|
||||
|
||||
if (itemMan == null)
|
||||
return;
|
||||
}
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||
if (npc == null) {
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Item gold = itemMan.getGoldInventory();
|
||||
if (gold == null) {
|
||||
|
||||
if (gold == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Item buy = null;
|
||||
|
||||
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
||||
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
||||
if (sellInventory == null) {
|
||||
if (sellInventory == null)
|
||||
return;
|
||||
}
|
||||
for (MobEquipment me : sellInventory) {
|
||||
if (me.getObjectUUID() == msg.getItemID()) {
|
||||
ItemBase ib = me.getItemBase();
|
||||
if (ib == null) {
|
||||
if (ib == null)
|
||||
return;
|
||||
}
|
||||
|
||||
//test room available for item
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight())) {
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||
return;
|
||||
}
|
||||
int cost = me.magicValue;
|
||||
if(npc.getContractID() == 1201 && me.getItemBase().getName().equals("Prospector"))
|
||||
cost = 50;
|
||||
|
||||
int cost = me.getMagicValue();
|
||||
|
||||
float bargain = sourcePlayer.getBargain();
|
||||
|
||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||
if(me.getItemBase().getType().equals(ItemType.POTION))
|
||||
profit -= 1.0f;
|
||||
|
||||
if (profit < 1)
|
||||
profit = 1;
|
||||
if(npc.getContractID() == 900){
|
||||
cost = Warehouse.getCostForResource(ib.getUUID()) * Warehouse.getSellStackSize(ib.getUUID());
|
||||
}
|
||||
|
||||
|
||||
cost *= profit;
|
||||
|
||||
|
||||
if (gold.getNumOfItems() - cost < 0) {
|
||||
//dont' have enough goldItem exit!
|
||||
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
|
||||
return;
|
||||
}
|
||||
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||
b = null;
|
||||
int buildingDeposit = cost - me.getMagicValue();
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
||||
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item");
|
||||
return;
|
||||
}
|
||||
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
|
||||
handleResourcePurchase(me,itemMan,npc,buy,sourcePlayer,ib);
|
||||
}else {
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
if(npc.contractUUID == 900 && buy.getItemBaseID() == 1705032){
|
||||
buy.setNumOfItems(10);
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||
}
|
||||
//itemMan.updateInventory();
|
||||
}
|
||||
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
//itemMan.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (msg.getItemType() == GameObjectType.Item.ordinal()) {
|
||||
|
||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||
|
||||
if (npcCim == null)
|
||||
return;
|
||||
|
||||
buy = Item.getFromCache(msg.getItemID());
|
||||
|
||||
if (buy == null)
|
||||
return;
|
||||
|
||||
ItemBase ib = buy.getItemBase();
|
||||
|
||||
if (ib == null)
|
||||
return;
|
||||
|
||||
if (!npcCim.inventoryContains(buy))
|
||||
return;
|
||||
|
||||
//test room available for item
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||
return;
|
||||
|
||||
//TODO test cost and subtract goldItem
|
||||
|
||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||
int cost = buy.getBaseValue();
|
||||
|
||||
if (buy.isID() || buy.isCustomValue())
|
||||
cost = buy.getMagicValue();
|
||||
|
||||
float bargain = sourcePlayer.getBargain();
|
||||
|
||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||
|
||||
if (profit < 1)
|
||||
profit = 1;
|
||||
|
||||
if (!buy.isCustomValue())
|
||||
cost *= profit;
|
||||
else
|
||||
cost = buy.getValue();
|
||||
|
||||
|
||||
if (gold.getNumOfItems() - cost < 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||
return;
|
||||
}
|
||||
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null)
|
||||
if (b.getProtectionState().equals(ProtectionState.NPC))
|
||||
b = null;
|
||||
|
||||
int buildingDeposit = cost;
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 110);
|
||||
return;
|
||||
}
|
||||
|
||||
if (buy != null)
|
||||
itemMan.buyFromNPC(buy, npc);
|
||||
|
||||
} else if (msg.getItemType() == GameObjectType.MobLoot.ordinal()) {
|
||||
|
||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||
|
||||
if (npcCim == null)
|
||||
return;
|
||||
|
||||
buy = MobLoot.getFromCache(msg.getItemID());
|
||||
|
||||
if (buy == null)
|
||||
return;
|
||||
|
||||
ItemBase ib = buy.getItemBase();
|
||||
|
||||
if (ib == null)
|
||||
return;
|
||||
|
||||
if (!npcCim.inventoryContains(buy))
|
||||
return;
|
||||
|
||||
//test room available for item
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||
return;
|
||||
|
||||
//TODO test cost and subtract goldItem
|
||||
|
||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||
|
||||
int cost = buy.getMagicValue();
|
||||
cost *= npc.getSellPercent(sourcePlayer);
|
||||
|
||||
|
||||
if (gold.getNumOfItems() - cost < 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||
return;
|
||||
}
|
||||
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||
b = null;
|
||||
int buildingDeposit = cost;
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit))
|
||||
return;
|
||||
|
||||
if (buy != null)
|
||||
itemMan.buyFromNPC(buy, npc);
|
||||
|
||||
} else
|
||||
return;
|
||||
|
||||
if (buy != null) {
|
||||
|
||||
msg.setItem(buy);
|
||||
//send the buy message back to update player
|
||||
// msg.setItemType(buy.getObjectType().ordinal());
|
||||
@@ -1552,44 +1607,16 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
|
||||
} finally {
|
||||
origin.buyLock.unlock();
|
||||
}
|
||||
} else {
|
||||
ErrorPopupMsg.sendErrorPopup(origin.getPlayerCharacter(), 12); // All production slots taken
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleResourcePurchase(MobEquipment me, CharacterItemManager itemMan, NPC npc, Item buy, PlayerCharacter sourcePlayer, ItemBase ib){
|
||||
boolean stacked = false;
|
||||
int buystack = Warehouse.getSellStackSize(me.getItemBase().getUUID());
|
||||
for(Item item : itemMan.getInventory()){
|
||||
int itemID = item.getItemBaseID();
|
||||
int meID = me.getItemBase().getUUID();
|
||||
if(itemID == meID){
|
||||
if(Warehouse.maxResources.isEmpty())
|
||||
Warehouse.getMaxResources();
|
||||
int maxStack = Warehouse.maxResources.get(itemID);
|
||||
if(maxStack > item.getNumOfItems() + buystack){
|
||||
item.setNumOfItems(item.getNumOfItems() + buystack);
|
||||
stacked = true;
|
||||
itemMan.updateInventory();
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(item,item.getNumOfItems());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!stacked){
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
buy.setNumOfItems(buystack);
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||
}
|
||||
}
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
private static void Repair(RepairMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
|
||||
@@ -1632,8 +1659,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (toRepair == null)
|
||||
return;
|
||||
|
||||
//if (toRepair.getItemBase().isGlass())
|
||||
// return;
|
||||
if (toRepair.getItemBase().isGlass())
|
||||
return;
|
||||
|
||||
//make sure item is in player's inventory or equipment
|
||||
if (!itemMan.inventoryContains(toRepair) && !itemMan.equippedContains(toRepair))
|
||||
@@ -1655,12 +1682,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
}
|
||||
//TODO get cost to repair
|
||||
int cost = (int) ((max - dur) * 80.1);
|
||||
|
||||
//glass costs 3x as much to repair
|
||||
if (toRepair.getItemBase().isGlass()){
|
||||
cost *= 3;
|
||||
}
|
||||
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null)
|
||||
@@ -1895,22 +1916,9 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
break;
|
||||
case LEAVEREQUEST:
|
||||
origin.disconnect();
|
||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
|
||||
if(origin.machineID.equals(pc.getClientConnection().machineID))
|
||||
sameMachine.add(pc);
|
||||
}
|
||||
if(sameMachine.isEmpty() == false){
|
||||
if(sameMachine.get(0) != null) {
|
||||
sameMachine.get(0).isBoxed = false;
|
||||
sameMachine.get(0).removeEffectBySource(EffectSourceType.DeathShroud,41,true);
|
||||
ChatManager.chatSystemInfo(sameMachine.get(0), "You Are No Longer Flagged 'Boxed'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case POWER:
|
||||
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
||||
//PowersManager.static_power_que.add(new PowersManager.PowerQueObject((PerformActionMsg) msg, origin, false));
|
||||
break;
|
||||
case REQUESTMELEEATTACK:
|
||||
CombatManager.setAttackTarget((AttackCmdMsg) msg, origin);
|
||||
|
||||
@@ -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,33 +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(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;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
GroupManager.RefreshOthersGroupList(player);
|
||||
}
|
||||
|
||||
player.enteredWorld = true;
|
||||
player.setEnteredWorld(true);
|
||||
// Set player active
|
||||
player.resetRegenUpdateTime();
|
||||
player.setActive(true);
|
||||
@@ -66,9 +66,6 @@ public class ArcLoginNotifyMsgHandler extends AbstractClientMsgHandler {
|
||||
// Send Guild, Nation and IC MOTD
|
||||
GuildManager.enterWorldMOTD(player);
|
||||
ChatManager.sendSystemMessage(player, ConfigManager.MB_WORLD_GREETING.getValue());
|
||||
ChatManager.sendSystemMessage(player, "Gold Drop Rate: " + ConfigManager.MB_NORMAL_GOLD_RATE.getValue());
|
||||
ChatManager.sendSystemMessage(player, "Loot Drop Rate: " + ConfigManager.MB_NORMAL_DROP_RATE.getValue());
|
||||
ChatManager.sendSystemMessage(player, "Experience Rate: " + ConfigManager.MB_NORMAL_EXP_RATE.getValue());
|
||||
|
||||
// Send branch string if available from ConfigManager.
|
||||
|
||||
|
||||
@@ -14,17 +14,18 @@ import engine.Enum.GuildHistoryType;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||
import engine.net.client.msg.guild.BanishUnbanishMsg;
|
||||
import engine.net.client.msg.guild.GuildListMsg;
|
||||
import engine.objects.*;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.GuildHistory;
|
||||
import engine.objects.GuildStatusController;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||
@@ -115,20 +116,6 @@ public class BanishUnbanishHandler extends AbstractClientMsgHandler {
|
||||
GuildListMsg guildListMsg = new GuildListMsg(guild);
|
||||
dispatch = Dispatch.borrow(source, guildListMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
if(GroupManager.getGroup(target) != null) {
|
||||
Group group = GroupManager.getGroup(target);
|
||||
group.removeGroupMember(PlayerCharacter.getPlayerCharacter(target));
|
||||
GroupManager.removeFromGroups(PlayerCharacter.getPlayerCharacter(target));
|
||||
GroupUpdateMsg gim;
|
||||
gim = new GroupUpdateMsg();
|
||||
gim.setGroup(group);
|
||||
gim.setMessageType(3);
|
||||
gim.setPlayer(PlayerCharacter.getPlayerCharacter(target));
|
||||
group.sendUpdate(gim);
|
||||
|
||||
String text = PlayerCharacter.getPlayerCharacter(target).getFirstName() + " has left your group.";
|
||||
ChatManager.chatGroupInfo(source, text);
|
||||
}
|
||||
} else {
|
||||
ErrorPopupMsg.sendErrorPopup(source, 103); // You may not banish this char
|
||||
}
|
||||
|
||||
@@ -61,6 +61,15 @@ public class CityDataHandler extends AbstractClientMsgHandler {
|
||||
dispatch = Dispatch.borrow(playerCharacter, cityDataMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
// If the hotZone has changed then update the client's map accordingly.
|
||||
|
||||
if (playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
||||
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
playerCharacter.setTimeStamp("hotzoneupdate", System.currentTimeMillis() - 100);
|
||||
}
|
||||
|
||||
// Serialize the realms for this map
|
||||
|
||||
WorldRealmMsg worldRealmMsg = new WorldRealmMsg();
|
||||
|
||||
@@ -62,7 +62,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
||||
if (city != null)
|
||||
bane = city.getBane();
|
||||
|
||||
if (bane != null) {
|
||||
if (bane != null && bane.getSiegePhase() == Enum.SiegePhase.WAR) {
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 171);
|
||||
return true;
|
||||
}
|
||||
@@ -71,12 +71,9 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
|
||||
if (blueprint.getBuildingGroup() == BuildingGroup.TOL)
|
||||
return true;
|
||||
|
||||
// destorying a shrine will yield a rubble pile for looting
|
||||
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE) {
|
||||
building.modifyHealth(-building.getHealth(), origin.getPlayerCharacter());
|
||||
building.destroyOrDerank(origin.getPlayerCharacter());
|
||||
// Can't destroy a shrine
|
||||
if (blueprint.getBuildingGroup() == BuildingGroup.SHRINE)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cannot destroy mines outside of normal mine mechanics
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.group.GroupInviteMsg;
|
||||
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||
import engine.objects.Group;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class GroupInviteHandler extends AbstractClientMsgHandler {
|
||||
@@ -104,12 +103,6 @@ public class GroupInviteHandler extends AbstractClientMsgHandler {
|
||||
if (target.isIgnoringPlayer(source))
|
||||
return false;
|
||||
|
||||
if(source.getGuild().getNation().equals(target.getGuild().getNation()) == false)
|
||||
return false; // cannot group outside of nation
|
||||
|
||||
if(source.getGuild().getNation().equals(target.getGuild().getNation()) && source.getGuild().getNation().equals(Guild.getErrantGuild()))
|
||||
if(source.getGuild().equals(target.getGuild()) == false)
|
||||
return false; // cannot group as an errant guild with other errant guilds
|
||||
|
||||
// dont block invites to people already in a group and
|
||||
// dont check for pending invites, the client does it
|
||||
|
||||
@@ -25,8 +25,6 @@ import engine.objects.Guild;
|
||||
import engine.objects.GuildStatusController;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
import static engine.objects.Bane.getBaneByAttackerGuild;
|
||||
|
||||
public class InviteToSubHandler extends AbstractClientMsgHandler {
|
||||
|
||||
public InviteToSubHandler() {
|
||||
@@ -97,25 +95,6 @@ public class InviteToSubHandler extends AbstractClientMsgHandler {
|
||||
if (sourceGuild.equals(targetGuild))
|
||||
return true;
|
||||
|
||||
if(sourceGuild.getNation().getOwnedCity().getBane() != null)
|
||||
return true; // cannot invite guilds to sub if you are baned
|
||||
|
||||
if(sourceGuild.getNation().getSubGuildList() != null){
|
||||
for(Guild subGuild : sourceGuild.getNation().getSubGuildList()){
|
||||
if(subGuild.getOwnedCity() != null)
|
||||
if(subGuild.getOwnedCity().getBane() != null)
|
||||
return true;//cannot invite guilds to sub if any tree in your nation has a bane on it
|
||||
}
|
||||
}
|
||||
|
||||
if(targetGuild.getOwnedCity() != null)
|
||||
if(targetGuild.getOwnedCity().getBane() != null)
|
||||
return true; // cannot be subbed if you have a bane placed on you
|
||||
|
||||
|
||||
if(getBaneByAttackerGuild(targetGuild) != null)
|
||||
return true; // cannot sub to a nation if they have a bane placed
|
||||
|
||||
//target must be GL or IC
|
||||
|
||||
if (GuildStatusController.isInnerCouncil(target.getGuildStatus()) == false && GuildStatusController.isGuildLeader(target.getGuildStatus()) == false) {
|
||||
|
||||
@@ -12,15 +12,16 @@ package engine.net.client.handlers;
|
||||
import engine.Enum.GuildHistoryType;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.GroupManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.net.client.msg.group.GroupUpdateMsg;
|
||||
import engine.net.client.msg.guild.LeaveGuildMsg;
|
||||
import engine.objects.*;
|
||||
import engine.objects.Guild;
|
||||
import engine.objects.GuildStatusController;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
||||
|
||||
@@ -60,21 +61,6 @@ public class LeaveGuildHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(GroupManager.getGroup(playerCharacter) != null) {
|
||||
Group group = GroupManager.getGroup(playerCharacter);
|
||||
group.removeGroupMember(playerCharacter);
|
||||
GroupManager.removeFromGroups(playerCharacter);
|
||||
GroupUpdateMsg gim;
|
||||
gim = new GroupUpdateMsg();
|
||||
gim.setGroup(group);
|
||||
gim.setMessageType(3);
|
||||
gim.setPlayer(playerCharacter);
|
||||
group.sendUpdate(gim);
|
||||
|
||||
String text = playerCharacter.getFirstName() + " has left your group.";
|
||||
ChatManager.chatGroupInfo(playerCharacter, text);
|
||||
}
|
||||
|
||||
// Send left guild message to rest of guild
|
||||
ChatManager.chatGuildInfo(oldGuild, playerCharacter.getFirstName() + " has left the guild.");
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Bounds;
|
||||
@@ -63,6 +62,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
Building building;
|
||||
|
||||
msg = (ManageCityAssetsMsg) baseMsg;
|
||||
|
||||
player = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (player == null)
|
||||
@@ -72,21 +72,34 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (building == null) {
|
||||
if (msg.actionType == 14) {
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||
|
||||
if (!zone.isPlayerCity()) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
City city = City.GetCityFromCache(zone.getPlayerCityUUID());
|
||||
if (city == null || !city.getGuild().equals(player.getGuild()) ||
|
||||
(!GuildStatusController.isInnerCouncil(player.getGuildStatus()) &&
|
||||
!GuildStatusController.isGuildLeader(player.getGuildStatus()))) {
|
||||
|
||||
if (city == null) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!city.getGuild().equals(player.getGuild())) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "You are not in the correct guild to command this city.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!GuildStatusController.isInnerCouncil(player.getGuildStatus()) && !GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||
ErrorPopupMsg.sendErrorMsg(player, "You must be an Inner Council or Guild leader to access city commands.");
|
||||
return true;
|
||||
}
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||
mca.actionType = 15;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -98,126 +111,181 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setAssetName(building.getName());
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (msg.actionType) {
|
||||
case 2:
|
||||
case 22:
|
||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
|
||||
outMsg.actionType = 18;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
} else if (BuildingManager.playerCanManage(player, building)) {
|
||||
configWindowState(player, building, outMsg);
|
||||
outMsg.actionType = 3;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setTargetType3(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID3(building.getObjectUUID());
|
||||
outMsg.setUnknown54(1);
|
||||
} else {
|
||||
// Handle other cases
|
||||
if (building.getRank() == -1) {
|
||||
if (!Bounds.collide(player.getLoc(), building)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
||||
return true;
|
||||
}
|
||||
switch (building.getBlueprint().getBuildingGroup()) {
|
||||
case SHRINE:
|
||||
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
|
||||
if (shrine == null || shrine.getFavors() == 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
|
||||
return true;
|
||||
}
|
||||
//loot elan stones
|
||||
MobLoot elanStones = new MobLoot(player,ItemBase.getItemBase(1705032),1,false);
|
||||
Item promotedItem = elanStones.promoteToItem(player);
|
||||
promotedItem.setNumOfItems(shrine.getFavors());
|
||||
player.getCharItemManager().addItemToInventory(promotedItem);
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(promotedItem,promotedItem.getNumOfItems());
|
||||
player.getCharItemManager().updateInventory();
|
||||
shrine.setFavors(0);
|
||||
break;
|
||||
case WAREHOUSE:
|
||||
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
|
||||
if (warehouse == null || warehouse.isEmpty()) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
AbstractCharacter owner = building.getOwner();
|
||||
if (owner == null) {
|
||||
msg.actionType = 4;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, msg), DispatchChannel.SECONDARY);
|
||||
} else {
|
||||
outMsg.actionType = 4;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setAssetName(building.getName());
|
||||
}
|
||||
}
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
case 13:
|
||||
outMsg.actionType = 13;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
case 5:
|
||||
building.setName(msg.getAssetName());
|
||||
if (msg.actionType == 2 || msg.actionType == 22) {
|
||||
|
||||
if (building.getBlueprint() != null && building.getBlueprint().getBuildingGroup() == engine.Enum.BuildingGroup.BANESTONE) {
|
||||
|
||||
outMsg.actionType = 18;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
|
||||
} else if (BuildingManager.playerCanManage(player, building)) { //TODO allow Friends list.
|
||||
configWindowState(player, building, outMsg);
|
||||
outMsg.actionType = 3;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setTargetType3(GameObjectType.Building.ordinal());
|
||||
outMsg.setTargetType3(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID3(building.getObjectUUID());
|
||||
outMsg.setAssetName1(building.getName());
|
||||
outMsg.setUnknown54(1);
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
case 14:
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||
mca.actionType = 15;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, mca), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
case 20:
|
||||
// Handle case 20
|
||||
return handleCase20(player, outMsg, building, msg, origin);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleCase20(PlayerCharacter player, ManageCityAssetsMsg outMsg, Building building, ManageCityAssetsMsg msg, ClientConnection origin) throws MsgSendException {
|
||||
Zone baneZone = building.getParentZone();
|
||||
if (baneZone == null)
|
||||
return true;
|
||||
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
|
||||
if (banedCity == null)
|
||||
return true;
|
||||
Bane bane = banedCity.getBane();
|
||||
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
int baneHour = msg.getBaneHour();
|
||||
if (baneHour < 16 || baneHour > 24) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||
} else {
|
||||
|
||||
if (building.getBlueprintUUID() != 0)
|
||||
switch (building.getBlueprint().getBuildingGroup()) {
|
||||
case SHRINE:
|
||||
if (building.getRank() == -1) {
|
||||
if (!Bounds.collide(player.getLoc(), building)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
||||
return true;
|
||||
}
|
||||
|
||||
Shrine shrine = Shrine.shrinesByBuildingUUID.get(building.getObjectUUID());
|
||||
|
||||
if (shrine == null)
|
||||
return true;
|
||||
|
||||
if (shrine.getFavors() == 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 166); // There is no more favor in this shrine to loot
|
||||
return true;
|
||||
}
|
||||
|
||||
BuildingManager.lootBuilding(player, building);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case WAREHOUSE:
|
||||
//TODO check
|
||||
if (building.getRank() == -1) {
|
||||
if (!Bounds.collide(player.getLoc(), building)) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 64);
|
||||
return true;
|
||||
}
|
||||
|
||||
Warehouse warehouse = Warehouse.warehouseByBuildingUUID.get(building.getObjectUUID());
|
||||
|
||||
if (warehouse == null)
|
||||
return true;
|
||||
|
||||
if (warehouse.isEmpty()) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 167); // no more resources.
|
||||
return true;
|
||||
}
|
||||
|
||||
BuildingManager.lootBuilding(player, building);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (building.getRank() == -1)
|
||||
return true;
|
||||
|
||||
AbstractCharacter owner = building.getOwner();
|
||||
|
||||
//no owner, send building info
|
||||
if (owner == null) {
|
||||
msg.actionType = 4;
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
outMsg.actionType = 4;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setAssetName(building.getName());
|
||||
|
||||
}
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg.actionType == 13) {
|
||||
outMsg.actionType = 13;
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//Rename Building.
|
||||
|
||||
if (msg.actionType == 5) {
|
||||
|
||||
//TODO we need to check names before allowing
|
||||
building.setName(msg.getAssetName());
|
||||
configWindowState(player, building, outMsg);
|
||||
|
||||
outMsg.actionType = 3;
|
||||
outMsg.setTargetType(building.getObjectType().ordinal());
|
||||
outMsg.setTargetID(building.getObjectUUID());
|
||||
outMsg.setTargetType3(GameObjectType.Building.ordinal());
|
||||
outMsg.setTargetID3(building.getObjectUUID());
|
||||
outMsg.setAssetName1(building.getName());
|
||||
outMsg.setUnknown54(1);
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
return true;
|
||||
|
||||
//TOL, update city name also
|
||||
//TODO update city and zone in database
|
||||
//TODO update city map data in game server
|
||||
}
|
||||
|
||||
if (msg.actionType == 14) {
|
||||
ManageCityAssetsMsg mca = new ManageCityAssetsMsg(player, building);
|
||||
mca.actionType = 15;
|
||||
Dispatch dispatch = Dispatch.borrow(player, mca);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (msg.actionType == 20) {
|
||||
|
||||
Zone baneZone = building.getParentZone();
|
||||
|
||||
if (baneZone == null)
|
||||
return true;
|
||||
|
||||
City banedCity = City.getCity(baneZone.getPlayerCityUUID());
|
||||
|
||||
if (banedCity == null)
|
||||
return true;
|
||||
|
||||
Bane bane = banedCity.getBane();
|
||||
|
||||
if (bane == null || bane.getLiveDate() != null || player.getGuild() != banedCity.getGuild() || GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
||||
return true;
|
||||
|
||||
int baneHour = msg.getBaneHour();
|
||||
|
||||
if (baneHour < 16 || baneHour > 24) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||
return true;
|
||||
}
|
||||
|
||||
DateTime baneLive = new DateTime(bane.getPlacementDate());
|
||||
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
||||
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
|
||||
baneLive = baneLive.minuteOfHour().setCopy(0);
|
||||
baneLive = baneLive.secondOfMinute().setCopy(1);
|
||||
bane.setLiveDate(baneLive);
|
||||
outMsg.actionType = 18;
|
||||
|
||||
Dispatch dispatch = Dispatch.borrow(player, outMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
DateTime baneLive = new DateTime(bane.getPlacementDate());
|
||||
baneLive = baneHour == 24 ? baneLive.plusDays(3) : baneLive.plusDays(2);
|
||||
baneLive = baneHour == 24 ? baneLive.hourOfDay().setCopy(0) : baneLive.hourOfDay().setCopy(baneHour);
|
||||
baneLive = baneLive.minuteOfHour().setCopy(0);
|
||||
baneLive = baneLive.secondOfMinute().setCopy(1);
|
||||
bane.setLiveDate(baneLive);
|
||||
outMsg.actionType = 18;
|
||||
DispatchMessage.dispatchMsgDispatch(Dispatch.borrow(player, outMsg), DispatchChannel.SECONDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void configWindowState(PlayerCharacter player, Building building, ManageCityAssetsMsg manageCityAssetsMsg) {
|
||||
|
||||
// Tests to turn on upgrade button if a building is not
|
||||
@@ -226,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.
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
Building shrineBuilding;
|
||||
Shrine shrine;
|
||||
|
||||
if (npc.getGuild().getNation() != player.getGuild().getNation())
|
||||
if (!npc.getGuild().getNation().equals(player.getGuild().getNation()))
|
||||
return;
|
||||
|
||||
shrineBuilding = npc.getBuilding();
|
||||
@@ -173,10 +173,10 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
//already haz boon.
|
||||
|
||||
//if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
|
||||
// ErrorPopupMsg.sendErrorPopup(player, 199);
|
||||
// return;
|
||||
//}
|
||||
if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 199);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Shrine.canTakeFavor(player, shrine))
|
||||
return;
|
||||
@@ -191,10 +191,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if(shrinePower.getName().equals("Boon: Nephilim"))
|
||||
shrinePower.name = "Boon: Chaos";
|
||||
|
||||
int trains = 5 * npc.getRank() + 5;//40 - (rank * 10);
|
||||
int rank = shrine.getRank();
|
||||
//R8 trees always get atleast rank 2 boons. rank uses index, where 0 is first place, 1 is second, etc...
|
||||
if (shrineBuilding.getCity() != null && shrineBuilding.getCity().getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8)
|
||||
if (rank != 0)
|
||||
rank = 1;
|
||||
int trains = 40 - (rank * 10);
|
||||
if (trains < 0)
|
||||
trains = 0;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -41,6 +42,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
if (player == null)
|
||||
return true;
|
||||
|
||||
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
|
||||
|
||||
NPC npc = NPC.getFromCache(minionMsg.getNpcID());
|
||||
@@ -61,10 +63,10 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
|
||||
|
||||
if (!npc.siegeMinionMap.containsKey(toRemove))
|
||||
if (!npc.getSiegeMinionMap().containsKey(toRemove))
|
||||
return true;
|
||||
|
||||
npc.siegeMinionMap.remove(toRemove);
|
||||
npc.getSiegeMinionMap().remove(toRemove);
|
||||
|
||||
WorldGrid.RemoveWorldObject(toRemove);
|
||||
|
||||
@@ -72,18 +74,14 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||
|
||||
DbManager.removeFromCache(toRemove);
|
||||
PlayerCharacter petOwner = toRemove.getOwner();
|
||||
|
||||
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
|
||||
if (petOwner != null) {
|
||||
petOwner.setPet(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
if (petOwner != null) {
|
||||
petOwner.setPet(null);
|
||||
toRemove.setOwner(null);
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
// we Found the move to remove, lets break the for loop so it doesnt look for more.
|
||||
@@ -117,7 +115,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (npc.getContractID() == 842)
|
||||
maxSlots = 1;
|
||||
|
||||
if (npc.siegeMinionMap.size() == maxSlots)
|
||||
if (npc.getSiegeMinionMap().size() == maxSlots)
|
||||
return true;
|
||||
|
||||
int mobBase;
|
||||
@@ -148,10 +146,42 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
if (mobBase == 0)
|
||||
return true;
|
||||
|
||||
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
|
||||
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
|
||||
|
||||
if (siegeMob == null)
|
||||
return true;
|
||||
|
||||
if (siegeMob != null) {
|
||||
|
||||
siegeMob.setSpawnTime(60 * 15);
|
||||
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
|
||||
|
||||
siegeMob.building = building;
|
||||
siegeMob.parentZone = zone;
|
||||
|
||||
// Slot siege minion
|
||||
// Can be either corner tower or bulwark.
|
||||
|
||||
int slot;
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
|
||||
slot = 2;
|
||||
else
|
||||
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
|
||||
|
||||
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
|
||||
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
|
||||
|
||||
// Rotate slot position by the building rotation
|
||||
|
||||
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
|
||||
|
||||
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
|
||||
|
||||
zone.zoneMobSet.add(siegeMob);
|
||||
siegeMob.setLoc(siegeMob.bindLoc);
|
||||
}
|
||||
}
|
||||
|
||||
ManageNPCMsg mnm = new ManageNPCMsg(npc);
|
||||
@@ -198,14 +228,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
toRemove.getParentZone().zoneMobSet.remove(toRemove);
|
||||
|
||||
DbManager.removeFromCache(toRemove);
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
|
||||
PlayerCharacter petOwner = toRemove.getOwner();
|
||||
|
||||
if (petOwner != null) {
|
||||
petOwner.setPet(null);
|
||||
|
||||
toRemove.guardCaptain = null;
|
||||
toRemove.setOwner(null);
|
||||
PetMsg petMsg = new PetMsg(5, null);
|
||||
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
@@ -271,12 +298,12 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
String pirateName = NPCManager.getPirateName(mobBase);
|
||||
|
||||
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
|
||||
|
||||
if (toCreate == null)
|
||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||
return true;
|
||||
|
||||
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
|
||||
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
|
||||
|
||||
if (toCreate == null)
|
||||
return true;
|
||||
|
||||
if (toCreate != null) {
|
||||
|
||||
@@ -195,9 +195,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
hPMod = (building.getMaxHitPoints() * Realm.getRealmHealthMod(city));
|
||||
float percentOfHealth = building.getCurrentHitpoints() / building.getHealthMax();
|
||||
building.setMaxHitPoints(building.getMaxHitPoints() + hPMod);
|
||||
building.setCurrentHitPoints(building.getMaxHitPoints() * percentOfHealth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,10 +439,8 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
// }
|
||||
// break;
|
||||
//}
|
||||
int i = 0;
|
||||
if(i != 0) {
|
||||
LootManager.peddleFate(player, item);
|
||||
}
|
||||
|
||||
LootManager.peddleFate(player,item);
|
||||
break;
|
||||
|
||||
case 30: //water bucket
|
||||
@@ -542,11 +538,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
PowersManager.applyPower(player, target, Vector3fImmutable.ZERO, ib.getUseID(), ib.getUseAmount(), true);
|
||||
|
||||
itemMan.consume(item);
|
||||
} else if(ib.getUUID() > 252128 && ib.getUUID() < 252568){
|
||||
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||
itemMan.consume(item);
|
||||
}
|
||||
}else //just remove the item at this point
|
||||
} else //just remove the item at this point
|
||||
itemMan.consume(item);
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
|
||||
@@ -44,13 +44,6 @@ public class OpenFriendsCondemnListMsgHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
|
||||
msg = (OpenFriendsCondemnListMsg) baseMsg;
|
||||
|
||||
sourceBuilding = BuildingManager.getBuildingFromCache(msg.getBuildingID());
|
||||
|
||||
if(sourceBuilding != null && sourceBuilding.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)){
|
||||
return true;
|
||||
}
|
||||
|
||||
openFriendsCondemnListMsg = new OpenFriendsCondemnListMsg(msg);
|
||||
friendListType = Enum.FriendListType.getListTypeByID(msg.getMessageType());
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -412,9 +412,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
break;
|
||||
if (!playerCharacter.getCharItemManager().doesCharOwnThisItem(contract.getObjectUUID()))
|
||||
break;
|
||||
if(contract.getItemBaseID() == 1035){//saetor shrine override
|
||||
msg.getFirstPlacementInfo().setBlueprintUUID(1720000);
|
||||
}
|
||||
buildingCreated = placeShrine(playerCharacter, origin, msg);
|
||||
break;
|
||||
case BARRACK:
|
||||
@@ -803,7 +800,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
treeObject.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||
treeObject.setParentZone(zoneObject);
|
||||
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(14));
|
||||
MaintenanceManager.setMaintDateTime(treeObject, LocalDateTime.now().plusDays(7));
|
||||
|
||||
// Update guild binds and tags
|
||||
//load the new city on the clients
|
||||
@@ -970,7 +967,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
// Create the shrine
|
||||
|
||||
|
||||
return createShrine((PlayerCharacter) cityObject.getTOL().getOwner(), msg.getFirstPlacementInfo(), serverZone);
|
||||
}
|
||||
|
||||
@@ -1213,7 +1210,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
private boolean createShrine(PlayerCharacter player, PlacementInfo buildingInfo, Zone currentZone) {
|
||||
|
||||
Blueprint blueprint;
|
||||
Building newMesh = null;
|
||||
Building newMesh;
|
||||
Shrine newShrine;
|
||||
City city;
|
||||
ShrineType shrineType;
|
||||
@@ -1274,10 +1271,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(blueprint.getName().equals("Nephilim Shrine ") && newMesh != null){
|
||||
newMesh.setName("Chaos Shrine");
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class RequestEnterWorldHandler extends AbstractClientMsgHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
player.enteredWorld = false;
|
||||
player.setEnteredWorld(false);
|
||||
|
||||
Account acc = SessionManager.getAccount(origin);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import engine.Enum;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -132,15 +131,14 @@ public class TaxCityMsgHandler extends AbstractClientMsgHandler {
|
||||
TaxCityMsg msg;
|
||||
|
||||
player = origin.getPlayerCharacter();
|
||||
ChatManager.chatSystemInfo(player,"Taxing has been disabled");
|
||||
return false;
|
||||
|
||||
//msg = (TaxCityMsg) baseMsg;
|
||||
|
||||
//ViewTaxes(msg, player);
|
||||
|
||||
|
||||
//return true;
|
||||
msg = (TaxCityMsg) baseMsg;
|
||||
|
||||
ViewTaxes(msg, player);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,6 @@ public class UpgradeAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
Logger.error("Attempt to upgrade null building by " + player.getName());
|
||||
return true;
|
||||
}
|
||||
if(buildingToRank.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE))
|
||||
return true;
|
||||
|
||||
// Early exit for building that is already ranking
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.net.*;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -78,98 +77,55 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
if (playerCharacter == null || origin == null || rb == null) {
|
||||
return false;
|
||||
}
|
||||
int raceID = playerCharacter.getRaceID();
|
||||
|
||||
//Check race is met
|
||||
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
|
||||
if(runeID != 3007 && runeID != 3014) {//bounty hunter and huntsman
|
||||
if (races.size() > 0) {
|
||||
|
||||
boolean valid = false;
|
||||
for (int validID : races.keySet()) {
|
||||
if (validID == raceID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(runeID == 3040)
|
||||
if (races.size() > 0) {
|
||||
int raceID = playerCharacter.getRaceID();
|
||||
boolean valid = false;
|
||||
for (int validID : races.keySet()) {
|
||||
if (validID == raceID) {
|
||||
valid = true;
|
||||
|
||||
if(runeID == 2514 && raceID == 1999)
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3036 && raceID == 1999)
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
valid = true;
|
||||
|
||||
if (!valid) {
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Check base class is met
|
||||
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
|
||||
if (baseClasses.size() > 0) {
|
||||
int baseClassID = playerCharacter.getBaseClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : baseClasses.keySet()) {
|
||||
if (validID == baseClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(runeID == 3040)
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3036 && raceID == 1999)
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3035 && baseClassID == 2501)
|
||||
valid = true;
|
||||
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check promotion class is met
|
||||
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
||||
if (promotionClasses.size() > 0) {
|
||||
int promotionClassID = playerCharacter.getPromotionClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : promotionClasses.keySet()) {
|
||||
if (validID == promotionClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(runeID == 3040)
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3004 && (playerCharacter.getPromotionClassID() == 2505 || playerCharacter.getPromotionClassID() == 2510))
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3036 && raceID == 1999)
|
||||
valid = true;
|
||||
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
valid = true;
|
||||
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else{
|
||||
if(playerCharacter.getPromotionClassID() == 2519){//priest
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check base class is met
|
||||
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
|
||||
if (baseClasses.size() > 0) {
|
||||
int baseClassID = playerCharacter.getBaseClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : baseClasses.keySet()) {
|
||||
if (validID == baseClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check promotion class is met
|
||||
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
||||
if (promotionClasses.size() > 0) {
|
||||
int promotionClassID = playerCharacter.getPromotionClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : promotionClasses.keySet()) {
|
||||
if (validID == promotionClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check disciplines are met
|
||||
ArrayList<CharacterRune> runes = playerCharacter.getRunes();
|
||||
ConcurrentHashMap<Integer, Boolean> disciplines = rb.getDiscipline();
|
||||
@@ -218,16 +174,7 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
int mod = rba.getModValue();
|
||||
switch (attrID) {
|
||||
case MBServerStatics.RUNE_COST_ATTRIBUTE_ID:
|
||||
switch (rb.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
mod = 0;
|
||||
}
|
||||
if (mod > playerCharacter.getUnusedStatPoints()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
cost = mod;
|
||||
@@ -285,29 +232,8 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (rb.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
for (CharacterRune charRune : playerCharacter.getRunes()) {
|
||||
RuneBase rb2 = charRune.getRuneBase();
|
||||
switch (rb2.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
ChatManager.chatSystemError(playerCharacter, "You Have Already Applied A Blood Rune");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if discipline, check number applied
|
||||
if (isDiscipline(runeID)) {
|
||||
//if(playerCharacter.getLevel() == 80)
|
||||
discCount -= 1; // level 80 characters get an extra disc rune
|
||||
if (playerCharacter.getLevel() < 70) {
|
||||
if (discCount > 2) {
|
||||
return false;
|
||||
@@ -378,15 +304,7 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
playerCharacter.recalculate();
|
||||
}
|
||||
}
|
||||
switch (rb.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
cost = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cost > 0) {
|
||||
ModifyStatMsg msm = new ModifyStatMsg((0 - cost), 0, 3);
|
||||
dispatch = Dispatch.borrow(playerCharacter, msm);
|
||||
|
||||
@@ -87,11 +87,7 @@ public class CityDataMsg extends ClientNetMsg {
|
||||
temp.putInt(cityList.size());
|
||||
|
||||
for (City city : cityList)
|
||||
try {
|
||||
City.serializeForClientMsg(city, temp);
|
||||
}catch(Exception e){
|
||||
continue;
|
||||
}
|
||||
City.serializeForClientMsg(city, temp);
|
||||
temp.put((byte) 0); // PAD
|
||||
|
||||
// Serialize runegates
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
@@ -43,8 +42,8 @@ public class CityZoneMsg extends ClientNetMsg {
|
||||
this.locY = locY;
|
||||
this.locZ = locZ;
|
||||
this.name = name;
|
||||
this.radiusX = Enum.CityBoundsType.ZONE.extents;
|
||||
this.radiusZ = Enum.CityBoundsType.ZONE.extents;
|
||||
this.radiusX = radiusX;
|
||||
this.radiusZ = radiusZ;
|
||||
this.unknown01 = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
@@ -532,10 +531,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
else if (building.getRank() == building.getBlueprint().getMaxRank())
|
||||
this.upgradeCost = Integer.MAX_VALUE;
|
||||
else
|
||||
if(building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.WAREHOUSE))
|
||||
this.upgradeCost = Integer.MAX_VALUE;
|
||||
else
|
||||
this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7));
|
||||
this.upgradeCost = building.getBlueprint().getRankCost(Math.min(building.getRank() + 1, 7));
|
||||
|
||||
writer.putInt(this.upgradeCost);
|
||||
} else
|
||||
|
||||
@@ -343,7 +343,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
writer.putInt(0); //runemaster list
|
||||
|
||||
//artillery captain list
|
||||
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.siegeMinionMap;
|
||||
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.getSiegeMinionMap();
|
||||
writer.putInt(1 + siegeMinions.size());
|
||||
serializeBulwarkList(writer, 1); //Trebuchet
|
||||
//serializeBulwarkList(writer, 2); //Ballista
|
||||
@@ -366,7 +366,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
long timeLife = upgradeTime - curTime;
|
||||
|
||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||
if (mob.guardCaptain.isAlive()) {
|
||||
if (mob.npcOwner.isAlive()) {
|
||||
writer.put((byte) 0);//shows respawning timer
|
||||
writer.putInt(mob.spawnTime);
|
||||
writer.putInt(mob.spawnTime);
|
||||
@@ -557,7 +557,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
|
||||
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
|
||||
|
||||
mobA = Mob.getMob(this.targetID);
|
||||
mobA = Mob.getFromCacheDBID(this.targetID);
|
||||
|
||||
if (mobA == null) {
|
||||
Logger.error("Missing Mob of ID " + this.targetID);
|
||||
@@ -689,7 +689,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
||||
long timeLife = upgradeTime - curTime;
|
||||
|
||||
if (upgradeTime * 1000 > System.currentTimeMillis()) {
|
||||
if (mob.guardCaptain.isAlive()) {
|
||||
if (mob.npcOwner.isAlive()) {
|
||||
writer.put((byte) 0);//shows respawning timer
|
||||
writer.putInt(mob.spawnTime);
|
||||
writer.putInt(mob.spawnTime);
|
||||
|
||||
@@ -601,9 +601,6 @@ public class PlaceAssetMsg extends ClientNetMsg {
|
||||
public int getBlueprintUUID() {
|
||||
return this.blueprintUUID;
|
||||
}
|
||||
public void setBlueprintUUID(int id) {
|
||||
this.blueprintUUID = id;
|
||||
}
|
||||
|
||||
public Vector3fImmutable getLoc() {
|
||||
return this.loc;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class RefinerScreenMsg extends ClientNetMsg {
|
||||
return this.unknown02;
|
||||
}
|
||||
|
||||
public void setUnknown02(float value) {
|
||||
public void setUnknown02(int value) {
|
||||
this.unknown02 = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ public class TrainMsg extends ClientNetMsg {
|
||||
|
||||
if (sk == null)
|
||||
return;
|
||||
|
||||
if (sk.getSkillsBase().getToken() == 40661438) {
|
||||
int maxValue = 15;
|
||||
|
||||
|
||||
@@ -9,19 +9,19 @@
|
||||
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.GuildHistoryType;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.GuildManager;
|
||||
import engine.gameManager.SessionManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.*;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.BoxTracker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -137,29 +137,6 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
msg.updateMessage(3, vd);
|
||||
}
|
||||
|
||||
if(contract.getObjectUUID() == 1502040){
|
||||
if(!playerCharacter.getTimestamps().containsKey("lastBoxChange"))
|
||||
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis() - 1000);
|
||||
|
||||
if(playerCharacter.getTimeStamp("lastBoxChange") + 30000L > System.currentTimeMillis()) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You Must Wait To Promote Again.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(playerCharacter.isBoxed == false) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You Are Already The Active Character.");
|
||||
return;
|
||||
}
|
||||
|
||||
playerCharacter.getTimestamps().put("lastBoxChange",System.currentTimeMillis());
|
||||
|
||||
for(PlayerCharacter newlyBoxed : BoxTracker.getPlayers(playerCharacter.getClientConnection().machineID)){
|
||||
newlyBoxed.isBoxed = true;
|
||||
}
|
||||
playerCharacter.isBoxed = false;
|
||||
InterestManager.setObjectDirty(playerCharacter);
|
||||
playerCharacter.removeEffectBySource(Enum.EffectSourceType.DeathShroud,50,true);
|
||||
}
|
||||
Dispatch dispatch = Dispatch.borrow(playerCharacter, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
@@ -571,36 +548,23 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
|
||||
// verify race valid for profession
|
||||
Race race = pc.getRace();
|
||||
if(race.getRaceRuneID() == 1999 && (promoID == 2512 || promoID == 2511)) {
|
||||
|
||||
} else if(promo.getName().equals("Ranger")&& race.getName().equals("Saetor"))
|
||||
{
|
||||
|
||||
}else {
|
||||
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
||||
// TODO send client promotion error
|
||||
return;
|
||||
}
|
||||
if (race == null || !promo.isAllowedRune(race.getToken())) {
|
||||
// TODO send client promotion error
|
||||
return;
|
||||
}
|
||||
|
||||
// verify baseclass valid for profession
|
||||
BaseClass bc = pc.getBaseClass();
|
||||
if(promo.getName().equals("Druid") && (bc.getName().equals("Rogue") || bc.getName().equals("Mage"))) { //allow rogue and mage druids
|
||||
|
||||
}
|
||||
else {
|
||||
if (bc == null || !promo.isAllowedRune(bc.getToken())) {
|
||||
// TODO send client promotion error
|
||||
return;
|
||||
}
|
||||
if (bc == null || !promo.isAllowedRune(bc.getToken())) {
|
||||
// TODO send client promotion error
|
||||
return;
|
||||
}
|
||||
|
||||
// verify gender
|
||||
if(race.getName().equals("Saetor") == false) { //saetors can promote to huntress and fury
|
||||
if (promoID == 2511 && pc.isMale()) // Fury
|
||||
return;
|
||||
if (promoID == 2512 && pc.isMale()) // Huntress
|
||||
return;
|
||||
}
|
||||
if (promoID == 2511 && pc.isMale()) // Fury
|
||||
return;
|
||||
if (promoID == 2512 && pc.isMale()) // Huntress
|
||||
return;
|
||||
if (promoID == 2517 && !pc.isMale()) // Warlock
|
||||
return;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.net.client.msg.ClientNetMsg;
|
||||
import engine.objects.Race;
|
||||
|
||||
public class CommitNewCharacterMsg extends ClientNetMsg {
|
||||
|
||||
@@ -176,7 +175,7 @@ public class CommitNewCharacterMsg extends ClientNetMsg {
|
||||
|
||||
public int getRace() {
|
||||
for (int i = 0; i < 23; i++)
|
||||
if(Race.getRace(this.runes[i]) != null)
|
||||
if (this.runes[i] > 1999 && this.runes[i] < 2030)
|
||||
return this.runes[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
public int contractUUID;
|
||||
public Contract contract;
|
||||
|
||||
public String firstName;
|
||||
public String lastName;
|
||||
protected String firstName;
|
||||
protected String lastName;
|
||||
protected short statStrCurrent;
|
||||
protected short statDexCurrent;
|
||||
protected short statConCurrent;
|
||||
@@ -88,7 +88,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
protected AtomicFloat mana = new AtomicFloat();
|
||||
protected float manaMax; // Health/Mana/Stamina
|
||||
protected AtomicBoolean isAlive = new AtomicBoolean(true);
|
||||
protected Resists resists = null;
|
||||
protected Resists resists = new Resists("Genric");
|
||||
protected ConcurrentHashMap<String, JobContainer> timers;
|
||||
protected ConcurrentHashMap<String, Long> timestamps;
|
||||
protected int atrHandOne;
|
||||
@@ -117,33 +117,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
protected boolean movingUp = false;
|
||||
private float desiredAltitude = 0;
|
||||
private long takeOffTime = 0;
|
||||
private float hateValue = 0;
|
||||
private long lastHateUpdate = 0;
|
||||
private boolean collided = false;
|
||||
private byte aoecntr = 0;
|
||||
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
|
||||
public AbstractCharacter() {
|
||||
super();
|
||||
this.firstName = "";
|
||||
this.lastName = "";
|
||||
|
||||
this.statStrCurrent = (short) 0;
|
||||
this.statDexCurrent = (short) 0;
|
||||
this.statConCurrent = (short) 0;
|
||||
this.statIntCurrent = (short) 0;
|
||||
this.statSpiCurrent = (short) 0;
|
||||
|
||||
this.unusedStatPoints = (short) 0;
|
||||
|
||||
this.level = (short) 0; // TODO get this from MobsBase later
|
||||
this.exp = 1;
|
||||
this.walkMode = true;
|
||||
this.bindLoc = Vector3fImmutable.ZERO;
|
||||
this.faceDir = Vector3fImmutable.ZERO;
|
||||
|
||||
this.runningTrains = (byte) 0;
|
||||
|
||||
this.skills = new ConcurrentHashMap<>();
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
this.initializeCharacter();
|
||||
|
||||
}
|
||||
@@ -231,6 +214,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
this.initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,6 +258,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
this.initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,6 +291,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,6 +342,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.powers = new ConcurrentHashMap<>();
|
||||
|
||||
this.initializeCharacter();
|
||||
|
||||
// Dangerous to use THIS in a constructor!!!
|
||||
this.charItemManager = new CharacterItemManager(this);
|
||||
}
|
||||
|
||||
public static int getBankCapacity() {
|
||||
@@ -678,22 +670,12 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final Resists getResists() {
|
||||
|
||||
if(this.getObjectType().equals(GameObjectType.Mob)){
|
||||
return ((Mob)this).mobResists;
|
||||
}else {
|
||||
|
||||
if (this.resists == null)
|
||||
return Resists.getResists(0);
|
||||
|
||||
return this.resists;
|
||||
}
|
||||
if (this.resists == null)
|
||||
return Resists.getResists(0);
|
||||
return this.resists;
|
||||
}
|
||||
|
||||
public final void setResists(final Resists value) {
|
||||
if(this.getObjectType().equals(GameObjectType.Mob))
|
||||
return;
|
||||
|
||||
this.resists = value;
|
||||
}
|
||||
|
||||
@@ -1004,7 +986,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
if (this.takeOffTime != 0)
|
||||
return super.getLoc();
|
||||
|
||||
return super.getLoc().moveTowards(this.endLoc, this.getSpeed() * ((System.currentTimeMillis() - this.lastSetLocUpdate) * .001f));
|
||||
return super.getLoc().moveTowards(this.endLoc, this.getSpeed() * ((System.currentTimeMillis() - lastSetLocUpdate) * .001f));
|
||||
|
||||
}
|
||||
|
||||
@@ -1114,6 +1096,23 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final void setCombatTarget(final AbstractWorldObject value) {
|
||||
if(this.getObjectTypeMask() == 2050) {//MOB?
|
||||
if (value == null) {
|
||||
if (this.isCombat()) {
|
||||
this.setCombat(false);
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(this);
|
||||
DispatchMessage.sendToAllInRange(this, rwss);
|
||||
}
|
||||
}else {
|
||||
if (!this.isCombat()) {
|
||||
this.setCombat(true);
|
||||
UpdateStateMsg rwss = new UpdateStateMsg();
|
||||
rwss.setPlayer(this);
|
||||
DispatchMessage.sendToAllInRange(this, rwss);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.combatTarget = value;
|
||||
}
|
||||
|
||||
@@ -1188,9 +1187,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
}
|
||||
|
||||
public final float modifyHealth(float value,final AbstractCharacter attacker,final boolean fromCost) {
|
||||
if(attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||
public final float modifyHealth(
|
||||
final float value,
|
||||
final AbstractCharacter attacker,
|
||||
final boolean fromCost) {
|
||||
|
||||
try {
|
||||
|
||||
try {
|
||||
@@ -1246,11 +1247,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final float modifyMana(
|
||||
float value,
|
||||
final float value,
|
||||
final AbstractCharacter attacker
|
||||
) {
|
||||
if(attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||
return this.modifyMana(value, attacker, false);
|
||||
}
|
||||
|
||||
@@ -1287,11 +1286,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
*/
|
||||
|
||||
public final float modifyStamina(
|
||||
float value,
|
||||
final float value,
|
||||
final AbstractCharacter attacker
|
||||
) {
|
||||
if(attacker.getObjectType().equals(GameObjectType.PlayerCharacter))
|
||||
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||
return this.modifyStamina(value, attacker, false);
|
||||
}
|
||||
|
||||
@@ -1761,6 +1758,29 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
this.inBuildingID = inBuildingID;
|
||||
}
|
||||
|
||||
public float getHateValue() {
|
||||
if (this.hateValue <= 0) {
|
||||
this.hateValue = 0;
|
||||
return hateValue;
|
||||
}
|
||||
|
||||
if (this.lastHateUpdate == 0) {
|
||||
this.lastHateUpdate = System.currentTimeMillis();
|
||||
return this.hateValue;
|
||||
}
|
||||
long duration = System.currentTimeMillis() - this.lastHateUpdate;
|
||||
//convert duration to seconds and multiply Hate Delimiter.
|
||||
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
|
||||
this.hateValue -= modAmount;
|
||||
this.lastHateUpdate = System.currentTimeMillis();
|
||||
return this.hateValue;
|
||||
}
|
||||
|
||||
public void setHateValue(float hateValue) {
|
||||
this.lastHateUpdate = System.currentTimeMillis();
|
||||
this.hateValue = hateValue;
|
||||
}
|
||||
|
||||
public int getInFloorID() {
|
||||
return inFloorID;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,11 @@
|
||||
|
||||
package engine.objects;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSet;
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mobileAI.Threads.MobAIThread;
|
||||
@@ -33,20 +31,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
protected Vector3fImmutable lastBindLoc;
|
||||
public boolean assist = false;
|
||||
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
|
||||
public boolean isPlayerGuard = false;
|
||||
public AbstractCharacter guardCaptain;
|
||||
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
|
||||
;
|
||||
public Enum.MobBehaviourType behaviourType;
|
||||
public ArrayList<Vector3fImmutable> patrolPoints;
|
||||
public int lastPatrolPointIndex = 0;
|
||||
public long stopPatrolTime = 0;
|
||||
public City guardedCity;
|
||||
|
||||
public AbstractIntelligenceAgent() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
|
||||
super(rs);
|
||||
@@ -102,8 +87,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
this.agentType = Enum.AIAgentType.CHARMED;
|
||||
|
||||
if (this.getObjectType().equals(GameObjectType.Mob)) {
|
||||
|
||||
((Mob) this).guardCaptain = owner;
|
||||
((Mob) this).setOwner(owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +110,14 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public PlayerCharacter getOwner() {
|
||||
|
||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
||||
return this.getOwner();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean getSafeZone() {
|
||||
|
||||
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
|
||||
@@ -154,7 +146,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
if ((this.agentType.equals(Enum.AIAgentType.PET))) { //delete summoned pet
|
||||
|
||||
WorldGrid.RemoveWorldObject(this);
|
||||
DbManager.removeFromCache(this);
|
||||
|
||||
if (this.getObjectType() == GameObjectType.Mob)
|
||||
if (((Mob) this).getParentZone() != null)
|
||||
@@ -167,7 +158,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
|
||||
//clear owner
|
||||
|
||||
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
|
||||
PlayerCharacter owner = this.getOwner();
|
||||
|
||||
//close pet window
|
||||
|
||||
@@ -183,7 +174,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
|
||||
owner.setPet(null);
|
||||
|
||||
if (this.getObjectType().equals(GameObjectType.Mob))
|
||||
((Mob) this).guardCaptain = null;
|
||||
((Mob) this).setOwner(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
}
|
||||
|
||||
JobContainer jc = new JobContainer(ntj);
|
||||
Effect eff = new Effect(jc, eb, trains,true);
|
||||
Effect eff = new Effect(jc, eb, trains);
|
||||
if (isStatic)
|
||||
eff.setIsStatic(isStatic);
|
||||
this.effects.put(name, eff);
|
||||
@@ -357,9 +357,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
|
||||
Mob mob = (Mob) this;
|
||||
if (mob.isSiege()) {
|
||||
if (mob.isPet()) {
|
||||
|
||||
|
||||
PlayerCharacter petOwner = (PlayerCharacter) mob.guardCaptain;
|
||||
PlayerCharacter petOwner = mob.getOwner();
|
||||
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
|
||||
petOwner.dismissPet();
|
||||
return;
|
||||
|
||||
@@ -17,7 +17,10 @@ import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.BaneRecord;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.gameManager.*;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.ActivateBaneJob;
|
||||
import engine.jobs.BaneDefaultTimeJob;
|
||||
@@ -32,8 +35,6 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -51,8 +52,6 @@ public final class Bane {
|
||||
// Internal cache for banes
|
||||
private ActivateBaneJob activateBaneJob;
|
||||
|
||||
public int capSize;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -107,17 +106,10 @@ public final class Bane {
|
||||
|
||||
if (this.liveDate == null)
|
||||
setDefaultTime();
|
||||
|
||||
this.capSize = ZergManager.getBaneCap(this.getCity().getGuild());
|
||||
}
|
||||
|
||||
public static boolean summonBanestone(PlayerCharacter player, ClientConnection origin, int rank) {
|
||||
|
||||
//if(LocalDateTime.now().getDayOfWeek().equals(DayOfWeek.WEDNESDAY) == false && LocalDateTime.now().getDayOfWeek().equals(DayOfWeek.THURSDAY) == false){
|
||||
// ChatManager.chatSystemError(player, "You can only place banes on Wednesdays and Thursdays.");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
Guild baningGuild;
|
||||
Zone cityZone;
|
||||
City targetCity;
|
||||
@@ -211,28 +203,18 @@ public final class Bane {
|
||||
return false;
|
||||
}
|
||||
|
||||
for(Guild subGuild : baningGuild.getNation().getSubGuildList()) {
|
||||
if (getBaneByAttackerGuild(subGuild) != null) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "Your Nation Already Has a Bane Placed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(targetCity.getGuild().getNation().getSubGuildList() != null) {
|
||||
|
||||
for (Guild subGuild : targetCity.getGuild().getNation().getSubGuildList()) {
|
||||
if (getBaneByAttackerGuild(subGuild) != null) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "This Nation Already Has a Bane Placed On It");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Blueprint blueprint = Blueprint.getBlueprint(24300); // Banestone
|
||||
|
||||
//Let's drop a banestone!
|
||||
|
||||
Vector3fImmutable localLocation = ZoneManager.worldToLocal(player.getLoc(), cityZone);
|
||||
|
||||
if (localLocation == null) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "A Serious error has occurred. Please post details for to ensure transaction integrity");
|
||||
Logger.info("Failed to Convert World coordinates to local zone coordinates");
|
||||
return false;
|
||||
}
|
||||
|
||||
Building stone = DbManager.BuildingQueries.CREATE_BUILDING(
|
||||
cityZone.getObjectUUID(), player.getObjectUUID(), blueprint.getName(), blueprint.getBlueprintUUID(),
|
||||
localLocation, 1.0f, blueprint.getMaxHealth(rank), ProtectionState.PROTECTED, 0, rank,
|
||||
@@ -243,7 +225,6 @@ public final class Bane {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
stone.addEffectBit((1 << 19));
|
||||
stone.setMaxHitPoints(stone.getBlueprint().getMaxHealth(stone.getRank()));
|
||||
stone.setCurrentHitPoints(stone.getMaxHitPoints());
|
||||
@@ -285,12 +266,6 @@ public final class Bane {
|
||||
BaneRecord baneRecord = BaneRecord.borrow(bane, Enum.RecordEventType.PENDING);
|
||||
DataWarehouse.pushToWarehouse(baneRecord);
|
||||
|
||||
if(bane.getCity().getTOL().getRank() == 8)
|
||||
bane.capSize = 40;
|
||||
else
|
||||
bane.capSize = 20;
|
||||
|
||||
bane.getCity().setSiegesWithstood(bane.capSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -367,12 +342,6 @@ public final class Bane {
|
||||
|
||||
newBane = DbManager.BaneQueries.LOAD_BANE(city.getObjectUUID());
|
||||
|
||||
if(newBane.getCity().getTOL().getRank() == 8)
|
||||
newBane.capSize = 40;
|
||||
else
|
||||
newBane.capSize = 20;
|
||||
|
||||
newBane.getCity().setSiegesWithstood(newBane.capSize);
|
||||
return newBane;
|
||||
}
|
||||
|
||||
@@ -607,10 +576,6 @@ public final class Bane {
|
||||
|
||||
DispatchMessage.dispatchMsgToAll(msg);
|
||||
}
|
||||
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(this.getCity().loc,1500,MBServerStatics.MASK_BUILDING)){
|
||||
Building building = (Building)awo;
|
||||
if(building.setOwner(this.getOwner()));
|
||||
}
|
||||
break;
|
||||
case DESTROY:
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@ public class Blueprint {
|
||||
public static HashMap<Integer, Blueprint> _meshLookup = new HashMap<>();
|
||||
private static HashMap<Integer, Blueprint> _blueprints = new HashMap<>();
|
||||
private static HashMap<Integer, Integer> _doorNumbers = new HashMap<>();
|
||||
private int blueprintUUID;
|
||||
private final int blueprintUUID;
|
||||
private final String name;
|
||||
private final BuildingGroup buildingGroup;
|
||||
private final int icon;
|
||||
private final int maxRank;
|
||||
private final int maxSlots;
|
||||
public int rank1UUID;
|
||||
public int rank3UUID;
|
||||
public int rank7UUID;
|
||||
private final int rank1UUID;
|
||||
private final int rank3UUID;
|
||||
private final int rank7UUID;
|
||||
private final int destroyedUUID;
|
||||
|
||||
private Blueprint() {
|
||||
@@ -167,7 +167,10 @@ public class Blueprint {
|
||||
// based upon the building's current rank
|
||||
|
||||
public static int getNpcMaintCost(int rank) {
|
||||
int maintCost = 0;
|
||||
int maintCost = Integer.MAX_VALUE;
|
||||
|
||||
maintCost = (9730 * rank) + 1890;
|
||||
|
||||
return maintCost;
|
||||
}
|
||||
|
||||
@@ -310,14 +313,10 @@ public class Blueprint {
|
||||
|
||||
// Early exit for buildings with single or no slots
|
||||
|
||||
if(this.buildingGroup.isTrainerBuilding() && currentRank > 0){
|
||||
return 3;
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -329,9 +328,9 @@ public class Blueprint {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
availableSlots = 2;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
availableSlots = 3;
|
||||
break;
|
||||
@@ -342,6 +341,7 @@ public class Blueprint {
|
||||
availableSlots = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||
availableSlots += 1;
|
||||
}
|
||||
@@ -587,9 +587,7 @@ public class Blueprint {
|
||||
public int getBlueprintUUID() {
|
||||
return blueprintUUID;
|
||||
}
|
||||
public void setBlueprintUUID(int id) {
|
||||
this.blueprintUUID = id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
@@ -614,10 +612,17 @@ public class Blueprint {
|
||||
|
||||
switch (this.buildingGroup) {
|
||||
case TOL:
|
||||
maintCost = 3000000;
|
||||
case BARRACK:
|
||||
maintCost = (61500 * rank) + 19500;
|
||||
break;
|
||||
case SPIRE:
|
||||
maintCost = (4800 * rank) + 1200;
|
||||
break;
|
||||
default:
|
||||
maintCost = 0;
|
||||
if (maxRank == 1)
|
||||
maintCost = 22500;
|
||||
else
|
||||
maintCost = (15900 * rank) + 3300;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ package engine.objects;
|
||||
import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.RealmMap;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.CityRecord;
|
||||
@@ -395,7 +394,7 @@ public class Building extends AbstractWorldObject {
|
||||
this.rank = newRank;
|
||||
|
||||
// New rank means new mesh
|
||||
int oldMeshID = this.meshUUID;
|
||||
|
||||
newMeshUUID = this.getBlueprint().getMeshForRank(this.rank);
|
||||
this.meshUUID = newMeshUUID;
|
||||
|
||||
@@ -429,15 +428,6 @@ public class Building extends AbstractWorldObject {
|
||||
BuildingManager.cleanupHirelings(this);
|
||||
|
||||
this.isDeranking.compareAndSet(true, false);
|
||||
|
||||
if(oldMeshID != this.meshUUID) {
|
||||
//move NPCs to new slot locations if the mesh was changed and force reload them
|
||||
int index = 0;
|
||||
for (AbstractCharacter hireling : this.hirelings.keySet()) {
|
||||
hireling.setLoc(BuildingManager._slotLocations.get(newMeshUUID).get(index).getLocation());
|
||||
InterestManager.reloadCharacter(hireling,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final int getOwnerUUID() {
|
||||
@@ -1010,10 +1000,7 @@ public class Building extends AbstractWorldObject {
|
||||
public final boolean setStrongboxValue(int newValue) {
|
||||
|
||||
boolean success = true;
|
||||
if(this.isOwnerIsNPC()) {
|
||||
newValue = 0;
|
||||
this.setStrongboxValue(0);
|
||||
}
|
||||
|
||||
try {
|
||||
DbManager.BuildingQueries.SET_PROPERTY(this, "currentGold", newValue);
|
||||
this._strongboxValue = newValue;
|
||||
@@ -1048,14 +1035,13 @@ public class Building extends AbstractWorldObject {
|
||||
|
||||
// *** Refactor: Can't we just use setRank() for this?
|
||||
|
||||
public final void rebuildMine(int maxHP) {
|
||||
public final void rebuildMine() {
|
||||
this.setRank(1);
|
||||
this.meshUUID = this.getBlueprint().getMeshForRank(this.rank);
|
||||
|
||||
// New rank mean new max hitpoints.
|
||||
|
||||
//this.healthMax = this.getBlueprint().getMaxHealth(this.rank);
|
||||
this.healthMax = maxHP;
|
||||
this.healthMax = this.getBlueprint().getMaxHealth(this.rank);
|
||||
this.setCurrentHitPoints(this.healthMax);
|
||||
this.getBounds().setBounds(this);
|
||||
}
|
||||
|
||||
@@ -12,14 +12,16 @@ package engine.objects;
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ItemType;
|
||||
import engine.gameManager.*;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
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.powers.poweractions.AbstractPowerAction;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -70,8 +72,6 @@ public class CharacterItemManager {
|
||||
*/
|
||||
private byte equipVer = (byte) 0;
|
||||
|
||||
public boolean updateLock = false;
|
||||
|
||||
public CharacterItemManager(AbstractCharacter ac) {
|
||||
super();
|
||||
this.absCharacter = ac;
|
||||
@@ -641,7 +641,6 @@ public class CharacterItemManager {
|
||||
|
||||
dispatch = Dispatch.borrow(other, utwm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.PRIMARY);
|
||||
stripTempEnchants(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -971,7 +970,6 @@ public class CharacterItemManager {
|
||||
// if (i.getObjectType() != GameObjectType.MobLoot)
|
||||
// CharacterItemManager.junkedItems.add(i);
|
||||
|
||||
|
||||
calculateWeights();
|
||||
|
||||
if (updateInventory)
|
||||
@@ -1057,7 +1055,7 @@ public class CharacterItemManager {
|
||||
i.addToCache();
|
||||
|
||||
calculateWeights();
|
||||
stripTempEnchants(i);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1202,17 +1200,8 @@ public class CharacterItemManager {
|
||||
i.addToCache();
|
||||
|
||||
calculateWeights();
|
||||
stripTempEnchants(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void stripTempEnchants(Item i) {
|
||||
//i.clearEffects();
|
||||
for (String name : i.getEffects().keySet()) {
|
||||
Effect eff = i.getEffects().get(name);
|
||||
if (!eff.isStatic())
|
||||
i.endEffect(name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Used for buying MobEquipment from NPC
|
||||
@@ -1243,7 +1232,7 @@ public class CharacterItemManager {
|
||||
|
||||
// This adds item to inventory for loot. Validity checks already handled
|
||||
public synchronized boolean addItemToInventory(Item i) {
|
||||
if (i.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
if (i.getItemBase().getType().equals(ItemType.GOLD))
|
||||
if (this.absCharacter.getObjectType() == GameObjectType.Mob) {
|
||||
if (this.goldInventory == null)
|
||||
loadGoldItems();
|
||||
@@ -1254,39 +1243,19 @@ public class CharacterItemManager {
|
||||
updateInventory();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} //else if (i.getItemBase().getType().equals(ItemType.RESOURCE)) {
|
||||
// if(this.inventoryContainsResource(i)){
|
||||
// Item resource = getResource(i);
|
||||
// if(resource != null){
|
||||
// resource.setNumOfItems(resource.getNumOfItems() + i.getNumOfItems());
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
||||
this.inventory.add(i);
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
|
||||
ItemBase ib = i.getItemBase();
|
||||
if (ib != null)
|
||||
this.inventoryWeight += ib.getWeight();
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean inventoryContainsResource(Item resource) {
|
||||
for(Item i : this.inventory){
|
||||
if(i.getItemBaseID() == resource.getItemBaseID())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Item getResource(Item resource) {
|
||||
for(Item i : this.inventory){
|
||||
if(i.getItemBaseID() == resource.getItemBaseID())
|
||||
return i;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//called for adding gold of a specified amount
|
||||
public synchronized boolean addItemToInventory(Item i, int amount) {
|
||||
if (i.getItemBase().getType().equals(ItemType.GOLD))
|
||||
@@ -1360,10 +1329,8 @@ public class CharacterItemManager {
|
||||
|
||||
Item gold = this.getGoldInventory();
|
||||
|
||||
if (cost <= 0 || (gold.getNumOfItems() - cost) < 0){
|
||||
ChatManager.chatSystemError((PlayerCharacter)this.getOwner(),"Not Enough Gold: " + "COST: " + cost);
|
||||
if (cost <= 0 || (gold.getNumOfItems() - cost) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (this.getOwner() != null && this.getOwner().getObjectType().equals(GameObjectType.PlayerCharacter)) {
|
||||
@@ -1377,6 +1344,7 @@ public class CharacterItemManager {
|
||||
// if the NPC is not slotted.
|
||||
|
||||
if (vendorBuilding == null) {
|
||||
|
||||
return this.modifyInventoryGold(-cost);
|
||||
}
|
||||
|
||||
@@ -1388,31 +1356,31 @@ public class CharacterItemManager {
|
||||
if (pc.getClientConnection() != null)
|
||||
ErrorPopupMsg.sendErrorPopup(pc, 206);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Update strongbox and inventory gold
|
||||
if (!this.modifyInventoryGold(-cost)) {
|
||||
if (!this.modifyInventoryGold(-cost))
|
||||
return false;
|
||||
}
|
||||
|
||||
City buildingCity = vendorBuilding.getCity();
|
||||
|
||||
if (buildingCity != null) {
|
||||
buildingCity.transactionLock.writeLock().lock();
|
||||
try {
|
||||
if (!vendorBuilding.isOwnerIsNPC() && !vendorBuilding.transferGold(buildingDeposit, true)) {
|
||||
if (!vendorBuilding.transferGold(buildingDeposit, true))
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
} finally {
|
||||
buildingCity.transactionLock.writeLock().unlock();
|
||||
}
|
||||
} else if (!vendorBuilding.isOwnerIsNPC() && !vendorBuilding.transferGold(buildingDeposit, true)) {
|
||||
} else if (!vendorBuilding.transferGold(buildingDeposit, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2288,8 +2256,6 @@ public class CharacterItemManager {
|
||||
if (this.absCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) == false)
|
||||
return;
|
||||
|
||||
if(this.updateLock)
|
||||
return;
|
||||
PlayerCharacter pc = (PlayerCharacter) this.absCharacter;
|
||||
|
||||
UpdateInventoryMsg updateInventoryMsg = new UpdateInventoryMsg(inventory, this.getBank(), this.getGoldInventory(), add);
|
||||
@@ -2368,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);
|
||||
@@ -2376,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);
|
||||
@@ -2459,7 +2425,7 @@ public class CharacterItemManager {
|
||||
i.setOwnerID(0);
|
||||
|
||||
calculateWeights();
|
||||
stripTempEnchants(i);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2468,10 +2434,6 @@ public class CharacterItemManager {
|
||||
if (item == null || amount < 1 || amount > 5)
|
||||
return;
|
||||
|
||||
if(ZoneManager.findSmallestZone(this.getOwner().loc).getSafeZone() == 1){
|
||||
return;
|
||||
}
|
||||
|
||||
//verify the item is equipped by this player
|
||||
int slot = item.getEquipSlot();
|
||||
if (!this.equipped.containsKey(slot))
|
||||
|
||||
@@ -489,6 +489,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
return;
|
||||
|
||||
ConcurrentHashMap<String, CharacterSkill> skills = pc.getSkills();
|
||||
|
||||
//First add skills that don't exist
|
||||
Race race = pc.getRace();
|
||||
if (race != null) {
|
||||
@@ -537,10 +538,6 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (pc.getRace().getName().equals("Saetor")) {
|
||||
if (cs.getSkillsBase().getName().equals("Parry") || cs.getSkillsBase().getName().equals("Staff") || cs.getSkillsBase().getName().equals("Staff Mastery"))
|
||||
valid = true;
|
||||
}
|
||||
//if skill doesn't belong to any runes, then remove it
|
||||
if (!valid) {
|
||||
DbManager.CharacterSkillQueries.DELETE_SKILL(cs.getObjectUUID());
|
||||
@@ -560,15 +557,6 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
if (skills == null)
|
||||
return;
|
||||
|
||||
//if (pc.getRace().getName().equals("Saetor")) {
|
||||
// SkillReq parry = new SkillReq(95961104, (short) 1);
|
||||
// SkillReq staff = new SkillReq(71438003, (short) 15);
|
||||
// SkillReq staffMastery = new SkillReq(-61022283, (short) 1);
|
||||
// skillsGranted.add(parry);
|
||||
// skillsGranted.add(staff);
|
||||
// skillsGranted.add(staffMastery);
|
||||
//}
|
||||
|
||||
for (SkillReq skillreq : skillsGranted) {
|
||||
SkillsBase skillsBase = skillreq.getSkillsBase();
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ public enum CharacterTitle {
|
||||
CSR_3(255, 0, 0, "CCR"),
|
||||
CSR_4(251, 181, 13, "CCR"),
|
||||
DEVELOPER(166, 153, 114, "Programmer"),
|
||||
QA(88, 250, 244, "GIRLFRIEND"),
|
||||
BOX(255, 0, 0, "");
|
||||
QA(88, 250, 244, "GIRLFRIEND");
|
||||
|
||||
int headerLength, footerLength;
|
||||
private ByteBuffer header;
|
||||
@@ -33,7 +32,7 @@ public enum CharacterTitle {
|
||||
(((_r < 100) ? ((_r < 10) ? "00" : "0") : "") + ((byte) _r & 0xFF)) +
|
||||
(((_g < 100) ? ((_g < 10) ? "00" : "0") : "") + ((byte) _g & 0xFF)) +
|
||||
(((_b < 100) ? ((_b < 10) ? "00" : "0") : "") + ((byte) _b & 0xFF)) +
|
||||
_prefix).toCharArray();
|
||||
'<' + _prefix + "> ").toCharArray();
|
||||
|
||||
char[] str_footer = ("^\\c255255255").toCharArray();
|
||||
|
||||
|
||||
+180
-121
@@ -32,7 +32,6 @@ import engine.server.MBServerStatics;
|
||||
import engine.server.world.WorldServer;
|
||||
import engine.workthreads.DestroyCityThread;
|
||||
import engine.workthreads.TransferCityThread;
|
||||
import org.joda.time.DateTime;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
@@ -40,7 +39,6 @@ import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -90,9 +88,6 @@ public class City extends AbstractWorldObject {
|
||||
private boolean reverseKOS = false;
|
||||
private String hash;
|
||||
|
||||
public final HashMap<Integer,Long> _recentMemory = new HashMap<>();
|
||||
HashMap<Guild,ArrayList<Integer>> dividedPlayers;
|
||||
public Integer totalPlayers;
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -199,132 +194,137 @@ public class City extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public static void serializeForClientMsg(City city, ByteBufferWriter writer) {
|
||||
AbstractCharacter guildRuler;
|
||||
Guild rulingGuild;
|
||||
Guild rulingNation;
|
||||
java.time.LocalDateTime dateTime1900;
|
||||
AbstractCharacter guildRuler;
|
||||
Guild rulingGuild;
|
||||
Guild rulingNation;
|
||||
java.time.LocalDateTime dateTime1900;
|
||||
|
||||
// Cities aren't a city without a TOL. Time to early exit.
|
||||
// No need to spam the log here as non-existant TOL's are indicated
|
||||
// during bootstrap routines.
|
||||
// Cities aren't a city without a TOL. Time to early exit.
|
||||
// No need to spam the log here as non-existant TOL's are indicated
|
||||
// during bootstrap routines.
|
||||
|
||||
if (city.getTOL() == null) {
|
||||
if (city.getTOL() == null) {
|
||||
|
||||
Logger.error("NULL TOL FOR " + city.cityName);
|
||||
}
|
||||
Logger.error("NULL TOL FOR " + city.cityName);
|
||||
}
|
||||
|
||||
|
||||
// Assign city owner
|
||||
// Assign city owner
|
||||
|
||||
if (city.getTOL() != null)
|
||||
guildRuler = city.getTOL().getOwner();
|
||||
else
|
||||
guildRuler = null;
|
||||
if (city.getTOL() != null)
|
||||
guildRuler = city.getTOL().getOwner();
|
||||
else
|
||||
guildRuler = null;
|
||||
|
||||
// If is an errant tree, use errant guild for serialization.
|
||||
// otherwise we serialize the soverign guild
|
||||
// If is an errant tree, use errant guild for serialization.
|
||||
// otherwise we serialize the soverign guild
|
||||
|
||||
if (guildRuler == null)
|
||||
rulingGuild = Guild.getErrantGuild();
|
||||
else
|
||||
rulingGuild = guildRuler.getGuild();
|
||||
if (guildRuler == null)
|
||||
rulingGuild = Guild.getErrantGuild();
|
||||
else
|
||||
rulingGuild = guildRuler.getGuild();
|
||||
|
||||
rulingNation = rulingGuild.getNation();
|
||||
rulingNation = rulingGuild.getNation();
|
||||
|
||||
// Begin Serialzing soverign guild data
|
||||
writer.putInt(city.getObjectType().ordinal());
|
||||
writer.putInt(city.getObjectUUID());
|
||||
writer.putString(city.cityName);
|
||||
// Begin Serialzing soverign guild data
|
||||
writer.putInt(city.getObjectType().ordinal());
|
||||
writer.putInt(city.getObjectUUID());
|
||||
writer.putString(city.cityName);
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
|
||||
writer.putString(rulingGuild.getName());
|
||||
writer.putString(city.motto);
|
||||
writer.putString(rulingGuild.getLeadershipType());
|
||||
|
||||
// Serialize guild ruler's name
|
||||
// If tree is abandoned blank out the name
|
||||
// to allow them a rename.
|
||||
|
||||
if (guildRuler == null)
|
||||
writer.putString("");
|
||||
else
|
||||
writer.putString(guildRuler.getFirstName() + ' ' + guildRuler.getLastName());
|
||||
|
||||
writer.putInt(rulingGuild.getCharter());
|
||||
writer.putInt(0); // always 00000000
|
||||
|
||||
writer.put(city.isSafeHold);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1); // *** Refactor: What are these flags?
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
|
||||
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
|
||||
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
|
||||
|
||||
writer.putInt(0);// TODO Implement description text
|
||||
|
||||
writer.put((byte) 1);
|
||||
|
||||
if (city.isCapital > 0)
|
||||
writer.put((byte) 1);
|
||||
else
|
||||
writer.put((byte) 0);
|
||||
|
||||
writer.put((byte) 1);
|
||||
|
||||
// Begin serializing nation guild info
|
||||
|
||||
if (rulingNation.isEmptyGuild()) {
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
|
||||
writer.putString(rulingGuild.getName());
|
||||
writer.putString(city.motto);
|
||||
writer.putString(rulingGuild.getLeadershipType());
|
||||
|
||||
// Serialize guild ruler's name
|
||||
// If tree is abandoned blank out the name
|
||||
// to allow them a rename.
|
||||
|
||||
if (guildRuler == null)
|
||||
writer.putString("");
|
||||
else
|
||||
writer.putString(guildRuler.getFirstName() + ' ' + guildRuler.getLastName());
|
||||
|
||||
writer.putInt(rulingGuild.getCharter());
|
||||
writer.putInt(0); // always 00000000
|
||||
|
||||
writer.put(city.isSafeHold);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1); // *** Refactor: What are these flags?
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 1);
|
||||
|
||||
GuildTag._serializeForDisplay(rulingGuild.getGuildTag(), writer);
|
||||
GuildTag._serializeForDisplay(rulingNation.getGuildTag(), writer);
|
||||
|
||||
writer.putInt(0);// TODO Implement description text
|
||||
|
||||
writer.put((byte) 1);
|
||||
|
||||
if (city.isCapital > 0)
|
||||
writer.put((byte) 1);
|
||||
else
|
||||
writer.put((byte) 0);
|
||||
|
||||
writer.put((byte) 1);
|
||||
|
||||
// Begin serializing nation guild info
|
||||
|
||||
if (rulingNation.isEmptyGuild()) {
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
} else {
|
||||
writer.putInt(rulingNation.getObjectType().ordinal());
|
||||
writer.putInt(rulingNation.getObjectUUID());
|
||||
}
|
||||
} else {
|
||||
writer.putInt(rulingNation.getObjectType().ordinal());
|
||||
writer.putInt(rulingNation.getObjectUUID());
|
||||
}
|
||||
|
||||
|
||||
// Serialize nation name
|
||||
// Serialize nation name
|
||||
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString("None");
|
||||
else
|
||||
writer.putString(rulingNation.getName());
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString("None");
|
||||
else
|
||||
writer.putString(rulingNation.getName());
|
||||
|
||||
if(city.getTOL() != null) {
|
||||
writer.putInt(city.getTOL().getRank());
|
||||
}else{
|
||||
writer.putInt(-1);
|
||||
}
|
||||
writer.putInt(city.getTOL().getRank());
|
||||
|
||||
if (city.isNoobIsle > 0)
|
||||
writer.putInt(1);
|
||||
else
|
||||
writer.putInt(0xFFFFFFFF);
|
||||
if (city.isNoobIsle > 0)
|
||||
writer.putInt(1);
|
||||
else
|
||||
writer.putInt(0xFFFFFFFF);
|
||||
|
||||
writer.putInt(city.population);
|
||||
writer.putInt(city.population);
|
||||
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString(" ");
|
||||
else
|
||||
writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName());
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString(" ");
|
||||
else
|
||||
writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName());
|
||||
|
||||
|
||||
writer.putLocalDateTime(city.established);
|
||||
writer.putLocalDateTime(city.established);
|
||||
|
||||
writer.putFloat(city.location.x);
|
||||
writer.putFloat(city.location.y);
|
||||
writer.putFloat(city.location.z);
|
||||
writer.putInt(ZergManager.getBaneCap(city.getGuild()));
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0x64);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
// writer.put((byte) city.established.getDayOfMonth());
|
||||
// writer.put((byte) city.established.minusMonths(1).getMonth().getValue());
|
||||
// writer.putInt((int) years);
|
||||
// writer.put((byte) hours);
|
||||
// writer.put((byte) minutes);
|
||||
// writer.put((byte) seconds);
|
||||
|
||||
writer.putFloat(city.location.x);
|
||||
writer.putFloat(city.location.y);
|
||||
writer.putFloat(city.location.z);
|
||||
|
||||
writer.putInt(city.siegesWithstood);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0x64);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
|
||||
public static Vector3fImmutable getBindLoc(int cityID) {
|
||||
@@ -980,12 +980,23 @@ public class City extends AbstractWorldObject {
|
||||
|
||||
public void onEnter() {
|
||||
|
||||
for (Integer id : this._playerMemory) {
|
||||
HashSet<AbstractWorldObject> currentPlayers;
|
||||
HashSet<Integer> currentMemory;
|
||||
PlayerCharacter player;
|
||||
|
||||
PlayerCharacter player = PlayerCharacter.getFromCache(id);
|
||||
if (player == null)
|
||||
// Gather current list of players within the zone bounds
|
||||
|
||||
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER);
|
||||
currentMemory = new HashSet<>();
|
||||
|
||||
for (AbstractWorldObject playerObject : currentPlayers) {
|
||||
|
||||
if (playerObject == null)
|
||||
continue;
|
||||
|
||||
player = (PlayerCharacter) playerObject;
|
||||
currentMemory.add(player.getObjectUUID());
|
||||
|
||||
// Player is already in our memory
|
||||
|
||||
if (_playerMemory.contains(player.getObjectUUID()))
|
||||
@@ -1001,6 +1012,62 @@ public class City extends AbstractWorldObject {
|
||||
//add spire effects.
|
||||
if (this.getEffects().size() > 0)
|
||||
this.applyAllCityEffects(player);
|
||||
|
||||
// Add player to our city's memory
|
||||
|
||||
_playerMemory.add(player.getObjectUUID());
|
||||
|
||||
// ***For debugging
|
||||
// Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size());
|
||||
}
|
||||
try {
|
||||
onExit(currentMemory);
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void onExit(HashSet<Integer> currentMemory) {
|
||||
|
||||
PlayerCharacter player;
|
||||
int playerUUID = 0;
|
||||
HashSet<Integer> toRemove = new HashSet<>();
|
||||
Iterator<Integer> iter = _playerMemory.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
|
||||
playerUUID = iter.next();
|
||||
|
||||
|
||||
player = PlayerCharacter.getFromCache(playerUUID);
|
||||
|
||||
if (this.isLocationWithinSiegeBounds(player.getLoc()))
|
||||
continue;
|
||||
|
||||
// Remove players safezone status if warranted
|
||||
// they can assumed to be not on the citygrid at
|
||||
// this point.
|
||||
|
||||
|
||||
player.setSafeZone(false);
|
||||
|
||||
this.removeAllCityEffects(player, false);
|
||||
|
||||
// We will remove this player after iteration is complete
|
||||
// so store it in a temporary collection
|
||||
|
||||
toRemove.add(playerUUID);
|
||||
// ***For debugging
|
||||
// Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size());
|
||||
}
|
||||
|
||||
// Remove players from city memory
|
||||
|
||||
_playerMemory.removeAll(toRemove);
|
||||
for (Integer removalUUID : toRemove) {
|
||||
if (this.cityOutlaws.contains(removalUUID))
|
||||
this.cityOutlaws.remove(removalUUID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1019,15 +1086,7 @@ public class City extends AbstractWorldObject {
|
||||
destroyCityThread.setName("deestroyCity:" + this.getName());
|
||||
destroyCityThread.start();
|
||||
}
|
||||
public static void destroyAllCityAssets(City city){
|
||||
if(city == null)
|
||||
Logger.error("Maintenance Failed To Find City To Destroy");
|
||||
for(Building building : city.getParent().zoneBuildingSet){
|
||||
building.setRank(-1);
|
||||
DbManager.removeFromCache(building);
|
||||
}
|
||||
city.getParent().zoneBuildingSet.clear();
|
||||
}
|
||||
|
||||
public final void transfer(AbstractCharacter newOwner) {
|
||||
|
||||
Thread transferCityThread = new Thread(new TransferCityThread(this, newOwner));
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Contract extends AbstractGameObject {
|
||||
public int inventorySet = 0;
|
||||
private int vendorID;
|
||||
private boolean isTrainer;
|
||||
public VendorDialog vendorDialog;
|
||||
private VendorDialog vendorDialog;
|
||||
private ArrayList<Integer> npcMenuOptions = new ArrayList<>();
|
||||
private ArrayList<Integer> npcModTypeTable = new ArrayList<>();
|
||||
private ArrayList<Integer> npcModSuffixTable = new ArrayList<>();
|
||||
@@ -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");
|
||||
|
||||
@@ -198,15 +204,6 @@ public class Contract extends AbstractGameObject {
|
||||
}
|
||||
|
||||
public ArrayList<MobEquipment> getSellInventory() {
|
||||
if(this.getObjectUUID() == 900){
|
||||
for (MobEquipment me : this.sellInventory) {
|
||||
if(me.getItemBase().getUUID() == 1705032) {
|
||||
me.magicValue = 1000000; //elan stones
|
||||
}else{
|
||||
me.magicValue = (Warehouse.getSellStackSize(me.getItemBase().getUUID()) * Warehouse.getCostForResource(me.getItemBase().getUUID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.sellInventory;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
this.inBuilding = belongsTo.getInBuilding();
|
||||
this.inFloorID = belongsTo.getInFloorID();
|
||||
this.inBuildingID = belongsTo.getInBuildingID();
|
||||
belongsTo.stopMovement(belongsTo.getMovementLoc());
|
||||
this.setLoc(belongsTo.getMovementLoc());
|
||||
this.setLoc(belongsTo.getLoc());
|
||||
} else {
|
||||
Logger.error("No player passed in for corpse");
|
||||
this.firstName = "";
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
|
||||
package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.TargetColor;
|
||||
import engine.gameManager.LootManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -119,11 +117,6 @@ public class Experience {
|
||||
159932666, // Level 74
|
||||
169707808, // Level 75
|
||||
179921247, // Level 76
|
||||
190548651, // Level 77
|
||||
201590020, // Level 78
|
||||
213045354, // Level 79
|
||||
224914653, // Level 80
|
||||
237197917 // Level 81
|
||||
|
||||
};
|
||||
|
||||
@@ -221,21 +214,9 @@ public class Experience {
|
||||
235166.21f, // Level 72
|
||||
246039.34f, // Level 73
|
||||
257240.58f, // Level 74
|
||||
268765.03f, // Level 75
|
||||
280612.69f, // Level 76
|
||||
292783.56f, // Level 77
|
||||
305277.64f, // Level 78
|
||||
318094.93f, // Level 79
|
||||
1, // Level 80
|
||||
1 // 268774.71 //Level 75
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
// Used to calcuate the amount of experience a monster grants in the
|
||||
// following formula
|
||||
// expGranted = a(moblevel)^2 + b(moblevel) + c
|
||||
@@ -287,8 +268,8 @@ public class Experience {
|
||||
if (level < 1)
|
||||
level = 1;
|
||||
|
||||
if (level > MBServerStatics.LEVELCAP)
|
||||
level = MBServerStatics.LEVELCAP;
|
||||
if (level > 75)
|
||||
level = 75;
|
||||
|
||||
return MaxExpPerLevel[level];
|
||||
}
|
||||
@@ -373,8 +354,8 @@ public class Experience {
|
||||
|
||||
if (leaderskill != null)
|
||||
leadership = leaderskill.getNumTrains();
|
||||
//if (leadership > 90)
|
||||
// leadership = 90; // leadership caps at 90%
|
||||
if (leadership > 90)
|
||||
leadership = 90; // leadership caps at 90%
|
||||
}
|
||||
|
||||
// Check every group member for distance to see if they get xp
|
||||
@@ -412,8 +393,6 @@ public class Experience {
|
||||
|
||||
// Process XP for this member
|
||||
|
||||
grantedExperience *= (1/giveEXPTo.size()+0.9);
|
||||
|
||||
penalty = getGroupMemberPenalty(leadership, playerCharacter, giveEXPTo,
|
||||
highestLevel);
|
||||
|
||||
@@ -444,14 +423,8 @@ public class Experience {
|
||||
if (grantedExperience == 0)
|
||||
grantedExperience = 1;
|
||||
|
||||
grantedExperience *= LootManager.NORMAL_EXP_RATE;
|
||||
// Grant the player the EXP
|
||||
if(mob.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (((PlayerCharacter) mob).pvpDeaths.contains(killer.getObjectUUID()) == false)
|
||||
playerCharacter.grantXP((int) Math.floor(grantedExperience), true);
|
||||
}else {
|
||||
playerCharacter.grantXP((int) Math.floor(grantedExperience), false);
|
||||
}
|
||||
playerCharacter.grantXP((int) Math.floor(grantedExperience));
|
||||
}
|
||||
|
||||
} else { // Give EXP to a single character
|
||||
@@ -462,8 +435,7 @@ public class Experience {
|
||||
return;
|
||||
|
||||
// Get XP and adjust for Mob Level with world xp modifier taken into account
|
||||
float mdofier = LOOTMANAGER.NORMAL_EXP_RATE;
|
||||
grantedExperience = maxXPPerKill(killer.getLevel());
|
||||
grantedExperience = (double) LOOTMANAGER.NORMAL_EXP_RATE * maxXPPerKill(killer.getLevel());
|
||||
grantedExperience *= getConMod(killer, mob);
|
||||
|
||||
// Modify for hotzone
|
||||
@@ -476,12 +448,7 @@ public class Experience {
|
||||
grantedExperience *= .6;
|
||||
|
||||
// Grant XP
|
||||
if(mob.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
if (((PlayerCharacter) mob).pvpDeaths.contains(killer.getObjectUUID()) == false)
|
||||
killer.grantXP((int) Math.floor(grantedExperience), true);
|
||||
}else {
|
||||
killer.grantXP((int) Math.floor(grantedExperience), false);
|
||||
}
|
||||
killer.grantXP((int) Math.floor(grantedExperience));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,9 +667,6 @@ public class Guild extends AbstractWorldObject {
|
||||
pc.incVer();
|
||||
DispatchMessage.sendToAllInRange(pc, new GuildInfoMsg(pc, Guild.getErrantGuild(), 2));
|
||||
|
||||
if(GroupManager.getGroup(pc) != null)
|
||||
GroupManager.getGroup(pc).removeGroupMember(pc);
|
||||
|
||||
}
|
||||
|
||||
public void upgradeGuildState(boolean nation) {
|
||||
@@ -733,29 +730,32 @@ public class Guild extends AbstractWorldObject {
|
||||
|
||||
public boolean canSubAGuild(Guild toSub) {
|
||||
|
||||
boolean canSubToNation;
|
||||
boolean canAcceptSub;
|
||||
boolean canSub;
|
||||
|
||||
if (this.equals(toSub))
|
||||
return false;
|
||||
switch (this.guildState) {
|
||||
case Nation:
|
||||
case Sovereign:
|
||||
canAcceptSub = true;
|
||||
canSub = true;
|
||||
break;
|
||||
default:
|
||||
canAcceptSub = false;
|
||||
canSub = false;
|
||||
}
|
||||
|
||||
switch (toSub.guildState) {
|
||||
case Errant:
|
||||
case Sovereign:
|
||||
canSubToNation = true;
|
||||
canSub = true;
|
||||
break;
|
||||
default:
|
||||
canSubToNation = false;
|
||||
canSub = false;
|
||||
}
|
||||
|
||||
return canAcceptSub && canSubToNation;
|
||||
City nationCap = City.getCity(nation.cityUUID);
|
||||
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
|
||||
canSub = false;
|
||||
}
|
||||
return canSub;
|
||||
}
|
||||
|
||||
public int getRealmsOwnedFlag() {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Item extends AbstractWorldObject {
|
||||
private short durabilityCurrent;
|
||||
private byte chargesRemaining;
|
||||
private byte equipSlot;
|
||||
public boolean canDestroy;
|
||||
private boolean canDestroy;
|
||||
private boolean rentable;
|
||||
private boolean isRandom = false;
|
||||
private int value;
|
||||
@@ -61,7 +61,7 @@ public class Item extends AbstractWorldObject {
|
||||
private ArrayList<EnchantmentBase> enchants = new ArrayList<>();
|
||||
private long dateToUpgrade;
|
||||
private String customName = "";
|
||||
public int magicValue;
|
||||
private int magicValue;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
@@ -233,6 +233,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.value = rs.getInt("item_value");
|
||||
this.customName = rs.getString("item_name");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void _serializeForClientMsg(Item item, ByteBufferWriter writer)
|
||||
@@ -665,6 +666,7 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
public static Item getFromCache(int id) {
|
||||
return (Item) DbManager.getFromCache(GameObjectType.Item, id);
|
||||
}
|
||||
@@ -887,8 +889,6 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public boolean isCanDestroy() {
|
||||
if(this.getItemBaseID() == 7)//gold
|
||||
return false;
|
||||
return canDestroy;
|
||||
}
|
||||
|
||||
@@ -1230,18 +1230,18 @@ public class Item extends AbstractWorldObject {
|
||||
return;
|
||||
|
||||
if (this.getItemBase() != null)
|
||||
for (Integer token : this.getItemBase().getBakedInStats().keySet()) {
|
||||
|
||||
effect = PowersManager.getEffectByToken(token);
|
||||
for (Integer token : this.getItemBase().getBakedInStats().keySet()) {
|
||||
|
||||
if (effect == null) {
|
||||
Logger.error("missing effect of token " + token);
|
||||
continue;
|
||||
}
|
||||
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
|
||||
apa.applyBakedInStatsForItem(this, this.getItemBase().getBakedInStats().get(token));
|
||||
effect = PowersManager.getEffectByToken(token);
|
||||
|
||||
if (effect == null) {
|
||||
Logger.error("missing effect of token " + token);
|
||||
continue;
|
||||
}
|
||||
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
|
||||
apa.applyBakedInStatsForItem(this, this.getItemBase().getBakedInStats().get(token));
|
||||
}
|
||||
}
|
||||
|
||||
public final void loadEnchantments() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -24,7 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ItemBase{
|
||||
public class ItemBase {
|
||||
|
||||
public static final byte GOLD_BASE_TYPE = 4;
|
||||
public static ItemBase GOLD_ITEM_BASE = null;
|
||||
@@ -36,10 +35,10 @@ public class ItemBase{
|
||||
private static HashMap<Integer, Integer> itemHashIDMap = new HashMap<>();
|
||||
private static HashMap<String, Integer> _IDsByNames = new HashMap<>();
|
||||
private static ArrayList<ItemBase> _resourceList = new ArrayList<>();
|
||||
private int uuid;
|
||||
private String name;
|
||||
private final int uuid;
|
||||
private final String name;
|
||||
private float durability;
|
||||
public int value;
|
||||
private int value;
|
||||
private short weight;
|
||||
private short color;
|
||||
private ItemType type;
|
||||
@@ -723,12 +722,7 @@ public class ItemBase{
|
||||
public final int getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
public void setUUID(int id) {
|
||||
this.uuid = id;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isRing() {
|
||||
return ((this.equipFlag & (64 | 128 | 192)) != 0);
|
||||
}
|
||||
@@ -922,68 +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() {
|
||||
|
||||
return new String[]{};
|
||||
}
|
||||
|
||||
public static int getPriceCeilingForRune(int runeID){
|
||||
switch(runeID){
|
||||
case 250001: //5 stats
|
||||
case 250010:
|
||||
case 250019:
|
||||
case 250028:
|
||||
case 250037:
|
||||
return 3000000;
|
||||
case 250002: //10 stats
|
||||
case 250011:
|
||||
case 250020:
|
||||
case 250029:
|
||||
case 250038:
|
||||
return 4000000;
|
||||
case 250003: //15 stats
|
||||
case 250012:
|
||||
case 250021:
|
||||
case 250030:
|
||||
case 250039:
|
||||
return 5000000;
|
||||
case 250004: //20 stats
|
||||
case 250013:
|
||||
case 250022:
|
||||
case 250031:
|
||||
case 250040:
|
||||
return 6000000;
|
||||
case 250005: //25 stats
|
||||
case 250014:
|
||||
case 250023:
|
||||
case 250032:
|
||||
case 250041:
|
||||
return 7000000;
|
||||
case 250006: //30 stats
|
||||
case 250015:
|
||||
case 250024:
|
||||
case 250033:
|
||||
case 250042:
|
||||
return 8000000;
|
||||
case 250007: //35 stats
|
||||
case 250016:
|
||||
case 250025:
|
||||
case 250034:
|
||||
case 250043:
|
||||
return 9000000;
|
||||
case 250008: //40 stats
|
||||
case 250017:
|
||||
case 250026:
|
||||
case 250035:
|
||||
case 250044:
|
||||
return 10000000;
|
||||
case 3040: //prospector
|
||||
case 3021: //traveller
|
||||
return 500000;
|
||||
}
|
||||
return 10000000;
|
||||
return (this.name.contains("Vorgrim") || this.name.contains("Bellugh") || this.name.contains("Crimson Circle"));
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user