Gptaqbc new stuff 6 (#328)

* Some stuff on weight

Some stuff on weight

* Cleaned some code related to trading and fixed most likely the issue where the player stays busy and cant trade till relog

Cleaned some code related to trading and fixed most likely the issue where the player stays busy and cant trade till relog

* removed a shitload of '== true'

I did a search and replace but I manually checked the changes that were made so there shouldn't be any issue with that.

* Fixed drop issue

* Fixed duel arena, changed some chat message so they are all the same, changed Additem

Fixed duel arena:
> 98% completed duel (the winning duel sound is still missing)
> Added forfeiting
> Added checks to prevent tbing, teleothers, teleport and logout from duel
> Remove the check for same IP to disable duel

Item Assistant:
> Changed the AddItem method so it now drops items on the ground if inventory is full

Cleaned some stuff while I was at it...

* Update ItemAssistant.java

Oupsie

* Resolving my issues

* Allow walking during movement

* Why won't commit work

Co-authored-by: Gptaqbc <56596815+Gptaqbc@users.noreply.github.com>
This commit is contained in:
Daniel Ginovker
2019-12-26 00:33:18 -05:00
committed by GitHub
parent e8685c97d0
commit 43a0f3e9f1
32 changed files with 80 additions and 41 deletions
@@ -160,7 +160,7 @@ public class GlobalDropsHandler {
}
if (player.getItemAssistant().freeSlots() < 1) {
if (!(player.getItemAssistant().playerHasItem(player.pItemId) && player.getItemAssistant().isStackable(player.pItemId))) {
player.getPacketSender().sendMessage("Not enough inventory space...");
player.getPacketSender().sendMessage("Not enough space in your inventory.");
return;
}
}
@@ -33,6 +33,7 @@ public class ItemHandler {
ItemList[i] = null;
}
loadItemList("item.cfg");
loadItemPrices("prices.txt");
}
/**
@@ -327,6 +328,22 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
ItemList[slot] = newItemList;
}
public void loadItemPrices(String filename) {
try {
@SuppressWarnings("resource")
Scanner s = new Scanner(new File("./data/cfg/" + filename));
while (s.hasNextLine()) {
String[] line = s.nextLine().split(" ");
ItemList temp = getItemList(Integer.parseInt(line[0]));
if (temp != null) {
temp.ShopValue = Integer.parseInt(line[1]);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public ItemList getItemList(int i) {
for (com.rebotted.game.items.ItemList element : ItemList) {
if (element != null) {
@@ -359,7 +376,7 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
Misc.println(FileName + ": error loading file.");
// return false;
}
while (!EndOfFile && line != null) {
while (EndOfFile == false && line != null) {
line = line.trim();
int spot = line.indexOf("=");
if (spot > -1) {