Skip to main content

Search Functions

Functions related to searching the transfer market.

clickBuscar()

Clicks the search button in the transfer market.
none
void
No parameters required
Returns: None XPath: /html/body/main/section/section/div[2]/div/div[2]/div/div[2]/button[2] Usage:
clickBuscar()

clickEncontrado()

Clicks the first found element if it exists and initiates purchase.
none
void
No parameters required
Returns: None Behavior:
  • Checks if elements exist in search results
  • Extracts price from first element
  • Calls comprar() function automatically
XPath: /html/body/main/section/section/div[2]/div/div/section[1]/div/ul/li/div

buscarRango()

Automatically searches for optimal price range based on market availability.
none
void
Uses global variables: final, maximo, inicial, iEsperada
Returns: None Algorithm:
  1. Starts with current sale price (final.get())
  2. Searches for items at that price
  3. If no items found, increases price incrementally:
    • < 1000: +50 coins
    • < 10000: +100 coins
    • < 50000: +500 coins
    • ≥ 50000: +500 coins
  4. If too many items (>4), decreases price
  5. When optimal range found (≤4 items), calculates:
    • Buy price: (salePrice * 0.95) - expectedProfit
    • Updates UI fields
    • Sends WhatsApp notification
Example:
buscarRango()
# Sends: "Nuevo Rango Compra: 4500 Venta: 5000"

revisarPrecio()

Reviews and updates price ranges based on current market conditions.
none
void
Uses global variables: final, maximo, inicial, iEsperada
Returns: None Difference from buscarRango():
  • Uses expected profit (iEsperada) for calculations
  • Does not send WhatsApp notifications
  • Formula: maxPrice = (salePrice * 0.95) - expectedProfit

Purchase Functions

Functions for buying and listing items.

comprar()

Purchases an item and automatically lists it on the market.
none
void
Uses global variables: mWhats, iteraciones, inicial, final
Returns: None Process:
  1. Captures initial balance
  2. Clicks buy button
  3. Confirms purchase in popup
  4. Waits 5 seconds
  5. Verifies balance changed (confirms purchase)
  6. Sends WhatsApp notification with iteration count
  7. Calls ponerMercado() and definirPrecio()
  8. If balance unchanged, sends “NO SE COMPRO” message
Error Handling:
try:
    # Purchase logic
except:
    print("ERROR EN COMPRAR")

ponerMercado()

Clicks the button to list a purchased item on the market.
none
void
No parameters required
Returns: None XPath: /html/body/main/section/section/div[2]/div/div/section[2]/div/div/div[2]/div[2]/div[1]/button

definirPrecio()

Sets the initial and final selling prices for a purchased item.
none
void
Uses global variables: inicial, final
Returns: None Process:
  1. Checks if price input fields exist
  2. Sets minimum price from inicial field
  3. Sets maximum price from final field
  4. Clicks “List on Market” button
  5. If fields don’t exist, prints “FALSA ALARMA”

Functions for navigating the FIFA Web App.

clickRegresar()

Returns to the transfer market search screen.
none
void
No parameters required
Returns: None XPath: /html/body/main/section/section/div[1]/button[1]

irMercadoTransferencias()

Navigates to the transfer market from any screen.
none
void
No parameters required
Returns: None Process:
  1. Clicks transfer menu button
  2. Waits 5 seconds
  3. Clicks market search option

Inventory Management Functions

Functions for managing sold items and inventory.

limpiarvendidos()

Clears sold items from the transfer list and checks balance.
none
void
No parameters required
Returns: None Process:
  1. Opens transfer menu
  2. Navigates to items section
  3. If sold items exist:
    • Sends screenshot via WhatsApp
    • Clicks clear button
  4. Returns to market search
  5. Sends current balance via WhatsApp
Usage:
limpiarvendidos()
# Sends screenshot + current balance to WhatsApp

limpiarvendidosBID()

Clears sold items when using bidding mode (no WhatsApp notification).
none
void
No parameters required
Returns: None Difference from limpiarvendidos():
  • Does not send WhatsApp messages
  • Does not check balance
  • Designed for bidding workflow

WhatsApp Functions

Functions for sending notifications via WhatsApp Web.

enviarWhatsapp(mensaje)

Sends a text message to WhatsApp.
mensaje
string
required
The message text to send
Returns: None Requirements:
  • WhatsApp Web must be open in Chrome on port 9222
  • eW checkbox must be enabled (eW=1)
  • First chat must be the target contact
Process:
  1. Checks if WhatsApp is enabled (eW.get() == 1)
  2. Clicks first chat in sidebar
  3. Clicks message input field
  4. Types message
  5. Clicks send button
Example:
enviarWhatsapp("SE COMPRO 5000 Iteracion: 42")
The bot always sends to the first chat in your WhatsApp sidebar. Make sure the correct contact is pinned to the top.

enviarScreenshot()

Captures a screenshot of FIFA Web App and sends it via WhatsApp.
none
void
No parameters required
Returns: None Requirements:
  • eSS checkbox must be enabled (eSS=1)
  • WhatsApp Web must be open
Process:
  1. Saves screenshot as screenshot.png
  2. Converts to BMP format
  3. Copies to Windows clipboard
  4. Calls enviarImagenWhatsapp()

enviarImagenWhatsapp()

Pastes image from clipboard and sends it via WhatsApp.
none
void
Requires image in clipboard
Returns: None Process:
  1. Clicks first chat
  2. Clicks message input
  3. Pastes image (Ctrl+V)
  4. Waits 3 seconds
  5. Clicks send button

enviarSSControlRemoto()

Sends screenshot for remote control commands (always enabled).
none
void
Does not check eSS flag
Returns: None Usage: Called by Firebase remote control commands.

Bidding Functions

Functions for automated bidding on players.

recorrerBid(objetivos)

Iterates through search results and bids on items below maximum price.
objetivos
int
required
Number of target items to bid on (typically 50 - current objectives)
Returns: None Algorithm:
  1. Calculates bids needed: 50 - objetivos
  2. Loops through 20 items per page
  3. For each item:
    • Checks current bid price
    • If price is ”---” (no bids) or < maximo, bids
    • Handles “too many bids” error (sleeps 300s)
  4. Moves to next page
  5. Stops when target bids reached
Example:
recorrerBid(45)  # Will place 5 bids
If you reach the bid limit, the bot will wait 300 seconds (5 minutes) before continuing.

clickPujar()

Clicks the bid button on the current item.
none
void
No parameters required
Returns: None XPath: /html/body/main/section/section/div[2]/div/div/section[2]/div/div/div[2]/div[2]/button[1]

clickSiguiente()

Clicks the next page button in search results.
none
void
No parameters required
Returns: None XPath: /html/body/main/section/section/div[2]/div/div/section[1]/div/div/button[2]

bidding()

Main bidding loop that automates the entire bidding process.
none
void
Uses global variables: nacionalidadEntry, inicial, final
Returns: None Process:
  1. Opens transfers menu
  2. Checks current objective count
  3. Navigates to market search
  4. Sets country filter (alternates between countries)
  5. Searches for items
  6. Calls recorrerBid() to place bids
  7. Calls limpiarvendidosBID() to clear sold items
  8. Calls borrarcaducos() to remove expired bids
  9. Calls ponerenVentaBid() to list won items
  10. Waits 300 seconds
  11. Repeats loop
Usage:
bidding()
# Runs in separate thread

ponerenVentaBid()

Lists all won bid items on the transfer market.
none
void
Uses global variables: inicial, final
Returns: None Process:
  1. Counts items in “Won Items” section
  2. For each item:
    • Clicks item
    • Clicks “List on Market”
    • Sets initial price from inicial
    • Sets final price from final
    • Confirms listing
  3. Repeats until no items remain

borrarcaducos()

Removes expired (unsuccessful) bids from objectives.
none
void
No parameters required
Returns: None Process:
  1. Opens transfers menu
  2. Opens objectives section
  3. If expired bids exist, clicks clear button
  4. Prints “NO CADUCOS” if none found

Filter Functions

Functions for setting search filters.

selecciones()

Applies all search filters from UI inputs.
none
void
Uses global variables: ligaClicked, clubEntry, calidadClicked, tipoClicked, posicionClicked, nacionalidadEntry
Returns: None Filters Applied:
  • Opens league dropdown
  • Searches for league name (e.g., “Premier League (ING 1)”)
  • If “Ninguno”, clears filter
  • Opens club dropdown
  • Types club name
  • If empty string, clears filter
  • Options: Oro, Plata, Bronce, Especial
  • If “Ninguno”, clears filter
  • Options: Comunes, Únicos, UCL cards, Icons, etc.
  • If “Ninguno”, clears filter
  • Options: POR, CAD, LD, DFC, LI, MC, etc.
  • If “Ninguno”, clears filter
  • Opens country dropdown
  • Searches for country name
  • If empty string, clears filter
Example:
# Set filters in UI first
ligaClicked.set("Premier League (ING 1)")
clubEntry.insert(0, "Manchester City")
calidadClicked.set("Oro")

# Apply filters
selecciones()

cambiarPais()

Alternates country filter between Brasil and Argentina.
none
void
Uses global variable: nacionalidadEntry
Returns: None Behavior:
  • If current = “Brasil”, changes to “Argentina”
  • If current = “Argentina”, changes to “Brasil”
  • Used by bidding mode to diversify searches

Authentication Functions

Functions for handling login and session management.

reLogin()

Automatically re-authenticates when session expires.
none
void
Hardcoded password: “Warewolf10”
Returns: None Process:
  1. Sends WhatsApp: “EMPEZARON RELOGIN”
  2. Clicks session expired button
  3. Waits 10 seconds
  4. Clicks login button
  5. Enters password (clears field first)
  6. Clicks accept
  7. Waits 15 seconds
  8. Navigates to transfer market
  9. Applies filters with selecciones()
  10. Reviews price with revisarPrecio()
  11. Sends screenshot
Security Risk: Password is hardcoded in plaintext. In production, use environment variables or secure credential storage.
Usage:
reLogin()
# Called automatically by Firebase remote control

Price Manipulation Functions

Functions for adjusting search prices.

precioMaximoBusqueda()

Sets the maximum search price from UI input.
none
void
Uses global variable: maximo
Returns: None Process:
  1. Clicks max price input field
  2. Types value from maximo entry

aumentaMinimoCompraYa()

Increases the minimum “Buy Now” price by one increment.
none
void
No parameters required
Returns: None XPath: /html/body/main/section/section/div[2]/div/div[2]/div/div[1]/div[2]/div[5]/div[2]/button[2]

disminuyeMinimoCompraYa()

Decreases the minimum “Buy Now” price by 3 increments.
none
void
No parameters required
Returns: None Behavior: Clicks decrease button 3 times in a loop.

Mas1ClickMaximo()

Increases maximum price by one increment (with delay in fast mode).
none
void
Checks global variable: rapido
Returns: None Delay: 2 seconds if rapido.get() == 1

Menos1ClickMaximo()

Decreases maximum price by one increment (with delay in fast mode).
none
void
Checks global variable: rapido
Returns: None Delay: 2 seconds if rapido.get() == 1

Control Functions

Functions for starting, stopping, and managing the bot.

iniciar()

Starts the main bot loop.
none
void
Uses global variables: seguir, switch, iteraciones, cuantos
Returns: None Process:
  1. Displays current balance
  2. Sets switch = True
  3. Calls precioMaximoBusqueda()
  4. Starts run loop in separate thread:
    • Increments iteration counter
    • Every N iterations (from numeroRango):
      • Sends progress via WhatsApp
      • Calls revisarPrecio()
    • Every itera iterations:
      • Calls limpiarvendidos() or waits S seconds
    • Alternates aumentaMinimoCompraYa() / disminuyeMinimoCompraYa()
    • Calls clickBuscar(), clickEncontrado(), clickRegresar()
  5. On exception, attempts recovery:
    • Calls irMercadoTransferencias()
    • Restarts loop
Example:
iniciar()
# Bot runs in background thread

switchoff()

Stops the bot gracefully.
none
void
Sets global variables: switch, switchBid
Returns: None Behavior:
  • Sets switch = False
  • Sets switchBid = False
  • Bot loop checks these flags and exits

switchon()

Enables the bot switch (does not start bot).
none
void
Sets global variable: switch
Returns: None Note: This only sets the flag. Call iniciar() to actually start the bot.

stop()

Stops the bot loop by setting seguir = False.
none
void
Sets global variable: seguir
Returns: None

Remote Control Functions

Functions for Firebase-based remote control.

stream_handler(message)

Handles Firebase real-time database commands.
message
dict
required
Firebase message containing command in message['data']
Returns: None Supported Commands:
CommandAction
DETENERCalls switchoff()
INICIARCalls iniciar()
SCREENSHOTCalls enviarSSControlRemoto()
RELOGINCalls reLogin()
Setup:
my_stream = db.child("comando").stream(stream_handler)
Usage: Update Firebase database with:
{"comando": "SCREENSHOT"}
After executing each command, the bot resets the command to “OK” to prevent duplicate execution.

close_window()

Cleanup function called when closing the application.
none
void
No parameters required
Returns: None Process:
  1. Calls switchoff() to stop bot
  2. Closes Firebase stream (my_stream.close())
  3. Destroys Tkinter window (root.destroy())

Utility Functions

send_to_clipboard(clip_type, data)

Copies data to Windows clipboard.
clip_type
int
required
Clipboard format (e.g., win32clipboard.CF_DIB for images)
data
bytes
required
Binary data to copy
Returns: None Process:
  1. Opens clipboard
  2. Empties existing content
  3. Sets new data
  4. Closes clipboard
Example:
send_to_clipboard(win32clipboard.CF_DIB, image_data)

detener()

Pauses bot execution when specific WhatsApp message is detected.
none
void
Monitors WhatsApp for pause message
Returns: None Behavior:
  • Checks for specific message in WhatsApp
  • Sends “PROCESO DETENIDO” notification
  • Enters wait loop (checks every 5 seconds)
  • Resumes when message disappears
Note: This function references a specific XPath that may not exist in current code. It appears to be legacy or incomplete functionality.

Global Variables Reference

User Interface Variables

VariableTypeDescription
maximoEntryMaximum buy price
inicialEntryMinimum sell price
finalEntryMaximum sell price
iEsperadaEntryExpected profit
iRealEntryReal profit
iteraEntryIterations before action (default: 10)
segundosEntryWait seconds (default: 45)
numeroRangoEntryIterations before price check (default: 31)

Control Variables

VariableTypeDescription
seguirboolMain loop control
switchboolBot enabled flag
switchBidboolBidding mode flag
iteracionesintCurrent iteration count
cuantosintCounter for range checks

Mode Variables

VariableTypeDescription
rIntVarAction mode (1=clear sold, 2=wait)
rapidoIntVarSpeed mode (1=normal, 2=fast)
eWIntVarEnable WhatsApp (1=on, 0=off)
eSSIntVarEnable screenshots (1=on, 0=off)
eRIntVarEnable range search (1=on, 0=off)

Filter Variables

VariableTypeDescription
ligaClickedStringVarSelected league
clubEntryEntryClub name
calidadClickedStringVarQuality (Oro/Plata/Bronce)
tipoClickedStringVarCard type
posicionClickedStringVarPosition
nacionalidadEntryEntryNationality

Code Architecture

Threading Model

The bot uses Python’s threading module to run operations concurrently:
thread = threading.Thread(target=run)
thread.start()
Main Thread: Tkinter UI event loop
Worker Thread: Bot automation loop
Firebase Thread: Real-time database listener

Error Handling Strategy

  1. Try-Except Blocks: Wrap critical operations
  2. Recovery Logic: Attempt to navigate back to transfer market
  3. WhatsApp Notifications: Alert user on errors with screenshots
  4. Graceful Degradation: Print error, send notification, continue
Example:
try:
    # Main bot loop
except Exception:
    if r.get() == 1:
        irMercadoTransferencias()
        iteraciones = 0
        run()  # Restart
    else:
        enviarWhatsapp("ALGO OCURRIO 1")
        enviarScreenshot()

Selenium WebDriver Setup

FIFA Web App (Port 9250):
opts = Options()
opts.add_experimental_option('debuggerAddress', 'localhost:9250')
driver = webdriver.Chrome(options=opts)
WhatsApp Web (Port 9222):
optsWhats = Options()
optsWhats.add_experimental_option('debuggerAddress', 'localhost:9222')
driverWhatsapp = webdriver.Chrome(options=optsWhats)
Both Chrome instances must be started manually with remote debugging enabled before running the bot.

Best Practices

Formula:
  • Buy Price: salePrice / 1.07 (accounts for 5% EA tax)
  • Min Sell: salePrice - increment
  • Max Sell: salePrice
Example:
  • To sell at 10,000 coins
  • Buy at: 10,000 / 1.07 = 9,345
  • Min sell: 9,500
  • Max sell: 10,000
  • Profit: (10,000 × 0.95) - 9,345 = 155 coins
  • Low iterations (5-10): Clears sold items quickly, good for high-volume trading
  • High iterations (20-50): Reduces transfer list checks, better for slow markets
  • Range checks (30-50): Monitors price changes without excessive searches
  • Normal (rapido=1): Full delays, safer, less likely to trigger rate limits
  • Fast (rapido=2): Minimal delays, higher throughput, higher ban risk
Fast mode increases detection risk. Use normal mode for long sessions.
  • Narrow filters: Reduce competition, higher profit margins
  • Broad filters: More opportunities, faster turnover
  • Popular items: High volume, low profit per item
  • Niche items: Low volume, high profit margins

Build docs developers (and LLMs) love