public JsonResult OutGroup() { Cow myCow = new Cow(); myCow.DisplayEarNum = Request.Form["displayEarNum"].ToString(); myCow.FarmCode = UserBLL.Instance.CurrentUser.Pasture.ID; myCow.EarNum = CowBLL.ConvertDislayEarNumToEarNum(myCow.DisplayEarNum, UserBLL.Instance.CurrentUser.Pasture.ID); Stray stray = new Stray(); stray.EarNum = myCow.EarNum; stray.PastureID = myCow.FarmCode; stray.Reason = Request.Form["strayReason"].ToString(); stray.StrayDate = Convert.ToDateTime(Request.Form["strayDate"]); stray.StrayType = Convert.ToInt32(Request.Form["strayType"]); stray.IsSold = Convert.ToInt32(Request.Form["isSold"]); if (stray.IsSold == 1) { stray.Price = Convert.ToSingle(Request.Form["price"]); } else { stray.Price = 0.0f; } StrayBLL strayBLL = new StrayBLL(); strayBLL.StrayCow(stray); return(Json(new { result = 1 })); }
/// <summary> /// 插入离群记录,且标记牛离群 /// </summary> /// <param name="s"></param> public void StrayCow(Stray s) { int i = InsertStray(s); if (i == 0) { throw new Exception("无法插入离群记录。"); } CowBLL cBLL = new CowBLL(); cBLL.UpdateCowStrayStatus(s.EarNum, 1); }
public Stray WrapStrayItem(DataRow row) { Stray stray = new Stray(); stray.EarNum = Convert.ToInt32(row["EarNum"]); stray.PastureID = Convert.ToInt32(row["PastureID"]); stray.StrayType = Convert.ToInt32(row["StrayType"]); stray.IsSold = Convert.ToInt32(row["IsSold"]); stray.Price = Convert.ToSingle(row["Price"]); stray.Reason = row["Reason"].ToString(); stray.StrayDate = Convert.ToDateTime(row["StrayDate"]); return(stray); }
public static Entity Create(this EntityType entityType, World world) { Entity entity = null; switch (entityType) { case EntityType.None: return(null); case EntityType.Chicken: entity = new Chicken(world); break; case EntityType.Cow: entity = new Cow(world); break; case EntityType.Pig: entity = new Pig(world); break; case EntityType.Sheep: entity = new Sheep(world); break; case EntityType.Wolf: entity = new Wolf(world); break; case EntityType.Villager: entity = new Villager(world); break; case EntityType.MushroomCow: entity = new Mooshroom(world); break; case EntityType.Squid: entity = new Squid(world); break; case EntityType.Rabbit: entity = new Rabbit(world); break; case EntityType.Bat: entity = new Bat(world); break; case EntityType.IronGolem: entity = new VillagerGolem(world); break; case EntityType.SnowGolem: entity = new Snowman(world); break; case EntityType.Ocelot: entity = new Ocelot(world); break; case EntityType.Zombie: entity = new Zombie(world); break; case EntityType.Creeper: entity = new Creeper(world); break; case EntityType.Skeleton: entity = new Skeleton(world); break; case EntityType.Spider: entity = new Spider(world); break; case EntityType.ZombiePigman: entity = new ZombiePigman(world); break; case EntityType.Slime: entity = new Slime(world); break; case EntityType.Endermite: entity = new Endermite(world); break; case EntityType.Enderman: entity = new Enderman(world); break; case EntityType.Silverfish: entity = new Silverfish(world); break; case EntityType.CaveSpider: entity = new CaveSpider(world); break; case EntityType.Ghast: entity = new Ghast(world); break; case EntityType.MagmaCube: entity = new MagmaCube(world); break; case EntityType.Blaze: entity = new Blaze(world); break; case EntityType.ZombieVillager: entity = new ZombieVillager(world); break; case EntityType.Witch: entity = new Witch(world); break; case EntityType.Stray: entity = new Stray(world); break; case EntityType.Husk: entity = new Husk(world); break; case EntityType.WitherSkeleton: entity = new WitherSkeleton(world); break; case EntityType.Guardian: entity = new Guardian(world); break; case EntityType.ElderGuardian: entity = new ElderGuardian(world); break; case EntityType.Horse: entity = new Horse(world); break; case EntityType.ZombieHorse: entity = new ZombieHorse(world); break; case EntityType.PolarBear: entity = new PolarBear(world); break; case EntityType.Shulker: entity = new Shulker(world); break; case EntityType.EnderDragon: entity = new EnderDragon(world); break; case EntityType.SkeletonHorse: entity = new SkeletonHorse(world); break; case EntityType.Wither: entity = new Wither(world); break; case EntityType.Evoker: entity = new EvocationIllager(world); break; case EntityType.Vindicator: entity = new VindicationIllager(world); break; case EntityType.Vex: entity = new Vex(world); break; case EntityType.FallingBlock: entity = new EntityFallingBlock(world, null); break; case EntityType.ArmorStand: entity = new EntityArmorStand(world, null); break; case EntityType.Arrow: entity = new ArrowEntity(world, null); break; case EntityType.Item: entity = new ItemEntity(world, null); break; case EntityType.Mooshroom: entity = new Mooshroom(world); break; case EntityType.Snowball: entity = new SnowballEntity(world, null); break; case EntityType.ThrownEgg: entity = new EggEntity(world, null); break; case EntityType.Salmon: entity = new Salmon(world); break; case EntityType.Donkey: entity = new Donkey(world); break; case EntityType.Llama: entity = new Llama(world); break; case EntityType.Mule: entity = new Mule(world); break; case EntityType.Fox: entity = new Fox(world); break; case EntityType.Parrot: entity = new Parrot(world); break; case EntityType.Phantom: entity = new Phantom(world); break; case EntityType.Bee: entity = new Bee(world); break; case EntityType.LlamaSpit: entity = new LlamaSpit(world); break; //case EntityType.Human: //entity = new PlayerMob("test", world, ); // break; default: return(null); } return(entity); }
public void Summon(Player player, EntityTypeEnum entityType, bool noAi = true, BlockPos spawnPos = null) { EntityType petType; try { petType = (EntityType)Enum.Parse(typeof(EntityType), entityType.Value, true); } catch (ArgumentException e) { return; } if (!Enum.IsDefined(typeof(EntityType), petType)) { player.SendMessage("No entity found"); return; } var coordinates = player.KnownPosition; if (spawnPos != null) { if (spawnPos.XRelative) { coordinates.X += spawnPos.X; } else { coordinates.X = spawnPos.X; } if (spawnPos.YRelative) { coordinates.Y += spawnPos.Y; } else { coordinates.Y = spawnPos.Y; } if (spawnPos.ZRelative) { coordinates.Z += spawnPos.Z; } else { coordinates.Z = spawnPos.Z; } } var world = player.Level; Mob mob = null; Entity entity = null; EntityType type = (EntityType)(int)petType; switch (type) { case EntityType.Chicken: mob = new Chicken(world); break; case EntityType.Cow: mob = new Cow(world); break; case EntityType.Pig: mob = new Pig(world); break; case EntityType.Sheep: mob = new Sheep(world); break; case EntityType.Wolf: mob = new Wolf(world) { Owner = player }; break; case EntityType.Villager: mob = new Villager(world); break; case EntityType.MushroomCow: mob = new MushroomCow(world); break; case EntityType.Squid: mob = new Squid(world); break; case EntityType.Rabbit: mob = new Rabbit(world); break; case EntityType.Bat: mob = new Bat(world); break; case EntityType.IronGolem: mob = new IronGolem(world); break; case EntityType.SnowGolem: mob = new SnowGolem(world); break; case EntityType.Ocelot: mob = new Ocelot(world); break; case EntityType.Zombie: mob = new Zombie(world); break; case EntityType.Creeper: mob = new Creeper(world); break; case EntityType.Skeleton: mob = new Skeleton(world); break; case EntityType.Spider: mob = new Spider(world); break; case EntityType.ZombiePigman: mob = new ZombiePigman(world); break; case EntityType.Slime: mob = new Slime(world); break; case EntityType.Enderman: mob = new Enderman(world); break; case EntityType.Silverfish: mob = new Silverfish(world); break; case EntityType.CaveSpider: mob = new CaveSpider(world); break; case EntityType.Ghast: mob = new Ghast(world); break; case EntityType.MagmaCube: mob = new MagmaCube(world); break; case EntityType.Blaze: mob = new Blaze(world); break; case EntityType.ZombieVillager: mob = new ZombieVillager(world); break; case EntityType.Witch: mob = new Witch(world); break; case EntityType.Stray: mob = new Stray(world); break; case EntityType.Husk: mob = new Husk(world); break; case EntityType.WitherSkeleton: mob = new WitherSkeleton(world); break; case EntityType.Guardian: mob = new Guardian(world); break; case EntityType.ElderGuardian: mob = new ElderGuardian(world); break; case EntityType.Horse: var random = new Random(); mob = new Horse(world, random.NextDouble() < 0.10, random); break; case EntityType.PolarBear: mob = new PolarBear(world); break; case EntityType.Shulker: mob = new Shulker(world); break; case EntityType.Dragon: mob = new Dragon(world); break; case EntityType.SkeletonHorse: mob = new SkeletonHorse(world); break; case EntityType.Wither: mob = new Wither(world); break; case EntityType.Evoker: mob = new Evoker(world); break; case EntityType.Vindicator: mob = new Vindicator(world); break; case EntityType.Vex: mob = new Vex(world); break; case EntityType.Npc: if (Config.GetProperty("EnableEdu", false)) { mob = new Npc(world); } else { mob = new PlayerMob("test", world); } break; case EntityType.Boat: entity = new Boat(world); break; } if (mob != null) { mob.NoAi = noAi; var direction = Vector3.Normalize(player.KnownPosition.GetHeadDirection()) * 1.5f; mob.KnownPosition = new PlayerLocation(coordinates.X + direction.X, coordinates.Y, coordinates.Z + direction.Z, coordinates.HeadYaw, coordinates.Yaw); mob.SpawnEntity(); } else if (entity != null) { entity.NoAi = noAi; var direction = Vector3.Normalize(player.KnownPosition.GetHeadDirection()) * 1.5f; entity.KnownPosition = new PlayerLocation(coordinates.X + direction.X, coordinates.Y, coordinates.Z + direction.Z, coordinates.HeadYaw, coordinates.Yaw); entity.SpawnEntity(); } }
public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords) { Log.WarnFormat("Player {0} trying to spawn Mob #{1}.", player.Username, Metadata); var coordinates = GetNewCoordinatesFromFace(blockCoordinates, face); Mob mob = null; EntityType type = (EntityType)Metadata; switch (type) { case EntityType.Chicken: mob = new Chicken(world); break; case EntityType.Cow: mob = new Cow(world); break; case EntityType.Pig: mob = new Pig(world); break; case EntityType.Sheep: mob = new Sheep(world); break; case EntityType.Wolf: mob = new Wolf(world) { Owner = player }; break; case EntityType.Villager: mob = new Villager(world); break; case EntityType.MushroomCow: mob = new MushroomCow(world); break; case EntityType.Squid: mob = new Squid(world); break; case EntityType.Rabbit: mob = new Rabbit(world); break; case EntityType.Bat: mob = new Bat(world); break; case EntityType.IronGolem: mob = new IronGolem(world); break; case EntityType.SnowGolem: mob = new SnowGolem(world); break; case EntityType.Ocelot: mob = new Ocelot(world); break; case EntityType.Zombie: mob = new Zombie(world); break; case EntityType.Creeper: mob = new Creeper(world); break; case EntityType.Skeleton: mob = new Skeleton(world); break; case EntityType.Spider: mob = new Spider(world); break; case EntityType.ZombiePigman: mob = new ZombiePigman(world); break; case EntityType.Slime: mob = new Slime(world); break; case EntityType.Enderman: mob = new Enderman(world); break; case EntityType.Silverfish: mob = new Silverfish(world); break; case EntityType.CaveSpider: mob = new CaveSpider(world); break; case EntityType.Ghast: mob = new Ghast(world); break; case EntityType.MagmaCube: mob = new MagmaCube(world); break; case EntityType.Blaze: mob = new Blaze(world); break; case EntityType.ZombieVillager: mob = new ZombieVillager(world); break; case EntityType.Witch: mob = new Witch(world); break; case EntityType.Stray: mob = new Stray(world); break; case EntityType.Husk: mob = new Husk(world); break; case EntityType.WitherSkeleton: mob = new WitherSkeleton(world); break; case EntityType.Guardian: mob = new Guardian(world); break; case EntityType.ElderGuardian: mob = new ElderGuardian(world); break; case EntityType.Horse: mob = new Horse(world); break; case EntityType.PolarBear: mob = new PolarBear(world); break; case EntityType.Shulker: mob = new Shulker(world); break; case EntityType.Dragon: mob = new Dragon(world); break; case EntityType.SkeletonHorse: mob = new SkeletonHorse(world); break; case EntityType.Wither: mob = new Mob(EntityType.Wither, world); break; case EntityType.Npc: mob = new PlayerMob("test", world); break; } if (mob == null) { return; } mob.KnownPosition = new PlayerLocation(coordinates.X, coordinates.Y, coordinates.Z); mob.SpawnEntity(); Log.WarnFormat("Player {0} spawned Mob #{1}.", player.Username, Metadata); }
public static Entity Create(this EntityType entityType, Level world) { Entity entity = null; switch (entityType) { case EntityType.None: return(null); case EntityType.Chicken: entity = new Chicken(world); break; case EntityType.Cow: entity = new Cow(world); break; case EntityType.Pig: entity = new Pig(world); break; case EntityType.Sheep: entity = new Sheep(world); break; case EntityType.Wolf: entity = new Wolf(world); break; case EntityType.Villager: entity = new Villager(world); break; case EntityType.MushroomCow: entity = new MushroomCow(world); break; case EntityType.Squid: entity = new Squid(world); break; case EntityType.Rabbit: entity = new Rabbit(world); break; case EntityType.Bat: entity = new Bat(world); break; case EntityType.IronGolem: entity = new IronGolem(world); break; case EntityType.SnowGolem: entity = new SnowGolem(world); break; case EntityType.Ocelot: entity = new Ocelot(world); break; case EntityType.Zombie: entity = new Zombie(world); break; case EntityType.Creeper: entity = new Creeper(world); break; case EntityType.Skeleton: entity = new Skeleton(world); break; case EntityType.Spider: entity = new Spider(world); break; case EntityType.ZombiePigman: entity = new ZombiePigman(world); break; case EntityType.Slime: entity = new Slime(world); break; case EntityType.Enderman: entity = new Enderman(world); break; case EntityType.Silverfish: entity = new Silverfish(world); break; case EntityType.CaveSpider: entity = new CaveSpider(world); break; case EntityType.Ghast: entity = new Ghast(world); break; case EntityType.MagmaCube: entity = new MagmaCube(world); break; case EntityType.Blaze: entity = new Blaze(world); break; case EntityType.ZombieVillager: entity = new ZombieVillager(world); break; case EntityType.Witch: entity = new Witch(world); break; case EntityType.Stray: entity = new Stray(world); break; case EntityType.Husk: entity = new Husk(world); break; case EntityType.WitherSkeleton: entity = new WitherSkeleton(world); break; case EntityType.Guardian: entity = new Guardian(world); break; case EntityType.ElderGuardian: entity = new ElderGuardian(world); break; case EntityType.Horse: var random = new Random(); entity = new Horse(world, random.NextDouble() < 0.10, random); break; case EntityType.PolarBear: entity = new PolarBear(world); break; case EntityType.Shulker: entity = new Shulker(world); break; case EntityType.Dragon: entity = new Dragon(world); break; case EntityType.SkeletonHorse: entity = new SkeletonHorse(world); break; case EntityType.Wither: entity = new Wither(world); break; case EntityType.Evoker: entity = new Evoker(world); break; case EntityType.Vindicator: entity = new Vindicator(world); break; case EntityType.Vex: entity = new Vex(world); break; case EntityType.Npc: entity = new PlayerMob("test", world); break; default: return(null); } return(entity); }
private int InsertStray(Stray s) { return(strayDAL.InsertStray(s.EarNum, s.PastureID, s.StrayType, s.IsSold, s.Price, s.Reason, s.StrayDate)); }
public void SimpleArray1() { Assert.AreEqual(2, Stray.FindTheStray(new int[] { 1, 1, 2 })); }
public void CommandSpawnMob(MiNET.Player player, string entityName, string mobName = "", string mobScale = "") { if (!(player is SkyPlayer skyPlayer) || !skyPlayer.PlayerGroup.IsAtLeast(PlayerGroup.Admin)) { player.SendMessage("§c§l(!)§r §cYou do not have permission for this command."); return; } entityName = entityName.ToLower(); entityName = entityName.Substring(0, 1).ToUpper() + entityName.Substring(1); if (!Enum.TryParse(entityName, out EntityType entityType)) { player.SendMessage($"§c§l(!) §r§cUnknown EntityType '{entityName}'"); return; } Level level = player.Level; Mob mob = null; switch (entityType) { case EntityType.Chicken: mob = new Chicken(level); break; case EntityType.Cow: mob = new Cow(level); break; case EntityType.Pig: mob = new Pig(level); break; case EntityType.Sheep: mob = new Sheep(level); break; case EntityType.Wolf: mob = new Wolf(level) { Owner = player }; break; case EntityType.Villager: mob = new Villager(level); break; case EntityType.MushroomCow: mob = new MushroomCow(level); break; case EntityType.Squid: mob = new Squid(level); break; case EntityType.Rabbit: mob = new Rabbit(level); break; case EntityType.Bat: mob = new Bat(level); break; case EntityType.IronGolem: mob = new IronGolem(level); break; case EntityType.SnowGolem: mob = new SnowGolem(level); break; case EntityType.Ocelot: mob = new Ocelot(level); break; case EntityType.Zombie: mob = new Zombie(level); break; case EntityType.Creeper: mob = new Creeper(level); break; case EntityType.Skeleton: mob = new Skeleton(level); break; case EntityType.Spider: mob = new Spider(level); break; case EntityType.ZombiePigman: mob = new ZombiePigman(level); break; case EntityType.Slime: mob = new MiNET.Entities.Hostile.Slime(level); break; case EntityType.Enderman: mob = new Enderman(level); break; case EntityType.Silverfish: mob = new Silverfish(level); break; case EntityType.CaveSpider: mob = new CaveSpider(level); break; case EntityType.Ghast: mob = new Ghast(level); break; case EntityType.MagmaCube: mob = new MagmaCube(level); break; case EntityType.Blaze: mob = new Blaze(level); break; case EntityType.ZombieVillager: mob = new ZombieVillager(level); break; case EntityType.Witch: mob = new Witch(level); break; case EntityType.Stray: mob = new Stray(level); break; case EntityType.Husk: mob = new Husk(level); break; case EntityType.WitherSkeleton: mob = new WitherSkeleton(level); break; case EntityType.Guardian: mob = new Guardian(level); break; case EntityType.ElderGuardian: mob = new ElderGuardian(level); break; case EntityType.Horse: mob = new Horse(level); break; case EntityType.PolarBear: mob = new PolarBear(level); break; case EntityType.Shulker: mob = new Shulker(level); break; case EntityType.Dragon: mob = new Dragon(level); break; case EntityType.SkeletonHorse: mob = new SkeletonHorse(level); break; case EntityType.Wither: mob = new Wither(level); break; case EntityType.Evoker: mob = new Evoker(level); break; case EntityType.Vindicator: mob = new Vindicator(level); break; case EntityType.Vex: mob = new Vex(level); break; case EntityType.Npc: mob = new PlayerMob("test", level); break; } if (!String.IsNullOrEmpty(mobName)) { mob.NameTag = mobName.Replace("&", "§"); mob.HideNameTag = false; mob.IsAlwaysShowName = true; } if (!String.IsNullOrEmpty(mobScale)) { try { mob.Scale = Double.Parse(mobScale); } catch (Exception e) { Console.WriteLine(e); throw; } } mob.KnownPosition = (PlayerLocation)player.KnownPosition.Clone(); mob.SpawnEntity(); player.SendMessage($"§e§l(!) §r§eSpawned new {entityType}"); }