-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added "getAllGlobalData.js" & "loadMultipleGlobalData.js", renamed pr…
…eviously added mod to follow modded actions naming convention (#74) * Create .yml * Create main.yml * Delete .yml * Rename file to follow mod naming convention * Add files via upload * Delete .github/workflows directory * Add files via upload * Update loadMultipleGlobalData_MOD.js * Update getAllGlobalData_MOD.js * Update loadMultipleGlobalData_MOD.js
- Loading branch information
Showing
3 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,4 +86,4 @@ module.exports = { | |
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = { | ||
data: { name: "Get all global data" }, | ||
category: "Global Data", | ||
info:{ | ||
source: "https://github.com/slothyace/BCS/tree/main/Mods", | ||
creator: "Acedia", | ||
}, | ||
|
||
UI: [ | ||
{ | ||
element: "store", | ||
storeAs: "store", | ||
} | ||
], | ||
|
||
subtitle: (values, constants) => { | ||
return `Store As: ${constants.variable(values.store)}` | ||
}, | ||
|
||
compatibility: ["Any"], | ||
|
||
async run(values, message, client, bridge) { | ||
var storedData = bridge.data.IO.get(); | ||
bridge.store(values.store, storedData.lists); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
module.exports = { | ||
data: { name: "Get multiple global data" }, | ||
category: "Global Data", | ||
info:{ | ||
source: "https://github.com/slothyace/BCS/tree/main/Mods", | ||
creator: "Acedia", | ||
}, | ||
UI: [ | ||
{ | ||
element: "input", | ||
storeAs: "defaultval", | ||
name: "Default value" | ||
}, | ||
"-", | ||
{ | ||
element: "menu", | ||
storeAs: "retrievelist", | ||
name: "Global data", | ||
types: { | ||
data: "datas" | ||
}, | ||
max: 1000, | ||
UItypes: { | ||
data: { | ||
data: {}, | ||
name: "Global data name", | ||
UI: [ | ||
{ | ||
element: "input", | ||
storeAs: "dataname", | ||
name: "Global data name" | ||
}, | ||
{ | ||
element: "store", | ||
storeAs: "store" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
subtitle: (data) => { | ||
return `Store ${data.retrievelist.length} global data(s).`; | ||
}, | ||
compatibility: ["Any"], | ||
|
||
async run(values, message, client, bridge) { | ||
let storedData = bridge.data.IO.get(); | ||
let defaultVal = values.defaultval ? bridge.transf(values.defaultval) : ''; | ||
|
||
for (let item of values.retrievelist) { | ||
let listData = defaultVal; | ||
|
||
const dataName = item.data.dataname; | ||
const storeLocation = item.data.store; | ||
|
||
try { | ||
const transformedDataName = bridge.transf(dataName); | ||
|
||
if (storedData.lists && storedData.lists[transformedDataName]) { | ||
listData = storedData.lists[transformedDataName]; | ||
} | ||
} catch (error) { | ||
storedData.lists = {}; | ||
bridge.data.IO.write(storedData); | ||
} | ||
|
||
bridge.store(storeLocation, listData); | ||
} | ||
} | ||
} |