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.