All you're gonna wanna do if you're using Ardi's Base, or project Raw, etc. Replace these files, and add things I say to do. It Will fix most bugs and dupes. Yes, I do know ardi is a bad base because of all the glitches and stuff or whatever, But I have been working on this base for a week now, and I can say I will be releasing it very soon. Released this too help people out.
public int lastSlot = -1;
public int tradeTime;
public void activateTradeTimer() {
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer e) {
if (tradeTime > 0)
tradeTime--;
if (tradeTime <= 0)
e.stop();
}
}, 0);
}
Add these Method in ItemAssistant.java
Spoiler for Add in ItemAssistant under a method:
Code:
public boolean forceAddItem(int item, int amount) {
if (amount < 1) {
amount = 1;
}
if (item <= 0) {
return false;
}
int freeSlotId = freeSlotId();
boolean freeSlot = freeSlotId != -1;
int itemSlot = getItemSlot(item);
if (((freeSlot || itemSlot != -1) && Item.itemStackable[item])
|| ((freeSlot) && !Item.itemStackable[item])) {
if (itemSlot != -1 && Item.itemStackable[item]
&& (c.playerItems[itemSlot] == (item + 1))) {
c.playerItems[itemSlot] = (item + 1);
if (((c.playerItemsN[itemSlot] + amount) < Config.MAXITEM_AMOUNT)
&& ((c.playerItemsN[itemSlot] + amount) > -1)) {
c.playerItemsN[itemSlot] += amount;
} else {
c.sendMessage("The item has dropped because you had the maximum of that item.");
ItemHandler.createGroundItem(c, item, c.absX, c.absY,
amount, c.playerId);
return false;
}
updateInventory = true;
return true;
}
if (c.lastSlot > -1) {
if (c.playerItems[c.lastSlot] <= 0) {
c.playerItems[c.lastSlot] = item + 1;
if ((amount < Config.MAXITEM_AMOUNT) && (amount > -1)) {
c.playerItemsN[c.lastSlot] = 1;
if (amount > 1) {
c.getItems().addItem(item, amount - 1);
c.lastSlot = -1;
return true;
}
} else {
c.playerItemsN[c.lastSlot] = Config.MAXITEM_AMOUNT;
}
updateInventory = true;
c.lastSlot = -1;
return true;
}
}
if (c.playerItems[freeSlotId] > 0)
return false;
c.playerItems[freeSlotId] = item + 1;
if (amount < Config.MAXITEM_AMOUNT) {
if (Item.itemStackable[item]) {
c.playerItemsN[freeSlotId] = amount;
} else {
c.playerItemsN[freeSlotId] = 1;
if (amount > 1) {
c.getItems().addItem(item, amount - 1);
return true;
}
}
} else
c.playerItemsN[freeSlotId] = Config.MAXITEM_AMOUNT;
updateInventory = true;
return true;
} else {
c.sendMessage("The item has dropped because you had no inventory space.");
ItemHandler.createGroundItem(c, item, c.absX, c.absY, amount,
c.playerId);
return false;
}
}
Spoiler for Add these methods in itemassistant.java As well::
Code:
public int getItemCount(int itemID) {
int count = 0;
for (int j = 0; j < c.playerItems.length; j++) {
if (c.playerItems[j] == itemID + 1) {
count += c.playerItemsN[j];
}
}
return count;
}
public boolean updateInventory = false;
public void updateInventory() {
updateInventory = false;
resetItems(3214);
}
public int freeSlotId() {
for (int i = 0; i < c.playerItems.length; i++) {
if (c.playerItems[i] <= 0) {
return i;
}
}
return -1;
}
Replace this method in ClickingButtons.java
Spoiler for In clickingbuttons.java, Replace case 13218 with:
Replace case 13218 With:
Code:
case 13218:
if (c.tradeTime > 0)
return;
if (System.currentTimeMillis() - c.lastButton < 400) {
c.lastButton = System.currentTimeMillis();
break;
} else {
c.lastButton = System.currentTimeMillis();
}
c.tradeAccepted = true;
Client ot1 = (Client) PlayerHandler.players[c.tradeWith];
if (ot1 == null) {
c.getTradeAndDuel().declineTrade();
c.sendMessage("Trade declined as the other player has disconnected.");
break;
}
if (c.inTrade && c.tradeConfirmed && ot1.tradeConfirmed
&& !c.tradeConfirmed2) {
c.tradeConfirmed2 = true;
if (ot1.tradeConfirmed2) {
c.getPA().resetInterfaceStatus();
ot1.getPA().resetInterfaceStatus();
c.acceptedTrade = true;
ot1.acceptedTrade = true;
c.getTradeAndDuel().giveItems();
ot1.getTradeAndDuel().giveItems();
c.getTradeAndDuel().resetTrade();
ot1.getTradeAndDuel().resetTrade();
c.sendMessage("Trade accepted.");
ot1.sendMessage("Trade accepted.");
break;
}
ot1.getPA().sendFrame126("Other player has accepted.", 3535);
c.getPA().sendFrame126("Waiting for other player...", 3535);
}
break;
Spoiler for Walking.java Add:
Code:
if (c.inTrade) {
c.tradeTime = 20;
c.activateTradeTimer();
c.getTradeAndDuel().declineTrade();
}
In playerassistant.java, add:
Spoiler for Add In Playerassistant.java:
Code:
public void resetInterfaceStatus() {
if (c.getOutStream() != null && c != null) {
c.getPA().resetVariables();
c.getOutStream().createFrame(219);
}
}
That's it, im pretty sure. If you get any errors, post them below and I will help you.
Nice to see you're actually working on it and not only say it's shit, also resetInterfaceStatus ? I've checked some of your code and you didn't put this method
Nice to see you're actually working on it and not only say it's shit, also resetInterfaceStatus ? I've checked some of your code and you didn't put this method
Added it. If it's missing anything else, let me know, and i'll add it in.
All you're gonna wanna do if you're using Ardi's Base, or project Raw, etc. Replace these files, and add things I say to do. It Will fix most bugs and dupes. Yes, I do know ardi is a bad base because of all the glitches and stuff or whatever, But I have been working on this base for a week now, and I can say I will be releasing it very soon. Released this too help people out.
public void activateTradeTimer() {
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer e) {
if (tradeTime > 0)
tradeTime--;
if (tradeTime <= 0)
e.stop();
}
}, 0);
}
Add these Method in ItemAssistant.java
Spoiler for Add in ItemAssistant under a method:
public boolean forceAddItem(int item, int amount) {
if (amount < 1) {
amount = 1;
}
if (item <= 0) {
return false;
}
int freeSlotId = freeSlotId();
boolean freeSlot = freeSlotId != -1;
int itemSlot = getItemSlot(item);
if (((freeSlot || itemSlot != -1) && Item.itemStackable[item])
|| ((freeSlot) && !Item.itemStackable[item])) {
if (itemSlot != -1 && Item.itemStackable[item]
&& (c.playerItems[itemSlot] == (item + 1))) {
c.playerItems[itemSlot] = (item + 1);
if (((c.playerItemsN[itemSlot] + amount) < Config.MAXITEM_AMOUNT)
&& ((c.playerItemsN[itemSlot] + amount) > -1)) {
c.playerItemsN[itemSlot] += amount;
} else {
c.sendMessage("The item has dropped because you had the maximum of that item.");
ItemHandler.createGroundItem(c, item, c.absX, c.absY,
amount, c.playerId);
return false;
}
updateInventory = true;
return true;
}
if (c.lastSlot > -1) {
if (c.playerItems[c.lastSlot] <= 0) {
c.playerItems[c.lastSlot] = item + 1;
if ((amount < Config.MAXITEM_AMOUNT) && (amount > -1)) {
c.playerItemsN[c.lastSlot] = 1;
if (amount > 1) {
c.getItems().addItem(item, amount - 1);
c.lastSlot = -1;
return true;
}
} else {
c.playerItemsN[c.lastSlot] = Config.MAXITEM_AMOUNT;
}
updateInventory = true;
c.lastSlot = -1;
return true;
}
}
if (c.playerItems[freeSlotId] > 0)
return false;
c.playerItems[freeSlotId] = item + 1;
if (amount < Config.MAXITEM_AMOUNT) {
if (Item.itemStackable[item]) {
c.playerItemsN[freeSlotId] = amount;
} else {
c.playerItemsN[freeSlotId] = 1;
if (amount > 1) {
c.getItems().addItem(item, amount - 1);
return true;
}
}
} else
c.playerItemsN[freeSlotId] = Config.MAXITEM_AMOUNT;
updateInventory = true;
return true;
} else {
c.sendMessage("The item has dropped because you had no inventory space.");
ItemHandler.createGroundItem(c, item, c.absX, c.absY, amount,
c.playerId);
return false;
}
}
Spoiler for Add these methods in itemassistant.java As well::
public int getItemCount(int itemID) {
int count = 0;
for (int j = 0; j < c.playerItems.length; j++) {
if (c.playerItems[j] == itemID + 1) {
count += c.playerItemsN[j];
}
}
return count;
}
public boolean updateInventory = false;
public void updateInventory() {
updateInventory = false;
resetItems(3214);
}
public int freeSlotId() {
for (int i = 0; i < c.playerItems.length; i++) {
if (c.playerItems[i] <= 0) {
return i;
}
}
return -1;
}
Replace this method in ClickingButtons.java
Spoiler for In clickingbuttons.java, Replace case 13218 with:
Replace case 13218 With:
case 13218:
if (c.tradeTime > 0)
return;
if (System.currentTimeMillis() - c.lastButton < 400) {
c.lastButton = System.currentTimeMillis();
break;
} else {
c.lastButton = System.currentTimeMillis();
}
c.tradeAccepted = true;
Client ot1 = (Client) PlayerHandler.players[c.tradeWith];
if (ot1 == null) {
c.getTradeAndDuel().declineTrade();
c.sendMessage("Trade declined as the other player has disconnected.");
break;
}
if (c.inTrade && c.tradeConfirmed && ot1.tradeConfirmed
&& !c.tradeConfirmed2) {
c.tradeConfirmed2 = true;
if (ot1.tradeConfirmed2) {
c.getPA().resetInterfaceStatus();
ot1.getPA().resetInterfaceStatus();
c.acceptedTrade = true;
ot1.acceptedTrade = true;
c.getTradeAndDuel().giveItems();
ot1.getTradeAndDuel().giveItems();
c.getTradeAndDuel().resetTrade();
ot1.getTradeAndDuel().resetTrade();
c.sendMessage("Trade accepted.");
ot1.sendMessage("Trade accepted.");
break;
}
ot1.getPA().sendFrame126("Other player has accepted.", 3535);
c.getPA().sendFrame126("Waiting for other player...", 3535);
}
break;
Spoiler for Walking.java Add:
if (c.inTrade) {
c.tradeTime = 20;
c.activateTradeTimer();
c.getTradeAndDuel().declineTrade();
}
In playerassistant.java, add:
Spoiler for Add In Playerassistant.java:
public void resetInterfaceStatus() {
if (c.getOutStream() != null && c != null) {
c.getPA().resetVariables();
c.getOutStream().createFrame(219);
}
}
That's it, im pretty sure. If you get any errors, post them below and I will help you.