gt: 				case WISDOM: //15
context: package org.reunionemu.jreunion.game;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Vector;
  
  import org.reunionemu.jcommon.ParsedItem;
  import org.reunionemu.jreunion.dao.QuestStateBaseDao;
  import org.reunionemu.jreunion.events.Event;
  import org.reunionemu.jreunion.events.EventListener;
  import org.reunionemu.jreunion.events.client.ClientDisconnectEvent;
  import org.reunionemu.jreunion.events.client.ClientEvent.ClientFilter;
  import org.reunionemu.jreunion.events.map.ItemPickupEvent;
  import org.reunionemu.jreunion.events.map.PlayerLogoutEvent;
  import org.reunionemu.jreunion.events.network.NetworkAcceptEvent;
  import org.reunionemu.jreunion.events.session.SessionEvent;
  import org.reunionemu.jreunion.game.Equipment.Slot;
  import org.reunionemu.jreunion.game.items.equipment.Armor;
  import org.reunionemu.jreunion.game.items.pet.PetEgg;
  import org.reunionemu.jreunion.game.quests.QuestState;
  import org.reunionemu.jreunion.model.Quest;
  import org.reunionemu.jreunion.server.Client;
  import org.reunionemu.jreunion.server.Client.State;
  import org.reunionemu.jreunion.server.DatabaseUtils;
  import org.reunionemu.jreunion.server.LocalMap;
  import org.reunionemu.jreunion.server.PacketFactory.Type;
  import org.reunionemu.jreunion.server.PacketParser;
  import org.reunionemu.jreunion.server.Reference;
  import org.reunionemu.jreunion.server.Server;
  import org.reunionemu.jreunion.server.Session;
  import org.reunionemu.jreunion.server.SessionList;
  import org.reunionemu.jreunion.server.Tools;
  import org.reunionemu.jreunion.server.beans.SpringApplicationContext;
  import org.slf4j.LoggerFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Configurable;
  
  /**
   * @author Aidamina
   * @license http://reunion.googlecode.com/svn/trunk/license.txt
   */
  @Configurable
  public abstract class Player extends LivingObject implements EventListener {
  
  	private long defense = 0;
  
  	private Map<Skill, Integer> skills = new HashMap<Skill, Integer>();
  
  	private long totalExp;
  
  	private long lvlUpExp;
  
  	private long lime; // Gold
  
  	private int slot;
  	
  	@Autowired
  	QuestStateBaseDao<QuestState> questStateDao;
  
  	private int petId; //used during server loading
  
  	private Pet pet;
  
  	public int playerId = -1 ; //id used for database storage
  
  	private boolean isInCombat; // 0 - Peace Mode; 1 - Attack Mode
  
  	private long strength;
  
  	private long wisdom;
  
  	private long dexterity;
  
  	private long constitution;
  
  	private long leadership;
  
  	private Sex sex; // 0 - Male; 1 - Female
  
  	private long speed;
  
  	private long statusPoints;
  
  	private Inventory inventory;
  
  	private long penaltyPoints;
  
  	private long adminState; // 0 - normal user; 255 - SuperGM
  
  	private Session playerSession;
  
  	private long hairStyle;
  
  	private Equipment equipment;
  
  	private List<Long> attackQueue = new Vector<Long>();
  
  	private QuickSlotBar quickSlotBar;
  
  	private QuestState questState;
  
  	private Stash stash;
  
  	private Exchange exchange;
  
  	private long guildId;
  
  	private long guildLevel;
  
  	private Client client;
  
  	private String requestedToGuild;
  
  	private Party party;
  
  	private long mana;
  
  	private long electricity;
  
  	private long stamina;
  
  	private String guildName;
  
  	private Shop shop;
  
  	private long social;
  
  	public Player(Client client) {
  		super();
  		this.setClient(client);
  		client.setPlayer(this);
  		inventory = new Inventory();
  		equipment = new Equipment(this);
  		quickSlotBar = new QuickSlotBar(this);
  		stash = new Stash(this);
  		exchange = new Exchange(this);
  
  		client.addEventListener(ClientDisconnectEvent.class, this, new ClientFilter(client));
  
  	}
  
  	public int getPlayerId() {
  		return playerId;
  	}
  
  	public void setPlayerId(int playerId) {
  		this.playerId = playerId;
  	}
  
  	public int getSlot() {
  		return slot;
  	}
  
  	public void setSlot(int slot) {
  		this.slot = slot;
  	}
  
  	public static enum Sex{
  		MALE, //0
  		FEMALE	//1
  	}
  
  	public static enum Race{
  		BULKAN(0), //0
  		KAILIPTON(1), //1
  		AIDIA(2), //2
  		HUMAN(3), //3
  		HYBRIDER(4), //4
  		PET(5), //5
  		UNDEFINED(6); //6
  
  		int value;
  		Race(int value){
  			this.value = value;
  
  		}
  		public int value(){
  			return value;			
  
  		}
  
  		public static Race byValue(int raceId){
  
  			for(Race race:Race.values())
  			{
  				if(race.value()==raceId){					
  					return race;
  				}
  			}
  			return null;
  		}		
  	}
  
  	public Client getClient() {
  		return client;
  	}
  
  	public void setClient(Client client) {
  		this.client = client;
  	}
  
  	private static Integer sessionRadius;
  
  	public String getGuildRequestName()
  	{
  		return requestedToGuild;
  	}
  
  	public void setGuildRequestName(String name)
  	{
  		this.requestedToGuild = name;
  	}
  
  	public void addAttack(long attack) {
  		if (attackQueue.size() >= 5) {
  			attackQueue.remove(0);
  		}
  		attackQueue.add(attack);
  	}
  
  	public void clearAttackQueue() {
  		attackQueue.clear();
  	}
  
  	/****** Manages the Item Drop ******/
  	public void dropItem(int playerId) {
  
  		HandPosition handPosition = getInventory().getHoldingItem();
  
  		if (handPosition == null) {
  			LoggerFactory.getLogger(Player.class).error("Failed to get Player "+this+" holding item (HandPosition=NULL)");
  			return;
  		}
  
  		Item<?> item = handPosition.getItem();
  
  		if (item == null) {
  			LoggerFactory.getLogger(Player.class).error("Failed to get Player "+this+" holding item (Item=NULL)");
  			return;
  		}
  
  		LocalMap map = getPosition().getLocalMap();
  		RoamingItem roamingItem = map.getWorld().getCommand().dropItem(getPosition(), item, this);
  		LoggerFactory.getLogger(Player.class).info("Player "+this+" droped roaming item "+roamingItem);
  		getInventory().setHoldingItem(null);
  	}
  
  
  	public long getAdminState() {
  		return adminState;
  	}
  
  	@Override
  	public synchronized void setHp(long hp){
  		long before = this.getHp();
  		super.setHp(hp);	
  		if(before!=this.getHp())
  			this.sendStatus(Status.HP);
  	}
  
  	public void sendStatus(Status status) {
  		if(client.getState()==State.INGAME||client.getState()==State.LOADED){
  			long min=0,max=0;
  			switch (status) {
  				case HP: //0
  					min = getHp();
  					max = getMaxHp();				
  					break;
  				case MANA: //1
  					min = getMana();
  					max = getMaxMana();
  					break;
  				case STAMINA: //2
  					min = getStamina();
  					max = getMaxStamina();
  					break;
  				case ELECTRICITY: //3
  					min = getElectricity();
  					max = getMaxElectricity();
  					break;
  				case LEVEL: //4
  					min = getLevel();
  					break;
  				case LIME: //10
  					min = getLime();
  					break;
  				case TOTALEXP:
  					min = getTotalExp();
  					break;
  				case LEVELUPEXP: //12
  					min = getLevelUpExp();
  					break;
  				case STATUSPOINTS: //13
  					min = getStatusPoints();
  					break;
  				case STRENGTH: //14
  					min = getStrength();
  					break;
  