// Decompiled by AS3 Sorcerer 6.78
// www.buraks.com/as3sorcerer

//scpacker.server.models.bonus.ServerBonusModel

package scpacker.server.models.bonus
{
    import alternativa.tanks.model.bonus.BonusModel;
    import alternativa.service.IModelService;
    import alternativa.init.Main;
    import projects.tanks.client.panel.model.bonus.IBonusModelBase;
    import projects.tanks.client.panel.model.bonus.BonusItem;

    public class ServerBonusModel 
    {

        private var model:BonusModel;
        private var modelsService:IModelService;

        public function ServerBonusModel()
        {
            this.modelsService = IModelService(Main.osgi.getService(IModelService));
            this.model = BonusModel(this.modelsService.getModelsByInterface(IBonusModelBase)[0]);
        }

        public function showBonuses(data:String):void
        {
            var item:Object;
            var bonusItem:BonusItem;
            var array:Array = new Array();
            var parser:Object = JSON.parse(data);
            var i:int;
            for each (item in parser.items)
            {
                bonusItem = new BonusItem(item.id);
                bonusItem.count = item.count;
                array[i] = bonusItem;
                i++;
            };
            this.model.showBonuses(null, array, "RU");
        }

        public function showCrystalls(count:int):void
        {
            this.model.showCrystals(null, count, null);
        }

        public function showDoubleCrystalls():void
        {
            this.model.showDoubleCrystalls(null, null);
        }

        public function showNoSupplies():void
        {
            this.model.showNoSupplies(null, null);
        }

        public function showNewbiesUpScore():void
        {
            this.model.showNubeUpScore();
        }

        public function showNewbiesNewRank():void
        {
            this.model.showNubeNewRank();
        }

        public function showRulesUpdate():void
        {
            this.model.showRulesUpdate();
        }


    }
}//package scpacker.server.models.bonus

это код из моего приложения на as 3.0, как прописать эту функцию showNewbiesUpScore чтобы сервер отправлял задачу клиенту, а клиент выводил это окно, вот сюда надо это добавить const
    {
        market_list,
        shop_data
    } = require("./server");
const Area = require("./Area.js"),
    {
        playerJson,
        battle_items,
        send
    } = require("./server");
var CTFBattle,
    TDMBattle,
    DMBattle,
    DOMBattle,
    ASLBattle,
    effect_model = {
        effects: []
    };

class Lobby extends Area {

    constructor() {
        super();
        this.battles = [];
        this.chat = require("./LobbyChat");
        this.battle_count = 0;
        this.anticheat = 0;


    }

    createBattles() {
        if (this.battles.length === 0) {
            var battle = new DMBattle(true, "For newbies", "map_sandbox", 0, 8, 1, 5, 10, false, false);
            this.battles.push(battle);
            this.broadcast("create_battle;" + JSON.stringify(battle.toObject()));


        }
    }

//battle;init_mines;{"mines":[]}

    getChat() {
        return this.chat;
    }

    getPrefix() {
        return "lobby";
    }

    getBattles(socket, tank) {
        var arr = [];

        for (var i in this.battles) {
            arr.push(this.battles[i].toObject());
        }

        var sub = false;
        if (tank !== null) {
            sub = tank.garage.hasItem("no_supplies");
            tank.garage.removePlayer(tank.name);
            this.addPlayer(tank);
        }

        setTimeout(() => {
            this.send(socket, "init_battle_select;" + JSON.stringify(
                {
                    haveSubscribe: sub,
                    battles: arr,
                    items: battle_items
                }));
        }, 100);
    }

    findBattle(id) {
        for (var i in this.battles)
            if (this.battles[i].battleId === id)
                return this.battles[i];

        return null;
    }

    /**
     * Removes a battle.
     *
     * @param {string} battleId
     *
     * @returns boolean
     */
    removeBattle(battleId) {
        for (var i in this.battles) {
            if (this.battles[i].battleId === battleId) {
                this.battles.splice(i, 1);
                this.broadcast("remove_battle;" + battleId);
                this.createBattles();
                return true;

            }
        }

        return false
    }

    initEffectModel(socket) {
        this.send(socket, "init_effect_model;" + JSON.stringify(effect_model));
        this.createBattles();
    }

    onData(socket, args) {
        var battles = this.battles,
            battle_count = this.battle_count,
            tank = socket.tank;
        if (tank === null) {
            socket.destroy();
            return;
        }

        if (args.length === 1 && args[0] === "get_data_init_battle_select") {
            var arr = [];

            for (var i in this.battles) {
                arr.push(this.battles[i].toObject());
            }

            var sub = false;
            if (tank !== null) {
                sub = tank.garage.hasItem("no_supplies");
                tank.garage.removePlayer(tank.name);
                this.addPlayer(tank);
            }

            setTimeout(() => {
                this.send(socket, "init_battle_select;" + JSON.stringify(
                    {
                        haveSubscribe: sub,
                        battles: arr,
                        items: battle_items
                    }));
            }, 100);
        }
        if (args.length === 1 && args[0] === "get_rating") {
            this.send(socket, "open_rating;" + JSON.stringify(
                {
                    crystalls: [
                        {
                            "count": tank.crystals,
                            "rank": tank.rank,
                            "id": tank.name
                        }]
                }));

        } else if (args.length === 1 && args[0] === "show_quests") {


        } 
		else if (args[0] === "user_inited") {

        }
		else if (args.length === 1 && args[0] === "show_profile") 
		{
            this.send(socket, "show_profile;" + JSON.stringify(
                {
                    isComfirmEmail: false,
                    emailNotice: false
                }));
        } else if (args.length === 2 && args[0] === "try_create_battle_ctf") {
            if (tank.rank > 3) {
                try {
                    const data = JSON.parse(args[1]);
                    const battle = new CTFBattle(false, data.gameName, data.mapId, data.time, data.numPlayers, data.minRang, data.maxRang, data.numFlags, !data.inventory, data.autoBalance, data.frielndyFire, data.pay, false);
                    this.battles.push(battle);
                    this.broadcast("create_battle;" + JSON.stringify(battle.toObject()));
                    console.log('\x1b[35m%s\x1b[0m', ' > ' + tank.name + " создал битву " + data.gameName);
                } catch (e) {
                    console.log(e);
                }
            } else {
                this.send(socket, "server_message;Создавать битвы можно со звания Капрал")
            }
        } else if (args.length === 2 && args[0] === "try_create_battle_dom") {
            if (tank.rank > 3) {
                try {
                    const data = JSON.parse(args[1]);
                    const battle = new DOMBattle(false, data.gameName, data.mapId, data.time, data.numPlayers, data.minRang, data.maxRang, data.numPointsScore, !data.inventory, data.autoBalance, data.frielndyFire, data.pay, false);
                    this.battles.push(battle);
                    this.broadcast("create_battle;" + JSON.stringify(battle.toObject()));
                    console.log('\x1b[35m%s\x1b[0m', ' > ' + tank.name + " создал битву " + data.gameName);
                } catch (e) {
                    console.log(e);
                }
            } else {
                this.send(socket, "server_message;Создавать битвы можно со звания Капрал")
            }
        } else if (args.length === 2 && args[0] === "try_create_battle_tdm") {
            if (tank.rank > 3) {
                try {
                    const data = JSON.parse(args[1]);
                    console.log('data', data);
                    const battle = new TDMBattle(false, data.gameName, data.mapId, data.time, data.numPlayers, data.minRang, data.maxRang, data.numKills, !data.inventory, data.autoBalance, data.frielndyFire, data.pay);
                    this.battles.push(battle);
                    this.broadcast("create_battle;" + JSON.stringify(battle.toObject()));
                    console.log('\x1b[35m%s\x1b[0m', ' > ' + tank.name + " создал битву " + data.gameName);
                } catch (e) {
                    console.log(e);
                }
            } else {
                this.send(socket, "server_message;Создавать битвы можно со звания Капрал")
            }
        } else if (args[0] === "try_create_battle_dm") {
            if (tank.rank > 3) {
                try {
                    const withoutBonuses = args[10] === 'true';
                    const withoutSupplies = args[9] === 'true';

                    var battle = new DMBattle(false, args[1], args[2], args[3], args[5], args[6], args[7], args[4], !withoutBonuses, withoutSupplies);
                    this.battles.push(battle);
                    this.broadcast("create_battle;" + JSON.stringify(battle.toObject()));
                    console.log('\x1b[35m%s\x1b[0m', ' > ' + tank.name + " создал битву в режиме DM ");
                } catch (e) {
                    console.log(e);
                }

            } else {
                this.send(socket, "server_message;Создавать битвы можно со звания Капрал")
            }
        } else if (args.length === 2 && args[0] === "get_show_battle_info") {
            for (var i in battles) {
                if (battles[i].battleId === args[1]) {
                    this.send(socket, "show_battle_info;" + JSON.stringify(battles[i].toDetailedObject(tank)));
                }

            }

        } else if (args.length === 2 && (args[0] === "enter_battle_spectator")) {
            var battle = this.findBattle(args[1]);

            if (battle !== null)
                battle.addSpectator(tank);
        } else if (args[3] !== "null" && args.length === 3 && (args[0] === "enter_battle_team")) {

            var battle = this.findBattle(args[1]);

            if (battle !== null) {
                this.anticheat++;
                setTimeout(() => {
                    if (this.anticheat > 1) {
                        this.send(tank.socket, "battle;kick_by_cheats");
                        tank.socket.destroy();
                    }
                }, 50);
                setTimeout(() => {
                    this.anticheat--;
                }, 1000);
                var type = args[2] === "false" ? "BLUE" : "RED";
                send(socket, "lobby;start_battle");
                var user = battle.addPlayer(tank, type);

                if (user !== null)
                    this.broadcast("add_player_to_battle;" + JSON.stringify(
                        {
                            kills: user.kills,
                            battleId: args[2],
                            name: tank.name,
                            rank: tank.rank,
                            id: tank.name,
                            type: type
                        }));

            }
        } else if (args[3] !== "null" && args.length === 3 && (args[0] === "enter_battle")) {
            var battle = this.findBattle(args[1]);
            send(socket, "lobby;start_battle");

            if (battle !== null && battle.getTeamCount() === 1) {
                var user = battle.addPlayer(tank);
                if (user !== null)
                    this.broadcast("add_player_to_battle;" + JSON.stringify(
                        {
                            kills: user.kills,
                            battleId: args[2],
                            name: tank.name,
                            rank: tank.rank,
                            id: tank.name,
                            type: "NONE"
                        }));
            }
        } else if (args.length === 2 && args[0] === "check_battleName_for_forbidden_words") {
            send(socket, "lobby;check_battle_name;" + args[1]);
        } else if (args.length === 1 && args[0] === "get_garage_data") {
            var tank = socket.tank;
            if (tank !== null) {
                setTimeout(() => {
                    tank.garage.initiate(socket);
                    this.initEffectModel(socket);

                    if (this.hasPlayer(tank.name))
                        this.removePlayer(tank.name);
                }, 1000);
            }
        }
    }

}

module.exports = new Lobby();

CTFBattle = require("./CTFBattle");
TDMBattle = require("./TDMBattle");
DMBattle = require("./DMBattle");
DOMBattle = require("./DOMBattle");
ASLBattle = require("./ASLBattle");