diff --git a/Outdated/JavaScript/1LogToConsole/package.json b/Outdated/JavaScript/1LogToConsole/package.json deleted file mode 100644 index d5a56fe..0000000 --- a/Outdated/JavaScript/1LogToConsole/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "LogToConsole", - "version": "1.0.0", - "main": "src/mod.js", - "license": "MIT", - "author": "Chomp", - "akiVersion": "2.4.0" -} \ No newline at end of file diff --git a/Outdated/JavaScript/1LogToConsole/src/mod.js b/Outdated/JavaScript/1LogToConsole/src/mod.js deleted file mode 100644 index 77f4e89..0000000 --- a/Outdated/JavaScript/1LogToConsole/src/mod.js +++ /dev/null @@ -1,19 +0,0 @@ -class Mod -{ - // Code added here will load BEFORE the server has started loading - load(container) - { - // get the logger from the server container - const logger = container.resolve("WinstonLogger"); - - logger.info("I am logging info!"); - logger.warning("I am logging a warning!"); - logger.error("I am logging an error!"); - } - - // Code added here will be run AFTER the server has started - delayedLoad(container) - { return } -} - -module.exports = { mod: new Mod() } \ No newline at end of file diff --git a/Outdated/JavaScript/2EditDatabase/package.json b/Outdated/JavaScript/2EditDatabase/package.json deleted file mode 100644 index 067fd4d..0000000 --- a/Outdated/JavaScript/2EditDatabase/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "EditDatabase", - "version": "1.0.0", - "main": "src/mod.js", - "license": "MIT", - "author": "Chomp", - "akiVersion": "2.4.0" -} \ No newline at end of file diff --git a/Outdated/JavaScript/2EditDatabase/src/mod.js b/Outdated/JavaScript/2EditDatabase/src/mod.js deleted file mode 100644 index f1d86ba..0000000 --- a/Outdated/JavaScript/2EditDatabase/src/mod.js +++ /dev/null @@ -1,28 +0,0 @@ -class Mod -{ - // not used for this example - load(container) - { return } - - delayedLoad(container) - { - // get database from server - const databaseServer = container.resolve("DatabaseServer"); - - // Get all the in-memory json found in /assets/database - const tables = databaseServer.getTables(); - - // find the ledx item by its Id - const ledx = tables.templates.items["5c0530ee86f774697952d952"]; - - // update one of its properties to be true - ledx._props.CanSellOnRagfair = true; - - - // example #2 - // get globals settings and set flea market min level to be 1 - tables.globals.config.RagFair.minUserLevel = 1; - } -} - -module.exports = { mod: new Mod() } \ No newline at end of file diff --git a/Outdated/JavaScript/3.0GetSptConfigFile/package.json b/Outdated/JavaScript/3.0GetSptConfigFile/package.json deleted file mode 100644 index ffa4f8d..0000000 --- a/Outdated/JavaScript/3.0GetSptConfigFile/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "GetSptConfigFile", - "version": "1.0.0", - "main": "src/mod.js", - "license": "MIT", - "author": "Chomp", - "akiVersion": "2.4.0" -} \ No newline at end of file diff --git a/Outdated/JavaScript/3.0GetSptConfigFile/src/mod.js b/Outdated/JavaScript/3.0GetSptConfigFile/src/mod.js deleted file mode 100644 index bb5c947..0000000 --- a/Outdated/JavaScript/3.0GetSptConfigFile/src/mod.js +++ /dev/null @@ -1,30 +0,0 @@ -class Mod -{ - // not used for this example - load(container) - { return } - - delayedLoad(container) - { - // get logger - const logger = container.resolve("WinstonLogger"); - - // get the config server - const configServer = container.resolve("ConfigServer"); - - // Request bot config - // Required - ConfigTypes.BOT is the enum of the config we want, others include ConfigTypes.Airdrop - const botConfig = configServer.getConfig("aki-bot"); - - // log the original pmc difficulty - logger.info(`here is the original bot pmc difficulty: ${botConfig.pmc.difficulty}`) - - // adjust the difficulty - botConfig.pmc.difficulty = "easy"; - - // log the new pmc difficulty - logger.info(`here is the altered bot pmc difficulty: ${botConfig.pmc.difficulty}`) - } -} - -module.exports = { mod: new Mod() } \ No newline at end of file diff --git a/Outdated/JavaScript/4UseACustomConfigFile/config/config.json b/Outdated/JavaScript/4UseACustomConfigFile/config/config.json deleted file mode 100644 index 2cc3a9f..0000000 --- a/Outdated/JavaScript/4UseACustomConfigFile/config/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "myProperty": "wow" -} \ No newline at end of file diff --git a/Outdated/JavaScript/4UseACustomConfigFile/package.json b/Outdated/JavaScript/4UseACustomConfigFile/package.json deleted file mode 100644 index 067fd4d..0000000 --- a/Outdated/JavaScript/4UseACustomConfigFile/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "EditDatabase", - "version": "1.0.0", - "main": "src/mod.js", - "license": "MIT", - "author": "Chomp", - "akiVersion": "2.4.0" -} \ No newline at end of file diff --git a/Outdated/JavaScript/4UseACustomConfigFile/src/mod.js b/Outdated/JavaScript/4UseACustomConfigFile/src/mod.js deleted file mode 100644 index 5215fa0..0000000 --- a/Outdated/JavaScript/4UseACustomConfigFile/src/mod.js +++ /dev/null @@ -1,19 +0,0 @@ -const modConfig = require("../config/config.json"); - -class Mod -{ - // not used for this example - load(container) - { return } - - delayedLoad(container) - { - // get logger - const logger = container.resolve("WinstonLogger"); - - // log the 'myProperty' value to the console - logger.info(`here is the value from my config: ${modConfig.myProperty}`); - } -} - -module.exports = { mod: new Mod() } \ No newline at end of file diff --git a/Outdated/JavaScript/5ReplaceMethod/package.json b/Outdated/JavaScript/5ReplaceMethod/package.json deleted file mode 100644 index a1be880..0000000 --- a/Outdated/JavaScript/5ReplaceMethod/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "ReplaceFunction", - "version": "1.0.0", - "main": "src/mod.js", - "license": "MIT", - "author": "Chomp", - "akiVersion": "2.4.0" -} \ No newline at end of file diff --git a/Outdated/JavaScript/5ReplaceMethod/src/mod.js b/Outdated/JavaScript/5ReplaceMethod/src/mod.js deleted file mode 100644 index 7ef6426..0000000 --- a/Outdated/JavaScript/5ReplaceMethod/src/mod.js +++ /dev/null @@ -1,24 +0,0 @@ -class Mod -{ - // Perform these actions before server fully loads - load(container) - { - // get watermarkLocale class from server - const watermarkLocale = container.resolve("WatermarkLocale"); - - // Replace the getDescription() function with the one below called 'replacementFunction()' - watermarkLocale.getDescription = this.replacementFunction; - } - - // not used for this example - delayedLoad(container) - { return } - - // our new replacement function, ready to be used - replacementFunction() - { - return ["SPT AKI, WOW VERY COOL"]; - } -} - -module.exports = { mod: new Mod() } \ No newline at end of file diff --git a/Outdated/JavaScript/6ReferenceAnotherClass/package.json b/Outdated/JavaScript/6ReferenceAnotherClass/package.json deleted file mode 100644 index 067fd4d..0000000 --- a/Outdated/JavaScript/6ReferenceAnotherClass/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "EditDatabase", - "version": "1.0.0", - "main": "src/mod.js", - "license": "MIT", - "author": "Chomp", - "akiVersion": "2.4.0" -} \ No newline at end of file diff --git a/Outdated/JavaScript/6ReferenceAnotherClass/src/MoreCode.js b/Outdated/JavaScript/6ReferenceAnotherClass/src/MoreCode.js deleted file mode 100644 index 8d92ffe..0000000 --- a/Outdated/JavaScript/6ReferenceAnotherClass/src/MoreCode.js +++ /dev/null @@ -1,9 +0,0 @@ -class MoreCode -{ - getTheWordFlub() - { - return "flub"; - } -} - -module.exports = { MoreCode: new MoreCode()} \ No newline at end of file diff --git a/Outdated/JavaScript/6ReferenceAnotherClass/src/mod.js b/Outdated/JavaScript/6ReferenceAnotherClass/src/mod.js deleted file mode 100644 index 7969451..0000000 --- a/Outdated/JavaScript/6ReferenceAnotherClass/src/mod.js +++ /dev/null @@ -1,25 +0,0 @@ -const MoreCode = require("./MoreCode"); - -class Mod -{ - // not used for this example - load(container) - { return } - - delayedLoad(container) - { - // get logger - const logger = container.resolve("WinstonLogger"); - - // Make a new instance of the 'MoreCode' class - const moreCode = new MoreCode(); - - // call the function 'getTheWordFlub()' and assign the result to 'result' - const result = moreCode.getTheWordFlub(); - - // log the 'myProperty' property to the console - logger.info(`Here is the value from my second class: ${result}`); - } -} - -module.exports = { mod: new Mod() } \ No newline at end of file diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/LICENSE b/Outdated/JavaScript/Revingly-FoodDrink-Redux/LICENSE deleted file mode 100644 index 9eb2465..0000000 --- a/Outdated/JavaScript/Revingly-FoodDrink-Redux/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Copyright (c) 2022 Revingly. All rights reserved. - -Developed by: - Wulv - - Revingly - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation files -(the "Software"), to deal with the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - -* Neither the names of Revingly, Food&Drinks-redux nor the names of its - contributors may be used to endorse or promote products derived from - this Software without specific prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH -THE SOFTWARE. \ No newline at end of file diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/README.md b/Outdated/JavaScript/Revingly-FoodDrink-Redux/README.md deleted file mode 100644 index 0c8873c..0000000 --- a/Outdated/JavaScript/Revingly-FoodDrink-Redux/README.md +++ /dev/null @@ -1,2 +0,0 @@ -This file should be placed into user/mods. -File name should be FoodDrink \ No newline at end of file diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/db/base.json b/Outdated/JavaScript/Revingly-FoodDrink-Redux/db/base.json deleted file mode 100644 index 3522616..0000000 --- a/Outdated/JavaScript/Revingly-FoodDrink-Redux/db/base.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "_id": "FoodDrink", - "working": true, - "customization_seller": false, - "name": "FoodDrink", - "surname": " ", - "nickname": "FoodDrink", - "location": "Get your food and drinks here ", - "avatar": "/files/trader/avatar/FoodDrink.jpg", - "balance_rub": 5000000, - "balance_dol": 0, - "balance_eur": 0, - "unlockedByDefault": true, - "discount": 0, - "discount_end": 0, - "buyer_up": true, - "currency": "RUB", - "nextResupply": 1615141448, - "repair": { - "availability": false, - "quality": "2", - "excluded_id_list": [], - "excluded_category": [], - "currency": "5449016a4bdc2d6f028b456f", - "currency_coefficient": 1, - "price_rate": 10 - }, - "insurance": { - "availability": false, - "min_payment": 0, - "min_return_hour": 0, - "max_return_hour": 0, - "max_storage_time": 99, - "excluded_category": [] - }, - "gridHeight": 150, - "loyaltyLevels": [ - { - "minLevel": 1, - "minSalesSum": 0, - "minStanding": 0, - "buy_price_coef": 38, - "repair_price_coef": 175, - "insurance_price_coef": 10, - "exchange_price_coef": 0, - "heal_price_coef": 0 - } - ], - "sell_category": [ - "82e7fac0b7495d72d4083356", - "ac705d3440c1407645e33579", - "dc97aee367144dc03389405d", - "7ffcc96aa06c7e90940330c5", - "e8f46e3ad74b9d862121f9dc", - "5b47574386f77428ca22b33e", - "5b47574386f77428ca22b33f", - "5b5f78dc86f77409407a7f8e", - "5b47574386f77428ca22b346", - "5b47574386f77428ca22b340", - "5b47574386f77428ca22b344", - "5b47574386f77428ca22b342", - "5b47574386f77428ca22b341", - "5b47574386f77428ca22b345", - "5b47574386f77428ca22b343", - "5b5f71b386f774093f2ecf11", - "5b5f71c186f77409407a7ec0", - "5b5f71de86f774093f2ecf13", - "5b5f724186f77447ed5636ad", - "5b5f736886f774094242f193", - "5b5f73ec86f774093e6cb4fd", - "5b5f74cc86f77447ec5d770a", - "5b5f750686f774093e6cb503", - "5b5f751486f77447ec5d770c", - "5b5f752e86f774093e6cb505", - "5b5f754a86f774094242f19b", - "5b5f755f86f77447ec5d770e", - "5b5f757486f774093e6cb507", - "5b5f75b986f77447ec5d7710", - "5b5f75c686f774094242f19f", - "5b5f75e486f77447ec5d7712", - "5b5f760586f774093e6cb509", - "5b5f761f86f774094242f1a1", - "5b5f764186f77447ec5d7714" - ] -} diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/package.js b/Outdated/JavaScript/Revingly-FoodDrink-Redux/package.js deleted file mode 100644 index d05b420..0000000 --- a/Outdated/JavaScript/Revingly-FoodDrink-Redux/package.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * authors: - Wulv - * - Revingly -*/ - -const { Mod } = require("./src/mod.js"); - -module.exports.mod = new Mod(); diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/package.json b/Outdated/JavaScript/Revingly-FoodDrink-Redux/package.json deleted file mode 100644 index 2ae758e..0000000 --- a/Outdated/JavaScript/Revingly-FoodDrink-Redux/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "FoodDrink-Redux", - "author": "Revingly", - "version": "2.9.0", - "license": "NCSA", - "main": "package.js", - "akiVersion": "2.3.1" -} \ No newline at end of file diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/res/FoodDrink.jpg b/Outdated/JavaScript/Revingly-FoodDrink-Redux/res/FoodDrink.jpg deleted file mode 100644 index 3e28418..0000000 Binary files a/Outdated/JavaScript/Revingly-FoodDrink-Redux/res/FoodDrink.jpg and /dev/null differ diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/src/config.json b/Outdated/JavaScript/Revingly-FoodDrink-Redux/src/config.json deleted file mode 100644 index 056c5a7..0000000 --- a/Outdated/JavaScript/Revingly-FoodDrink-Redux/src/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "original_prices": true -} \ No newline at end of file diff --git a/Outdated/JavaScript/Revingly-FoodDrink-Redux/src/mod.js b/Outdated/JavaScript/Revingly-FoodDrink-Redux/src/mod.js deleted file mode 100644 index c0e40f9..0000000 --- a/Outdated/JavaScript/Revingly-FoodDrink-Redux/src/mod.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * authors: - Wulv - * - Revingly -*/ - -"use strict"; - -class Mod { - constructor() { - this.mod = "Revingly-FoodDrink-Redux"; - this.funcptr = HttpServer.onRespond["IMAGE"]; - - Logger.info(`Loading: ${this.mod}`); - ModLoader.onLoad[this.mod] = this.load.bind(this); - HttpServer.onRespond["IMAGE"] = this.getImage.bind(this); - this.itemsToSell = {}; - } - - getImage(sessionID, req, resp, body) { - const filepath = `${ModLoader.getModPath(this.mod)}res/`; - - if (req.url.includes("/avatar/FoodDrink")) { - HttpServer.sendFile(resp, `${filepath}FoodDrink.jpg`); - return; - } - - this.funcptr(sessionID, req, resp, body); - } - - - - load() { - Logger.info(`Loading: ${this.mod}`); - - const filepath = `${ModLoader.getModPath(this.mod)}db/`; - - DatabaseServer.tables.traders.FoodDrink = { - "assort": this.createFoodAndDrinkAssortTable(), - "base": JsonUtil.deserialize(VFS.readFile(`${filepath}base.json`)) - }; - - let locales = DatabaseServer.tables.locales.global; - - for (const locale in locales) { - locales[locale].trading.FoodDrink = { - "FullName": "Food & Drink", - "FirstName": "Food & Drink", - "Nickname": "Food & Drink", - "Location": "In the food shop", - "Description": "Get your food and drink here!" - }; - } - - DatabaseServer.tables.locales.global = locales; - - // Add refresh time in seconds - const traderRefreshConfig = {"traderId": "FoodDrink","seconds": 3600} - TraderConfig["updateTime"].push(traderRefreshConfig); - } - - createFoodAndDrinkAssortTable() { - const { original_prices } = require('./config.json'); - const FOOD_ID = "5448e8d04bdc2ddf718b4569"; - const WATER_ID = "5448e8d64bdc2dce718b4568"; - const FOOD_CONTAINER_ID = "5c093db286f7740a1b2617e3"; - const SELL_AMOUNT = 10000; - const ROUBLE_ID = "5449016a4bdc2d6f028b456f"; - const items = DatabaseServer.tables.templates.items; - const prices = DatabaseServer.tables.templates.prices; - - return Object - .values(items) - .filter(item => item._parent === FOOD_ID || item._parent === WATER_ID || item._id === FOOD_CONTAINER_ID) - .map(item => { - return { - "_id": HashUtil.generate(), - "_tpl": item._id, - "parentId": "hideout", - "slotId": "hideout", - "upd": { - "UnlimitedCount": true, - "StackObjectsCount": 999999999 - } - } - }) - .reduce((acc, item) => { - acc.items.push(item); - acc.barter_scheme[item._id] = [ - [ - { - "count": original_prices ? prices[item._tpl] : SELL_AMOUNT , - "_tpl": ROUBLE_ID - } - ] - ]; - acc.loyal_level_items[item._id] = 1; - return acc; - }, - { - items: [], barter_scheme: {}, loyal_level_items: {} - } - ); - } -} - -module.exports.Mod = Mod; diff --git a/readme.md b/readme.md index 9299fb8..49e0829 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Mod examples for 3.2.2 +# Mod examples for 3.2.3 A collection of example mods that perform typical actions in SPT