diff --git a/css/basic.css b/css/basic.css index 9d41302..907f235 100644 --- a/css/basic.css +++ b/css/basic.css @@ -1,3 +1,11 @@ body{ background: #333; +} +.inMaking{ + width: 300px; + text-align: center; +} +.inMaking img{ + width: 300px; + aspect-ratio: 1/1; } \ No newline at end of file diff --git a/img/underconstuction.png b/img/underconstuction.png new file mode 100644 index 0000000..e307ae9 Binary files /dev/null and b/img/underconstuction.png differ diff --git a/js/fornum.js b/js/fornum.js index bddeb2d..b4de34d 100644 --- a/js/fornum.js +++ b/js/fornum.js @@ -2,11 +2,11 @@ function fornum(num){ if(num<1000) return Math.floor(num); else{ - const suffixes = ['', ' K', ' M', ' B', ' T', - ' aa', ' ab', ' ac', ' ad', ' ae', ' af', ' ag', ' ah', ' ai', ' aj', ' ak', ' al', ' am', ' an', ' ao', ' ap', ' aq', ' ar', ' as', ' at', ' au', ' av', ' aw', ' ax', ' ay', ' az', - ' ba', ' bb', ' bc', ' bd', ' be', ' bf', ' bg', ' bh', ' bi', ' bj', ' bk', ' bl', ' bm', ' bn', ' bo', ' bp', ' bq', ' br', ' bs', ' bt', ' bu', ' bv', ' bw', ' bx', ' by', ' bz', - ' ca', ' cb', ' cc', ' cd', ' ce', ' cf', ' cg', ' ch', ' ci', ' cj', ' ck', ' cl', ' cm', ' cn', ' co', ' cp', ' cq', ' cr', ' cs', ' ct', ' cu', ' cv', ' cw', ' cx', ' cy', ' cz', - ' da', ' db', ' dc', ' dd', ' de', ' df', ' dg', ' dh', ' di', ' dj', ' dk', ' dl', ' dm', ' dn', ' do', ' dp', ' dq', ' dr', ' ds', ' dt', ' du', ' dv', ' dw', ' dx', ' dy', ' dz']; + const suffixes = ['', 'K', 'M', 'B', 'T', + 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al', 'am', 'an', 'ao', 'ap', 'aq', 'ar', 'as', 'at', 'au', 'av', 'aw', 'ax', 'ay', 'az', + 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bk', 'bl', 'bm', 'bn', 'bo', 'bp', 'bq', 'br', 'bs', 'bt', 'bu', 'bv', 'bw', 'bx', 'by', 'bz', + 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'cg', 'ch', 'ci', 'cj', 'ck', 'cl', 'cm', 'cn', 'co', 'cp', 'cq', 'cr', 'cs', 'ct', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz', + 'da', 'db', 'dc', 'dd', 'de', 'df', 'dg', 'dh', 'di', 'dj', 'dk', 'dl', 'dm', 'dn', 'do', 'dp', 'dq', 'dr', 'ds', 'dt', 'du', 'dv', 'dw', 'dx', 'dy', 'dz']; let i = 0; while (num >= 1000 && i < suffixes.length - 1) { diff --git a/js/htmls.js b/js/htmls.js index 3a0ebc8..75d8431 100644 --- a/js/htmls.js +++ b/js/htmls.js @@ -646,33 +646,32 @@ const htmlShop = `
-
+
-

Lemons

- +69k/s +

Lemons

+ +69k/s
- -
-

You've got OUTPUT

+

You've got OUTPUT

-
+

Lemon t

- +69k/s

@@ -733,7 +732,13 @@ const htmlUpgrade = `

+
--> + +
+

In Making

+
+ ${menu}`; diff --git a/js/main.js b/js/main.js index a694dc8..b398019 100644 --- a/js/main.js +++ b/js/main.js @@ -21,19 +21,19 @@ Upraveno: Načítání obchodu Smazáno: Možnost výběru změny jazyka a S/T módu` function loadClicking(){ - if (localStorage.getItem('items')!=null){ - items = JSON.parse(localStorage.getItem('items')); - } + if (localStorage.getItem('BRB-Progress')!=null){ + bigredbutton = JSON.parse(localStorage.getItem('BRB-Progress')); +} } // updateClicking function updateClicking(){ - let i = JSON.stringify(items); - localStorage.setItem('items', i); + let i = JSON.stringify(bigredbutton); + localStorage.setItem('BRB-Progress', i); if(navigator.language == 'cs' || navigator.language == 'cs-CZ'){ - document.getElementById('disclick').innerHTML=`Máš ${fornum(items.clicks)} kliků a generuješ ${fornum(cs*items.pres)} k/s!` + document.getElementById('disclick').innerHTML=`Máš ${fornum(bigredbutton.items.special[0].number)} kliků a generuješ ${fornum(cs*bigredbutton.settings.prestige)} k/s!` }else{ - document.getElementById('disclick').innerHTML=`You have ${fornum(items.clicks)} clicks, and generating ${fornum(cs*items.pres)} c/s!` + document.getElementById('disclick').innerHTML=`You have ${fornum(bigredbutton.items.special[0].number)} clicks, and generating ${fornum(cs*bigredbutton.settings.prestige)} c/s!` } checklang(); } @@ -65,7 +65,7 @@ function change(){ } function clicking(){ - items.clicks += 1*(items.Mclick||1)*items.pres; + bigredbutton.items.special[0].number += 1; //*(items.Mclick||1)*items.pres; updateClicking(); document.getElementById('unpressed').style.visibility='hidden' diff --git a/js/normal.js b/js/normal.js index 9160676..7b704ce 100644 --- a/js/normal.js +++ b/js/normal.js @@ -1,4 +1,4 @@ -let contextBRBCONST = { +const contextBRBCONST = { items: { special:[ { @@ -130,7 +130,7 @@ let contextBRBCONST = { name: 'squirrel', number: 0, history: 0, - cost: 9000000, + cost: 900000, make: 9000, upgrade: 1, }, @@ -187,6 +187,8 @@ let contextBRBCONST = { settings: { prestige: 1, tokens: 0, + quality: 0, + numberOfAnimals: 3, }, } @@ -205,3 +207,7 @@ const updateContext = (context) => { context.settings.tokens = 0; // Set tokens to 0 context.settings.prestige += 0.5; // Add 0.5 to prestige }; + +function log(mess = 'If you see this then message MrEidam that it doesn\'t work'){ + alert(mess); +} \ No newline at end of file diff --git a/js/shop.js b/js/shop.js index c319ee4..40523ae 100644 --- a/js/shop.js +++ b/js/shop.js @@ -1,3 +1,5 @@ +let animal; + while(document.title === 'BRB - Obchod'||document.title === 'BRB - Shop'){ //! Shopdope } @@ -11,163 +13,152 @@ addEventListener('scroll', () => { } }) +//* DISPLAYING THE GENERATION OF CLICKS +function displayClickGen(animal, make, upgrade, number){ + const animalElement = document.querySelector(`#${animal}Make`); + + if(animalElement){ + animalElement.innerHTML = `
+${fornum(make*upgrade*number*bigredbutton.settings.prestige)}/s`;
+  }
+}
+
 function loadShop(){
-  if(navigator.language == 'csd' || navigator.language == 'cs-CZd'){
-  document.getElementById('disclick').innerHTML=`Máš ${fornum(items.clicks)} kliků a děláš ${fornum(cs*items.pres)} za sekundu!`
+  animal = bigredbutton.items.animals;
 
-
-    disdog.innerHTML=
-    `Máš ${fornum(items.dogs)}
- Tvořící ${fornum((items.dogs*1)*items.pres)} kliků!` - discat.innerHTML= - `Máš ${fornum(items.cats)}
- Tvořící ${fornum((items.cats*12)*items.pres)} kliků!` - disfox.innerHTML= - `Máš ${fornum(items.foxes)}
- Tvořící ${fornum((items.foxes*18)*items.pres)} kliků!` - diswol.innerHTML= - `Máš ${fornum(items.wolfs)}
- Tvořící ${fornum((items.wolfs*100)*items.pres)} kliků!` - disham.innerHTML= - `Máš ${fornum(items.hamsters)}
- Tvořící ${fornum((items.hamsters*130)*items.pres)} kliků!` - diswha.innerHTML= - `Máš ${fornum(items.whales)}
- Tvořící ${fornum((items.whales*220)*items.pres)} kliků!` - discap.innerHTML= - `Máš ${fornum(items.capybaras)}
- Tvořící ${fornum((items.capybaras*280)*items.pres)} kliků!` - dissna.innerHTML= - `Máš ${fornum(items.snakes)}
- Tvořící ${fornum((items.snakes*1000)*items.pres)} kliků!` - dische.innerHTML= - `Máš ${fornum(items.cheetahs)}
- Tvořící ${fornum((items.cheetahs*3000)*items.pres)} kliků!` - disgir.innerHTML= - `Máš ${fornum(items.girrafes)}
- Tvořící ${fornum((items.girrafes*8400)*items.pres)} kliků!` - disoth.innerHTML= - `Máš ${fornum(items.otters)}
- Tvořící ${fornum((items.otters*9000)*items.pres)} kliků!` - disrac.innerHTML= - `Máš ${fornum(items.raccoon)}
- Tvořící ${fornum((items.raccoon*14500)*items.pres)} kliků!` - disbad.innerHTML= - `Máš ${fornum(items.badger)}
- Tvořící ${fornum((items.badger*32000)*items.pres)} kliků!` - dissqu.innerHTML= - `Máš ${fornum(items.squirrel)}
- Tvořící ${fornum((items.squirrel*50000)*items.pres)} kliků!` - discha.innerHTML= - `Máš ${fornum(items.chameleon)}
- Tvořící ${fornum((items.chameleon*70000)*items.pres)} kliků!` - dischi.innerHTML= - `Máš ${fornum(items.chicken)}
- Tvořící ${fornum((items.chicken*120000)*items.pres)} kliků!` - diswom.innerHTML= - `Máš ${fornum(items.wombat)}
- Tvořící ${fornum((items.wombat*280000)*items.pres)} kliků!` - disfro.innerHTML= - `Máš ${fornum(items.frog)}
- Tvořící ${fornum((items.frog*900000)*items.pres)} kliků!` - dispig.innerHTML= - `Máš ${fornum(items.pig)}
- Tvořící ${fornum((items.pig*1150000)*items.pres)} kliků!` - dissea.innerHTML= - `Máš ${fornum((items.seal||0))}
- Tvořící ${fornum(((items.seal||0)*1300000)*items.pres)} kliků!` - - - document.getElementById('dislem').innerHTML= - `Máš ${fornum(items.lemons)} citrónů!` - document.getElementById('dislt3').innerHTML= - `Máš ${fornum(items.lt3)} citronovníků!
- Tvořící ${fornum((items.lt3*items.pres))} citrónů
za 100 sec.` - - disdogName.innerHTML=`Psi` - discatName.innerHTML=`Kočky` - disfoxName.innerHTML=`Lišky` - diswolName.innerHTML=`Vlci` - dishamName.innerHTML=`Křečci` - diswhaName.innerHTML=`Velryby` - discapName.innerHTML=`Kapybary` - dissnaName.innerHTML=`Hadi` - discheName.innerHTML=`Gepardi` - disgirName.innerHTML=`Žirafy` - disottName.innerHTML=`Vydry` - disracName.innerHTML=`Mývalové` - disbadName.innerHTML=`Jezevci` - dissquName.innerHTML=`Veverky` - dischaName.innerHTML=`Chameleóni` - dischiName.innerHTML=`Slepice` - diswomName.innerHTML=`Wombati` - disfroName.innerHTML=`Žáby` - dispigName.innerHTML=`Prasata` - disseaName.innerHTML=`Tuleni` - dislemName.innerHTML=`Citróny` - dislt3Name.innerHTML=`Citrónovníky` - - dg1.innerHTML = 'Kup za 100 kliků' - ct1.innerHTML = 'Kup za 10 psů' - fx1.innerHTML = 'Kup za 15 psů' - wl1.innerHTML = 'Kup za:
6 psů a 5 lišek' - hm1.innerHTML = 'Kup za:
1 vlka a 2 kočky' - wh1.innerHTML = 'Kup za 2 vlky' - cp1.innerHTML = 'Kup za:
1 velrybu a 4 kočky' - sn1.innerHTML = 'Kup za:
2 velryby a 4 křečky' - ch1.innerHTML = 'Kup za:
2 hady a 2 ptakopysky' - gi1.innerHTML = 'Kup za:
1 kobru a 20 lišek' - ot1.innerHTML = 'Kup za:
1 žirafu a 2 kapybary' - ra1.innerHTML = 'Kup za:
1 surikatu a 7 dikobrazů' - ba1.innerHTML = 'Kup za:
1 sovu a 2 kobry' - sq1.innerHTML = 'Kup za:
1 jezevce a 5 gepardů' - cha1.innerHTML = 'Kup za:
1 veverku a 2 surikaty' - chi1.innerHTML = 'Kup za:
2 veverky a 1 sovu' - wom1.innerHTML = 'Kup za:
1 slepici a 2 chameleóny' - fro1.innerHTML = 'Kup za:
1 kojota a 40 hadů' - pig1.innerHTML = 'Kup za:
1 medvěda a 6 jezevců' - sea1.innerHTML = 'Kup za:
1 prase a 9 vyder' - - lm1.innerHTML = 'Kup za 20 koček' - lt1.innerHTML = 'Kup za 5 citrónů' - - // Buying for clicks - Cct1.innerHTML = 'Kup za 1,2 k kliků' - Cfx1.innerHTML = 'Kup za 1,8 k kliků' - Cwl1.innerHTML = 'Kup za 10 k kliků' - Chm1.innerHTML = 'Kup za 13 k kliků' - Cwh1.innerHTML = 'Kup za 22 k kliků' - Ccp1.innerHTML = 'Kup za 28 k kliků' - Csn1.innerHTML = 'Kup za 150 k kliků' - Cch1.innerHTML = 'Kup za 350 k kliků' - Cgi1.innerHTML = 'Kup za 880 k kliků' - Cot1.innerHTML = 'Kup za 950 k kliků' - Cra1.innerHTML = 'Kup za 1,5 mil kliků' - Cba1.innerHTML = 'Kup za 3,5 mil kliků' - Csq1.innerHTML = 'Kup za 5,5 mil kliků' - Ccha1.innerHTML = 'Kup za 7,7 mil kliků' - Cchi1.innerHTML = 'Kup za 13 mil kliků' - Cwom1.innerHTML = 'Kup za 31 mil kliků' - Cfro1.innerHTML = 'Kup za 99 mil kliků' - Cpig1.innerHTML = 'Kup za 126,5 mil kliků' - Csea1.innerHTML = 'Kup za 143 mil kliků' - }else{ - disclick.innerHTML=`You've got ${fornum(items.clicks)} clicks`; + if(navigator.language == 'cs' || navigator.language == 'cs-CZ'){ + document.querySelector('#disclick').innerHTML=`
Máš ${fornum(bigredbutton.items.special[0].number)} kliků`;
     document.querySelector('#clickMake').innerHTML = `+${fornum(cs)}/s`
-    //* DISPLAYING THE GENERATION OF CLICKS
-    function displayClickGen(animal, make, upgrade, number){
-      const animalElement = document.querySelector(`#${animal}Make`);
+
+    //* DISPLAYING THE NUMBER OF ANIMALS
+    function czechDisplayAnimal(animal, number){
+      const animalElement = document.querySelector(`#dis${animal}`);
 
       if(animalElement){
-          animalElement.innerHTML = `+ ${fornum(make*upgrade*number*bigredbutton.settings.prestige)}/s`;
+          animalElement.innerHTML = `Máš jich ${fornum(number)}`;
       }
     }
 
-    bigredbutton.items.animals.forEach(({ name , make , upgrade , number}) => {
-        displayClickGen(name, make, upgrade, number);
+    bigredbutton.items.animals.forEach(({ name, number }) => {
+      czechDisplayAnimal(name, number);
     });
 
 
+    //* DISPLAYING THE COST OF ANIMAL BUY
+    function purchaseTextCzech(animal, text = null){
+      const animalElement = document.querySelector(`#${animal}1`);
+  
+      if(animalElement){
+          if(text){
+              animalElement.innerHTML = text;
+          }else{
+              animalElement.innerHTML = `${animal}`;
+          }
+      }
+    }
+
+    const purchases = [
+      { id: 'dog', text: 'Kup za 100 kliků' },
+      { id: 'cat', text: 'Kup za 10 psů' },
+      { id: 'fox', text: 'Kup za 15 psů' },
+      { id: 'wolf', text: 'Kup za:
5 lišek a 6 psů' }, + { id: 'hamster', text: 'Kup za:
1 vlka a 2 kočky' }, + { id: 'whale', text: 'Kup za:
2 vlky a 1 křečeka' }, + { id: 'capybara', text: 'Kup za:
1 velrybu a 4 koček' }, + { id: 'snake', text: 'Kup za:
1 kapybaru a 4 lišky' }, + { id: 'cheetah', text: 'Kup za:
2 hady a 20 psů' }, + { id: 'giraffe', text: 'Kup za:
1 geparda a 2 velryby' }, + { id: 'otter', text: 'Kup za:
2 žirafy a 3 hady' }, + { id: 'racoon', text: 'Kup za:
1 vydru a 4 kapybary' }, + { id: 'badger', text: 'Kup za:
1 mývala a 6 křečeků' }, + { id: 'squirrel', text: 'Kup za:
1 jezevce a 2 gepardy' }, + { id: 'chameleon', text: 'Kup za:
1 veverku a 2 vydry'}, + { id: 'chicken', text: 'Kup za:
1 chameleóna a 4 žirafy' }, + { id: 'wombat', text: 'Kup za:
1 slepici a 6 velryb' }, + { id: 'frog', text: 'Kup za:
1 vombata a 1 chameleóna' }, + { id: 'pig', text: 'Kup za:
2 žáby a 5 mývalů' }, + { id: 'seal', text: 'Kup za:
2 prasata a 10 lišek' } + ]; + function getPurchaseTextCzech(animalName){ + const purchase = purchases.find(p => p.id === animalName); + return purchase ? purchase.text : null; + } + //? Updating animal names from bigredbutton.items.animals with purchase text + bigredbutton.items.animals.forEach(({ name }) => { + const text = getPurchaseTextCzech(name); + purchaseTextCzech(name, text); + }); + + + //* DISPLAYING THE COST OF ANIMAL BUY + animal.forEach(a => { + const animalId = `dis${a.name}Name`; + const animalElement = document.getElementById(animalId); + + if(animalElement){ + animalElement.innerHTML = transtaleAnimalName(a.name); + } + }); + + function transtaleAnimalName(animalName){ + const translation = { + dog: 'Psi', + cat: 'Kočky', + fox: 'Lišky', + wolf: 'Vlci', + hamster: 'Křečci', + whale: 'Velryby', + capybara: 'Kapybary', + snake: 'Hadi', + cheetah: 'Gepardi', + giraffe: 'Žirafy', + otter: 'Vydry', + racoon: 'Mývalové', + badger: 'Jezevci', + squirrel: 'Veverky', + chameleon: 'Chameleóni', + chicken: 'Slepice', + wombat: 'Wombati', + frog: 'Žáby', + pig: 'Prasata', + seal: 'Tuleni', + }; + return translation[animalName] || animalName; + } + + + /* + dislem + `Máš fornum citrónů!` + + dislt3 + `Máš fornum citronovníků!
+ Tvořící fornum citrónů
za 100 sec.` + + dislemName.innerHTML=`Citróny` + dislt3Name.innerHTML=`Citrónovníky` + + lm1.innerHTML = 'Kup za 20 koček' + lt1.innerHTML = 'Kup za 5 citrónů' +*/ + + + //* BUYING FOR CLICKS DISPLAY + function czechClickDisplay(animal, cost){ + const animalElement = document.querySelector(`#C${animal}1`); + + if(animalElement){ + animalElement.innerHTML = `Kup za ${fornum(cost)} kliků!`; + } + } + bigredbutton.items.animals.forEach(({ name , cost }) => { + czechClickDisplay(name, cost); + }); + + }else{ + document.querySelector('#disclick').innerHTML=`You've got ${fornum(bigredbutton.items.special[0].number)} clicks`; + document.querySelector('#clickMake').innerHTML = `+${fornum(cs)}/s`; + + //* DISPLAYING THE NUMBER OF ANIMALS function displayAnimal(animal, number){ const animalElement = document.querySelector(`#dis${animal}`); @@ -195,6 +186,7 @@ function loadShop(){ displayAnimalName(name); }); + //* DISPLAYING THE COST OF ANIMAL BUY function purchaseText(animal, text = null){ const animalElement = document.querySelector(`#${animal}1`); @@ -209,35 +201,32 @@ function loadShop(){ } const purchases = [ - { id: 'dog', text: 'Buy for 10 dogs' }, - { id: 'cat', text: 'Buy for 15 dogs' }, - { id: 'fox', text: 'Buy for:
6 dogs and 5 foxes' }, - { id: 'wolf', text: 'Buy for:
1 wolf and 2 cats' }, - { id: 'hamster', text: 'Buy for:
' }, - { id: 'whale', text: 'Buy for 2 wolfs' }, + { id: 'dog', text: 'Buy for 100 clicks' }, + { id: 'cat', text: 'Buy for 10 dogs' }, + { id: 'fox', text: 'Buy for 15 dogs' }, + { id: 'wolf', text: 'Buy for:
5 foxes and 6 dogs' }, + { id: 'hamster', text: 'Buy for:
1 wolf and 2 cats' }, + { id: 'whale', text: 'Buy for:
2 wolfs and 1 hamster' }, { id: 'capybara', text: 'Buy for:
1 whale and 4 cats' }, - { id: 'snake', text: 'Buy for:
2 whales and 4 hamsters' }, - { id: 'cheetah', text: 'Buy for:
2 snakes and 2 platypuses' }, - { id: 'giraffe', text: 'Buy for:
1 python and 20 foxes' }, - { id: 'otter', text: 'Buy for:
1 giraffe and 2 capybaras' }, - { id: 'racoon', text: 'Buy for:
1 meerkat and 7 porcupines' }, - { id: 'badger', text: 'Buy for:
1 owl and 2 pythons' }, - { id: 'squirrel', text: 'Buy for:
1 badger and 5 cheetah' }, - { id: 'chameleon', text: 'Buy for:
1 squirrel and 2 meerkats' }, - { id: 'chicken', text: 'Buy for:
2 squirrels and 1 owl' }, - { id: 'wombat', text: 'Buy for:
1 chicken and 2 chameleons' }, - { id: 'frog', text: 'Buy for:
1 coyote and 40 snakes' }, - { id: 'pig', text: 'Buy for:
1 bear and 6 badgers' }, - { id: 'seal', text: 'Buy for:
1 pig and 9 otters' } + { id: 'snake', text: 'Buy for:
1 capybara and 4 foxes' }, + { id: 'cheetah', text: 'Buy for:
2 snakes and 20 dogs' }, + { id: 'giraffe', text: 'Buy for:
1 cheetah and 2 whales' }, + { id: 'otter', text: 'Buy for:
2 giraffes and 3 snakes' }, + { id: 'racoon', text: 'Buy for:
1 otter and 4 capybaras' }, + { id: 'badger', text: 'Buy for:
1 racoon and 6 hamsters' }, + { id: 'squirrel', text: 'Buy for:
1 badger and 2 cheetahs' }, + { id: 'chameleon', text: 'Buy for:
1 squirrel and 2 otters'}, + { id: 'chicken', text: 'Buy for:
1 chameleon and 4 giraffes' }, + { id: 'wombat', text: 'Buy for:
1 chicken and 6 whales' }, + { id: 'frog', text: 'Buy for:
1 wombat and 1 chameleon' }, + { id: 'pig', text: 'Buy for:
2 frogs and 5 racoons' }, + { id: 'seal', text: 'Buy for:
2 pigs and 10 foxes' } ]; - - // Function to find corresponding text for a given animal function getPurchaseText(animalName){ const purchase = purchases.find(p => p.id === animalName); return purchase ? purchase.text : null; } - - // Updating animal names from bigredbutton.items.animals with purchase text + //? Updating animal names from bigredbutton.items.animals with purchase text bigredbutton.items.animals.forEach(({ name }) => { const text = getPurchaseText(name); purchaseText(name, text); @@ -252,11 +241,12 @@ function loadShop(){ animalElement.innerHTML = `Buy for ${fornum(cost)} clicks!`; } } - bigredbutton.items.animals.forEach(({ name , cost }) => { internationalClicksDisplay(name, cost); }); - }/* + } + + /* dislem.innerHTML= `You have ${fornum(items.lemons)}!` dislt3.innerHTML= @@ -268,296 +258,121 @@ function loadShop(){ lm1.innerHTML = 'Buy for 20 cats' lt1.innerHTML = 'Buy for 5 lemons'*/ + + + bigredbutton.items.animals.forEach(({ name , make , upgrade , number}) => { + displayClickGen(name, make, upgrade, number); + }); } // uploadShop function uploadShop(){update();loadShop();} -// Nákupy +/* +               _____ _ +              / ____| | | +             | (___ | |__ ___   _ __ +              \___ \ | '_ \ / _ \ | '_ \ +              ____) | | | | | | (_) | | |_) | +             |_____/ |_| |_| \___/ | .__/ +                                       | | +                                       |_| +*/ -let animal = bigredbutton.items.animals; - -function numHis(animals, num){ - animal[animals].number += num; - animal[animals].history += num; +function numHis(animalIndex, num){ + animal[animalIndex].number += num; + animal[animalIndex].history += num; } -function buydog(){ - if(bigredbutton.items.special[0].number>=100){ - bigredbutton.items.special[0] -= 100; - numHis(0,1); +function buyAnimal(animalName, conditions, amount = 1){ + const animalIndex = animal.findIndex(a => a.name === animalName); + if(animalIndex === -1) return; //? Error 404: Animal + + //? Calcs the max you can buy + let maxAffordable = Infinity; + for(const [item, requiredAmount] of Object.entries(conditions)){ + const resourceIndex = animal.findIndex(a => a.name === item); + if(resourceIndex === -1) return; //? Requirement doesn't exist + + const availableAmount = animal[resourceIndex].number; + const affordableByThisResource = Math.floor(availableAmount/requiredAmount); + + //? What limits you + maxAffordable = Math.min(maxAffordable, affordableByThisResource); } - uploadShop(); -} -function buycat(){ - if(items.dogs>=10){ - items.dogs-=10; - items.cats+=1; + + //? Was 'max' used? + const buyAmount = (amount === 'max') ? maxAffordable : Math.min(amount, maxAffordable); + + if(buyAmount === 0) return; //? Broke + + for(const [item, requiredAmount] of Object.entries(conditions)){ + const resourceIndex = animal.findIndex(a => a.name === item); + animal[resourceIndex].number -= requiredAmount * buyAmount; } - uploadShop(); -} -function buyfox(){ - if(items.dogs>=15){ - items.dogs-=15; - items.foxes+=1; - } - uploadShop(); -} -function buywol(){ - if(items.dogs>=6 && items.foxes>=5){ - items.dogs-=6; - items.foxes-=5; - items.wolfs+=1; - } - uploadShop(); -} -function buyham(){ - if(items.wolfs>=1 && items.cats>=2){ - items.wolfs-=1; - items.cats-=2; - items.hamsters+=1; - } - uploadShop(); -} -function buywha(){ - if(items.wolfs>=2){ - items.wolfs-=2; - items.whales+=1; - } - uploadShop(); -} -function buycap(){ - if(items.whales>=1 && items.cats>=4){ - items.whales-=1; - items.cats-=4; - items.capybaras+=1; - } - uploadShop(); -} -function buypla(){ - if(items.capybaras>=1 && items.wolfs>=1){ - items.capybaras-=1; - items.wolfs-=1; - items.platapuses+=1; - } - uploadShop(); -} -function buypor(){ - if(items.platapuses>=1 && items.whales>=1){ - items.platapuses-=1; - items.whales-=1; - items.porcupines++; - } - uploadShop(); -} -function buyhip(){ - if(items.porcupines>=1 && items.hamsters>=2){ - items.porcupines-=1; - items.hamsters-=2; - items.hippos++; - } - uploadShop(); -} -function buysna(){ - if(items.whales>=2 && items.hamsters>=4){ - items.whales-=2; - items.hamsters-=4; - items.snakes++; - } - uploadShop(); -} -function buyche(){ - if(items.snakes>=2 && items.platapuses>=2){ - items.snakes-=2; - items.platapuses-=2; - items.cheetahs++; - } - uploadShop(); -} -function buypyt(){ - if(items.cheetahs>=1 && items.hippos>=5){ - items.cheetahs-=1; - items.hippos-=5; - items.pythons++; - } - uploadShop(); -} -function buygir(){ - if(items.pythons>=1 && items.foxes>=20){ - items.pythons-=1; - items.foxes-=20; - items.girrafes++; - } - uploadShop(); -} -function buyoth(){ - if(items.girrafes>=1 && items.capybaras>=2){ - items.girrafes-=1; - items.capybaras-=2; - items.otters++; - } - uploadShop(); -} -function buymee(){ - if(items.otters>=1 && items.whales>=3){ - items.otters-=1; - items.whales-=3; - items.meerkat++; - } - uploadShop(); -} -function buyrac(){ - if(items.meerkat>=1 && items.porcupines>=7){ - items.meerkat-=1; - items.porcupines-=7; - items.raccoon++; - } - uploadShop(); -} -function buyowl(){ - if(items.raccoon>=1 && items.snakes>=1){ - items.raccoon-=1; - items.snakes-=1; - items.owl++; - } - uploadShop(); -} -function buybad(){ - if(items.owl>=1 && items.pythons>=2){ - items.owl-=1; - items.pythons-=2; - items.badger++; - } - uploadShop(); -} -function buysqu(){ - if(items.badger>=1 && items.cheetahs>=5){ - items.badger-=1; - items.cheetahs-=5; - items.squirrel++; - } - uploadShop(); -} -function buycha(){ - if(items.squirrel>=1 && items.meerkat>=2){ - items.squirrel-=1; - items.meerkat-=2; - items.chameleon++; - } - uploadShop(); -} -function buychi(){ - if(items.squirrel>=2 && items.owl>=1){ - items.squirrel-=2; - items.owl-=1; - items.chicken++; - } - uploadShop(); -} -function buywom(){ - if(items.chicken>=1 && items.chameleon>=2){ - items.chicken-=1; - items.chameleon-=2; - items.wombat++; - } - uploadShop(); -} -function buypan(){ - if(items.wombat>=1 && items.chicken>=2){ - items.wombat-=1; - items.chicken-=2; - items.panther++; - } - uploadShop(); -} -function buycoy(){ - if(items.panther>=1 && items.chameleon>=4){ - items.panther-=1; - items.chameleon-=4; - items.coyote++; - } - uploadShop(); -} -function buyfro(){ - if(items.coyote>=1 && items.snakes>=40){ - items.coyote-=1; - items.snakes-=40; - items.frog++; - } - uploadShop(); -} -function buybea(){ - if(items.frog>=1 && items.girrafes>=5){ - items.frog-=1; - items.girrafes-=5; - items.bear++; - } - uploadShop(); -} -function buypig(){ - if(items.bear>=1 && items.badger>=6){ - items.bear-=1; - items.badger-=6; - items.pig++; - } - uploadShop(); -} -function buysea(){ - if(items.pig>=1 && items.otters>=9){ - items.pig-=1; - items.otters-=9; - items.seal++; - } + + numHis(animalIndex, buyAmount); uploadShop(); } -function buylem(){ +function buycat(){buyAnimal('cat',{ dog: 10 });} +function mxCcat(){buyAnimal('cat',{ dog: 10 }, 'max');} +function buyfox(){buyAnimal('fox',{ dog: 15 });} +function mxCfox(){buyAnimal('fox',{ dog: 15 }, 'max');} +function buywolf(){buyAnimal('wolf',{ dog: 6, fox: 5 });} +function mxCwolf(){buyAnimal('wolf',{ dog: 6, fox: 5 }, 'max');} +function buyhamster(){buyAnimal('hamster',{ wolf: 1, cat: 2 });} +function mxChamster(){buyAnimal('hamster',{ wolf: 1, cat: 2 }, 'max');} +function buywhale(){buyAnimal('whale', { wolf: 2, hamster: 1});} +function mxCwhale(){buyAnimal('whale', { wolf: 2, hamster: 1}, 'max');} +function buycapybara(){buyAnimal('capybara', { whale: 1, cat: 4});} +function mxCcapybara(){buyAnimal('capybara', { whale: 1, cat: 4}, 'max');} +function buysnake(){buyAnimal('snake', { capybara: 1, fox: 4 });} +function mxCsnake(){buyAnimal('snake', { capybara: 1, fox: 4 }, 'max');} +function buycheetah(){buyAnimal('cheetah', { snake: 2, dog: 20 });} +function mxCcheetah(){buyAnimal('cheetah', { snake: 2, dog: 20 }, 'max');} +function buygiraffe(){buyAnimal('giraffe', { cheetah: 1, whale: 2 });} +function mxCgiraffe(){buyAnimal('giraffe', { cheetah: 1, whale: 2 }, 'max');} +function buyotter(){buyAnimal('otter', { giraffe: 2, snake: 3 });} +function mxCotter(){buyAnimal('otter', { giraffe: 2, snake: 3 }, 'max');} +function buyracoon(){buyAnimal('racoon', { otter: 1, capybara: 4 });} +function mxCracoon(){buyAnimal('racoon', { otter: 1, capybara: 4 }, 'max');} +function buybadger(){buyAnimal('badger', { racoon: 1, hamster: 6 });} +function mxCbadger(){buyAnimal('badger', { racoon: 1, hamster: 6 }, 'max');} +function buysquirrel(){buyAnimal('squirrel', { badger: 1, cheetah: 2 });} +function mxCsquirrel(){buyAnimal('squirrel', { badger: 1, cheetah: 2 }, 'max');} +function buychameleon(){buyAnimal('chameleon', { squirrel: 1, otter: 2 });} +function mxCchameleon(){buyAnimal('chameleon', { squirrel: 1, otter: 2 }, 'max');} +function buychicken(){buyAnimal('chicken', { chameleon: 1, giraffe: 4 });} +function mxCchicken(){buyAnimal('chicken', { chameleon: 1, giraffe: 4 }, 'max');} +function buywombat(){buyAnimal('wombat', { chicken: 1, whale: 6 });} +function mxCwombat(){buyAnimal('wombat', { chicken: 1, whale: 6 }, 'max');} +function buyfrog(){buyAnimal('frog', { wombat: 1, chameleon: 1 });} +function mxCfrog(){buyAnimal('frog', { wombat: 1, chameleon: 1 }, 'max');} +function buypig(){buyAnimal('pig', { frog: 2, racoon: 5 });} +function mxCpig(){buyAnimal('pig', { frog: 2, racoon: 5 }, 'max');} +function buyseal(){buyAnimal('seal', { pig: 2, fox: 10 });} +function mxCseal(){buyAnimal('seal', { pig: 2, fox: 10 }, 'max');} + +/* + _ +| | +| | +| | +| |__ +|____| + +*/ +function buylemom(){ + return; if(items.cats>=20){ items.cats-=20; items.lemons+=1; } uploadShop(); } -function buylt3(){ - if(items.lemons>=5){ - items.lemons-=5; - items.lt3+=1; - } - uploadShop(); -} - -/* - __ __ _____ _ -| \/ | / ____| | | -| \ / | __ _ __ __ | (___ | |__ ___   _ __ -| |\/| | / _` | \ \/ / \___ \ | '_ \ / _ \ | '_ \ -| | | | | (_| | > < ____) | | | | | | (_) | | |_) | -|_| |_| \__,_| /_/\_\ |_____/ |_| |_| \___/ | .__/ -                                                      | | -                                                      |_| -*/ -function mxdg(){ - const amount = Math.floor(items.clicks / 100) - - items.clicks -= amount * 100 - items.dogs += amount - uploadShop(); -} -function mxct(){ - const amount = Math.floor(items.dogs / 10) - - items.dogs -= amount * 10 - items.cats += amount - uploadShop(); -} -function mxfx(){ - const amount = Math.floor(items.dogs/15) - - items.dogs -= amount*15 - items.foxes += amount - uploadShop(); -} -function mxlm(){ +function mxlemon(){ + return; let RanLemCost = 20;////Math.floor(Math.random()*100); const amount = Math.floor(items.cats/RanLemCost) @@ -565,391 +380,133 @@ function mxlm(){ items.lemons += amount uploadShop(); } +function buylt3(){ + return; + if(items.lemons>=5){ + items.lemons-=5; + items.lt3+=1; + } + uploadShop(); +} function mxlt(){ + return; const amount = Math.floor(items.lemons/5) items.lemons -= amount*5 items.lt3 += amount uploadShop() } -function mxwh(){ - const amount = Math.floor(items.wolfs/2); - - items.wolfs -= amount*2; - items.whales += amount; - uploadShop(); -} -function mxwl(){ - const amount = Math.min(Math.floor(items.foxes/5), Math.floor(items.dogs/6)); - if(amount > 0){ - items.foxes -= amount*5 - items.dogs -= amount*6 - items.wolfs += amount - } - uploadShop(); -} -function mxhm(){ - const amount = Math.min(Math.floor(items.wolfs/1), Math.floor(items.cats/2)); +/* SHOPPING WITH ONLY +               _____ _ _ _ +              / ____| | | (_) | | +             | | | | _ ___ | | __ ___ +             | | | | | | / __| | |/ / / __| +             | |____ | | | | | (__ | < \__ \ +              \_____| |_| |_| \___| |_|\_\ |___/ +*/ - if(amount > 0){ - items.wolfs -= amount*1; - items.cats -= amount*2; - items.hamsters += amount; - } - uploadShop(); -} -function mxcp(){ - const amount = Math.min(Math.floor(items.whales/1), Math.floor(items.cats/4)); - - if(amount > 0){ - items.whales -= amount*1; - items.cats -= amount*4; - items.capybaras += amount; - } - uploadShop(); -} -function mxpl(){ - const amount = Math.min(Math.floor(items.capybaras/1), Math.floor(items.wolfs/1)); - - if(amount > 0){ - items.capybaras -= amount*1; - items.wolfs -= amount*1; - items.platapuses += amount; - } - uploadShop(); -} -function mxpr(){ - const amount = Math.min(Math.floor(items.platapuses/1), Math.floor(items.whales/1)); - - if(amount > 0){ - items.platapuses -= amount*1; - items.whales -= amount*1; - items.porcupines += amount; - } - uploadShop(); -} -function mxhi(){ - const amount = Math.min(Math.floor(items.porcupines/1), Math.floor(items.hamsters/2)); - - if(amount > 0){ - items.porcupines -= amount*1; - items.hamsters -= amount*2; - items.hippos += amount; - } - uploadShop(); -} -function mxsn(){ - const amount = Math.min(Math.floor(items.whales/2), Math.floor(items.hamsters/4)); - - if(amount > 0){ - items.whales -= amount*2; - items.hamsters -= amount*4; - items.snakes += amount; - } - uploadShop(); -} -function mxch(){ - const amount = Math.min(Math.floor(items.snakes/2), Math.floor(items.platapuses/2)); - - if(amount > 0){ - items.snakes -= amount*2; - items.platapuses -= amount*2; - items.cheetahs += amount; - } - uploadShop(); -} -function mxpy(){ - const amount = Math.min(Math.floor(items.cheetahs/1), Math.floor(items.hippos/5)); - - if(amount > 0){ - items.cheetahs -= amount*1; - items.hippos -= amount*5; - items.pythons += amount; - } - uploadShop(); -} -function mxgi(){ - const amount = Math.min(Math.floor(items.pythons/1), Math.floor(items.foxes/20)); - - if(amount){ - items.pythons -= amount*1; - items.foxes -= amount*20; - items.girrafes += amount; - } - uploadShop(); -} -function mxot(){ - const amount = Math.min(Math.floor(items.girrafes/1), Math.floor(items.capybaras/2)); - - if(amount > 0){ - items.girrafes -= amount*1; - items.capybaras -= amount*2; - items.otters += amount; - } - uploadShop(); -} -function mxme(){ - const amount = Math.min(Math.floor(items.otters/1), Math.floor(items.whales/3)); - - if(amount > 0){ - items.otters -= amount*1; - items.whales -= amount*3; - items.meerkat += amount; - } - uploadShop(); -} -function mxra(){ - const amount = Math.min(Math.floor(items.meerkat/1), Math.floor(items.porcupines/7)); - - if(amount > 0){ - items.meerkat -= amount*1; - items.porcupines -= amount*7; - items.raccoon += amount; - } - uploadShop(); -} -function mxow(){ - const amount = Math.min(Math.floor(items.raccoon/1), Math.floor(items.snakes/1)); - - if(amount > 0){ - items.raccoon -= amount*1; - items.snakes -= amount*1; - items.owl += amount; - } - uploadShop(); -} -function mxba(){ - const amount = Math.min(Math.floor(items.owl/1), Math.floor(items.pythons/2)); - - if(amount > 0){ - items.owl -= amount*1; - items.pythons -= amount*2; - items.badger += amount; - } - uploadShop(); -} -function mxsq(){ - const amount = Math.min(Math.floor(items.badger/1), Math.floor(items.cheetahs/5)); - - if(amount > 0){ - items.badger -= amount*1; - items.cheetahs -= amount*5; - items.squirrel += amount; - } - uploadShop(); -} -function mxcha(){ - const amount = Math.min(Math.floor(items.squirrel/1), Math.floor(items.meerkat/2)); - if(amount > 0){ - items.squirrel -= amount*1; - items.meerkat -= amount*2; - items.chameleon += amount; - } - uploadShop(); -} -function mxchi(){ - const amount = Math.min(Math.floor(items.squirrel/2), Math.floor(items.owl/1)); - if(amount > 0){ - items.squirrel -= amount*2; - items.owl -= amount*1; - items.chicken += amount; - } - uploadShop(); -} -function mxwom(){ - const amount = Math.min(Math.floor(items.chicken/1), Math.floor(items.chameleon/2)); - if(amount > 0){ - items.chicken -= amount*1; - items.chameleon -= amount*2; - items.wombat += amount; - } - uploadShop(); -} -function mxpan(){ - const amount = Math.min(Math.floor(items.wombat/1), Math.floor(items.chicken/2)); - if(amount > 0){ - items.wombat -= amount*1; - items.chicken -= amount*2; - items.panther += amount; - } - uploadShop(); -} -function mxcoy(){ - const amount = Math.min(Math.floor(items.panther/1), Math.floor(items.chameleon/4)); - if(amount > 0){ - items.panther -= amount*1; - items.chameleon -= amount*4; - items.coyote += amount; - } - uploadShop(); -} -function mxfro(){ - const amount = Math.min(Math.floor(items.coyote/1), Math.floor(items.snakes/40)); - if(amount > 0){ - items.coyote -= amount*1; - items.snakes -= amount*40; - items.frog += amount; - } - uploadShop(); -} -function mxbea(){ - const amount = Math.min(Math.floor(items.frog/1), Math.floor(items.girrafes/5)); - if(amount > 0){ - items.frog -= amount*1; - items.girrafes -= amount*5; - items.bear += amount; - } - uploadShop(); -} -function mxpig(){ - const amount = Math.min(Math.floor(items.bear/1), Math.floor(items.badger/6)); - if(amount > 0){ - items.bear -= amount*1; - items.badger -= amount*6; - items.pig += amount; - } - uploadShop(); -} -function mxsea(){ - const amount = Math.min(Math.floor(items.pig/1), Math.floor(items.otters/9)); - if(amount > 0){ - items.pig -= amount*1; - items.otters -= amount*9; - items.seal += amount; - } - uploadShop(); -} +function buyAnimalWithClicks(animalName, amount = 1){ + const animal = bigredbutton.items.animals.find(a => a.name === animalName); + const clicksAvailable = bigredbutton.items.special[0].number; //Clicks + const costInClicks = animal?.cost; //? optional chaining. It is used to safely access properties of an object that might be null or undefined. -/* SHOPPING WITH ONLY CLICKS */ + if(animal){ + const maxAffordable = Math.floor(clicksAvailable/costInClicks); + //? If amount is 'max' use maxAffordable + const buyAmount = (amount === 'max') ? maxAffordable : Math.min(amount, maxAffordable); -function canimal(animal, cost){ - if(items.clicks >= cost){ - items[animal]++; - items.clicks -= cost; - uploadShop(); + if(buyAmount >= 0){ + const totalCost = costInClicks * buyAmount; + + bigredbutton.items.special[0].number -= totalCost; + numHis(bigredbutton.items.animals.indexOf(animal), buyAmount); + uploadShop(); + }else{ + console.log(`Not enough clicks to buy ${amount} ${animalName}(s).`); + } + }else{ + console.log(`Animal not found: ${animalName}`); } } -function cManimal(animal, cost) { - const quantity = Math.floor(items.clicks / cost); - - if(quantity > 0){ - items[animal] += quantity; - items.clicks -= quantity * cost; - uploadShop(); - } -} +// dog +function buydog(){buyAnimalWithClicks('dog');} +function mxdog(){buyAnimalWithClicks('dog', 'max')} // cat -function buyCcat(){canimal('cats', 1200)} -function mxCct(){cManimal('cats', 1200)} +function buyCcat(){buyAnimalWithClicks('cat')} +function mxcat(){buyAnimalWithClicks('cat', 'max')} // fox -function buyCfox(){canimal('foxes', 1800)} -function mxCfx(){cManimal('foxes', 1800)} +function buyCfox(){buyAnimalWithClicks('fox')} +function mxfox(){buyAnimalWithClicks('fox', 'max')} // wolf -function buyCwol(){canimal('wolfs', 10000)} -function mxCwl(){cManimal('wolfs', 10000)} +function buyCwolf(){buyAnimalWithClicks('wolf')} +function mxwolf(){buyAnimalWithClicks('wolf', 'max')} // hamster -function buyCham(){canimal('hamsters', 13000)} -function mxChm(){cManimal('hamsters', 13000)} +function buyChamster(){buyAnimalWithClicks('hamster')} +function mxhamster(){buyAnimalWithClicks('hamster', 'max')} // whale -function buyCwha(){canimal('whales', 22000)} -function mxCwh(){cManimal('whales', 22000)} +function buyCwhale(){buyAnimalWithClicks('whale')} +function mxwhale(){buyAnimalWithClicks('whale', 'max')} // cappybarra -function buyCcap(){canimal('capybaras', 28000)} -function mxCcp(){cManimal('capybaras', 28000)} - -// platypussy -function buyCpla(){canimal('platapuses', 42000)} -function mxCpl(){cManimal('platapuses', 42000)} - -// porcupine -function buyCpor(){canimal('porcupines', 70000)} -function mxCpr(){cManimal('porcupines', 70000)} - -// hippopopopotamusss -function buyChip(){canimal('hippos', 100000)} -function mxChi(){cManimal('hippos', 100000)} +function buyCcapybara(){buyAnimalWithClicks('capybara')} +function mxcapybara(){buyAnimalWithClicks('capybara', 'max')} // Snuk -function buyCsna(){canimal('snakes', 150000)} -function mxCsn(){cManimal('snakes', 150000)} +function buyCsnake(){buyAnimalWithClicks('snake')} +function mxsnake(){buyAnimalWithClicks('snake', 'max')} // Chetuch -function buyCche(){canimal('cheetahs', 350000)} -function mxCch(){cManimal('cheetahs', 350000)} - -// .py -function buyCpyt(){canimal('pythons', 820000)} -function mxCpy(){cManimal('pythons', 820000)} +function buyCcheetah(){buyAnimalWithClicks('cheetah')} +function mxcheetah(){buyAnimalWithClicks('cheetah', 'max')} // Gurllaf -function buyCgir(){canimal('girrafes', 880000)} -function mxCgi(){cManimal('girrafes', 880000)} +function buyCgiraffe(){buyAnimalWithClicks('giraffe')} +function mxgiraffe(){buyAnimalWithClicks('giraffe', 'max')} // Other space -function buyCoth(){canimal('otters', 950000)} -function mxCot(){cManimal('otters', 950000)} - -// Mii Cat -function buyCmee(){canimal('meerkat', 1000000)} -function mxCme(){cManimal('meerkat', 1000000)} +function buyCotter(){buyAnimalWithClicks('otter')} +function mxotter(){buyAnimalWithClicks('otter', 'max')} // C rac -function buyCrac(){canimal('raccoon', 1500000)} -function mxCra(){cManimal('raccoon', 1500000)} - -// O -function buyCowl(){canimal('owl', 1800000)} -function mxCow(){cManimal('owl', 1800000)} +function buyCracoon(){buyAnimalWithClicks('racoon')} +function mxracoon(){buyAnimalWithClicks('racoon', 'max')} // bad -function buyCbad(){canimal('badger', 3500000)} -function mxCba(){cManimal('badger', 3500000)} +function buyCbadger(){buyAnimalWithClicks('badger')} +function mxbadger(){buyAnimalWithClicks('badger', 'max')} // squirt -function buyCsqu(){canimal('squirrel', 5500000)} -function mxCsq(){cManimal('squirrel', 5500000)} +function buyCsquirrel(){buyAnimalWithClicks('squirrel')} +function mxsquirrel(){buyAnimalWithClicks('squirrel', 'max')} // cha cha -function buyCcha(){canimal('chameleon', 7700000)} -function mxCcha(){cManimal('chameleon', 7700000)} +function buyCchameleon(){buyAnimalWithClicks('chameleon')} +function mxchameleon(){buyAnimalWithClicks('chameleon', 'max')} // chimken -function buyCchi(){canimal('chicken', 13000000)} -function mxCchi(){cManimal('chicken', 13000000)} +function buyCchicken(){buyAnimalWithClicks('chicken')} +function mxchicken(){buyAnimalWithClicks('chicken', 'max')} // Write Only Memory -function buyCwom(){canimal('wombat', 31000000)} -function mxCwom(){cManimal('wombat', 31000000)} - -// panta -function buyCpan(){canimal('panther', 60500000)} -function mxCpan(){cManimal('panther', 60500000)} - -// cojojojojojo -function buyCcoy(){canimal('coyote', 92400000)} -function mxCcoy(){cManimal('coyote', 92400000)} +function buyCwombat(){buyAnimalWithClicks('wombat')} +function mxwombat(){buyAnimalWithClicks('wombat', 'max')} // fjog -function buyCfro(){canimal('frog', 99000000)} -function mxCfro(){cManimal('frog', 99000000)} - -// cocaina bear -function buyCbea(){canimal('bear', 104500000)} -function mxCbea(){cManimal('bear', 104500000)} +function buyCfrog(){buyAnimalWithClicks('frog')} +function mxfrog(){buyAnimalWithClicks('frog', 'max')} // TECHNOBLADE -function buyCpig(){canimal('pig', 126500000)} -function mxCpig(){cManimal('pig', 126500000)} +function buyCpig(){buyAnimalWithClicks('pig')} +function mxpig(){buyAnimalWithClicks('pig', 'max')} // Seal of approval -function buyCsea(){canimal('seal', 143000000)} -function mxCsea(){cManimal('seal', 143000000)} +function buyCseal(){buyAnimalWithClicks('seal')} +function mxseal(){buyAnimalWithClicks('seal', 'max')} // 892 před V46 | 1160 ve V46 \ No newline at end of file diff --git a/js/title.js b/js/title.js index 7c755e4..bc985fd 100644 --- a/js/title.js +++ b/js/title.js @@ -1,63 +1,20 @@ -let items; +let bigredbutton; let cs; window.onload = function(){ - let socmenu = document.querySelector('.socmenu'); - let toggle = document.querySelector('.toggle'); - items = { - clicks:0, - dogs:0, - cats:0, - foxes:0, - wolfs:0, - hamsters:0, - whales:0, - capybaras:0, - platapuses:0, - porcupines:0, - hippos:0, - snakes:0, - cheetahs:0, - pythons:0, - girrafes:0, - lions:0, - otters:0, - meerkat:0, - raccoon:0, - owl:0, - badger:0, - squirrel:0, - chameleon:0, - chicken:0, - wombat:0, - panther:0, - coyote:0, - frog:0, - bear:0, - pig:0, - seal:0, + let socmenu = document.querySelector('.socmenu'); + let toggle = document.querySelector('.toggle'); + + bigredbutton = contextBRBCONST - - - lemons:0, - lt3:0, - pres:1, - Mclick:1, - token:0, - } load(); update(); - for(let item in items){ - if(!items[item]){ - items[item] = 0; - } - } cash(); if(navigator.language == 'cs' || navigator.language == 'cs-CZ'){ - document.title = 'BRB - Hlavní menu' - document.querySelector('#tit').innerHTML = 'BRB - HRA'; - document.querySelector('#heh').innerHTML = 'Zmáčkni tlačítko aby ses dostal do hry!'; - document.querySelector('footer').innerHTML = `Vytvořil: MrEidam`; + document.title = 'BRB - Hlavní menu' + document.querySelector('#tit').innerHTML = 'BRB - HRA'; + document.querySelector('#heh').innerHTML = 'Zmáčkni tlačítko aby ses dostal do hry!'; + document.querySelector('footer').innerHTML = `Vytvořil: MrEidam`; }else{ document.title = 'BRB - Main Menu'; document.querySelector('#tit').innerHTML = 'BRB THE GAME'; @@ -65,241 +22,64 @@ window.onload = function(){ document.querySelector('footer').innerHTML = `Made by: MrEidam`; } toggle.onclick = () => { - socmenu.classList.toggle('active'); + socmenu.classList.toggle('active'); }; - toShop() } function click(){ - setTimeout(() => { - if(document.title === 'BRB - Obchod'||document.title === 'BRB - Shop'){ - document.querySelector('#imgcli').src = '../img/icons8-clicked.png'; - } - },750); - setTimeout(() => { - if(document.title === 'BRB - Obchod'||document.title === 'BRB - Shop'){ - document.querySelector('#imgcli').src = '../img/icons8-rest.svg'; - } - },1000); + setTimeout(() => { + if(document.title === 'BRB - Obchod'||document.title === 'BRB - Shop'){ + document.querySelector('#imgcli').src = '../img/icons8-clicked.png'; + } + },750); + setTimeout(() => { + if(document.title === 'BRB - Obchod'||document.title === 'BRB - Shop'){ + document.querySelector('#imgcli').src = '../img/icons8-rest.svg'; + } + },1000); +} + +function calculateCS(){ + const anim = bigredbutton.items.animals; + let prestigeMultiplier = bigredbutton.settings.prestige || 1; + let clicksPerSecond = 0; + + anim.forEach(animal => { + const { number = 0, make = 0, upgrade = 1 } = animal; + clicksPerSecond += number*make*upgrade; + }); + + clicksPerSecond *= prestigeMultiplier; + + return clicksPerSecond; } function cash(){ setTimeout (() => { - cs = items.dogs+items.cats*12+items.foxes*18+items.wolfs*100+items.hamsters*130+items.whales*220+items.capybaras*280+items.platapuses*400+items.porcupines*650+items.hippos*950+items.snakes*1000+items.cheetahs*3000+items.pythons*7800+items.girrafes*8400+items.otters*9000+items.meerkat*9800+items.raccoon*14500+items.owl*16000+items.badger*32000+items.squirrel*50000+items.chameleon*70000+items.chicken*120000+items.wombat*280000+items.panther*550000+items.coyote*840000+items.frog*900000+items.bear*950000+items.pig*1150000+(items.seal||0)*1300000; - items.clicks += cs*items.pres; - items.lemons += (items.lt3/100)*items.pres; - update();cash(); - if(document.title === 'BRB - Klikání'||document.title === 'BRB - Clicking'){ - uploadClicking(); - } - if(document.title === 'BRB - Obchod'||document.title === 'BRB - Shop'){ - uploadShop(); - click(); - } + cs = calculateCS(); + bigredbutton.items.special[0].number += cs; + //items.lemons += (items.lt3/100)*items.pres; + + update();cash(); + if(document.title === 'BRB - Klikání'||document.title === 'BRB - Clicking'){ + uploadClicking(); + } + if(document.title === 'BRB - Obchod'||document.title === 'BRB - Shop'){ + uploadShop(); + click(); + } ////console.log(`Clicks: ${items.clicks}`); },1000) } function load(){ - if (localStorage.getItem('items')!=null){ - items = JSON.parse(localStorage.getItem('items')); + if (localStorage.getItem('BRB-Progress')!=null){ + bigredbutton = JSON.parse(localStorage.getItem('BRB-Progress')); } } // Update function update(){ - let i = JSON.stringify(items); - localStorage.setItem('items', i); -} - -let bigredbutton = { - items: { - special:[ - { - name: 'click', - number: 0, - history: 0, - make: 0, - upgrade: 1, - }, - { - name: 'lemon', - number: 0, - history: 0, - upgrade: 1, - }, - { - name: 'lemon tree', - number: 0, - history: 0, - upgrade: 1, - }, - ], - animals: [ - { - name: 'dog', - number: 0, - history: 0, - cost: 100, - make: 1, - upgrade: 1, // min 1 - }, - { - name: 'cat', - number: 0, - history: 0, - cost: 1200, - make: 12, - upgrade: 1, - }, - { - name: 'fox', - number: 0, - history: 0, - cost: 1800, - make: 18, - upgrade: 1, - }, - { - name: 'wolf', - number: 0, - history: 0, - cost: 10000, - make: 100, - upgrade: 1, - }, - { - name: 'hamster', - number: 0, - history: 0, - cost: 13000, - make: 130, - upgrade: 1, - }, - { - name: 'whale', - number: 0, - history: 0, - cost: 35000, - make: 350, - upgrade: 1, - }, - { - name: 'capybara', - number: 0, - history: 0, - cost: 41000, - make: 410, - upgrade: 1, - }, - { - name: 'snake', - number: 0, - history: 0, - cost: 50000, - make: 500, - upgrade: 1, - }, - { - name: 'cheetah', - number: 0, - history: 0, - cost: 55000, - make: 550, - upgrade: 1, - }, - { - name: 'giraffe', - number: 0, - history: 0, - cost: 150000, - make: 1500, - upgrade: 1, - }, - { - name: 'otter', - number: 0, - history: 0, - cost: 475000, - make: 4750, - upgrade: 1, - }, - { - name: 'racoon', - number: 0, - history: 0, - cost: 650000, - make: 6500, - upgrade: 1, - }, - { - name: 'badger', - number: 0, - history: 0, - cost: 740000, - make: 7400, - upgrade: 1, - }, - { - name: 'squirrel', - number: 0, - history: 0, - cost: 9000000, - make: 9000, - upgrade: 1, - }, - { - name: 'chameleon', - number: 0, - history: 0, - cost: 1900000, - make: 19000, - upgrade: 1, - }, - { - name: 'chicken', - number: 0, - history: 0, - cost: 2700000, - make: 27000, - upgrade: 1, - }, - { - name: 'wombat', - number: 0, - history: 0, - cost: 3000000, - make: 30000, - upgrade: 1, - }, - { - name: 'frog', - number: 0, - history: 0, - cost: 5000000, - make: 50000, - upgrade: 1, - }, - { - name: 'pig', - number: 0, - history: 0, - cost: 13500000, - make: 135000, - upgrade: 1, - }, - { - name: 'seal', - number: 0, - history: 0, - cost: 27590000, - make: 275900, - upgrade: 1, - }, - ] - }, - settings: { - prestige: 1, - tokens: 0, - }, + let i = JSON.stringify(bigredbutton); + localStorage.setItem('BRB-Progress', i); } \ No newline at end of file diff --git a/js/upgr.js b/js/upgr.js index a86eb52..2c29a33 100644 --- a/js/upgr.js +++ b/js/upgr.js @@ -1,5 +1,5 @@ function loadUpgrades(){ - if (localStorage.getItem('items')!=null){ + /*if (localStorage.getItem('items')!=null){ items = JSON.parse(localStorage.getItem('items')); prog.max = 1000*items.pres; } @@ -29,14 +29,14 @@ function loadUpgrades(){ presBT1.innerHTML = `1 Ticket for ${fornum(2000)} Lemons`; ItsTime.innerHTML = `Let's do this!`; if(items.pres > 1) got.innerHTML = `You have ${items.pres-1} Prestige points`; - } + }*/ } // UploadUpgrades -function uploadUpgrades(){update();loadUpgrades();} +//function uploadUpgrades(){update();loadUpgrades();} /* U P G R A D E S */ - +/* function buyMcc(){ alert("Doesn't work"); return 0; @@ -176,4 +176,4 @@ function TheThing(){ toClick(); } } -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/txt/add.txt b/txt/add.txt index be440d1..da77024 100644 --- a/txt/add.txt +++ b/txt/add.txt @@ -23,6 +23,7 @@ max 5 hour 1 pig = 135 000 c/s = 7 624 300 | 2 frog + 5 racc 1 seal = 275 900 c/s = 15 323 600 | 2 pig + 10 foxes +//Removed 1 platypus 1 porcupine 1 hippo @@ -39,30 +40,4 @@ compile to .exe and add it to the play store add complete history of clicks, dogs, cats, lemons, ... -Wiki on a new page - https://wiki.mreidam-brb.com - -BRB = { - items: { - animals: [ - { - name: 'dog', - number: 0, - history: 25, - cost: 100, - make: 1, - upgrade: 1, // min 1 - }, - { - name: 'cat', - number: 5, - history: 6, - cost: 1200, - make: 12, - upgrade: 1, - } - ] - }, - settings :{ - - }, -} \ No newline at end of file +Wiki on a new page - https://wiki.mreidam-brb.com \ No newline at end of file