|
|
|
@ -29,7 +29,10 @@ import engine.server.world.WorldServer; |
|
|
|
import engine.session.Session; |
|
|
|
import engine.session.Session; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
import java.util.Iterator; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
public enum ChatManager { |
|
|
|
public enum ChatManager { |
|
|
|
|
|
|
|
|
|
|
|
@ -186,53 +189,6 @@ public enum ChatManager { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(text.startsWith("./junk")){ |
|
|
|
|
|
|
|
//junk command
|
|
|
|
|
|
|
|
PlayerCharacter pc = (PlayerCharacter)player; |
|
|
|
|
|
|
|
for(Item i : pc.getCharItemManager().getInventory()){ |
|
|
|
|
|
|
|
ItemBase ib = i.getItemBase(); |
|
|
|
|
|
|
|
if(ib.isGlass() || ib.getType().equals(Enum.ItemType.CONTRACT) || ib.isVorg() || ib.getType().equals(Enum.ItemType.RUNE) |
|
|
|
|
|
|
|
|| ib.getType().equals(Enum.ItemType.SCROLL) || ib.getType().equals(Enum.ItemType.POTION) || ib.getType().equals(Enum.ItemType.RESOURCE) |
|
|
|
|
|
|
|
|| ib.getType().equals(Enum.ItemType.OFFERING) || ib.getType().equals(Enum.ItemType.REALMCHARTER)) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int value = ib.getBaseValue(); |
|
|
|
|
|
|
|
if(pc.getCharItemManager().getGoldInventory().getNumOfItems() + value > MBServerStatics.PLAYER_GOLD_LIMIT) |
|
|
|
|
|
|
|
continue; // cannot hold gold value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pc.getCharItemManager().addGoldToInventory(value,false); |
|
|
|
|
|
|
|
pc.getCharItemManager().junk(i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pc.getCharItemManager().updateInventory(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(text.startsWith("./stackresources")){ |
|
|
|
|
|
|
|
HashMap<Integer,Integer> resources = new HashMap<>(); |
|
|
|
|
|
|
|
PlayerCharacter pc = (PlayerCharacter)player; |
|
|
|
|
|
|
|
for(Item i : pc.getCharItemManager().getInventory()){ |
|
|
|
|
|
|
|
ItemBase ib = i.getItemBase(); |
|
|
|
|
|
|
|
if(ib.getType().equals(Enum.ItemType.RESOURCE)){ |
|
|
|
|
|
|
|
if(resources.containsKey(ib.getUUID())){ |
|
|
|
|
|
|
|
//already logged this resource, add to count
|
|
|
|
|
|
|
|
int count = resources.get(ib.getUUID()); |
|
|
|
|
|
|
|
count += i.getNumOfItems(); |
|
|
|
|
|
|
|
resources.put(ib.getUUID(),count); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
//have not logged this resource yet
|
|
|
|
|
|
|
|
resources.put(ib.getUUID(),i.getNumOfItems()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pc.getCharItemManager().junk(i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for(int id : resources.keySet()){ |
|
|
|
|
|
|
|
ItemBase ib = ItemBase.getItemBase(id); |
|
|
|
|
|
|
|
MobLoot ml = new MobLoot(pc,ib,resources.get(id),false); |
|
|
|
|
|
|
|
Item i = ml.promoteToItem(pc); |
|
|
|
|
|
|
|
pc.getCharItemManager().addItemToInventory(i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pc.getCharItemManager().updateInventory(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ChatManager.isDevCommand(text) == true) { |
|
|
|
if (ChatManager.isDevCommand(text) == true) { |
|
|
|
ChatManager.processDevCommand(player, text); |
|
|
|
ChatManager.processDevCommand(player, text); |
|
|
|
return; |
|
|
|
return; |
|
|
|
|