package com.backfire.room.data;

import java.util.ArrayList;
import java.util.List;

import com.backfire.arithmetic.Card;

import net.yeeyo.doudizhu.feiyu.R;


public class Player {
	//用户基本信息
	private long 	uid 				= 0;					//用户uid
	private String 	nick 				= "";					//用户昵称
	private int 	icon 				= 0;					//用户图像
	private long 	money 				= 0;					//用户金币
	private int 	level 				= 0;					//用户等级
	private int 	sex 				= 0;					//用户性别
	private ArrayList<Integer> items 	= null;					//用户道具
	private int 	gameCount 			= 0;					//游戏场数
	private int 	winCount 			= 0;					//胜利场数
	private int 	dropCount 			= 0;					//掉线次数
	private int 	runCount 			= 0;					//逃跑次数
	private String  sign				= "";
	
	//游戏相关数据
	private int 	seatId 				= 0;					//用户座位
	private boolean isDeposit			= false;				//是否托管
	private boolean isReady				= false;				//是否准备
	
	private int 	operateAction		=0;						//操作action
	
	private int 	state 				= 0;					//用户当前操作： 1准备，2抢庄，3不抢庄，4出牌（要），5出牌（不要）
	private int     cardNum				= 0;					//持有牌的数量
	private int 	action				= 0;					//用户动作(出牌，表情等)
	
	private int 	faceId				= 0;					//目前发送的表情

	//结算相关数据
	private long	winMoney 			= 0;					//赢得金钱
	private boolean win    			= false; 					//是否是胜利方
	private int 	side    			= 0; 					//0代表没有角色，1代表地主，2代表农民
	private int 	winRatio    		= 0; 					//翻倍数
	private int 	bombs    			= 0; 					//炸弹数
	private int 	spring    			= 0; 					//春天数
	private int 	reward    			= 0; 					//活动奖励
	private long 	lottery				= 0;					//用户剩余彩券数
	private long 	winLottery			= 0;					//用户赢彩券数
	private ArrayList<Card>	limitedCards= null;					//牌局结束后剩余牌
	
	public Player(){
		items = new ArrayList<Integer>();
		limitedCards = new ArrayList<Card>();
	}
	
	//每局结束后调用
	public void clear(){
		//游戏相关数据
		seatId 				= 0;					//用户座位
		isDeposit			= false;				//是否托管
		isReady				= false;
		operateAction		=0;
		state 				= 0;
		cardNum				= 0;					//持有牌的数量
		action				=0;
		//结算相关数据
		winMoney 			= 0;					//赢得金钱
		win    				= false; 				//胜利方 1地主 2农民
		winRatio    		= 0; 					//翻倍数
		bombs    			= 0; 					//炸弹数
		spring    			= 0; 					//春天数
		reward    			= 0; 					//活动奖励
		if(limitedCards!=null){
			limitedCards.clear();
			limitedCards = null;
		}
	}
	
	//退出房间时调用
	public void clearAll(){
		//用户基本信息
		uid 				= 0;					//用户uid
		nick 				= null;					//用户昵称
		icon 				= 0;					//用户图像
		money 				= 0;					//用户金币
		level 				= 0;					//用户等级
		sex 				= 0;					//用户性别
		sign				= null;
		//用户道具
		if(items!=null){
			items.clear();
			items = null;
		}
		gameCount 			= 0;					//游戏场数
		winCount 			= 0;					//胜利场数
		dropCount 			= 0;					//掉线次数
		runCount 			= 0;					//逃跑次数
		
		//游戏相关数据
		seatId 				= 0;					//用户座位
		isDeposit			= false;				//是否托管
		isReady				= false;
		operateAction		=0;
		state 				= 0;
		cardNum				= 0;					//持有牌的数量
		action				= 0;
		
		//结算相关数据
		winMoney 			= 0;					//赢得金钱
		win					= false;
		winRatio    		= 0; 					//翻倍数
		bombs    			= 0; 					//炸弹数
		spring    			= 0; 					//春天数
		reward    			= 0; 					//活动奖励
		if(limitedCards!=null){
			limitedCards.clear();
			limitedCards = null;
		}
	}
	
	public long getUid() {
		return uid;
	}
	public void setUid(long uid) {
		this.uid = uid;
	}
	public String getNick() {
		return nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}
	public int getIcon() {
		if(icon<=0)icon=R.drawable.user_icon_1;
		return icon;
	}
	public void setIcon(int icon) {
		this.icon = icon;
	}
	public long getMoney() {
		return money;
	}
	public void setMoney(long money) {
		this.money = money;
	}
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
	public int getSex() {
		return sex;
	}
	public void setSex(int sex) {
		this.sex = sex;
	}
	public ArrayList<Integer> getItems() {
		return items;
	}
	public void setItems(List<Integer> items) {
		this.items = (ArrayList<Integer>)items;
	}
	public int getGameCount() {
		return gameCount;
	}
	public void setGameCount(int gameCount) {
		this.gameCount = gameCount;
	}
	public int getWinCount() {
		return winCount;
	}
	public void setWinCount(int winCount) {
		this.winCount = winCount;
	}
	public int getDropCount() {
		return dropCount;
	}
	public void setDropCount(int dropCount) {
		this.dropCount = dropCount;
	}
	public int getRunCount() {
		return runCount;
	}
	public void setRunCount(int runCount) {
		this.runCount = runCount;
	}
	public int getSeatId() {
		return seatId;
	}
	public void setSeatId(int seatId) {
		this.seatId = seatId;
	}
	public boolean isDeposit() {
		return isDeposit;
	}
	public void setDeposit(boolean isDeposit) {
		this.isDeposit = isDeposit;
	}
	public long getWinMoney() {
		return winMoney;
	}
	public void setWinMoney(long winMoney) {
		this.winMoney = winMoney;
	}
	
	public int getWinRatio() {
		return winRatio;
	}
	public void setWinRatio(int winRatio) {
		this.winRatio = winRatio;
	}
	public int getBombs() {
		return bombs;
	}
	public void setBombs(int bombs) {
		this.bombs = bombs;
	}
	public int getSpring() {
		return spring;
	}
	public void setSpring(int spring) {
		this.spring = spring;
	}
	public int getReward() {
		return reward;
	}
	public void setReward(int reward) {
		this.reward = reward;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}
	
	public int getOperateAction() {
		return operateAction;
	}

	public void setOperateAction(int operateAction) {
		this.operateAction = operateAction;
	}

	public int getCardNum() {
		return cardNum;
	}

	public void setCardNum(int cardNum) {
		this.cardNum = cardNum;
	}

	public ArrayList<Card> getLimitedCards() {
		if(limitedCards!=null){
			return limitedCards;
		}
		return null;
	}

	public void setLimitedCards(ArrayList<Card> cards) {
		if(limitedCards!=null){
			for(Card card :cards){
				limitedCards.add(new Card(card));
			}
		}
	}


	public boolean isWin() {
		return win;
	}

	public void setWin(boolean win) {
		this.win = win;
	}
	
	public int getSide() {
		return side;
	}

	public void setSide(int side) {
		this.side = side;
	}
	
	public int getAction() {
		return action;
	}

	public void setAction(int action) {
		this.action = action;
	}
	
	public boolean isReady() {
		return isReady;
	}

	public void setReady(boolean isReady) {
		this.isReady = isReady;
	}
	
	public int getFaceId() {
		return faceId;
	}

	public void setFaceId(int faceId) {
		this.faceId = faceId;
	}

	public long getWinLottery() {
		return winLottery;
	}

	public void setWinLottery(long winLottery) {
		this.winLottery = winLottery;
	}

	public long getLottery() {
		return lottery;
	}

	public void setLottery(long lottery) {
		this.lottery = lottery;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}
}
