예제 #1
0
    private static void HandleCatch(GameSession session, PacketReader packet)
    {
        bool success = packet.ReadBool();

        CoordF guideBlock = Block.ClosestBlock(session.Player.Guide.Coord);

        guideBlock.Z -= Block.BLOCK_SIZE; // get liquid block coord
        MapBlock            block  = MapMetadataStorage.GetMapBlock(session.Player.MapId, guideBlock.ToShort());
        List <FishMetadata> fishes = FishMetadataStorage.GetValidFishes(session.Player.MapId, block.Attribute);

        //determine fish rarity
        List <FishMetadata> selectedFishRarities = FilterFishesByRarity(fishes);

        Random       rnd             = RandomProvider.Get();
        int          randomFishIndex = rnd.Next(selectedFishRarities.Count);
        FishMetadata fish            = selectedFishRarities[randomFishIndex];

        //determine fish size
        int fishSize = rnd.NextDouble() switch
        {
예제 #2
0
    private static MapBlock ScanZAxisForLiquidBlock(CoordF checkBlock, int mapId)
    {
        for (int zAxis = 0; zAxis < 3; zAxis++)
        {
            if (MapMetadataStorage.BlockAboveExists(mapId, checkBlock.ToShort()))
            {
                return(null);
            }

            MapBlock block = MapMetadataStorage.GetMapBlock(mapId, checkBlock.ToShort());
            if (block == null || !IsLiquidBlock(block))
            {
                checkBlock.Z -= Block.BLOCK_SIZE;
                continue;
            }

            return(block);
        }
        return(null);
    }