safe NPC profits
This commit is contained in:
@@ -1435,14 +1435,13 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
bargain = 0;
|
bargain = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
float profit;
|
||||||
if(me.getItemBase().getType().equals(ItemType.POTION))
|
|
||||||
profit -= 1.0f;
|
if(npc.isInSafeZone())
|
||||||
if (profit < 1)
|
|
||||||
profit = 1;
|
|
||||||
if(ZoneManager.findSmallestZone(npc.loc) != null && ZoneManager.findSmallestZone(npc.loc).getSafeZone() == 1){
|
|
||||||
profit = 0;
|
profit = 0;
|
||||||
}
|
else
|
||||||
|
profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||||
|
|
||||||
|
|
||||||
if(profit > 0)
|
if(profit > 0)
|
||||||
cost *= profit;
|
cost *= profit;
|
||||||
|
|||||||
@@ -193,6 +193,18 @@ public class NPC extends AbstractCharacter {
|
|||||||
serializeForClientMsgOtherPlayer(npc, writer);
|
serializeForClientMsgOtherPlayer(npc, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInSafeZone() {
|
||||||
|
|
||||||
|
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
|
||||||
|
|
||||||
|
if (zone != null) {
|
||||||
|
return zone.getSafeZone() == (byte) 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
//return this.safeZone;
|
||||||
|
}
|
||||||
|
|
||||||
public static void serializeForClientMsgOtherPlayer(NPC npc, ByteBufferWriter writer)
|
public static void serializeForClientMsgOtherPlayer(NPC npc, ByteBufferWriter writer)
|
||||||
throws SerializationException {
|
throws SerializationException {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user