MediaWiki:Gadget-crob.js

From RuneRealm Wiki

This is the current revision of this page, as edited by Alex (talk | contribs) at 12:06, 20 October 2024. The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

After saving, you may need to bypass your browser's cache to see the changes. For further information, see Wikipedia:Bypass your cache.

  • In most Windows and Linux browsers: Hold down Ctrl and press F5.
  • In Safari: Hold down ⇧ Shift and click the Reload button.
  • In Chrome and Firefox for Mac: Hold down both ⌘ Cmd+⇧ Shift and press R.
"use strict";

$(function () {
  if (mw.config.get('wgNamespaceNumber') != 0 && mw.config.get('wgNamespaceNumber') != 116 || mw.config.get('wgAction') != 'view') {
    return;
  }
  var data = {
    "Optimal quest guide": {
      "initial": "Getting tired of doing quests? Click me for some help.",
      "options": ["Sure", "No thanks."],
      "response": ["Sorry, I changed my mind. Do them yourself.", "Why, are you playing Ironman Mode?"]
    },
    "Quests/List": {
      "initial": "Getting tired of doing quests? Click me for some help.",
      "options": ["Sure", "No thanks."],
      "response": ["Sorry, I changed my mind. Do them yourself.", "Why, are you playing Ironman Mode?"]
    },
    "Quest experience rewards": {
      "initial": "Getting tired of doing quests? Click me for some help.",
      "options": ["Sure", "No thanks."],
      "response": ["Sorry, I changed my mind. Do them yourself.", "Why, are you playing Ironman Mode?"]
    },
    "Achievement Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train Runecraft?"]
    },
    "Ardougne Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Magic?"]
    },
    "Desert Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Thieving?"]
    },
    "Falador Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to get a skillcape?"]
    },
    "Fremennik Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train Runecraft?"]
    },
    "Kandarin Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Smithing?"]
    },
    "Karamja Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Runecraft?"]
    },
    "Kourend & Kebos Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Slayer?"]
    },
    "Lumbridge & Draynor Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to get a quest cape?"]
    },
    "Morytania Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Fishing?"]
    },
    "Varrock Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Cooking?"]
    },
    "Western Provinces Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["Not 'really badly'? Should've chosen that one, noob.", "You SURE you want to train up Slayer?"]
    },
    "Wilderness Diary": {
      "initial": "How badly do you want those diary rewards?",
      "options": ["Badly.", "Really badly."],
      "response": ["You SURE you want to enter the Wilderness? You might lose your spade!", "You must truly be desperate to enter the Wilderness. You have my respect!"]
    },
    "Recipe for Disaster": {
      "initial": "Do you know there's a shortcut to getting Barrows gloves?",
      "options": ["I did not.", "Yes, I do."],
      "response": ["There isn't. Making one would be quite the Recipe for Disaster.", "LIAR! Hacking your account now as we speak."]
    },
    "Money making guide": {
      "initial": "It appears you are looking for a way to make money. Do you want to know an extremely fast way of getting some gold?",
      "options": ["Yes!", "No."],
      "response": ["Me too.", "Wrong answer. Choose 'Yes.' next time and I'll show you."]
    },
    "SKILL_TRAINING": {
      "initial": "It appears you are looking to make some gains. Want some advice?",
      "options": ["Yes!", "No."],
      "response": ["Skill at your own pace. You don't need to be hyper-efficient to have fun!", "Good. I wasn't going to give you any, anyway."]
    },
    "Varlamore": {
      "initial": "Welcome to Varlamore! Or the page for it, anyway. Will you read all the lore on this page?",
      "options": ["Yes, I love lore!", "No, I don't think I will."],
      "response": [":D! Me too! Varlamore is full of Varla-LORE!", "How rude! I hope your next few Colosseum runs gives you the WORST handicaps!"]
    },
    "Fortis Colosseum": {
      "initial": "Here to get Dizana's quiver?",
      "options": ["Yes. I'm having a hard time, though...", "No, I'm just farming splinters on wave 1."],
      "response": ["A pro tip is to take the Doom handicap. It's basically free; just don't take damage!", "Can't fault you for that, they're selling like hotcakes!"]
    },
    "Perilous Moons": {
      "initial": "Did you mean to look for the boss page, the Moons of Peril?",
      "options": ["Yes.", "No."],
      "response": ["Its ok, its not your fault! Its Jagex's for making the names quite similar.", "You don't have to lie my friend, I'm just a crab."]
    },
    "Moons of Peril": {
      "initial": "Did you come from the Perilous Moons page?",
      "options": ["Yes.", "No."],
      "response": ["Its ok, its not your fault! Its Jagex's for making the names quite similar.", "You don't have to lie my friend, I'm just a crab."]
    },
    "Sol Heredit": {
      "initial": "Pretty sly of you to look up how to fight ol' Sol here.",
      "options": [],
      "response": []
    },
    "Hunters' Rumours": {
      "initial": "Are you having fun doing Hunters' Rumours?",
      "options": ["Yes, I'm having a great time!", "No, leave me alone you stupid crab."],
      "response": ["Good! Its important to have fun, even if some of the rumours aren't the best.", "How rude of you! I hope your next rare creature part is as dry as the Kharidian Desert."]
    },
    "Lunar Chest": {
      "initial": "Sorry, looking at this page isn't going to boost your chances at a unique. Keep at it!",
      "options": [],
      "response": []
    },
    "Dizana's quiver": {
      "initial": "Why are you looking at this page when you haven't even beaten the Colosseum yet? Get back there before I tell my buddy Sol to give you the worst handicaps!",
      "options": ["Nice try, but I own the quiver already.", "Ok I'm sorry, please bless me with good handicaps."],
      "response": ["Yes, but I can see you haven't blessed it yet. Back in you go!", "I'll put in a good word for you with ol' Sol."]
    },
    "Tumeken's shadow": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Scythe of vitur": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Twisted bow": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Elysian sigil": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Elysian spirit shield": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Eldritch orb": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Eldritch nightmare staff": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Torva armour": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Torva full helm": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Torva platebody": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Torva platelegs": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Zaryte crossbow": {
      "initial": "HEY! You're too poor to buy this item. Go somewhere else.",
      "options": [],
      "response": []
    },
    "Jagex Moderator": {
      "initial": "🦀jmods wont reply<br/>to this crab🦀",
      "options": [],
      "response": []
    },
    "RANDOM1": {
      "initial": "The wiki is so crabtivating, don't you think?",
      "options": [],
      "response": []
    },
    "RANDOM2": {
      "initial": "Hey, you do like me, right?",
      "options": ["I love you, Crabby.", "Honestly? Not really. You're kind of annoying."],
      "response": ["I... I love you too. This is the happiest day of my life.", "Oh.. forget I said anything."]
    },
    "RANDOM3": {
      "initial": "Contrary to popular belief, I rarely get crabby.",
      "options": [],
      "response": []
    },
    "RANDOM4": {
      "initial": "I'm a crabbo but don't worry, I won't stabbo.",
      "options": [],
      "response": []
    },
    "RANDOM5": {
      "initial": "*Crabby is too busy raving to pay attention to you*",
      "options": [],
      "response": []
    },
    "RANDOM6": {
      "initial": "Have you heard about the latest game update? It's called updog.",
      "options": ["Yeah", "What's updog?"],
      "response": ["Really? Amazing, because I'm the Wiki Assistant and according to my database it doesn't exist.", "Not much, what about you? Also, I'm a crab, but I realise it's easy to get the 2 species confused."]
    },
    "RANDOM7": {
      "initial": "Does this page look good?",
      "options": ["Yeah!", "Naw."],
      "response": ["Yay! That means we're doing our job.", "Click 'Edit' up top there to make it better then!"]
    },
    "RuneRealm Wiki": {
      "initial": "Hi! I'm Crabby, your wiki assistant. Do you need a hand?",
      "options": ["Yes", "No"],
      "response": ["Unfortunately I can't help you there, as I only have claws.", "Crabrific! Enjoy your stay; I'll be here, watching."]
    },
    "Crab": {
      "initial": "Yikes, these guys need to go see a good plastic surgeon.",
      "options": [],
      "response": []
    },
    "Crab (Prifddinas)": {
      "initial": "That guy right there looks awfully intimidating, doesn't he?",
      "options": ["Yes, he's veRy intimidating!", "I'm not that impressed."],
      "response": ["He's no match for me though!", '<img src="/w/Special:Filepath/File:Crob.gif" width="125px" />']
    },
    "Crab helmet": {
      "initial": "You didn't actually mean to search this, right?",
      "options": ["Of course I did, I need to protect my head, whatever the cost.", "No, of course not! Pure accident."],
      "response": ["The amount of my friends that have been killed for this! How could you! *cries in crab*", "Phew. I always knew you were a true friend."]
    },
    "Fresh crab shell": {
      "initial": "You didn't actually mean to search this, right?",
      "options": ["Of course I did, I need to protect my head, whatever the cost.", "No, of course not! Pure accident."],
      "response": ["The amount of my friends that have been killed for this! How could you! *cries in crab*", "Phew. I always knew you were a true friend."]
    },
    "Raw dark crab": {
      "initial": "You didn't actually mean to search this, right?",
      "options": ["Of course I did - I LOVE dark crabs.", "No, of course not! Pure accident."],
      "response": ["You sick ****!", "Phew. I always knew you were a true friend."]
    },
    "Dark crab": {
      "initial": "You didn't actually mean to search this, right?",
      "options": ["Of course I did - I LOVE dark crabs.", "No, of course not! Pure accident."],
      "response": ["You sick ****!", "Phew. I always knew you were a true friend."]
    },
    "Crab meat": {
      "initial": "You didn't actually mean to search this, right?",
      "options": ["Of course I did - crab is my favourite food.", "No, of course not! Pure accident."],
      "response": ["You heartless monster.", "Phew. I always knew you were a true friend."]
    },
    "Cooked crab meat": {
      "initial": "This is not what I envisioned crab heaven to be like.",
      "options": [],
      "response": []
    },
    "Ground crab meat": {
      "initial": "You didn't actually mean to search this, right?",
      "options": ["Of course I did - crab is my favourite food.", "No, of course not! Pure accident."],
      "response": ["You heartless monster.", "Phew. I always knew you were a true friend."]
    },
    "Fresh crab claw": {
      "initial": "You didn't actually mean to search this, right?",
      "options": ["Of course I did - crab is my favourite food.", "No, of course not! Pure accident."],
      "response": ["You heartless monster.", "Phew. I always knew you were a true friend."]
    },
    "Rock Crab": {
      "initial": "What's a crab's favourite genre of music?",
      "options": ["I don't know, what?"],
      "response": ["Rock! Duh."]
    },
    "CALCULATORS": {
      "initial": "It looks like you want to calculate things. Can't you do these formulas in your head? ",
      "options": ["Yes", "No"],
      "response": ["Really? I smell a liar.", "Try and work your brain a bit harder and you might be able to."]
    },
    "Player Moderator": {
      "initial": "Hello! I have checked your account and have seen maturity. I would like to offer you the once-in-a-lifetime chance to be a crab moderator.",
      "options": ["Wow! Yes please!", "No thanks."],
      "response": ["Oops, sorry, you responded too late. This offer has now expired.", "Fine! I'll find someone else to sca- uh, HELP."]
    },
    "Weird gloop": {
      "initial": "You may think this is a useless item, but I can assure you that gloop is very important to a crab's wellbeing!",
      "options": [],
      "response": []
    },
    "TREASURE_TRAILS": {
      "initial": "Treasure Trails look so fun! I wish I could try them, but unfortunately I can't do those fiddly puzzle boxes with these pincers.",
      "options": [],
      "response": []
    },
    "MUSIC": {
      "initial": "Did you mean: Crab Rave [EXTREME BASS BOOST]?",
      "options": [],
      "response": []
    },
    "Ratcatchers": {
      "initial": "Is Ratcatchers your favorite quest?",
      "options": ["Yes, of course! ~Aside~ Hopefully Crabby can't tell I'm lying.", "No, this quest is terrible!"],
      "response": ["~Crabby dazzles you with another one of its trademark smiles.~", "Oh, that's okay! ~Crabby flashes you an unconvincing smile.~"]
    },
    "Money making guide/Catching dark crabs": {
      "initial": "Don't even think about it.",
      "options": ["What?"],
      "response": ["You heard me."]
    },
    "Rotten potato": {
      "initial": "You some sorta cop?",
      "options": [],
      "response": []
    },
    "Sea Shanty 2": {
      "initial": "🔥🔥🔥",
      "options": [],
      "response": []
    },
    "Gadget-crob.js": {
      "initial": "What do you think you're doing? Get out!",
      "options": [],
      "response": []
    }
  };
  var pagename = mw.config.get('wgTitle');
  var namespace = mw.config.get('wgCanonicalNamespace');
  var categories = mw.config.get('wgCategories');
  var conversation = null;
  if (data[pagename] !== undefined) {
    conversation = data[pagename];
  } else if (pagename.startsWith("Money making")) {
    conversation = data["MONEY_MAKING"];
  } else if (pagename.startsWith("Treasure Trails")) {
    conversation = data["TREASURE_TRAILS"];
  } else if (namespace.startsWith("Calculator")) {
    conversation = data["CALCULATORS"];
  } else if (categories.indexOf("Training guides") > -1) {
    conversation = data["SKILL_TRAINING"];
  } else if (categories.indexOf("Music") > -1) {
    conversation = data["MUSIC"];
  } else {
    var key = "RANDOM" + (Math.floor(Math.random() * 7) + 1);
    conversation = data[key];
  }
  var $div = $('<div id="crob"><div id="crob-speech"><div id="crob-speech-text"></div></div><div id="crob-speech-arrow"></div><div id="crob-img"></div></div>');
  var $buttons = $('<div id="crob-speech-buttons"></div>');
  var $button = $('<button class="crob-button">No</button>');
  console.log(conversation.initial);
  $('#firstHeading').after($div);
  $("#crob-speech-text").html(conversation.initial);
  if (conversation.options.length > 0) {
    $("#crob-speech-text").after($buttons);
  }
  var onClick = function onClick(event) {
    $("#crob-speech-text").html($(event.target).attr('data-response'));
    $("#crob-speech-buttons").remove();
  };
  for (var i = 0; i < conversation.options.length; i++) {
    var butt = $button.clone();
    butt.text(conversation.options[i]);
    butt.attr("data-response", conversation.response[i]);
    butt.click(onClick);
    $("#crob-speech-buttons").append(butt);
  }
});