Esempio n. 1
0
        private static bool Before_GetFish(Farm __instance, float millisecondsAfterNibble, int bait, int waterDepth, Farmer who, double baitPotency, Vector2 bobberTile, ref SObject __result)
        {
            if (FarmPatcher.IsInPatch || !FarmPatcher.IsSmallBeachFarm(who?.currentLocation))
            {
                return(true);
            }

            try
            {
                FarmPatcher.IsInPatch = true;

                FishType type = FarmPatcher.GetFishType(__instance, (int)bobberTile.X, (int)bobberTile.Y);
                FarmPatcher.Monitor.VerboseLog($"Fishing {type.ToString().ToLower()} tile at ({bobberTile.X / Game1.tileSize}, {bobberTile.Y / Game1.tileSize}).");
                if (type == FishType.Ocean)
                {
                    __result = __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Beach");
                    return(false);
                }
                else
                {
                    // match riverland farm behavior
                    __result = Game1.random.NextDouble() < 0.3
                        ? __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Forest")
                        : __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Town");
                    return(false);
                }
            }
            finally
            {
                FarmPatcher.IsInPatch = false;
            }
        }
Esempio n. 2
0
    void Start()
    {
        if (fishType == FishType.greenBride)
        {
            _enumIndex = 0;
        }

        if (fishType == FishType.greenGroom)
        {
            _enumIndex = 1;
        }

        if (fishType == FishType.orangeBride)
        {
            _enumIndex = 2;
        }

        if (fishType == FishType.orangeGroom /*|| UnbreakableManager.OrangeFeesh == UnbreakableManager.OrangeFishChosen.OrangeGroomChosen && GetComponent<SinputPlayerController>().PlayerNumber == 1*/)
        {
            _enumIndex = 3;
            Debug.Log(UnbreakableManager.OrangeFeesh);
        }
        _fishTypeString = fishType.ToString();
        _facingLeft     = true;
        GetComponent <SpriteRenderer>().sprite = _defaultSprite[_enumIndex];
        _fishController = GetComponent <Animator>();
        _rigidbody      = GetComponent <Rigidbody2D>();
    }
Esempio n. 3
0
    public static GameObject GetFishPrefab(FishType type)
    {
        string path = string.Empty;
        path = System.IO.Path.Combine("Prefabs", "Fish");
        path = System.IO.Path.Combine(path, "Fish_" + type.ToString()).Replace("\\", "/");

        GameObject go = GetPrefab(path);

        return go;
    }
Esempio n. 4
0
    public static GameFish Create(FishType pFinshType, Transform pTrans, Transform pScreenCenter)
    {
        string     tFishPath = string.Format("fish/{0}", pFinshType.ToString());
        GameObject tFish     = Resources.Load <GameObject> (tFishPath);

        tFish = Instantiate(tFish, pTrans);
        GameFish tGameFish = tFish.AddComponent <GameFish> ();

        tGameFish.Init(pFinshType, pScreenCenter);
        return(tGameFish);
    }
Esempio n. 5
0
    public override string ItemType()
    {
        itemtype = fish_type.ToString();

        return(itemtype);
    }
Esempio n. 6
0
        public async Task Command()
        {
            // Cooldown in seconds.
            const int FISHING_COOLDOWN         = 15;
            const int FISHING_COOLDOWN_PREMIUM = 5;

            User user = await DatabaseQueries.GetOrCreateUserAsync(Context.User.Id);

            Server server = await DatabaseQueries.GetOrCreateServerAsync(Context.Guild.Id);

            if (user.Points < user.FishCost())
            {
                var baitEmbed = new KaguyaEmbedBuilder(EmbedColor.RED)
                {
                    Description = $"You do not have enough points to play the fishing game.",
                    Footer      = new EmbedFooterBuilder
                    {
                        Text = $"You need {user.FishCost()} points to play. You have {user.Points} points."
                    }
                };

                await SendEmbedAsync(baitEmbed);

                return;
            }

            bool isPremium = user.IsPremium;

            if (user.LastFished >= DateTime.Now.AddSeconds(-FISHING_COOLDOWN).ToOADate() && !isPremium ||
                user.LastFished >= DateTime.Now.AddSeconds(-FISHING_COOLDOWN_PREMIUM).ToOADate() && isPremium)
            {
                TimeSpan ts = DateTime.FromOADate(user.LastFished) - DateTime.Now.AddSeconds(-15);

                if (isPremium)
                {
                    ts -= TimeSpan.FromSeconds(10);
                }

                var errorEmbed = new KaguyaEmbedBuilder(EmbedColor.RED)
                {
                    Description = $"Please wait `{ts.Humanize(minUnit: TimeUnit.Second)}` before fishing again."
                };

                await ReplyAndDeleteAsync("", false, errorEmbed.Build(), TimeSpan.FromSeconds(3));

                return;
            }

            int value;
            var embed = new KaguyaEmbedBuilder
            {
                Description = $"🎣 | {Context.User.Mention} "
            };

            var    r      = new Random();
            double roll   = r.NextDouble();
            int    fishId = r.Next(int.MaxValue);
            int    fishExp;

            while (await DatabaseQueries.ItemExistsAsync <Fish>(x => x.FishId == fishId))
            {
                fishId = r.Next(int.MaxValue);
            }

            var bonuses = new FishHandler.FishLevelBonuses(user.FishExp);

            roll *= 1 - (bonuses.BonusLuckPercent / 100);

            if (isPremium)
            {
                roll *= 0.95;
            }

            FishType fishType = GetFishType(roll);

            switch (fishType)
            {
            case FishType.SEAWEED:
                value              = 2;
                fishExp            = 0;
                embed.Description += $"Aw man, you caught `seaweed`. Better luck next time!";
                embed.SetColor(EmbedColor.GRAY);

                break;

            case FishType.PINFISH:
                value              = 15;
                fishExp            = r.Next(1, 3);
                embed.Description += $"you caught a `pinfish`!";
                embed.SetColor(EmbedColor.GRAY);

                break;

            case FishType.SMALL_BASS:
                value              = 25;
                fishExp            = r.Next(2, 6);
                embed.Description += $"you caught a `small bass`!";
                embed.SetColor(EmbedColor.GREEN);

                break;

            case FishType.SMALL_SALMON:
                value              = 25;
                fishExp            = r.Next(2, 6);
                embed.Description += $"you caught a `small salmon`!";
                embed.SetColor(EmbedColor.GREEN);

                break;

            case FishType.CATFISH:
                value              = 75;
                fishExp            = r.Next(5, 9);
                embed.Description += $"you caught a `catfish`!";
                embed.SetColor(EmbedColor.GREEN);

                break;

            case FishType.LARGE_BASS:
                value              = 150;
                fishExp            = r.Next(7, 11);
                embed.Description += $"Wow, you caught a `large bass`!";
                embed.SetColor(EmbedColor.LIGHT_BLUE);

                break;

            case FishType.LARGE_SALMON:
                value              = 150;
                fishExp            = r.Next(7, 11);
                embed.Description += $"Wow, you caught a `large salmon`!";
                embed.SetColor(EmbedColor.LIGHT_BLUE);

                break;

            case FishType.RED_DRUM:
                value              = 200;
                fishExp            = r.Next(7, 20);
                embed.Description += $"Holy smokes, you caught a `red drum`!";
                embed.SetColor(EmbedColor.RED);

                break;

            case FishType.TRIGGERFISH:
                value              = 350;
                fishExp            = r.Next(11, 30);
                embed.Description += $"Holy smokes, you caught a `triggerfish`!";
                embed.SetColor(EmbedColor.LIGHT_PURPLE);

                break;

            case FishType.GIANT_SEA_BASS:
                value              = 500;
                fishExp            = r.Next(18, 36);
                embed.Description += $"No way, you caught a `giant sea bass`! Nice work!";
                embed.SetColor(EmbedColor.LIGHT_PURPLE);

                break;

            case FishType.SMALLTOOTH_SAWFISH:
                value              = 1000;
                fishExp            = r.Next(29, 42);
                embed.Description += $"No way, you caught a `smalltooth sawfish`! Nice work!";
                embed.SetColor(EmbedColor.LIGHT_PURPLE);

                break;

            case FishType.DEVILS_HOLE_PUPFISH:
                value              = 2500;
                fishExp            = r.Next(40, 95);
                embed.Description += $"I can't believe my eyes!! you caught a `devils hold pupfish`! You're crazy!";
                embed.SetColor(EmbedColor.VIOLET);

                break;

            case FishType.ORANTE_SLEEPER_RAY:
                value              = 5000;
                fishExp            = r.Next(75, 325);
                embed.Description += $"Hot diggity dog, you caught an `orante sleeper ray`! This is unbelievable!";
                embed.SetColor(EmbedColor.ORANGE);

                break;

            case FishType.GIANT_SQUID:
                value              = 20000;
                fishExp            = r.Next(400, 900);
                embed.Description += $"Well butter my buttcheeks and call me a biscuit, you caught the second " +
                                     $"rarest fish in the sea! It's a `giant squid`!! Congratulations!";

                embed.SetColor(EmbedColor.ORANGE);

                break;

            case FishType.BIG_KAHUNA:
                value              = 50000;
                fishExp            = r.Next(1250, 4500);
                embed.Description += $"<a:siren:429784681316220939> NO WAY! You hit the jackpot " +
                                     $"and caught the **Legendary `BIG KAHUNA`**!!!! " +
                                     $"What an incredible moment this is! <a:siren:429784681316220939>";

                embed.SetColor(EmbedColor.GOLD);

                break;

            default:
                value              = 0;
                fishExp            = 0;
                embed.Description += $"Oh no, it took your bait! Better luck next time...";
                embed.SetColor(EmbedColor.GRAY);

                break;
            }

            user.FishExp   += fishExp;
            user.Points    -= user.FishCost();
            user.LastFished = DateTime.Now.ToOADate();

            var fish = new Fish
            {
                FishId     = fishId,
                UserId     = Context.User.Id,
                ServerId   = Context.Guild.Id,
                TimeCaught = DateTime.Now.ToOADate(),
                FishType   = fishType,
                FishString = fishType.ToString(),
                Value      = value,
                Exp        = fishExp,
                Sold       = false
            };

            value = Fish.GetPayoutForFish(fish, user.FishExp);

            await DatabaseQueries.InsertAsync(fish);

            await DatabaseQueries.UpdateAsync(user);

            await KaguyaEvents.TriggerFish(new FishHandlerEventArgs(user, fish, Context)); // Triggers the fish EXP service.

            if (fishType != FishType.BAIT_STOLEN)
            {
                List <Fish> existingFish = (await DatabaseQueries.GetFishForUserMatchingTypeAsync(fishType, user.UserId)).ToList();
                int         fishCount    = existingFish.Count(x => !x.Sold);
                string      fishString   = fishType.ToString().Replace("_", " ").ToLower();

                embed.Description += $"\n\nFish ID: `{fishId}`\n" +
                                     $"Fish Value: `{value:N0}` points.\n" +
                                     $"Fishing Exp Earned: `{fishExp:N0} exp`\n" +
                                     $"Points Remaining: `{user.Points:N0} (-{user.FishCost()})`\n\n" +
                                     $"You now have `{fishCount}` `{fishString}`";
            }
            else
            {
                embed.Description += $"\nPoints Remaining: `{user.Points:N0} (-{user.FishCost()})`";
            }

            embed.Footer = new EmbedFooterBuilder
            {
                Text = $"Use the {server.CommandPrefix}myfish command to view your fishing stats!\n" +
                       $"The {server.CommandPrefix}sellfish command may be used to sell your fish."
            };

            // Fish Embed
            await ReplyAsync(embed : embed.Build());
        }