# Gccg command to mark all cards on the current collection page as wanted. # # Copyright (C) 2005 Neil Moore . Distributed with NO WARRANTY # under the terms of the GPL, version 2 (only). # if(msg.box != NULL) { Msg("Loading {gold}Wantall.command"); } # MakeWanted(c,tl)---mark c as wanted tl-have(c) times. def MakeWanted { push(c); push(tl); push(e); push(n); c = ARG[0]; tl = ARG[1]; e = book_entry(card.book,c); n = -tl + e[0]; if(e[4] != n && n < 0) { BookChangeForsale(c, n - e[4]); return 1; } else { return 0; } n = pop(); e = pop(); tl = pop(); c = pop(); } # Sell all extra cards on the current page. # def ChatCommandWantall { push(cards); push(c); push(i); push(tl); if(typeof(options{"trade_limit"})=="integer") { tl = options{"trade_limit"}; } else { tl = 4; } cards = book_cards(card.book,book_page(card.book)); if(length(ARG) != 0) { Msg("{orange}Command {white}/wantall{orange} takes no arguments."); } i = 0; for(c)(cards) { if(MakeWanted(c,tl)) { i = i + 1; if(i % 5 == 0) { refresh(1); sleep(1); refresh(0); } } } refresh(1); tl = pop(); i = pop(); c = pop(); cards = pop(); } HELP{"chat"}{"wantall"}=("","want all cards on current page", NULL, "For each card on the current collection page, want as many copies of that card as necessary to reach {cyan}trade_limit{white}.");