Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var d = GDT.getDataStore("FSMPASTRACT").data
- d.YPA = []; // create array
- var a = function() {
- var b = GameManager.company.getDate(GameManager.company.currentWeek)
- if (b.week == 1 && b.month == 1) { // this block of code should run once a year (on M1 W1)
- d.YPA.push(parseInt(GameManager.company.cash)); // add current cash to the array
- if (d.YPA.length >= 2) { // check if the array contains 2 or more items
- d.YP = parseInt(d.YPA[d.YPA.length - 1]) - parseInt(d.YPA[d.YPA.length - 2]); // YP is the difference between the latest addition to the array and the one before that (= profit in a year)
- if (d.ASS > 0 && d.YP > 0) { // if amount of shares sold and yearly profit is higher than 0
- GameManager.company.adjustCash(-d.YP * 0.2, "a"); // subtract 20% of the yearly profit from current cash
- }
- }
- }
- }
- GDT.on(GDT.eventKeys.gameplay.weekProceeded, a); // check every week to see if it's M1 W1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement