package hmggirlfront.entity;

import gvclib.entity.trader.EntityNPCBase;
import hmggirlfront.mod_GirlFront;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;

public class EntityKalina extends EntityNPCBase {

	public EntityKalina(World worldIn) {
		super(worldIn);
		this.setSize(0.5F, 1.8F);
		this.biped = true;
		{
			this.sell_page = 3;
			{
				//sell = //売り物
				//sell_id = //売り物
				//sell_size = //売り物の量
				//sellm = //販売価格
				this.setCustomNameTag("Kalina");
				this.sell[0] = mod_GirlFront.idoll_bullet;
				this.sell[1] = mod_GirlFront.idoll_parts;
				this.sell[2] = mod_GirlFront.idoll_food;
				this.sell_size[0] = 8;
				this.sell_size[1] = 8;
				this.sell_size[2] = 8;
				this.sellm[0] = 1;
				this.sellm[1] = 1;
				this.sellm[2] = 1;
				
				this.sell[3] = mod_GirlFront.idoll_bandage;
				this.sell[4] = mod_GirlFront.idoll_grenade_n;
				this.sell[5] = mod_GirlFront.ve_hmmwv;
				this.sell_size[3] = 4;
				this.sell_size[4] = 3;
				this.sell_size[5] = 1;
				this.sellm[3] = 2;
				this.sellm[4] = 2;
				this.sellm[5] = 8;
				
				
				
				this.sell[6] = mod_GirlFront.ve_bike;
				this.sell[7] = mod_GirlFront.ve_truck;
				this.sell[8] = mod_GirlFront.ve_rhib;
				this.sell_size[6] = 1;
				this.sell_size[7] = 1;
				this.sell_size[8] = 1;
				this.sellm[6] = 8;
				this.sellm[7] = 8;
				this.sellm[8] = 8;
				
				
				//p2
				this.sell[10] = mod_GirlFront.armor_gk_uniform_head;
				this.sell[11] = mod_GirlFront.armor_gk_uniform_chest;
				this.sell[12] = mod_GirlFront.armor_gk_uniform_legs;
				this.sell_size[10] = 1;
				this.sell_size[11] = 1;
				this.sell_size[12] = 1;
				this.sellm[10] = 1;
				this.sellm[11] = 1;
				this.sellm[12] = 1;
				
				this.sell[13] = mod_GirlFront.armor_gk_uniform_feet;
				this.sell_size[13] = 1;
				this.sellm[13] = 1;
				
				
				this.sell[14] = mod_GirlFront.armor_pmc_head;
				this.sell[15] = mod_GirlFront.armor_pmc_chest;
				this.sell[16] = mod_GirlFront.armor_pmc_legs;
				this.sell_size[14] = 1;
				this.sell_size[15] = 1;
				this.sell_size[16] = 1;
				this.sellm[14] = 4;
				this.sellm[15] = 4;
				this.sellm[16] = 4;
				this.sell[17] = mod_GirlFront.armor_pmc_feet;
				this.sell_size[17] = 1;
				this.sellm[17] = 4;
				
				/*
				this.sell[10] = mod_GirlFront.mission_card_1;
				this.sell[11] = mod_GirlFront.mission_card_2;
				this.sell[12] = mod_GirlFront.mission_card_3;
				this.sell_size[10] = 1;
				this.sell_size[11] = 1;
				this.sell_size[12] = 1;
				this.sellm[10] = 1;
				this.sellm[11] = 1;
				this.sellm[12] = 1;
				
				this.sell[13] = mod_GirlFront.mission_card_4;
				this.sell[14] = mod_GirlFront.mission_card_5;
				this.sell[15] = mod_GirlFront.mission_card_6;
				this.sell_size[13] = 1;
				this.sell_size[14] = 1;
				this.sell_size[15] = 1;
				this.sellm[13] = 1;
				this.sellm[14] = 1;
				this.sellm[15] = 1;
				*/
				/*
				this.sell[16] = mod_GirlFront.story_mission_card_1;
				this.sell_size[16] = 1;
				this.sellm[16] = 1;
				*/
				
				//p3
				this.sell[20] = Items.EXPERIENCE_BOTTLE;
				this.sell_size[20] = 1;
				this.sellm[20] = 8;
				
				this.sell[22] = mod_GirlFront.idoll_pledge;
				this.sell_size[22] = 1;
				this.sellm[22] = 64;
				
				
				this.sell[23] = mod_GirlFront.doll_tool_combatknife;
				this.sell_size[23] = 1;
				this.sellm[23] = 16;
				this.sell[24] = mod_GirlFront.doll_tool_mshovel;
				this.sell_size[24] = 1;
				this.sellm[24] = 16;
				this.sell[25] = mod_GirlFront.doll_tool_soflam;
				this.sell_size[25] = 1;
				this.sellm[25] = 16;
				
				this.sell[26] = mod_GirlFront.doll_tool_mpickaxe;
				this.sell_size[26] = 1;
				this.sellm[26] = 16;
				this.sell[27] = mod_GirlFront.doll_tool_maxe;
				this.sell_size[27] = 1;
				this.sellm[27] = 16;
				
				/*this.sell[6] = Items.IRON_INGOT;
				this.sell[7] = Items.GOLD_INGOT;
				this.sell_size[6] = 1;
				this.sell_size[7] = 1;
				this.sellm[6] = 2;
				this.sellm[7] = 4;*/
				
				/*
				this.sell[6] = new ItemStack(Blocks.TORCH).getItem();
				this.sell[7] = Items.IRON_PICKAXE;
				this.sell[8] = Items.APPLE;
				this.sell_size[6] = 16;
				this.sell_size[7] = 1;
				this.sell_size[8] = 4;
				this.sellm[6] = 1;
				this.sellm[7] = 12;
				this.sellm[8] = 4;
				*/
			}
			
			
		}
		
		this.buy_page = 4;
		{
			this.buy[0] = mod_GirlFront.dollgun_ibc04smg;
			this.buy_size[0] = 2;
			this.buym[0] = 1;
			
			this.buy[1] = mod_GirlFront.dollgun_ibc05ar;
			this.buy_size[1] = 4;
			this.buym[1] = 1;
			
			this.buy[2] = mod_GirlFront.dollgun_ibc06rf;
			this.buy_size[2] = 8;
			this.buym[2] = 1;
			
			this.buy[3] = mod_GirlFront.dollgun_ibc07hg;
			this.buy_size[3] = 4;
			this.buym[3] = 1;
			
			this.buy[4] = mod_GirlFront.dollgun_ibc07sd;
			this.buy_size[4] = 4;
			this.buym[4] = 1;
			
			this.buy[5] = mod_GirlFront.dollgun_ibc08sw;
			this.buy_size[5] = 8;
			this.buym[5] = 1;
			
			this.buy[6] = mod_GirlFront.dollgun_ibc08sd;
			this.buy_size[6] = 8;
			this.buym[6] = 1;
		}
		{
			this.buy[10] = mod_GirlFront.dollam_horo;
			this.buy_size[10] = 1;//帰ってくるエメラルド
			this.buym[10] = 1;//売る量
			this.buy[11] = mod_GirlFront.dollam_dotsight;
			this.buy_size[11] = 1;//帰ってくるエメラルド
			this.buym[11] = 1;//売る量
			this.buy[12] = mod_GirlFront.dollam_acog;
			this.buy_size[12] = 1;//帰ってくるエメラルド
			this.buym[12] = 1;//売る量
			this.buy[13] = mod_GirlFront.dollam_scope;
			this.buy_size[13] = 1;//帰ってくるエメラルド
			this.buym[13] = 1;//売る量
			this.buy[14] = mod_GirlFront.dollam_lasersight;
			this.buy_size[14] = 1;//帰ってくるエメラルド
			this.buym[14] = 1;//売る量
			
			this.buy[15] = mod_GirlFront.dollam_bullet_ap;
			this.buy_size[15] = 1;//帰ってくるエメラルド
			this.buym[15] = 1;//売る量
			this.buy[16] = mod_GirlFront.dollam_bullet_hv;
			this.buy_size[16] = 1;//帰ってくるエメラルド
			this.buym[16] = 1;//売る量
			
			this.buy[20] = mod_GirlFront.dollam_micro;
			this.buy_size[20] = 1;//帰ってくるエメラルド
			this.buym[20] = 1;//売る量
			this.buy[21] = mod_GirlFront.dollam_coyote;
			this.buy_size[21] = 1;//帰ってくるエメラルド
			this.buym[21] = 1;//売る量
			this.buy[22] = mod_GirlFront.dollam_kobra;
			this.buy_size[22] = 1;//帰ってくるエメラルド
			this.buym[22] = 1;//売る量
			this.buy[23] = mod_GirlFront.dollam_suppressor;
			this.buy_size[23] = 1;//帰ってくるエメラルド
			this.buym[23] = 1;//売る量
			this.buy[24] = mod_GirlFront.dollam_grip;
			this.buy_size[24] = 1;//帰ってくるエメラルド
			this.buym[24] = 1;//売る量
			this.buy[25] = mod_GirlFront.dollam_bipod;
			this.buy_size[25] = 1;//帰ってくるエメラルド
			this.buym[25] = 1;//売る量
			this.buy[26] = mod_GirlFront.dollam_anglegrip;
			this.buy_size[26] = 1;//帰ってくるエメラルド
			this.buym[26] = 1;//売る量
			this.buy[27] = mod_GirlFront.dollam_gripod;
			this.buy_size[27] = 1;//帰ってくるエメラルド
			this.buym[27] = 1;//売る量
			
			
			this.buy[30] = mod_GirlFront.dollam_frame_m;
			this.buy_size[30] = 1;//帰ってくるエメラルド
			this.buym[30] = 1;//売る量
			this.buy[31] = mod_GirlFront.dollam_frame_x;
			this.buy_size[31] = 1;//帰ってくるエメラルド
			this.buym[31] = 1;//売る量
			
			this.buy[32] = mod_GirlFront.idoll_squad_cn;
			this.buy_size[32] = 2;//帰ってくるエメラルド
			this.buym[32] = 1;//売る量
		}
	}

	protected void initEntityAI() {
		this.tasks.addTask(1, new EntityAISwimming(this));
		this.tasks.addTask(2, new EntityAILookIdle(this));
	}

	protected void applyEntityAttributes() {
		super.applyEntityAttributes();
		this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20D);
	}

	public double getYOffset()
    {
        return 0.1D;
    }
	
	@Override
	public boolean processInteract(EntityPlayer player, EnumHand hand)
    {
		if(player != null) {
			if(this.getArmID_A() == 1) {
				if(this.world.isRemote)player.sendMessage(new TextComponentTranslation("hmggirlfront.helianthus.serif_0.name", new Object[0]));
			}else if(this.getArmID_A() == 0){
				int ra = this.world.rand.nextInt(5);
				if(ra == 1) {
					if(this.world.isRemote)player.sendMessage(new TextComponentTranslation("hmggirlfront.kalina.serif_1.name", new Object[0]));
				}
				else if(ra == 2) {
					if(this.world.isRemote)player.sendMessage(new TextComponentTranslation("hmggirlfront.kalina.serif_2.name", new Object[0]));
				}
				else if(ra == 3) {
					if(this.world.isRemote)player.sendMessage(new TextComponentTranslation("hmggirlfront.kalina.serif_3.name", new Object[0]));
				}
				else if(ra == 4) {
					if(this.world.isRemote)player.sendMessage(new TextComponentTranslation("hmggirlfront.kalina.serif_4.name", new Object[0]));
				}else{
					if(this.world.isRemote)player.sendMessage(new TextComponentTranslation("hmggirlfront.kalina.serif_0.name", new Object[0]));
				}
			}else if(this.getArmID_A() == 3) {
				if(this.world.isRemote)player.sendMessage(new TextComponentTranslation("......", new Object[0]));
			}
		}
		super.processInteract(player, hand);
		return true;
    }
	
	public void onLivingUpdate() {
		super.onLivingUpdate();
		if(this.getArmID_A() == 1) {
			this.setCustomNameTag("Helianthus");
			this.sell_page = 1;
			{
				//sell = //売り物
				//sell_id = //売り物
				//sell_size = //売り物の量
				//sellm = //販売価格
		/*		this.sell[0] = mod_GirlFront.mission_card_1;
				this.sell[1] = mod_GirlFront.mission_card_2;
				this.sell[2] = mod_GirlFront.mission_card_3;
				this.sell_size[0] = 1;
				this.sell_size[1] = 1;
				this.sell_size[2] = 1;
				this.sellm[0] = 1;
				this.sellm[1] = 1;
				this.sellm[2] = 1;
				
				this.sell[3] = mod_GirlFront.mission_card_4;
				this.sell[4] = mod_GirlFront.mission_card_5;
				this.sell[5] = mod_GirlFront.mission_card_6;
				this.sell_size[3] = 1;
				this.sell_size[4] = 1;
				this.sell_size[5] = 1;
				this.sellm[3] = 1;
				this.sellm[4] = 1;
				this.sellm[5] = 1;
				for(int x = 6; x <= 8; ++x) {
					this.sell[x] = null;
					this.sell_size[x] = 0;
					this.sellm[x] = 0;
				}*/
				
				this.sell[0] = Item.getItemFromBlock(mod_GirlFront.help_base_headquarters);
				this.sell[1] = Item.getItemFromBlock(mod_GirlFront.help_base_oil_complex);
				this.sell[2] = Item.getItemFromBlock(mod_GirlFront.help_base_forest_base);
				this.sell_size[0] = 1;
				this.sell_size[1] = 1;
				this.sell_size[2] = 1;
				this.sellm[0] = 8;
				this.sellm[1] = 8;
				this.sellm[2] = 8;
				
				this.sell[3] = Item.getItemFromBlock(mod_GirlFront.help_base_desert_base);
				this.sell[4] = Item.getItemFromBlock(mod_GirlFront.help_base_amusement);
				this.sell[5] = Item.getItemFromBlock(mod_GirlFront.help_base_observation_base);
				this.sell_size[3] = 1;
				this.sell_size[4] = 1;
				this.sell_size[5] = 1;
				this.sellm[3] = 8;
				this.sellm[4] = 8;
				this.sellm[5] = 8;
				
				
				//p2
				this.sell[6] = Item.getItemFromBlock(mod_GirlFront.help_base_sea_launch);
				this.sell[7] = Item.getItemFromBlock(mod_GirlFront.help_base_missile_silo);
				this.sell[8] = null;
				this.sell_size[6] = 1;
				this.sell_size[7] = 1;
				this.sell_size[8] = 0;
				this.sellm[6] = 8;
				this.sellm[7] = 8;
				this.sellm[8] = 0;
				
				this.sell[9] = null;
				this.sell[10] = null;
				this.sell[11] = null;
				this.sell_size[9] = 0;
				this.sell_size[10] = 0;
				this.sell_size[11] = 0;
				this.sellm[9] = 0;
				this.sellm[10] = 0;
				this.sellm[11] = 0;
			}
				
		}
		else if(this.getArmID_A() == 2) {
			this.setCustomNameTag("Kryuger");
			this.sell_page = 2;
			{
				//sell = //売り物
				//sell_id = //売り物
				//sell_size = //売り物の量
				//sellm = //販売価格
				//p1
				this.sell[0] = Item.getItemFromBlock(mod_GirlFront.b_block_ammobox1_df);
				this.sell[1] = Item.getItemFromBlock(mod_GirlFront.b_block_barrel_drum1_df);
				this.sell[2] = Item.getItemFromBlock(mod_GirlFront.b_block_barrel_drum2_df);
				this.sell_size[0] = 1;
				this.sell_size[1] = 1;
				this.sell_size[2] = 1;
				this.sellm[0] = 2;
				this.sellm[1] = 1;
				this.sellm[2] = 1;
				
				this.sell[3] = Item.getItemFromBlock(mod_GirlFront.b_block_hesco_df);
				this.sell[4] = Item.getItemFromBlock(mod_GirlFront.b_block_sandbag_b1_df);
				this.sell[5] = Item.getItemFromBlock(mod_GirlFront.b_block_rcc_df);
				this.sell_size[3] = 16;
				this.sell_size[4] = 32;
				this.sell_size[5] = 16;
				this.sellm[3] = 1;
				this.sellm[4] = 1;
				this.sellm[5] = 1;
				
				
				//p2
				this.sell[6] = Item.getItemFromBlock(mod_GirlFront.b_block_laptop_df);
				this.sell[7] = Item.getItemFromBlock(mod_GirlFront.b_block_toughbook_df);
				this.sell[8] = Item.getItemFromBlock(mod_GirlFront.b_block_monitor1_df);
				this.sell_size[6] = 1;
				this.sell_size[7] = 1;
				this.sell_size[8] = 1;
				this.sellm[6] = 2;
				this.sellm[7] = 2;
				this.sellm[8] = 2;
				
				this.sell[9] = Item.getItemFromBlock(mod_GirlFront.b_block_sincgars_df);
				this.sell[10] = Item.getItemFromBlock(mod_GirlFront.b_block_server_cont1_df);
				this.sell[11] = Item.getItemFromBlock(mod_GirlFront.b_block_server_cont2_df);
				this.sell_size[9] = 1;
				this.sell_size[10] = 1;
				this.sell_size[11] = 1;
				this.sellm[9] = 2;
				this.sellm[10] = 2;
				this.sellm[11] = 2;
				
				
				//p3
				this.sell[12] = Item.getItemFromBlock(mod_GirlFront.b_block_at_obstacles2);
				this.sell[13] = Item.getItemFromBlock(mod_GirlFront.b_block_barbed1_df);
				this.sell[14] = Item.getItemFromBlock(mod_GirlFront.b_block_barbed2_df);
				this.sell_size[12] = 1;
				this.sell_size[13] = 1;
				this.sell_size[14] = 1;
				this.sellm[12] = 2;
				this.sellm[13] = 2;
				this.sellm[14] = 2;
				
			}
		}
		else if(this.getArmID_A() == 4) {
			this.setCustomNameTag("Springfield");
			this.sell_page = 2;
			{
				//sell = //売り物
				//sell_id = //売り物
				//sell_size = //売り物の量
				//sellm = //販売価格
				this.sell[0] = Item.getItemFromBlock(mod_GirlFront.b_block_box1_iop);
				this.sell[1] = Item.getItemFromBlock(mod_GirlFront.b_block_jutebag_df);
				this.sell[2] = Item.getItemFromBlock(mod_GirlFront.b_block_medbag_df);
				this.sell_size[0] = 1;
				this.sell_size[1] = 1;
				this.sell_size[2] = 1;
				this.sellm[0] = 2;
				this.sellm[1] = 1;
				this.sellm[2] = 1;
				
				this.sell[3] = Item.getItemFromBlock(mod_GirlFront.b_block_gunrack_htgk);
				this.sell[4] = Item.getItemFromBlock(mod_GirlFront.b_block_gunrack_rsgk);
				this.sell[5] = Item.getItemFromBlock(mod_GirlFront.b_block_gunrack_rtgk1);
				this.sell_size[3] = 16;
				this.sell_size[4] = 32;
				this.sell_size[5] = 16;
				this.sellm[3] = 1;
				this.sellm[4] = 1;
				this.sellm[5] = 1;
				
				//p2
				this.sell[6] = Item.getItemFromBlock(mod_GirlFront.b_block_fire_exti_df);
				this.sell[7] = Item.getItemFromBlock(mod_GirlFront.b_block_Jerrycan1_df);
				this.sell[8] = Item.getItemFromBlock(mod_GirlFront.b_block_odunit_df);
				this.sell_size[6] = 1;
				this.sell_size[7] = 1;
				this.sell_size[8] = 1;
				this.sellm[6] = 2;
				this.sellm[7] = 2;
				this.sellm[8] = 2;
				
				this.sell[9] = Item.getItemFromBlock(mod_GirlFront.b_block_mil_cont1_df);
				this.sell[10] = Item.getItemFromBlock(mod_GirlFront.b_block_mil_cont2_df);
				this.sell[11] = null;
				this.sell_size[9] = 1;
				this.sell_size[10] = 1;
				this.sell_size[11] = 0;
				this.sellm[9] = 2;
				this.sellm[10] = 2;
				this.sellm[11] = 0;
				
				//p3
				this.sell[12] = Item.getItemFromBlock(mod_GirlFront.b_block_t_wall1_df);
				this.sell[13] = Item.getItemFromBlock(mod_GirlFront.b_block_t_wall2_df);
				//this.sell[14] = Item.getItemFromBlock(mod_GirlFront.b_block_barbed2_df);
				this.sell_size[12] = 1;
				this.sell_size[13] = 1;
				//this.sell_size[14] = 1;
				this.sellm[12] = 2;
				this.sellm[13] = 2;
				//this.sellm[14] = 2;
				
			}
		}
		else if(this.getArmID_A() == 3) {
			this.setCustomNameTag("mysterious trader");
			this.currency = mod_GirlFront.idoll_collapse_sample;
			this.sell_page = 1;
			{
				//sell = //売り物
				//sell_id = //売り物
				//sell_size = //売り物の量
				//sellm = //販売価格
				this.sell[0] = mod_GirlFront.dollam_m1903onlyscope;
				this.sell[1] = mod_GirlFront.dollam_an_peq15;
				this.sell[2] = mod_GirlFront.dollam_eot_exps3;
				this.sell_size[0] = 1;
				this.sell_size[1] = 1;
				this.sell_size[2] = 1;
				this.sellm[0] = 32;
				this.sellm[1] = 32;
				this.sellm[2] = 32;
				
				this.sell[3] = mod_GirlFront.dollam_eot_exps3_416;
				this.sell[4] = mod_GirlFront.dollam_lam_unit;
				this.sell[5] = mod_GirlFront.dollam_oss_silencer;
				this.sell_size[3] = 1;
				this.sell_size[4] = 1;
				this.sell_size[5] = 1;
				this.sellm[3] = 48;
				this.sellm[4] = 16;
				this.sellm[5] = 16;
				for(int x = 6; x <= 8; ++x) {
					this.sell[x] = null;
					this.sell_size[x] = 0;
					this.sellm[x] = 0;
				}
			}
		}
	}
	
	
}