Z
Z
zeaovede2022-04-17 15:21:57
JavaScript
zeaovede, 2022-04-17 15:21:57

How to transfer prices from calculator to json file?

How to transfer prices from calculator to json file? For convenience, you need to display prices from the js file to json, so that later in this json file you can change prices without resorting to edits in the js file

//price
    if (server === "na" || server === "oce" || server === "las" || server === "lan" || server === "br" || server === "jp") {
        if (current_tier_num === "0") {
            pricepergame = 2.9;
        }
        if (current_tier_num === "1") {
            pricepergame = 1.8;
        }
        if (current_tier_num === "2") {
            pricepergame = 1.8;
        }
        if (current_tier_num === "3") {
            pricepergame = 2.8;
        }
        if (current_tier_num === "4") {
            pricepergame = 3.6;
        }
        if (current_tier_num === "5") {
            pricepergame = 4.3;
        }
        if (current_tier_num === "6") {
            pricepergame = 6;
        }
        if (current_tier_num === "7") {
            pricepergame = 9;
        }
        if (current_tier_num === "8") {
            pricepergame = 10;
        }
        if (current_tier_num === "9") {
            pricepergame = 11;
        }
        
        currency = "РУБ";
        currency_s = "₽";
    } else {
       
        if (current_tier_num === "0") {
            pricepergame = 2;
        }
        if (current_tier_num === "1") {
            pricepergame = 1.5;
        }
        if (current_tier_num === "2") {
            pricepergame = 1.65;
        }
        if (current_tier_num === "3") {
            pricepergame = 2;
        }
        if (current_tier_num === "4") {
            pricepergame = 2.5;
        }
        if (current_tier_num === "5") {
            pricepergame = 3;
        }
        if (current_tier_num === "6") {
            pricepergame = 4.5;
        }
        if (current_tier_num === "7") {
            pricepergame = 7;
        }
        if (current_tier_num === "8") {
            pricepergame = 8;
        }
        if (current_tier_num === "9") {
            pricepergame = 9;
        }
        currency = "РУБ";
        currency_s = "₽";

    }
    //end price

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wonderingpeanut, 2022-04-17
@wonderingpeanut

on the client - no way, you need to send data to the back and write to the json file on the back through the fs module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question