Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Shareholders = {};
- (function(){
- UltimateLib.Research.addRndResearch({
- id: "c0956353-4012-4983-9576-22e515e14f69",
- name: "National Stock Exchange",
- pointsCost: 1000,
- iconUri: "./mods/Shareholders/images/researches/lab/ResearchIMG.png",
- description: "This will unlock the ability to sell shares on the National Stock Exchange and create extra cash for your upcoming projects",
- canResearch: function () {
- var res = true;
- res &= GameManager.company.flags.rndLabUnlocked;
- return res;
- },
- repeatable: false,
- targetZone: 2,
- complete: function () {
- var research = Research.getAllItems().filter(function (f) { return f.id === 'c0956353-4012-4983-9576-22e515e14f69'; });
- if(research){
- GameManager.company.researchCompleted.push(research);
- var notification = new Notification({
- header: "National Stock Exchange",
- text: "You have now unlocked the ability to sell shares. Click on the screen to go to the National Stock Exchange.",
- image: "",
- buttonText: "OK",
- weeksUntilFired: 0
- });
- GameManager.company.notifications.push(notification);
- // Actions
- }
- else {
- var notification = new Notification({
- header: "UME Error",
- text: "An error occurred on lab research complete callback.",
- image: "",
- buttonText: "OK",
- weeksUntilFired: 0
- });
- GameManager.company.notifications.push(notification);
- }
- }
- })
- var shareValue;
- var shareAmount;
- UI.SellShares = function (a) {
- Sound.click();
- switch (a.id) {
- case "SellShares":
- sharesSell();
- break;
- default:
- return;
- }
- };
- var div = $("body");
- div.append('<div id="NatStockEx" class="windowBorder tallWindow" style="overflow:auto;display:none;"> <div id="toNSE" class="windowTitle smallerWindowTitle">National Stock Exchange</div>');
- div = $("#NatStockEx");
- div.append('<div id="ShareValue" style="text-align:center;margin-left:50px;width: 450px"></div>');
- div.append('<div id="MaxAmountOfShares" style="text-align:center;margin-left:50px;width: 450px"></div>');
- div.append('<div id="AmountOfShares" style="text-align:center;margin-left:50px;width: 450px"></div>');
- div.append('<div class="SAS"></div>');
- div.append('<div id="SellShares" class="selectorButton whiteButton" onclick="UI.SellShares(this)" style="margin-left:50px;width: 450px">Sell shares</div>');
- function valueShares() { // Value of each share
- shareValue = GameManager.company.cash / 500000000 * 20;
- div.find("#ShareValue").html("Value per share: " + shareValue)
- };
- function MaxShares() { // Max amount of shares that can be sold
- var maxAmount = Math.round(GameManager.company.cash / shareValue)
- div.find("#MaxAmountOfShares").html("Maximum amount of shares: " + maxAmount);
- };
- function totalShares(z) {
- var amountOfShares = z;
- div.find("#AmountOfShares").html("Amount of shares selected to sell:" + amountOfShares)
- }
- function sharesSell() {
- shareValue = GameManager.company.cash / 500000000 * 20;
- var s = amountOfShares * shareValue;
- GameManager.company.adjustCash(s, "Shares Sales")
- };
- var OriginalContextMenu = UI.showContextMenu;
- var NewContextMenu = function (b, c, d, h) {
- c.push({
- label: "National Stock Exchange...",
- action: function () {
- Sound.click();
- GameManager.resume(true);
- var div = $("#NatStockEx");
- div.scrollTop()
- div.gdDialog({
- popout: !0,
- close: !0
- })
- //var shareValue = GameManager.company.cash / 500000000 * 20;
- }
- });
- var shareAmount = Math.round(GameManager.company.cash / shareValue);
- var maxValue = math.floor(GameManager.company.cash / (GameManager.company.cash / 500000000 * 20)); // line 107
- div.find(".SAS").slider({
- min: 1,
- max: maxValue,
- range: "min",
- value: Math.floor(shareAmount),
- animate: !1,
- slide: function (a, b) {
- var c = b.value;
- totalShares(c);
- }
- });
- totalShares(shareAmount);
- OriginalContextMenu(b, c, d, h);
- };
- UI.showContextMenu = NewContextMenu;
- })();
Advertisement
Add Comment
Please, Sign In to add comment