<commit_before>define([
    'ash',
    'game/constants/UIConstants',
    'game/constants/ItemConstants',
    'game/constants/BagConstants',
    'game/nodes/player/PlayerActionResultNode',
    'game/components/common/PositionComponent',
    'game/components/player/BagComponent'
], function (Ash, UIConstants, ItemConstants, BagConstants, PlayerActionResultNode, PositionComponent, BagComponent) {
    var UIOutPopupInventorySystem = Ash.System.extend({

        uiFunctions: null,
        playerActionResultNodes: null,
    
        constructor: function (uiFunctions) {
            this.uiFunctions = uiFunctions;
			return this;
        },

        addToEngine: function (engine) {
            this.playerActionResultNodes = engine.getNodeList(PlayerActionResultNode);
            this.playerActionResultNodes.nodeAdded.add(this.onNodeAdded, this);
        },
		
        removeFromEngine: function (engine) {
            this.playerActionResultNodes.nodeAdded.remove(this.onNodeAdded, this);
            this.playerActionResultNodes = null;
        },
        
        onNodeAdded: function (node) {
            this.pendingListUpdate = true;
        },

        update: function (time) {
            if (!($(".popup").is(":visible")) || $(".popup").data("fading") == true)
                return;
            if (!($(".popup #info-results").is(":visible")))
                return;
            
            this.updateButtons();
            
            if (this.pendingListUpdate) {
                this.updateLists();
            }
        },
        
        updateButtons: function() {
            var resultNode = this.playerActionResultNodes.head;
            if (resultNode) {
                var rewards = resultNode.result.pendingResultVO;
                var hasPickedSomething = rewards.selectedItems.length > 0 || rewards.selectedResources.getTotal() > 0 || rewards.discardedItems.length > 0 || rewards.discardedResources.getTotal() > 0;
                var canPickSomething = rewards.gainedResources.getTotal() > 0 || rewards.gainedItems.length > 0;
                $("#info-ok").text(hasPickedSomething ? "Take selected" : canPickSomething ? "Leave all" : "Continue");
            }
        },
        
        updateLists: function () {
            $("#resultlist-inventorymanagement-found ul").empty();
            $("#resultlist-inventorymanagement-kept ul").empty();
            $("#resultlist-loststuff-lost ul").empty();
            
            var sys = this;<commit_msg>fix fight result popup not updating<commit_after>define([
    'ash',
    'game/constants/UIConstants',
    'game/constants/ItemConstants',
    'game/constants/BagConstants',
    'game/nodes/player/PlayerActionResultNode',
    'game/components/common/PositionComponent',
    'game/components/player/BagComponent'
], function (Ash, UIConstants, ItemConstants, BagConstants, PlayerActionResultNode, PositionComponent, BagComponent) {
    var UIOutPopupInventorySystem = Ash.System.extend({

        uiFunctions: null,
        playerActionResultNodes: null,
    
        constructor: function (uiFunctions) {
            this.uiFunctions = uiFunctions;
			return this;
        },

        addToEngine: function (engine) {
            this.playerActionResultNodes = engine.getNodeList(PlayerActionResultNode);
            this.playerActionResultNodes.nodeAdded.add(this.onNodeAdded, this);
        },
		
        removeFromEngine: function (engine) {
            this.playerActionResultNodes.nodeAdded.remove(this.onNodeAdded, this);
            this.playerActionResultNodes = null;
        },
        
        onNodeAdded: function (node) {
            this.pendingListUpdate = true;
        },

        update: function (time) {
            if (!($(".popup").is(":visible")) || $(".popup").data("fading") == true)
                return;
            if (!($(".popup #info-results").is(":visible")) && !($(".popup #fight-popup-results").is(":visible")))
                return;
            
            this.updateButtons();
            
            if (this.pendingListUpdate) {
                this.updateLists();
            }
        },
        
        updateButtons: function() {
            var resultNode = this.playerActionResultNodes.head;
            if (resultNode) {
                var rewards = resultNode.result.pendingResultVO;
                var hasPickedSomething = rewards.selectedItems.length > 0 || rewards.selectedResources.getTotal() > 0 || rewards.discardedItems.length > 0 || rewards.discardedResources.getTotal() > 0;
                var canPickSomething = rewards.gainedResources.getTotal() > 0 || rewards.gainedItems.length > 0;
                $("#info-ok").text(hasPickedSomething ? "Take selected" : canPickSomething ? "Leave all" : "Continue");
            }
        },
        
        updateLists: function () {
            $("#resultlist-inventorymanagement-found ul").empty();
            $("#resultlist-inventorymanagement-kept ul").empty();
            $("#resultlist-loststuff-lost ul").empty();
            
            var sys = this;
{'fraction_non_alphanumeric': 0.12430939226519337, 'fraction_numerical': 0.0023677979479084454, 'mean_word_length': 2.2184126984126986, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5706512', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1291, 'n_words': 224}