Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //===========================================================================================
  2. //WikiCookies
  3. //===========================================================================================
  4.  
  5. addCookieRes = function(){
  6.     var cookie = {//res
  7.         name: "cookie",
  8.         title: "WikiCookie",
  9.         type: "rare",
  10.         visible: true,
  11.         calculatePerTick: false,
  12.         aiCanDestroy: false,
  13.         craftable: false,
  14.         transient: true,
  15.         persists: true,
  16.         value: 1,
  17.         unlocked: true,
  18.         refundable: false
  19.     };
  20.     gamePage.resPool.resources.push(cookie);
  21.     gamePage.resPool.resourceMap["cookie"] = cookie;
  22.     gamePage.console.filters["cookie"] = {//console
  23.         title: "WikiCookies",
  24.         enabled: true,
  25.         unlocked: false
  26.     };
  27.     for(var i in gamePage.bld.buildingGroups)//buildings
  28.         if(gamePage.bld.buildingGroups[i].name == "other")
  29.             gamePage.bld.buildingGroups[i].buildings.push("chatroom");
  30.     gamePage.bld.buildingsData.push({
  31.         name: "chatroom",
  32.         label: "IRC Catroom",
  33.         description: "Allowing kittens to talk to each other using the Internet Relay Cat",
  34.         unlockRatio: 0.3,
  35.         unlockable: true,
  36.         prices: [
  37.             {name: "cookie", val: 1}
  38.         ],
  39.         priceRatio: 1.15,
  40.         on: 0,
  41.         val: 0,
  42.         effects: { },
  43.         earnCookie: function(amt = 1, cookiename = ""){
  44.             gamePage.resPool.get("cookie").unlocked=true;
  45.             gamePage.resPool.addResEvent("cookie",amt);
  46.             var earn = " earned ";
  47.             if(amt < 0){
  48.                 earn = " lost ";
  49.                 amt = Math.abs(amt);
  50.             }
  51.             if(cookiename != ""){
  52.                 if(amt == 1)
  53.                     gamePage.msg("You" + earn + "one " + cookiename + "!","","cookie");
  54.                 else
  55.                     gamePage.msg("You" + earn + amt + " " + cookiename + "s!","","cookie");
  56.             }
  57.             else{
  58.                 if(amt == 1)
  59.                     gamePage.msg("You" + earn + "a WikiCookie!","","cookie");
  60.                 else
  61.                     gamePage.msg("You" + earn + gamePage.getDisplayValueExt(amt) + " WikiCookies!","","cookie");
  62.             }
  63.         },
  64.         action: function(self, game){
  65.             var numDone = Math.random() * 10000;//1/10,000 odds per chatroom per tick
  66.             if(numDone <= self.on){
  67.                 var numCookies = Math.floor(Math.random() * numDone * 2);
  68.                 if(numCookies > self.on)
  69.                     numCookies = self.on;
  70.                 if(numCookies == 0){
  71.                     var numLost = Math.floor(-1 * Math.random() * numDone + .5);
  72.                 }
  73.                 if(numCookies != 0)
  74.                     self.earnCookie(numCookies);
  75.             }
  76.         },
  77.         flavor: "Trout? My favorite!"
  78.     });
  79. }
  80.  
  81. addCookieRes();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement