|
|
|
@ -248,7 +248,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -248,7 +248,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
Period upgradePeriod; |
|
|
|
|
int upgradePeriodInSeconds; |
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
writer.putInt(messageType); //1
|
|
|
|
@ -281,7 +281,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -281,7 +281,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
NPC npc = null; |
|
|
|
|
Mob mobA = null; |
|
|
|
|
|
|
|
|
|
if (this.targetType == GameObjectType.NPC.ordinal()){ |
|
|
|
|
if (this.targetType == GameObjectType.NPC.ordinal()) { |
|
|
|
|
|
|
|
|
|
npc = NPC.getFromCache(this.targetID); |
|
|
|
|
|
|
|
|
@ -344,7 +344,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -344,7 +344,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
profit = NPCProfits.defaultProfits; |
|
|
|
|
//adding .000000001 to match client.
|
|
|
|
|
int buyNormal = (int) ((profit.buyNormal + .000001f) * 100); |
|
|
|
|
int buyGuild = (int) ((profit.buyGuild + .000001f) *100); |
|
|
|
|
int buyGuild = (int) ((profit.buyGuild + .000001f) * 100); |
|
|
|
|
int buyNation = (int) ((profit.buyNation + .000001f) * 100); |
|
|
|
|
|
|
|
|
|
int sellNormal = (int) ((profit.sellNormal + .000001f) * 100); |
|
|
|
@ -365,7 +365,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -365,7 +365,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
//figure out number of protection slots based on building rank
|
|
|
|
|
int runemasterSlots = (2 * npc.getRank()) + 6; |
|
|
|
|
|
|
|
|
|
writer.putInt( runemasterSlots); |
|
|
|
|
writer.putInt(runemasterSlots); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 13; i++) { |
|
|
|
|
writer.putInt(0); //statics
|
|
|
|
@ -396,15 +396,15 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -396,15 +396,15 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
|
|
|
|
|
writer.putLong(0); //TODO Identify what Comp this is suppose to be.
|
|
|
|
|
if (b.getProtectionState() == ProtectionState.PENDING) |
|
|
|
|
writer.put((byte)1); |
|
|
|
|
writer.put((byte) 1); |
|
|
|
|
else |
|
|
|
|
writer.put((byte)0); |
|
|
|
|
writer.put((byte)0); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
writer.putString(b.getName()); |
|
|
|
|
writer.putInt(1);//what?
|
|
|
|
|
writer.putInt(1);//what?
|
|
|
|
|
//taxType = b.getTaxType()
|
|
|
|
|
switch(b.taxType){ |
|
|
|
|
switch (b.taxType) { |
|
|
|
|
case NONE: |
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.putInt(0); |
|
|
|
@ -419,8 +419,8 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -419,8 +419,8 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
writer.put(b.enforceKOS ? (byte)1:0); //ENFORCE KOS
|
|
|
|
|
writer.put((byte)0); //??
|
|
|
|
|
writer.put(b.enforceKOS ? (byte) 1 : 0); //ENFORCE KOS
|
|
|
|
|
writer.put((byte) 0); //??
|
|
|
|
|
writer.putInt(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -474,13 +474,13 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -474,13 +474,13 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
writer.putInt(900); |
|
|
|
|
writer.putInt((int) timeLife); //time remaining?
|
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.put((byte)0); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
writer.putString(mob.getName()); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
if (Contract.NoSlots(npc.getContract())) |
|
|
|
|
writer.putInt(0); |
|
|
|
@ -546,7 +546,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -546,7 +546,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
EffectsBase prefix = null; |
|
|
|
|
EffectsBase suffix = null; |
|
|
|
|
|
|
|
|
|
for (String effectName: effectsList){ |
|
|
|
|
for (String effectName : effectsList) { |
|
|
|
|
if (effectName.contains("PRE")) |
|
|
|
|
prefix = PowersManager.getEffectByIDString(effectName); |
|
|
|
|
if (effectName.contains("SUF")) |
|
|
|
@ -615,10 +615,9 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -615,10 +615,9 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
writer.putInt(inventory.size()); //placeholder for item cnt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Item i : inventory) { |
|
|
|
|
|
|
|
|
|
Item.serializeForClientMsgWithoutSlot(i,writer); |
|
|
|
|
Item.serializeForClientMsgWithoutSlot(i, writer); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -636,7 +635,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -636,7 +635,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
writer.putInt(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else if (this.targetType == GameObjectType.Mob.ordinal()){ |
|
|
|
|
} else if (this.targetType == GameObjectType.Mob.ordinal()) { |
|
|
|
|
|
|
|
|
|
mobA = Mob.getFromCacheDBID(this.targetID); |
|
|
|
|
if (mobA == null) { |
|
|
|
@ -644,7 +643,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -644,7 +643,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (mobA != null){ |
|
|
|
|
if (mobA != null) { |
|
|
|
|
Contract con = mobA.getContract(); |
|
|
|
|
if (con == null) { |
|
|
|
|
Logger.error("Missing contract for NPC " + this.targetID); |
|
|
|
@ -653,7 +652,7 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -653,7 +652,7 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
|
|
|
|
|
int maxSlots = 1; |
|
|
|
|
|
|
|
|
|
switch (mobA.getRank()){ |
|
|
|
|
switch (mobA.getRank()) { |
|
|
|
|
case 1: |
|
|
|
|
case 2: |
|
|
|
|
maxSlots = 1; |
|
|
|
@ -675,8 +674,8 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -675,8 +674,8 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
maxSlots = 1; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(NPC.ISGuardCaptain(mobA.getContract().getContractID()) == false){ |
|
|
|
|
maxSlots =0; |
|
|
|
|
if (NPC.ISGuardCaptain(mobA.getContract().getContractID()) == false) { |
|
|
|
|
maxSlots = 0; |
|
|
|
|
} |
|
|
|
|
writer.putInt(0); //anything other than 0 seems to mess up the client
|
|
|
|
|
writer.putInt(targetType); |
|
|
|
@ -763,27 +762,46 @@ public class ManageNPCMsg extends ClientNetMsg {
@@ -763,27 +762,46 @@ public class ManageNPCMsg extends ClientNetMsg {
|
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.putInt(1); |
|
|
|
|
writer.putInt(1); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
|
|
|
|
|
long curTime = System.currentTimeMillis() / 1000; |
|
|
|
|
long upgradeTime = mob.getTimeToSpawnSiege() / 1000; |
|
|
|
|
long upgradeTime = (mob.deathTime + (mob.spawnTime * 1000)) / 1000; |
|
|
|
|
long timeLife = upgradeTime - curTime; |
|
|
|
|
|
|
|
|
|
writer.putInt(900); |
|
|
|
|
writer.putInt(900); |
|
|
|
|
writer.putInt((int) timeLife); //time remaining?
|
|
|
|
|
if (upgradeTime * 1000 > System.currentTimeMillis()) { |
|
|
|
|
if(mob.npcOwner.isAlive()) { |
|
|
|
|
writer.put((byte) 0);//shows respawning timer
|
|
|
|
|
writer.putInt(mob.spawnTime); |
|
|
|
|
writer.putInt(mob.spawnTime); |
|
|
|
|
writer.putInt((int) timeLife); //time remaining for mob that is dead
|
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.put((byte)0); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
writer.putString(mob.getNameOverride().isEmpty() ? mob.getName() : mob.getNameOverride()); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else{ |
|
|
|
|
writer.put((byte) 0);//shows respawning timer
|
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.putInt(0); //time remaining for mob that is dead
|
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
writer.putString(mob.getNameOverride().isEmpty() ? mob.getName() : mob.getNameOverride()); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//nothing required for countdown for a mob that is alive
|
|
|
|
|
writer.put((byte) 1);//shows "Standing By"
|
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.putInt(0); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
writer.putString(mob.getNameOverride().isEmpty() ? mob.getName() : mob.getNameOverride()); |
|
|
|
|
writer.put((byte) 0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}catch(Exception e){ |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|