<commit_before>/******************************
    Default shop setup
    for spacialgaze.psim.us
    coded by HoeenHero
    -----------------------
    THIS IS NOT THE SAME AS
    THE PRIVATE SHOP ON SG
******************************/
'use strict';

const fs = require('fs');
var allowThisShop = false; //Change to true to make these command work
var writeJSON = true;
SG.eShop = {};

function newItem (name, desc, price, isSSB) {
  this.name = name;
  this.id = toId(name);
  this.desc = Chat.escapeHTML(desc);
  this.price = Number(price);
  this.isSSB = Boolean(isSSB);
}

function writeShop() {
  if (!writeJSON) return false; //Prevent corruptions
  fs.writeFile('config/eShop.json', JSON.stringify(SG.eShop));
}

function shopDisplay() { //2px solid #070e96
  let output = '<div style="max-height:300px; width: 100%;"><table style="border:2px solid #101ad1; border-radius: 5px; width: 100%;"><tr><th colspan="3" style="border: 2px solid #070e96; border-radius: 5px">Server Shop</th></tr>';
  for (let i in SG.eShop) {
    if (!SG.eShop[i]) continue;
    output += '<tr><td style="border: 2px solid #070e96; width: 20%; text-align: center"><button name="send" value="/eshop buy ' + SG.eShop[i].id + '">' + SG.eShop[i].name + '</button></td><td style="border: 2px solid #070e96; width: 70%; text-align: center">' + SG.eShop[i].desc + '</td><td style="border: 2px solid #070e96; width: 10%; text-align: center">' + SG.eShop[i].price + '</td></tr>';
  }
  output += '</table></div>';
  return output;
}

try {
  fs.accessSync('config/eShop.json', fs.F_OK);
  let raw = JSON.parse(fs.readFileSync('config/eShop.json', 'utf8'));
  SG.eShop = raw;
} catch(e) {
  fs.writeFile('config/eShop.json', "{}", function(err) {<commit_msg>Fix overflow error<commit_after>/******************************
    Default shop setup
    for spacialgaze.psim.us
    coded by HoeenHero
    -----------------------
    THIS IS NOT THE SAME AS
    THE PRIVATE SHOP ON SG
******************************/
'use strict';

const fs = require('fs');
var allowThisShop = false; //Change to true to make these command work
var writeJSON = true;
SG.eShop = {};

function newItem (name, desc, price, isSSB) {
  this.name = name;
  this.id = toId(name);
  this.desc = Chat.escapeHTML(desc);
  this.price = Number(price);
  this.isSSB = Boolean(isSSB);
}

function writeShop() {
  if (!writeJSON) return false; //Prevent corruptions
  fs.writeFile('config/eShop.json', JSON.stringify(SG.eShop));
}

function shopDisplay() {
  let output = '<div style="max-height:300px; width: 100%; overflow: scroll"><table style="border:2px solid #101ad1; border-radius: 5px; width: 100%;"><tr><th colspan="3" style="border: 2px solid #070e96; border-radius: 5px">Server Shop</th></tr>';
  for (let i in SG.eShop) {
    if (!SG.eShop[i]) continue;
    output += '<tr><td style="border: 2px solid #070e96; width: 20%; text-align: center"><button name="send" value="/eshop buy ' + SG.eShop[i].id + '">' + SG.eShop[i].name + '</button></td><td style="border: 2px solid #070e96; width: 70%; text-align: center">' + SG.eShop[i].desc + '</td><td style="border: 2px solid #070e96; width: 10%; text-align: center">' + SG.eShop[i].price + '</td></tr>';
  }
  output += '</table></div>';
  return output;
}

try {
  fs.accessSync('config/eShop.json', fs.F_OK);
  let raw = JSON.parse(fs.readFileSync('config/eShop.json', 'utf8'));
  SG.eShop = raw;
} catch(e) {
  fs.writeFile('config/eShop.json', "{}", function(err) {
{'fraction_non_alphanumeric': 0.22761409589832468, 'fraction_numerical': 0.029462738301559793, 'mean_word_length': 4.048104956268221, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '3059848', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1193, 'n_words': 305}