Thread: Anti-Dupe; Not for Newbs.

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1 Anti-Dupe; Not for Newbs. *Updated Once Again!* 
    Member
    Boomer's Avatar
    Join Date
    Sep 2006
    Posts
    1,282
    Thanks given
    309
    Thanks received
    795
    Rep Power
    1111
    Important: Update Handler again . Also read the new step in the instructions marked with 2 *'s.
    Purpose: This is where you write what the whole point of your tutorial
    Yer.

    Difficulty: You rate it from 1-10 (easiest to hardest), in your opinion of its difficulty to complete
    Yer.

    Assumed Knowledge: Basically saying that the reader should know where to find certain things
    Yer.

    Server Base: The name of the server release that the tutorial was performed on
    Yer.

    Classes Modified: Just list all the classes that are going to be edited in this tutorial, assume that all of these classes are open during the tutorial
    Yer.

    Procedure
    Step 1: It would be terrific if you could just explain the gist of what is going on, but if you really deem it necessary, you can show before and after code, IN CODE TAGS. eg.

    Step 2: Organise your tutorial into steps, otherwise it is horrible to read

    Step 3: And so on...
    Yer.

    Credits: The name of the person who originally wrote the tutorial
    Yer.



    Now lets get to the good stuff yeah?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    I thought of this code to stop some client-side dupers, I am 95% sure it should work. Please leave feedback after you have added it. *Warning - Make a backup of your server even if you think your an 'advanced' coder. There make still be some tweaks. Also follow the instructions carefully!*



    /*Instructions:
    *In the methods wear, bankItem, and addItem call AntiDupe.addKnownItem.
    *In the methods remove, fromBank, and deleteItem call AntiDupe.deleteKnownItem
    *In client.java declare public AntiDupe AntiDupe = new AntiDupe(this);
    *In the methods wear, bankItem, addItem, remove, fromBank, deleteItem call AntiDupe.checkLegit
    *In the packets for using items on objects/npcs/items call AntiDupe.checkLegit
    *In the methods for highalch/lowalch also call AntiDupe.checkLegit
    **Call loadKnownItems() in the method initialize()
    */



    This would be the class son.

    Code:
    /*Designed and Created by Boomer*/
    /*Instructions:
    	*In the methods wear, bankItem, and addItem call AntiDupe.addKnownItem.
    	*In the methods remove, fromBank, and deleteItem call AntiDupe.deleteKnownItem
    	*In client.java declare public AntiDupe AntiDupe = new AntiDupe(this);
    	*In the methods wear, bankItem, addItem, remove, fromBank, deleteItem call AntiDupe.checkLegit
    	*In the packets for using items on objects/npcs/items call AntiDupe.checkLegit
    	*In the methods for highalch/lowalch also call AntiDupe.checkLegit
    	**Call loadKnownItems() in the method initialize() 
    */
    /*Tips
    	*Wherever you want it to check for Dupe'd items call AntiDupe.checkLegit!
    	*Make sure to enjoy!
    */
    
    
    public class AntiDupe {
    	public void loadKnownItems() {
    		for (int i = 0; i < c.playerItems.length; i++) {
    			knownItems[c.playerItems[i]-1] += c.playerItemsN[i];
    		}
    		for (int i = 0; i < c.bankItems.length; i++) {
    			knownItems[c.bankItems[i]-1] += c.bankItemsN[i];
    		}
    		for (int i = 0; i < c.playerEquipment.length; i++) {
    			knownItems[c.playerEquipment[i]] += c.playerEquipmentN[i];
    	}
    	public int[] knownItems = new int[10000];
    	public void addKnownItem(int itemID, int itemAmount) {
    		knownItems[itemID] += itemAmount;
    	}
    	public void deleteKnownItem(int itemID, int itemAmount) {
    		knownItems[itemID] -= itemAmount;
    	}
    	public void checkLegit(int itemID) {
    		if (totalItems(itemID) > knownItems[itemID]) {
    			int itemsToDelete = (totalItems(itemID)-knownItems[itemID]);
    			for (int i = 0; i < itemsToDelete; i++) {
    				while (c.playerHasItemAmount(itemID, 1)) {
    					if (itemsToDelete == 0) {
    						return;
    					}
    					else {
    						c.deleteItem(itemID, c.getItemSlot(itemID), 1);
    						itemsToDelete--;	
    					}						
    				}
    			}
    			if (itemsToDelete > 0) {
    				for (int i = 0; i < c.bankItems.length; i++) {
    					if (c.bankItems[i]-1 == itemID) {
    						while (c.bankItemsN[i] > 0) {
    							if (itemsToDelete == 0) {
    								return;
    							}
    							else {
    								c.bankItemsN[i]--;
    								itemsToDelete--;
    							}
    						}
    					}
    				}
    			}
    			if (itemsToDelete > 0) {
    				for (int i = 0; i < c.playerEquipment.length; i++) {
    					if (c.playerEquipment[i] == itemID) {
    						while (c.playerEquipmentN > 0) {
    							if (itemsToDelete == 0) {
    								return;
    							}
    							else {
    								c.playerEquipmentN[i]--;
    								itemsToDelete--;
    							}
    						}
    					}
    				}
    			}
    			if (itemsToDelete > 0) {
    				knownItems[itemID] += itemsToDelete;
    				itemsToDelete = 0;
    			}
    			return;
    		}
    		if (totalItems(itemID) < knownItems[itemID]) {
    			knownItems[itemID] = totalItems(itemID);
    			return;
    		}
    	}
    	public int totalItems(int itemID) {
    		int tItems = 0;
    		for (int i = 0; i < c.playerEquipment.length; i++) {
    			if (c.playerEquipment[i] == itemID) {
    				tItems += c.playerEquipmentN[i];
    			}
    		}	
    		for (int i = 0; i < c.playerItems.length; i++) {
    			if (c.playerItems[i]-1 == itemID) {
    				tItems += c.playerItemsN[i];
    			}
    		}
    		for (int i = 0; i < c.bankItems.length; i++) {
    			if (c.bankItems[i]-1 == itemID) {
    				tItems += c.bankItemsN[i];
    			}
    		}
    		return tItems;
    	}
    	public AntiDupe(client c) {
    		this.c = c;
    	}
    	private client c;
    }
    Enjoy

    I haven't released anything in a while. If I don't get nice feedback I will just stop releasing stuff forever.
    Last edited by Boomer; 12-16-2007 at 09:50 AM. Reason: Update II


    Osiris ||| FightScape | InnerFantasy | PkIsle | Paragon | Enkrona | 2006Scape
     

  2. #2  
    Singod2222
    Guest
    You just Boomed my bewbs.
     

  3. #3  
    Registered Member
    Your Name's Avatar
    Join Date
    Oct 2007
    Age
    31
    Posts
    1,442
    Thanks given
    0
    Thanks received
    4
    Rep Power
    172
    i dont understand were to put it
    Find Chuck Norris



    MoparScape name = Doodooss
     

  4. #4  
    Member
    Boomer's Avatar
    Join Date
    Sep 2006
    Posts
    1,282
    Thanks given
    309
    Thanks received
    795
    Rep Power
    1111
    Quote Originally Posted by Im So Hood! View Post
    i dont understand were to put it
    Well I said it wasn't for newbs


    Osiris ||| FightScape | InnerFantasy | PkIsle | Paragon | Enkrona | 2006Scape
     

  5. #5  
    Donator

    tj007razor's Avatar
    Join Date
    Feb 2007
    Posts
    895
    Thanks given
    2
    Thanks received
    9
    Rep Power
    210
    Thanks for this, I'll probably add later.
     

  6. #6  
    Registered Member
    Your Name's Avatar
    Join Date
    Oct 2007
    Age
    31
    Posts
    1,442
    Thanks given
    0
    Thanks received
    4
    Rep Power
    172
    Quote Originally Posted by Boomer View Post
    Well I said it wasn't for newbs
    im not a newb im learning impaired lol jkin i found out were to put
    thnx for dis
    Find Chuck Norris



    MoparScape name = Doodooss
     

  7. #7  
    I Sell 07 Gold PM Me

    Join Date
    Jan 2007
    Age
    24
    Posts
    1,522
    Thanks given
    48
    Thanks received
    79
    Rep Power
    280
    Nice! ***!!
    Remember buying your first rune set with rune chain at W1 Varrock?
    Remember the excitement you got being Members for the first time?

    Want to re-live the good old days of RuneScape 2006 at its fullest?


    Then try:
    Spoiler for 2006 Old Days:


    Comes in many flavors.
     

  8. #8  
    Chrisz.13
    Guest
    nicely done i can sure help my mate with his sewrver with this
     

  9. #9  
    x19
    Guest
    Sexy release Boomer... When I can be botherd I will add.
     

  10. #10  
    × Zenzie ×
    Guest
    Quote Originally Posted by Im So Hood! View Post
    i dont understand were to put it
    [PHP]public class AntiDupe {[/PHP]

    Its a new class >.<
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •