forked from MagicBane/Server
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9965223d9b | |||
| 08b99d0d3a | |||
| 519a6a2b1e | |||
| 524f5d470b | |||
| 6631c6a5d7 | |||
| 10f95fb0d9 | |||
| a315366026 | |||
| 1901c9a679 | |||
| 415ad5402f | |||
| 9a40e12dbc | |||
| a1af663796 | |||
| 78b7ddb32a | |||
| 5e5ee4fed1 | |||
| 84c022a39b | |||
| 300741b05a | |||
| dc685a01c6 | |||
| 752f897a34 | |||
| 722cb6b1fd | |||
| 50c095cd09 | |||
| c23546eb46 | |||
| 36340c4e52 | |||
| a7ab38f40c | |||
| 0901c03b74 | |||
| 50817352c1 | |||
| ee4a7447bc | |||
| a6d3c827ad | |||
| d4ea31b91f |
@@ -788,7 +788,9 @@ public enum PowersManager {
|
||||
//msg.setPowerUsedID(407015607);
|
||||
applyPower(playerCharacter,playerCharacter,playerCharacter.loc,429397210,msg.getNumTrains(),false);
|
||||
}
|
||||
|
||||
if(msg.getPowerUsedID() == 429494441) {//wildkins chase
|
||||
playerCharacter.removeEffectBySource(EffectSourceType.Root,40,true);
|
||||
}
|
||||
if (playerCharacter.isCasting()) {
|
||||
playerCharacter.update();
|
||||
playerCharacter.updateStamRegen(-100);
|
||||
|
||||
@@ -205,11 +205,11 @@ public class MobAI {
|
||||
mob.setLastAttackTime(System.currentTimeMillis() + attackDelay);
|
||||
}
|
||||
|
||||
if (mob.isSiege()) {
|
||||
PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
ppm.setRange(50);
|
||||
DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
}
|
||||
//if (mob.isSiege()) {
|
||||
// PowerProjectileMsg ppm = new PowerProjectileMsg(mob, target);
|
||||
// ppm.setRange(50);
|
||||
// DispatchMessage.dispatchMsgToInterestArea(mob, ppm, DispatchChannel.SECONDARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false);
|
||||
//}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage());
|
||||
|
||||
@@ -13,6 +13,8 @@ import engine.exception.FactoryBuildException;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.client.ClientConnection;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.net.client.msg.PlaceAssetMsg;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -94,11 +96,9 @@ public class NetMsgFactory {
|
||||
if (origin instanceof ClientConnection) {
|
||||
PlayerCharacter player = ((ClientConnection) origin).getPlayerCharacter();
|
||||
if (player != null) {
|
||||
// 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("Invalid protocol msg : " + opcode + " lastopcode: " + origin.lastProtocol.name() + " Error Code : " + errorCode);
|
||||
|
||||
PlaceAssetMsg.sendPlaceAssetError(player.getClientConnection(), 1, "Please Report What You Just Did. Ref Code: " + opcode);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1402,12 +1402,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
Item buy = null;
|
||||
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
||||
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
||||
if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||
sellInventory = npc.getSellInventorySteward();
|
||||
}
|
||||
if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||
sellInventory = npc.getSellInventoryBuilder();
|
||||
}
|
||||
//if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||
// sellInventory = npc.getSellInventorySteward();
|
||||
//}
|
||||
//if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||
// sellInventory = npc.getSellInventoryBuilder();
|
||||
//}
|
||||
if (sellInventory == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -274,60 +274,85 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (targetCity == null)
|
||||
return;
|
||||
|
||||
//verify level required to teleport or repledge
|
||||
|
||||
Guild toGuild = targetCity.getGuild();
|
||||
|
||||
if (toGuild != null)
|
||||
if (isTeleport) {
|
||||
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
|
||||
return;
|
||||
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
|
||||
if (targetCity == null){
|
||||
Mine mineTele = null;
|
||||
for(Mine mine : Mine.getMinesToTeleportTo(player)){
|
||||
if(mine.getObjectUUID() == msg.getCityID()){
|
||||
mineTele = mine;
|
||||
}
|
||||
}
|
||||
if(mineTele == null){
|
||||
return;
|
||||
}else {
|
||||
int time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||
msg.setTeleportTime(time);
|
||||
Building tower = Mine.getTower(mineTele);
|
||||
if (tower == null)
|
||||
return;
|
||||
Vector3fImmutable teleportLoc = Vector3fImmutable.getRandomPointOnCircle(tower.getLoc(), 10);
|
||||
ChatManager.chatSystemInfo(player, "You Will Teleport To " + mineTele.getParentZone().getParent().getName() + "'s Mine In " + time + " Seconds.");
|
||||
if (time > 0) {
|
||||
//TODO add timer to teleport
|
||||
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//finish porting to a city
|
||||
//verify level required to teleport or repledge
|
||||
|
||||
boolean joinedGuild = false;
|
||||
Guild toGuild = targetCity.getGuild();
|
||||
|
||||
//if repledge, reguild the player
|
||||
if (toGuild != null)
|
||||
if (isTeleport) {
|
||||
if (player.getLevel() < toGuild.getTeleportMin() || player.getLevel() > toGuild.getTeleportMax())
|
||||
return;
|
||||
} else if (player.getLevel() < toGuild.getRepledgeMin() || player.getLevel() > toGuild.getRepledgeMax())
|
||||
return;
|
||||
|
||||
if (!isTeleport)
|
||||
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
|
||||
boolean joinedGuild = false;
|
||||
|
||||
int time;
|
||||
//if repledge, reguild the player
|
||||
|
||||
if (!isTeleport) //repledge
|
||||
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
|
||||
else
|
||||
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||
if (!isTeleport)
|
||||
joinedGuild = GuildManager.joinGuild(player, targetCity.getGuild(), targetCity.getObjectUUID(), GuildHistoryType.JOIN);
|
||||
|
||||
//resend message
|
||||
msg.setTeleportTime(time);
|
||||
int time;
|
||||
|
||||
if ((!isTeleport && joinedGuild) || (isTeleport)) {
|
||||
if (!isTeleport) //repledge
|
||||
time = MBServerStatics.REPLEDGE_TIME_IN_SECONDS;
|
||||
else
|
||||
time = MBServerStatics.TELEPORT_TIME_IN_SECONDS;
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
//resend message
|
||||
msg.setTeleportTime(time);
|
||||
|
||||
if ((!isTeleport && joinedGuild) || (isTeleport)) {
|
||||
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
//teleport player to city
|
||||
|
||||
Vector3fImmutable teleportLoc;
|
||||
|
||||
if (targetCity.getTOL().getRank() == 8)
|
||||
teleportLoc = targetCity.getTOL().getStuckLocation();
|
||||
else
|
||||
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||
|
||||
if (time > 0) {
|
||||
//TODO add timer to teleport
|
||||
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||
} else if (joinedGuild) {
|
||||
player.teleport(teleportLoc);
|
||||
player.setSafeMode();
|
||||
}
|
||||
}
|
||||
|
||||
//teleport player to city
|
||||
|
||||
Vector3fImmutable teleportLoc;
|
||||
|
||||
if (targetCity.getTOL().getRank() == 8)
|
||||
teleportLoc = targetCity.getTOL().getStuckLocation();
|
||||
else
|
||||
teleportLoc = Vector3fImmutable.getRandomPointOnCircle(targetCity.getTOL().getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
|
||||
|
||||
if (time > 0) {
|
||||
//TODO add timer to teleport
|
||||
TeleportJob tj = new TeleportJob(player, npc, teleportLoc, origin, true);
|
||||
JobScheduler.getInstance().scheduleJob(tj, time * 1000);
|
||||
} else if (joinedGuild) {
|
||||
player.teleport(teleportLoc);
|
||||
player.setSafeMode();
|
||||
}
|
||||
}
|
||||
|
||||
private static PowersBase getPowerforHermit(NPC npc) {
|
||||
|
||||
@@ -169,6 +169,8 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
valid = true;
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3028 && (raceID == 2013 || raceID == 2014) && playerCharacter.getBaseClassID() == 2501)
|
||||
valid = true;
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,12 +112,12 @@ public class BuyFromNPCWindowMsg extends ClientNetMsg {
|
||||
|
||||
if (contract != null)
|
||||
sellInventory = contract.getSellInventory();
|
||||
if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||
sellInventory = npc.getSellInventorySteward();
|
||||
}
|
||||
if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||
sellInventory = npc.getSellInventoryBuilder();
|
||||
}
|
||||
//if(npc.contract.getObjectUUID() == 890){ // default steward
|
||||
// sellInventory = npc.getSellInventorySteward();
|
||||
// }
|
||||
//if(npc.contract.getObjectUUID() == 889){ // default builder
|
||||
// sellInventory = npc.getSellInventoryBuilder();
|
||||
// }
|
||||
}
|
||||
|
||||
if (man != null)
|
||||
|
||||
@@ -16,7 +16,9 @@ import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.Protocol;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -24,6 +26,7 @@ import java.util.ArrayList;
|
||||
public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
|
||||
ArrayList<City> cities;
|
||||
ArrayList<Mine> mines;
|
||||
private PlayerCharacter player;
|
||||
private boolean isTeleport;
|
||||
|
||||
@@ -77,10 +80,19 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
|
||||
public void configure() {
|
||||
|
||||
if (isTeleport)
|
||||
if (isTeleport) {
|
||||
cities = City.getCitiesToTeleportTo(player);
|
||||
else
|
||||
try {
|
||||
mines = Mine.getMinesToTeleportTo(player);
|
||||
if(mines == null)
|
||||
mines = new ArrayList<>();
|
||||
}catch(Exception e){
|
||||
Logger.error("Unable To Load Mines For Teleport: " + e.getMessage());
|
||||
}
|
||||
}else {
|
||||
cities = City.getCitiesToRepledgeTo(player);
|
||||
mines = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,10 +108,14 @@ public class TeleportRepledgeListMsg extends ClientNetMsg {
|
||||
for (int i = 0; i < 3; i++)
|
||||
writer.putInt(0);
|
||||
|
||||
writer.putInt(cities.size());
|
||||
writer.putInt(cities.size() + mines.size());
|
||||
|
||||
for (City city : cities)
|
||||
City.serializeForClientMsg(city, writer);
|
||||
|
||||
for(Mine mine : mines)
|
||||
Mine.serializeForClientMsgTeleport(mine, writer);
|
||||
|
||||
}
|
||||
|
||||
public PlayerCharacter getPlayer() {
|
||||
|
||||
@@ -1056,6 +1056,7 @@ public class CharacterItemManager {
|
||||
// add to Bank
|
||||
this.bank.add(i);
|
||||
i.addToCache();
|
||||
i.stripCastableEnchants();
|
||||
|
||||
calculateWeights();
|
||||
|
||||
@@ -1204,6 +1205,7 @@ public class CharacterItemManager {
|
||||
|
||||
calculateWeights();
|
||||
|
||||
i.stripCastableEnchants();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1085,6 +1085,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.ownerID = pc.getObjectUUID();
|
||||
this.ownerType = OwnerType.PlayerCharacter;
|
||||
this.containerType = ItemContainerType.INVENTORY;
|
||||
this.stripCastableEnchants();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1105,6 +1106,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.ownerID = npc.getObjectUUID();
|
||||
this.ownerType = OwnerType.Npc;
|
||||
this.containerType = Enum.ItemContainerType.INVENTORY;
|
||||
this.stripCastableEnchants();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ public class ItemFactory {
|
||||
pi.setAmount(itemsToRoll);
|
||||
pi.setRandom(false);
|
||||
|
||||
ItemQueue produced = ItemQueue.borrow(pi, (long) (time * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue())));
|
||||
ItemQueue produced = ItemQueue.borrow(pi, (long) time);
|
||||
ItemProductionManager.send(produced);
|
||||
|
||||
return ml;
|
||||
@@ -410,7 +410,7 @@ public class ItemFactory {
|
||||
|
||||
if (overdraft > 0 && !useWarehouse) {
|
||||
if (pc != null)
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough gold in building strongbox." + ib.getName());
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "Not enough gold in building strongbox. " + ib.getName());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -936,7 +936,7 @@ public class ItemFactory {
|
||||
|
||||
//calculate gold costs and remove from the warehouse
|
||||
if (prefix != null || suffix != null) {
|
||||
int costToCreate = (int) (ib.getBaseValue() + ib.getBaseValue() * .10f);
|
||||
int costToCreate = ib.getBaseValue();
|
||||
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, costToCreate);
|
||||
int overdraft = BuildingManager.GetOverdraft(forge, costToCreate);
|
||||
|
||||
|
||||
@@ -319,6 +319,17 @@ public class Mine extends AbstractGameObject {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ArrayList<Mine> getMinesToTeleportTo(PlayerCharacter player) {
|
||||
ArrayList<Mine> mines = new ArrayList<>();
|
||||
for(Mine mine : Mine.getMines())
|
||||
if(!mine.isActive)
|
||||
if(mine.getOwningGuild() != null)
|
||||
if(mine.getOwningGuild().getNation().equals(player.getGuild().getNation()))
|
||||
mines.add(mine);
|
||||
|
||||
return mines;
|
||||
}
|
||||
|
||||
public boolean changeProductionType(Resource resource) {
|
||||
if (!this.validForMine(resource))
|
||||
return false;
|
||||
@@ -418,7 +429,7 @@ public class Mine extends AbstractGameObject {
|
||||
writer.putInt(this.getModifiedProductionAmount());
|
||||
writer.putInt(this.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
writer.putInt(3600); //window in seconds
|
||||
writer.putInt(this.isExpansion() ? this.mineType.xpacHash : this.mineType.hash);
|
||||
writer.putInt(this.mineType.hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -661,4 +672,134 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
_playerMemory.removeAll(toRemove);
|
||||
}
|
||||
public static Building getTower(Mine mine){
|
||||
Building tower = BuildingManager.getBuildingFromCache(mine.buildingID);
|
||||
if(tower != null)
|
||||
return tower;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public static void serializeForClientMsgTeleport(Mine mine, ByteBufferWriter writer) {
|
||||
AbstractCharacter guildRuler;
|
||||
Guild rulingGuild;
|
||||
Guild rulingNation;
|
||||
java.time.LocalDateTime dateTime1900;
|
||||
|
||||
// Cities aren't a mine without a TOL. Time to early exit.
|
||||
// No need to spam the log here as non-existant TOL's are indicated
|
||||
// during bootstrap routines.
|
||||
Building tower = Mine.getTower(mine);
|
||||
if (tower == null) {
|
||||
|
||||
Logger.error("NULL TOWER FOR " + mine.zoneName + " mine");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Assign mine owner
|
||||
|
||||
if (tower.getOwner() != null)
|
||||
guildRuler = tower.getOwner();
|
||||
else
|
||||
guildRuler = null;
|
||||
|
||||
// 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();
|
||||
|
||||
rulingNation = rulingGuild.getNation();
|
||||
|
||||
// Begin Serialzing soverign guild data
|
||||
writer.putInt(mine.getObjectType().ordinal());
|
||||
writer.putInt(mine.getObjectUUID());
|
||||
writer.putString(mine.zoneName + " Mine");
|
||||
writer.putInt(rulingGuild.getObjectType().ordinal());
|
||||
writer.putInt(rulingGuild.getObjectUUID());
|
||||
|
||||
writer.putString(rulingGuild.getName());
|
||||
writer.putString("");
|
||||
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((byte)0);
|
||||
|
||||
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);
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
// Serialize nation name
|
||||
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString("None");
|
||||
else
|
||||
writer.putString(rulingNation.getName());
|
||||
|
||||
writer.putInt(1);
|
||||
|
||||
writer.putInt(0xFFFFFFFF);
|
||||
|
||||
writer.putInt(0);
|
||||
|
||||
if (rulingNation.isEmptyGuild())
|
||||
writer.putString(" ");
|
||||
else
|
||||
writer.putString(Guild.GetGL(rulingNation).getFirstName() + ' ' + Guild.GetGL(rulingNation).getLastName());
|
||||
|
||||
writer.putLocalDateTime(LocalDateTime.now());
|
||||
|
||||
if(tower != null) {
|
||||
writer.putFloat(tower.loc.x);
|
||||
writer.putFloat(tower.loc.y);
|
||||
writer.putFloat(tower.loc.z);
|
||||
} else{
|
||||
writer.putFloat(0);
|
||||
writer.putFloat(0);
|
||||
writer.putFloat(0);
|
||||
}
|
||||
writer.putInt(0);
|
||||
|
||||
writer.put((byte) 1);
|
||||
writer.put((byte) 0);
|
||||
writer.putInt(0x64);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
writer.put((byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1694,6 +1694,16 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.defenseRating = (short) this.mobBase.getDefense();
|
||||
}
|
||||
// calculate defense for equipment
|
||||
|
||||
if(this.isDropper || Mob.discDroppers.contains(this)){
|
||||
this.defenseRating *= 2;
|
||||
this.atrHandOne *= 2;
|
||||
this.atrHandTwo *= 2;
|
||||
this.minDamageHandOne *= 2;
|
||||
this.minDamageHandTwo *= 2;
|
||||
this.maxDamageHandOne *= 2;
|
||||
this.maxDamageHandTwo *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetDefense(int defense, Mob mob){
|
||||
@@ -2060,6 +2070,9 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
if(this.isDropper){
|
||||
this.setLevel((short)65);
|
||||
this.setResists(new Resists("Dropper"));
|
||||
this.atrHandOne *= 2;
|
||||
this.atrHandTwo *= 2;
|
||||
|
||||
}
|
||||
try {
|
||||
if (this.equipmentSetID != 0)
|
||||
|
||||
@@ -2048,7 +2048,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
public void respawn(boolean setAlive, boolean enterWorld, boolean makeCorpse) {
|
||||
|
||||
// Recalculate everything
|
||||
|
||||
if(this.timestamps.containsKey("DeathTime"))
|
||||
this.timestamps.remove("DeathTime");
|
||||
|
||||
this.recalculatePlayerStats(true);
|
||||
this.setCombat(false);
|
||||
@@ -4815,43 +4816,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (sourcePlayer == null)
|
||||
return;
|
||||
|
||||
if (sourcePlayer.isAlive()) {
|
||||
Logger.error("Player " + sourcePlayer.getObjectUUID() + " respawning while alive");
|
||||
return;
|
||||
}
|
||||
// ResetAfterDeath player
|
||||
sourcePlayer.respawnLock.writeLock().lock();
|
||||
try {
|
||||
sourcePlayer.respawn(true, false, true);
|
||||
sourcePlayer.getClientConnection().disconnect();
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
} finally {
|
||||
sourcePlayer.respawnLock.writeLock().unlock();
|
||||
|
||||
}
|
||||
RespawnMsg msg = new RespawnMsg();
|
||||
// Echo ResetAfterDeath message back
|
||||
msg.setPlayerHealth(sourcePlayer.getHealth());
|
||||
// TODO calculate any experience loss before this point
|
||||
msg.setPlayerExp(sourcePlayer.getExp() + sourcePlayer.getOverFlowEXP());
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
MoveToPointMsg moveMsg = new MoveToPointMsg();
|
||||
moveMsg.setPlayer(sourcePlayer);
|
||||
moveMsg.setStartCoord(sourcePlayer.getLoc());
|
||||
moveMsg.setEndCoord(sourcePlayer.getLoc());
|
||||
moveMsg.setInBuilding(-1);
|
||||
moveMsg.setUnknown01(-1);
|
||||
|
||||
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
|
||||
|
||||
MovementManager.sendRWSSMsg(sourcePlayer);
|
||||
|
||||
// refresh the whole group with what just happened
|
||||
JobScheduler.getInstance().scheduleJob(new RefreshGroupJob(sourcePlayer), MBServerStatics.LOAD_OBJECT_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -4860,7 +4826,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (this.updateLock.writeLock().tryLock()) {
|
||||
try {
|
||||
|
||||
if (!this.isAlive()) {
|
||||
if (!this.isAlive() && this.isEnteredWorld()) {
|
||||
if(!this.timestamps.containsKey("DeathTime")){
|
||||
this.timestamps.put("DeathTime",System.currentTimeMillis());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user