Skip to content

Commit

Permalink
6.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Zezombye committed Aug 17, 2021
1 parent 08e45db commit c209c72
Show file tree
Hide file tree
Showing 23 changed files with 1,093 additions and 242 deletions.
4 changes: 4 additions & 0 deletions VS Code Extension/customGameSettingsSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3679,6 +3679,10 @@
"description": {
"type": "string",
"maxLength": 512
},
"modeName": {
"type": "string",
"maxLength": 32
}
}
},
Expand Down
50 changes: 49 additions & 1 deletion VS Code Extension/overpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45814,6 +45814,11 @@ const customGameSettingsSchema =
"ru-RU": "Описание",
"zh-CN": "描述",
"zh-TW": "敘述"
},
"modeName": {
"values": "__string__",
"maxChars": 32,
"en-US": "Mode Name",
}
},
"guid": "00000001006E",
Expand Down Expand Up @@ -46546,6 +46551,7 @@ const typeTree = [
"FullwidthStringLiteral",
"BigLettersStringLiteral",
"PlaintextStringLiteral",
"CaseSensitiveStringLiteral",
]}
]},

Expand Down Expand Up @@ -52089,6 +52095,39 @@ astParsingFunctions.__format__ = function(content) {

}


var caseSensitiveReplacements = {
"æ": "ӕ",
"nj": "nj",
" a ": " a ",
"a": "ạ",
"b": "ḅ",
"c": "ƈ",
"d": "ḍ",
"e": "ẹ",
"f": "ƒ",
"g": "ǵ",
"h": "һ",
"i": "і",
"j": "ј",
"k": "ḳ",
"l": "I",
"m": "ṃ",
"n": "ṇ",
"o": "ο",
"p": "ṗ",
"q": "ǫ",
"r": "ṛ",
"s": "ѕ",
"t": "ṭ",
"u": "υ",
"v": "ν",
"w": "ẉ",
"x": "ҳ",
"y": "ỵ",
"z": "ẓ",
}

//Parses a custom string.
function parseCustomString(str, formatArgs) {

Expand All @@ -52099,6 +52138,7 @@ function parseCustomString(str, formatArgs) {
var isBigLetters = (str.type === "BigLettersStringLiteral");
var isFullwidth = (str.type === "FullwidthStringLiteral");
var isPlaintext = (str.type === "PlaintextStringLiteral");
var isCaseSensitive = (str.type === "CaseSensitiveStringLiteral");

var content = str.name;
//console.log(content);
Expand Down Expand Up @@ -52138,6 +52178,12 @@ function parseCustomString(str, formatArgs) {

content = tmpStr;

} else if (isCaseSensitive) {
content = content.replaceAll(/e([0123456789!\?\/@\(\)\]\}\{"\&#\^\$\*%])/g, "ѐ$1")
content = content.replaceAll(/n([0123456789!\?\/@\(\)\]\}\{"\&#\^\$\*%])/g, "ǹ$1")
for (var key of Object.keys(caseSensitiveReplacements)) {
content = content.replaceAll(key, caseSensitiveReplacements[key])
}
}

if (obfuscationSettings.obfuscateStrings && !isPlaintext) {
Expand Down Expand Up @@ -56555,7 +56601,7 @@ function parseAst(content) {

//For string literals, check if they are a child of __format__ (or of a string function). If not, wrap them with the __format__ function.
//Do not use isTypeSuitable as that can return true for "value".
if (["StringLiteral", "LocalizedStringLiteral", "CustomStringLiteral", "FullwidthStringLiteral", "BigLettersStringLiteral", "PlaintextStringLiteral"].includes(content.type)) {
if (["StringLiteral", "LocalizedStringLiteral", "CustomStringLiteral", "FullwidthStringLiteral", "BigLettersStringLiteral", "PlaintextStringLiteral", "CaseSensitiveStringLiteral"].includes(content.type)) {
if (["__format__", "__customString__", "__localizedString__"].includes(content.parent.name) && content.parent.argIndex === 0) {
return content;
} else {
Expand Down Expand Up @@ -57944,6 +57990,8 @@ function parse(content, kwargs={}) {
stringType = "FullwidthStringLiteral";
} else if (content[0].text === "p") {
stringType = "PlaintextStringLiteral";
} else if (content[0].text === "c") {
stringType = "CaseSensitiveStringLiteral";
} else {
error("Invalid string modifier '"+content[0].text+"', valid ones are 'l' (localized), 'b' (big letters), 'p' (plaintext) and 'w' (fullwidth)");
}
Expand Down
2 changes: 1 addition & 1 deletion VS Code Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/Zezombye/overpy"
},
"description": "High-level language for the Overwatch Workshop, with decompilation and compilation.",
"version": "6.9.3",
"version": "6.10.0",
"readme": "README.md",
"engines": {
"vscode": "^1.36.0"
Expand Down
80 changes: 79 additions & 1 deletion demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,87 @@
<script src="src/compiler/compiler.js"></script>
<script src="src/data/localizedStrings.js"></script>


<script>

var text = "You have 3.51e15 money and deal 6.13e31 dmg"

var replacements = {
"æ": "ӕ",
"nj": "nj",
"d": "ḍ",
"e": "ẹ",
"f": "ƒ",
"g": "ǵ",
"h": "һ",
"i": "і",
"j": "ј",
"k": "ḳ",
"l": "I",
"m": "ṃ",
"n": "ṇ",
"o": "ο",
"p": "ṗ",
"q": "ǫ",
"r": "ṛ",
"s": "ѕ",
"t": "ṭ",
"v": "ν",
"y": "ỵ",
"z": "ẓ",


" a ": " a ",
"a": "ạ",
"b": "ḅ",
"c": "ƈ",
"u": "υ",
"w": "ẉ",
"x": "ҳ",

}
/*
var replacements1 = {
" a ": " a ",
"b": "ƅ",
"c": "ƈ",
"u": "ư",
"w": "ẇ",
"x": "ҳ",
}
var replacements2 = {
"b": "ƅ",
"c": "ƈ",
"w": "ѡ",
"x": "ҳ",
}
var replacements3 = {
"c": "ҫ",
"u": "ụ",
"x": "ҳ",
}
var replacements4 = {
" a ": "a",
"b": "ḅ",
"c": "ϲ",
"u": "ṵ",
"v": "ν",
"w": "ẉ",
"x": "ϰ",
}*/

var result = "";
var txt = text;
txt = txt.replaceAll(/e([0123456789!\?\/@\(\)\]\}\{"\&#\^\$\*%])/g, "ѐ$1")
txt = txt.replaceAll(/n([0123456789!\?\/@\(\)\]\}\{"\&#\^\$\*%])/g, "ǹ$1")
for (var key of Object.keys(replacements)) {
txt = txt.replaceAll(key, replacements[key])
}
result += " print(\""+txt+"\")\n"
console.log(result)


</script>

Expand Down
8 changes: 4 additions & 4 deletions generate-the-other-languages-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var languages = ["en-US", "de-DE", "es-ES", "es-MX", "fr-FR", "it-IT", "ja-JP",
var docFolder = "./src/data/"
var docFiles = ["actions.js", "constants.js", "keywords.js", "stringKw.js", "values.js"]

var datatoolPath = "C:\\Users\\Zezombye\\Downloads\\toolchain-release(8)\\DataTool.exe"
var datatoolPath = "C:\\Users\\Zezombye\\Downloads\\toolchain-release(9)\\DataTool.exe"
var overwatchPath = "C:\\Program Files\\Overwatch"
var outputFolder = "strings"
var guids = {};
Expand Down Expand Up @@ -188,8 +188,8 @@ function normalizeName(content) {



//generateStringFiles();
getGuids();
generateStringFiles();
/*getGuids();
replaceJsonObjectsInFile(docFolder+"actions.js");
replaceJsonObjectsInFile(docFolder+"values.js");
replaceJsonObjectsInFile(docFolder+"constants.js");
Expand All @@ -199,7 +199,7 @@ replaceJsonObjectsInFile(docFolder+"gamemodes.js");
replaceJsonObjectsInFile(docFolder+"customGameSettings.js");
removeParentheses = false;
replaceJsonObjectsInFile(docFolder+"localizedStrings.js");
replaceJsonObjectsInFile(docFolder+"other.js");
replaceJsonObjectsInFile(docFolder+"other.js");*/

function sleep(ms){
return new Promise(resolve=>{
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/astParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function parseAst(content) {

//For string literals, check if they are a child of __format__ (or of a string function). If not, wrap them with the __format__ function.
//Do not use isTypeSuitable as that can return true for "value".
if (["StringLiteral", "LocalizedStringLiteral", "CustomStringLiteral", "FullwidthStringLiteral", "BigLettersStringLiteral", "PlaintextStringLiteral"].includes(content.type)) {
if (["StringLiteral", "LocalizedStringLiteral", "CustomStringLiteral", "FullwidthStringLiteral", "BigLettersStringLiteral", "PlaintextStringLiteral", "CaseSensitiveStringLiteral"].includes(content.type)) {
if (["__format__", "__customString__", "__localizedString__"].includes(content.parent.name) && content.parent.argIndex === 0) {
return content;
} else {
Expand Down
40 changes: 40 additions & 0 deletions src/compiler/functions/__format__.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,39 @@ astParsingFunctions.__format__ = function(content) {

}


var caseSensitiveReplacements = {
"æ": "ӕ",
"nj": "nj",
" a ": " a ",
"a": "ạ",
"b": "ḅ",
"c": "ƈ",
"d": "ḍ",
"e": "ẹ",
"f": "ƒ",
"g": "ǵ",
"h": "һ",
"i": "і",
"j": "ј",
"k": "ḳ",
"l": "I",
"m": "ṃ",
"n": "ṇ",
"o": "ο",
"p": "ṗ",
"q": "ǫ",
"r": "ṛ",
"s": "ѕ",
"t": "ṭ",
"u": "υ",
"v": "ν",
"w": "ẉ",
"x": "ҳ",
"y": "ỵ",
"z": "ẓ",
}

//Parses a custom string.
function parseCustomString(str, formatArgs) {

Expand All @@ -75,6 +108,7 @@ function parseCustomString(str, formatArgs) {
var isBigLetters = (str.type === "BigLettersStringLiteral");
var isFullwidth = (str.type === "FullwidthStringLiteral");
var isPlaintext = (str.type === "PlaintextStringLiteral");
var isCaseSensitive = (str.type === "CaseSensitiveStringLiteral");

var content = str.name;
//console.log(content);
Expand Down Expand Up @@ -114,6 +148,12 @@ function parseCustomString(str, formatArgs) {

content = tmpStr;

} else if (isCaseSensitive) {
content = content.replaceAll(/e([0123456789!\?\/@\(\)\]\}\{"\&#\^\$\*%])/g, "ѐ$1")
content = content.replaceAll(/n([0123456789!\?\/@\(\)\]\}\{"\&#\^\$\*%])/g, "ǹ$1")
for (var key of Object.keys(caseSensitiveReplacements)) {
content = content.replaceAll(key, caseSensitiveReplacements[key])
}
}

if (obfuscationSettings.obfuscateStrings && !isPlaintext) {
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ function parse(content, kwargs={}) {
stringType = "FullwidthStringLiteral";
} else if (content[0].text === "p") {
stringType = "PlaintextStringLiteral";
} else if (content[0].text === "c") {
stringType = "CaseSensitiveStringLiteral";
} else {
error("Invalid string modifier '"+content[0].text+"', valid ones are 'l' (localized), 'b' (big letters), 'p' (plaintext) and 'w' (fullwidth)");
}
Expand Down
Loading

0 comments on commit c209c72

Please sign in to comment.