Browse Source

gold dupe prevention

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
39f7be99b0
  1. 23
      src/engine/net/client/ClientMessagePump.java
  2. 2
      src/engine/objects/PlayerCharacter.java
  3. 9
      src/engine/objects/Warehouse.java

23
src/engine/net/client/ClientMessagePump.java

@ -340,6 +340,11 @@ public class ClientMessagePump implements NetMsgHandler {
if (player == null) if (player == null)
return; return;
if(msg.getNumItems() < 1) {
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
return;//catch gold dupe for negative numbers
}
if (!NPCVaultBankRangeCheck(player, origin, "bank")) if (!NPCVaultBankRangeCheck(player, origin, "bank"))
return; return;
@ -397,6 +402,11 @@ public class ClientMessagePump implements NetMsgHandler {
if (player == null) if (player == null)
return; return;
if(msg.getNumItems() < 1) {
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
return;//catch gold dupe for negative numbers
}
if (!NPCVaultBankRangeCheck(player, origin, "bank")) if (!NPCVaultBankRangeCheck(player, origin, "bank"))
return; return;
@ -515,6 +525,11 @@ public class ClientMessagePump implements NetMsgHandler {
if (player == null) if (player == null)
return; return;
if(msg.getAmount() < 1) {
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
return;//catch gold dupe for negative numbers
}
Account account = player.getAccount(); Account account = player.getAccount();
if (account == null) if (account == null)
@ -531,6 +546,11 @@ public class ClientMessagePump implements NetMsgHandler {
if (player == null) if (player == null)
return; return;
if(msg.getAmount() < 1) {
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
return;//catch gold dupe for negative numbers
}
Account account = player.getAccount(); Account account = player.getAccount();
if (account == null) if (account == null)
@ -1871,6 +1891,9 @@ public class ClientMessagePump implements NetMsgHandler {
s = SessionManager.getSession(origin); s = SessionManager.getSession(origin);
protocolMsg = msg.getProtocolMsg(); protocolMsg = msg.getProtocolMsg();
PlayerCharacter player = ((ClientConnection) msg.getOrigin()).getPlayerCharacter();
if(player != null)
player.lastAction = System.currentTimeMillis();
switch (protocolMsg) { switch (protocolMsg) {
case SETSELECTEDOBECT: case SETSELECTEDOBECT:

2
src/engine/objects/PlayerCharacter.java

@ -177,6 +177,8 @@ public class PlayerCharacter extends AbstractCharacter {
public float ZergMultiplier = 1.0f; public float ZergMultiplier = 1.0f;
public int mineAppliedID = 0; public int mineAppliedID = 0;
public long lastAction = 0;
/** /**
* No Id Constructor * No Id Constructor
*/ */

9
src/engine/objects/Warehouse.java

@ -129,6 +129,12 @@ public class Warehouse extends AbstractWorldObject {
public static void warehouseDeposit(MerchantMsg msg, PlayerCharacter player, NPC npc, ClientConnection origin) { public static void warehouseDeposit(MerchantMsg msg, PlayerCharacter player, NPC npc, ClientConnection origin) {
if(player.lastAction + 5000 > System.currentTimeMillis()){
ChatManager.chatSystemInfo(player, "You Must Wait To Do This");
return;
}
Building warehouseBuilding; Building warehouseBuilding;
Warehouse warehouse; Warehouse warehouse;
int depositAmount; int depositAmount;
@ -140,6 +146,9 @@ public class Warehouse extends AbstractWorldObject {
return; return;
depositAmount = msg.getAmount(); depositAmount = msg.getAmount();
if(depositAmount < 1){
ChatManager.chatSystemInfo(player, "You Have Attempted To Dupe. Please Don't");
}
CharacterItemManager itemMan = player.getCharItemManager(); CharacterItemManager itemMan = player.getCharItemManager();
if (itemMan.doesCharOwnThisItem(resource.getObjectUUID()) == false) if (itemMan.doesCharOwnThisItem(resource.getObjectUUID()) == false)

Loading…
Cancel
Save