Skip to content

Commit

Permalink
adding shards to quest / checklist rewards at a rate of 1 reroll (100…
Browse files Browse the repository at this point in the history
… shards) per crate
  • Loading branch information
sfk-steelsong committed Jan 17, 2021
1 parent f017909 commit dd17082
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/botHandlers/questHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ async function check(msg,id,username,questName,result,count,extra){
text += "<:crate:523771259302182922>".repeat(reward);
rewardSql = "INSERT INTO crate (uid,boxcount,claim) VALUES ((SELECT uid FROM user WHERE id = ?),?,'2017-01-01 10:10:10') ON DUPLICATE KEY UPDATE boxcount = boxcount + ?;";
var rewardVar = [id,reward,reward];
}else if(rewardType=="shards"){
text += "<:weaponshard:655902978712272917>".repeat(reward);
rewardSql = `INSERT INTO shards (uid,count) VALUES ((SELECT uid FROM user WHERE id = ?),?) ON DUPLICATE KEY UPDATE count = count + ?;`;
var rewardVar = [id,reward,reward];
}else{
text += global.toFancyNum(reward)+" <:cowoncy:416043450337853441>";
rewardSql = "INSERT INTO cowoncy (id,money) VALUES (?,?) ON DUPLICATE KEY UPDATE money = money + ?";
Expand Down
7 changes: 5 additions & 2 deletions src/commands/commandList/economy/quest.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ function getQuest(id,qid,afterMidSQL){
/* Grab prize type */
var prize = "cowoncy";
rand = Math.random();
if(rand > .6) prize = "crate";
else if(rand > .3) prize = "lootbox";
if(rand > .75) prize = "crate";
else if(rand > .5) prize = "lootbox";
else if(rand > .25) prize = "shards";

/* Construct insert sql */
var sql = `INSERT IGNORE INTO quest (uid,qid,qname,level,prize,count) values (
Expand Down Expand Up @@ -222,6 +223,8 @@ function parseQuest(questInfo){
var reward = "<:box:427352600476647425>".repeat(quest.lootbox[questInfo.level]);
}else if(questInfo.prize=="crate"){
var reward = "<:crate:523771259302182922>".repeat(quest.crate[questInfo.level]);
}else if (questInfo.prize=="shards"){
var reward = global.toFancyNum(quest.shards[questInfo.level]) + " <:weaponshard:655902978712272917>";
}
var count = quest.count[questInfo.level];
if(global.isInt(count))
Expand Down
5 changes: 3 additions & 2 deletions src/commands/commandList/utils/checklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module.exports = new CommandInterface({
}else if(!reward){
description += "\n"+box+" "+tada+" Complete your checklist to get a reward!";
}else{
description += "\n"+check+" "+tada+" You earned 1,000 "+p.config.emoji.cowoncy+", 1 "+p.config.emoji.lootbox+", 1 "+p.config.emoji.crate+", and 1 "+p.config.emoji.cookie+"!";
description += "\n"+check+" "+tada+" You earned 1,000 "+p.config.emoji.cowoncy+", 1 "+p.config.emoji.lootbox+", 1 "+p.config.emoji.crate+", 100 "+p.config.emoji.shards+", and 1 "+p.config.emoji.cookie+"!";
}

if(reward){
Expand All @@ -79,7 +79,8 @@ module.exports = new CommandInterface({
UPDATE lootbox SET boxcount = boxcount + 1 WHERE id = ${p.msg.author.id};
UPDATE crate SET boxcount = boxcount + 1 WHERE uid = ${uid};
UPDATE cowoncy SET money = money + 1000 WHERE id = ${p.msg.author.id};
UPDATE rep SET count = count + 1 WHERE id = ${p.msg.author.id};`;
UPDATE rep SET count = count + 1 WHERE id = ${p.msg.author.id};
UPDATE shards SET count = count + 100 WHERE uid = ${p.msg.author.id};`;
result = await p.query(sql);
p.quest("cookieBy",1,p.msg.author);
}
Expand Down
1 change: 1 addition & 0 deletions src/data/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"lootbox":"<:box:427352600476647425>",
"cookie":"<a:cookieeat:423020737364885525>",
"fabledLootbox":"<a:flootbox:725570544065445919>",
"shards": "<:weaponshard:655902978712272917>",
"previous":"⬅️",
"next":"➡️",
"steal":"🕵️"
Expand Down
12 changes: 12 additions & 0 deletions src/data/quests.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,95 @@
"cowoncy":[100,500,1000,20000,50000],
"lootbox":[1,2,3,7,10],
"crate":[1,2,3,7,10],
"shards": [100, 200, 300, 700, 1000],
"chance":[0.4,0.3,0.24,0.05,0.01]
},
"battle":{
"count":[10,50,100,500,1000],
"cowoncy":[100,500,1000,20000,50000],
"lootbox":[1,2,3,7,10],
"crate":[1,2,3,7,10],
"shards": [100, 200, 300, 700, 1000],
"chance":[0.4,0.3,0.24,0.05,0.01]
},
"gamble":{
"count":[5,10,25],
"cowoncy":[250,750,1000],
"lootbox":[1,2,3],
"crate":[1,2,3],
"shards": [100, 200, 300],
"chance":[0.4,0.4,0.2]
},
"drop":{
"count":[5,10,15],
"cowoncy":[250,750,1000],
"lootbox":[1,2,3],
"crate":[1,2,3],
"shards": [100, 200, 300],
"chance":[0.4,0.4,0.2]
},
"emoteTo":{
"count":[1,3,5],
"cowoncy":[100,300,500],
"lootbox":[1,2,3],
"crate":[1,2,3],
"shards": [100, 200, 300],
"chance":[0.5,0.3,0.2]
},
"emoteBy":{
"count":[1,3,5],
"cowoncy":[200,600,1000],
"lootbox":[1,2,3],
"crate":[1,2,3],
"shards": [100, 200, 300],
"chance":[0.5,0.3,0.2]
},
"find":{
"count":["rare","epic","mythical"],
"cowoncy":[500,2500,20000],
"lootbox":[2,5,8],
"crate":[2,5,8],
"shards": [200, 500, 800],
"chance":[0.5,0.3,0.2]
},
"cookieBy":{
"count":[2,4,6],
"cowoncy":[500,2500,25000],
"lootbox":[2,4,8],
"crate":[2,4,8],
"shards": [200, 400, 800],
"chance":[0.5,0.3,0.2]
},
"prayBy":{
"count":[3,5,15],
"cowoncy":[500,2500,20000],
"lootbox":[2,4,6],
"crate":[2,4,6],
"shards": [200, 400, 600],
"chance":[0.5,0.3,0.2]
},
"curseBy":{
"count":[3,5,15],
"cowoncy":[500,2500,20000],
"lootbox":[2,4,6],
"crate":[2,4,6],
"shards": [200, 400, 600],
"chance":[0.5,0.3,0.2]
},
"friendlyBattle":{
"count":[3,5,15],
"cowoncy":[500,2500,20000],
"lootbox":[2,4,6],
"crate":[2,4,6],
"shards": [200, 400, 600],
"chance":[0.5,0.3,0.2]
},
"xp":{
"count":[2500,12500,25000,125000,250000],
"cowoncy":[100,500,1000,20000,50000],
"lootbox":[1,2,3,7,10],
"crate":[1,2,3,7,10],
"shards": [100, 200, 300, 700, 1000],
"chance":[0.4,0.3,0.24,0.05,0.01]
}
}

0 comments on commit dd17082

Please sign in to comment.