import { eventType } from '../../module/collection_event';
import { player } from '../../shared/protocols/user/type';


export class EventFun {

    /**
     * 补发玩家战令奖励
     */
    static async reissueZhanLingPrize(data: eventType['zhanling'], player: player) {
        let prize: atn[] = [];
        let rec = data.rec;
        let isPay = data.isPay;

        for (let index = 0; index < G.gc.zhanling.prize.length; index++) {
            let conf = G.gc.zhanling.prize[index];
            if (data.lv < conf.lv) break;

            if (!rec[index] || !rec[index].pt) conf.pt.length > 0 && prize.push(...conf.pt);
            if (isPay && (!rec[index] || !rec[index].tq)) conf.tq.length > 0 && prize.push(...conf.tq);
        }

        if (prize.length > 0) {
            // EmailFun.addEmail({
            //     uid: player.uid,
            //     type: 'system',
            //     prize: PublicShared.mergePrize(prize),
            //     title: G.gc.zhanling.email.title,
            //     content: G.gc.zhanling.email.content
            // });
        }
    }
}