Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===========================================================================================
- //WikiCookies
- //===========================================================================================
- addCookieRes = function(){
- var cookie = {//res
- name: "cookie",
- title: "WikiCookie",
- type: "rare",
- visible: true,
- calculatePerTick: false,
- aiCanDestroy: false,
- craftable: false,
- transient: true,
- persists: true,
- value: 1,
- unlocked: true,
- refundable: false
- };
- gamePage.resPool.resources.push(cookie);
- gamePage.resPool.resourceMap["cookie"] = cookie;
- gamePage.console.filters["cookie"] = {//console
- title: "WikiCookies",
- enabled: true,
- unlocked: false
- };
- for(var i in gamePage.bld.buildingGroups)//buildings
- if(gamePage.bld.buildingGroups[i].name == "other")
- gamePage.bld.buildingGroups[i].buildings.push("chatroom");
- gamePage.bld.buildingsData.push({
- name: "chatroom",
- label: "IRC Catroom",
- description: "Allowing kittens to talk to each other using the Internet Relay Cat",
- unlockRatio: 0.3,
- unlockable: true,
- prices: [
- {name: "cookie", val: 1}
- ],
- priceRatio: 1.15,
- on: 0,
- val: 0,
- effects: { },
- earnCookie: function(amt = 1, cookiename = ""){
- gamePage.resPool.get("cookie").unlocked=true;
- gamePage.resPool.addResEvent("cookie",amt);
- var earn = " earned ";
- if(amt < 0){
- earn = " lost ";
- amt = Math.abs(amt);
- }
- if(cookiename != ""){
- if(amt == 1)
- gamePage.msg("You" + earn + "one " + cookiename + "!","","cookie");
- else
- gamePage.msg("You" + earn + amt + " " + cookiename + "s!","","cookie");
- }
- else{
- if(amt == 1)
- gamePage.msg("You" + earn + "a WikiCookie!","","cookie");
- else
- gamePage.msg("You" + earn + gamePage.getDisplayValueExt(amt) + " WikiCookies!","","cookie");
- }
- },
- action: function(self, game){
- var numDone = Math.random() * 10000;//1/10,000 odds per chatroom per tick
- if(numDone <= self.on){
- var numCookies = Math.floor(Math.random() * numDone * 2);
- if(numCookies > self.on)
- numCookies = self.on;
- if(numCookies == 0){
- var numLost = Math.floor(-1 * Math.random() * numDone + .5);
- }
- if(numCookies != 0)
- self.earnCookie(numCookies);
- }
- },
- flavor: "Trout? My favorite!"
- });
- }
- addCookieRes();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement