Skip to content

Commit

Permalink
scraped!
Browse files Browse the repository at this point in the history
  • Loading branch information
SpazElectro committed Nov 25, 2023
1 parent 054132a commit bebd2a5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
2 changes: 1 addition & 1 deletion experiments/spazlint/classes.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion experiments/spazlint/global.json

Large diffs are not rendered by default.

22 changes: 2 additions & 20 deletions experiments/spazlint/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,12 @@
classProperties: dict = json.load(open(os.path.dirname(__file__) + "/classes.json"))

# merge globalProperties into one
globalPropertiesTemp: dict = {}
globalPropertiesTemp = {}
for i in globalProperties:
if i == "eventsList":
for x in globalProperties[i]:
x["type"] = "event"

# example event
{
"name": "onChat",
"description": "onChat is called whenever a chat message pops up in game. onLocalChat is called only when chat is received from players on the same machine the script is executing on. A return value of true indicates that the chat message should be suppressed, whereas a return value of false will cause the message to be handled normally. clientID is a unique ID of the game client that sent the chat message. stringReceived is the text of the chat message that was received. chatType can take one of the following values: NORMAL, TEAMCHAT, WHISPER amd ME.\nAny message beginning with \"/\" is interpreted as a command, not as chat, and so will not be passed to either of these hooks. Messages beginning with \"!\" will, though, as will arguments of commands /whisper (and its aliases, /w and @) and /me.\n",
"full": "void onChat(int clientID, string &in stringReceived, CHAT::Type chatType)",
"type": "function",
"arguments":[
{"type": "int", "name": "clientID", "attributes": [],"items": []},
{"type": "string", "name": "&in", "attributes": [],"items": []},
{"type": "CHAT::Type", "name": "chatType", "attributes": [], "items": ["NORMAL", "TEAMCHAT", "WHISPER", "ME"]}
]
}

globalPropertiesTemp[i[:-4]] = globalProperties[i]

classPropertiesTemp: dict = {}
classPropertiesTemp = {}
for i in classProperties:
# print(i[:-4].strip())
classPropertiesTemp[i[:-4]] = classProperties[i]

globalProperties = globalPropertiesTemp
Expand Down
15 changes: 10 additions & 5 deletions generation_scripts/scrape.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function findNextDD(element, startIndex) {
return resultx;
}

function getItems(rootTableElement, isClass) {
function getItems(rootTableElement) {
var items = []
var isEvents = rootTableElement.id == "eventsList";

Expand All @@ -92,6 +92,8 @@ function getItems(rootTableElement, isClass) {
var full = "";
var funcAttrbs = [];

rootTableElement.childNodes[i].classList.forEach(attrb => funcAttrbs.push({"type": attrb}));

for (let it = 0; it < rootTableElement.childNodes[i].childNodes.length; it++) {
if (rootTableElement.childNodes[i].nodeType == 3) {
if(full == rootTableElement.childNodes[i].nodeValue)
Expand Down Expand Up @@ -204,11 +206,14 @@ function getItems(rootTableElement, isClass) {
}

let output = {}
let classes = {}

throw Error;
rootTables.forEach(x => output[x] = getItems(document.getElementById(x), isClassTable[rootTables.indexOf(x)]))
rootTables.forEach(x => (isClassTable[rootTables.indexOf(x)] ? classes : output)[x] = getItems(document.getElementById(x)));

console.log(
// JSON.stringify(
output
// )
JSON.stringify(
// output
classes
)
)

0 comments on commit bebd2a5

Please sign in to comment.