public static Neopal GeneratePet(bool isActiveUser = false) { isActiveUser = isActiveUser || (double)Utils.randm(1f) < 0.0199999995529652; Array values = Enum.GetValues(typeof(Neopal.PetType)); Neopal.PetType petType = (Neopal.PetType)values.GetValue(Utils.random.Next(values.Length)); return(new Neopal() { CombatRating = (byte)Utils.random.Next((int)byte.MaxValue), DaysSinceFed = isActiveUser ? Utils.random.Next(2) : Utils.random.Next(3650), Happiness = isActiveUser ? 1f - Utils.randm(0.15f) : Utils.randm(0.05f), Name = Neopal.GenerateName(), Type = petType, Identifier = Guid.NewGuid().ToString().Substring(0, 13) }); }
public void DrawSpecialCase(Vector2 currentPos, Rectangle totalArea, Type objType, string drawnValue, SpriteBatch sb) { if (!(sb.Name != "AltRTBatch") || !(objType == typeof(Neopal.PetType))) { return; } int num1 = Math.Min(ReflectiveRenderer.GetEntryLineHeight() * 6, totalArea.Width / 4); Texture2D sprite = this.PlaceholderSprite; Neopal.PetType petType = (Neopal.PetType)Enum.Parse(objType, drawnValue); if (this.WildcardAssets.ContainsKey((object)petType)) { sprite = this.WildcardAssets[(object)petType]; } Rectangle petDrawPos = new Rectangle(totalArea.X + totalArea.Width - num1 - 10, (int)currentPos.Y + 4, num1, num1); double num2 = (double)sprite.Height / (double)petDrawPos.Height; int val2 = totalArea.Y + totalArea.Height - petDrawPos.Y; int height = Math.Min(sprite.Height, (int)(num2 * (double)val2)); Rectangle?clip = new Rectangle?(new Rectangle(0, 0, sprite.Width, height)); petDrawPos.Height = Math.Min(petDrawPos.Height, val2); this.os.postFXDrawActions += (Action)(() => sb.Draw(sprite, petDrawPos, clip, Color.White)); }