Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- KatDevsGames06/05/2020
- also
- ok
- we're adding 5 effects to smw
- I need to do the menu updater now I suppose
- since we're going to have a shitload for this one
- how ought I autoprice these?
- dtothefourth06/05/2020
- Uh, I assume the powerup ones can probably just be the same as the stock versions. Invisible probably similar to windowed or something. Not sure on kaizo, I guess somewhere in between, not as much as the timed ones since it's just a one time
- KatDevsGames06/05/2020
- def easiest to define stuff in terms of something that already exists
- possibly times a constant
- so that's all fine
- KatDevsGames06/07/2020
- ok
- time to write a proper menu update tool
- KatDevsGames06/07/2020
- const mysql = require('mysql2');
- const util = require('util');
- const connection = mysql.createConnection({
- host: process.env.CCdbHost,
- user: process.env.CCdbUser,
- password: process.env.CCdbPass,
- database: process.env.CCdbName
- });
- const query = util.promisify(connection.query).bind(connection);
- async function updateMenu(gameID) {
- var tq = await query('SELECT `id`, `name`, `description`, `channel`, `game`, `template` FROM `menus` WHERE `game`=? AND `template`>0;', [gameID]);
- var templates = [];
- tq.forEach(r => {
- var id = tq['id'];
- var tContents = await query('SELECT `item`, `menu`, `price`, `price_multiplier`, `competitive_choices`, `user_limit`, `game_limit`, `user_cooldown`, `game_cooldown`, `order_min`, `order_max`, `scale_mode`, `scale_factor`, `scale_decay_time`, `scale_parent`, `hidden` FROM `inventory` WHERE `menu`=?;', [id]);
- if ((id||1)==1) { templates[2]=tContents; }
- if ((id||2)==2) { templates[1]=tContents; }
- if ((id||4)==4) { templates[0]=tContents; }
- });
- var mq = await query('SELECT `menus`.`id`, `channels`.`broadcaster_type` FROM `menus` INNER JOIN `channels` ON (`channel`.`id`=`menus`.`channel`) WHERE `game`=? AND `template`=0;', [gameID]);
- mq.forEach(r => {
- var t = templates[mq['broadcaster_type']];
- await query('INSERT IGNORE (`item`, `menu`, `price`, `price_multiplier`, `competitive_choices`, `user_limit`, `game_limit`, `user_cooldown`, `game_cooldown`, `order_min`, `order_max`, `scale_mode`, `scale_factor`, `scale_decay_time`, `scale_parent`, `hidden`) (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) INTO `inventory`;',
- [ t['item'], mq['id'], t['price'], t['price_multiplier'], t['competitive_choices'], t['user_limit'], t['game_limit'], t['user_cooldown'], t['game_cooldown'], t['order_min'], t['order_max'], t['scale_mode'], t['scale_factor'], t['scale_decay_time'], t['scale_parent'], t['hidden'] ]);
- });
- };
- something like that
- ought to sort the menus
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement