public static PacketWriter ProcessTile(int totalTileCount, int freeRollAmount, MapleopolyTile tile)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.Mapleopoly);

        pWriter.Write(MapleopolyPacketMode.ProcessTile);
        pWriter.Write(tile.Type);
        pWriter.WriteInt(tile.TileParameter);
        pWriter.WriteInt(totalTileCount);
        pWriter.WriteInt(freeRollAmount);
        pWriter.WriteInt(tile.ItemId);
        pWriter.WriteByte(tile.ItemRarity);
        pWriter.WriteInt(tile.ItemAmount);
        return(pWriter);
    }
        public static Packet ProcessTile(Mapleopoly playerGame, MapleopolyTile tile)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.MAPLEOPOLY);

            pWriter.WriteEnum(MapleopolyPacketMode.ProcessTile);
            pWriter.WriteEnum(tile.Type);
            pWriter.WriteInt(tile.TileParameter);
            pWriter.WriteInt(playerGame.TotalTileCount);
            pWriter.WriteInt(playerGame.FreeRollAmount);
            pWriter.WriteInt(tile.ItemId);
            pWriter.WriteByte(tile.ItemRarity);
            pWriter.WriteInt(tile.ItemAmount);
            return(pWriter);
        }
    private static void HandleProcessTile(GameSession session)
    {
        int currentTilePosition = session.Player.Mapleopoly.TotalTileCount % Mapleopoly.TILE_AMOUNT;

        MapleopolyTile currentTile = DatabaseManager.Mapleopoly.FindTileByPosition(currentTilePosition + 1);

        switch (currentTile.Type)
        {
        case MapleopolyTileType.Item:
        case MapleopolyTileType.TreasureTrove:
            Item item = new(currentTile.ItemId)
            {
                Amount = currentTile.ItemAmount,
                Rarity = currentTile.ItemRarity
            };
            session.Player.Inventory.AddItem(session, item, true);
            break;

        case MapleopolyTileType.Backtrack:
            session.Player.Mapleopoly.TotalTileCount -= currentTile.TileParameter;
            break;

        case MapleopolyTileType.MoveForward:
            session.Player.Mapleopoly.TotalTileCount += currentTile.TileParameter;
            break;

        case MapleopolyTileType.RoundTrip:
            session.Player.Mapleopoly.TotalTileCount += Mapleopoly.TILE_AMOUNT;
            break;

        case MapleopolyTileType.GoToStart:
            int tileToStart = Mapleopoly.TILE_AMOUNT - currentTilePosition;
            session.Player.Mapleopoly.TotalTileCount += tileToStart;
            break;

        case MapleopolyTileType.Start:
            break;

        default:
            Logger.Warn("Unsupported tile");
            break;
        }

        ProcessTrip(session); // Check if player passed Start
        session.Send(MapleopolyPacket.ProcessTile(session.Player.Mapleopoly, currentTile));
    }
Example #4
0
    private static void HandleProcessTile(GameSession session, GameEventUserValue totalTileValue, GameEventUserValue freeRollValue,
                                          GameEventUserValue totalTripValue)
    {
        int.TryParse(freeRollValue.EventValue, out int freeRolls);
        int.TryParse(totalTileValue.EventValue, out int totalTiles);
        int currentTilePosition = totalTiles % MapleopolyTile.TILE_AMOUNT;

        MapleopolyTile currentTile = DatabaseManager.Mapleopoly.FindTileByPosition(currentTilePosition + 1);

        switch (currentTile.Type)
        {
        case MapleopolyTileType.Item:
        case MapleopolyTileType.TreasureTrove:
            Item item = new(currentTile.ItemId, currentTile.ItemAmount, currentTile.ItemRarity);
            session.Player.Inventory.AddItem(session, item, true);
            break;

        case MapleopolyTileType.Backtrack:
            totalTiles -= currentTile.TileParameter;
            break;

        case MapleopolyTileType.MoveForward:
            totalTiles += currentTile.TileParameter;
            break;

        case MapleopolyTileType.RoundTrip:
            totalTiles += MapleopolyTile.TILE_AMOUNT;
            break;

        case MapleopolyTileType.GoToStart:
            int tileToStart = MapleopolyTile.TILE_AMOUNT - currentTilePosition;
            totalTiles += tileToStart;
            break;

        case MapleopolyTileType.Start:
            break;

        default:
            Logger.Warning("Unsupported tile");
            break;
        }

        ProcessTrip(session, totalTripValue, totalTiles); // Check if player passed Start
        totalTileValue.UpdateValue(session, totalTiles);
        session.Send(MapleopolyPacket.ProcessTile(totalTiles, freeRolls, currentTile));
    }