Loading

Paste #pikaktc2j

  1. class CompanyValue extends GSController
  2. {
  3.   function Start()
  4.   function Save()
  5.   function Load(version, data);
  6. }
  7.  
  8. function CompanyValue::Save()
  9. {
  10.   return{}
  11. }
  12.  
  13. function CompanyValue::Load(version, data)
  14. {
  15. }
  16.  
  17. function CompanyValue::Start()
  18. {
  19.  if (GSGoal.IsValidGoal(0)) GSGoal.Remove(0)
  20.  local goalid = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_CV, GSController.GetSetting("value")), GSGoal.GT_NONE, 0)
  21.  if (GSCompany.ResolveCompanyID(0) != GSCompany.COMPANY_INVALID) local goalcid0 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 0, GSCompany.GetQuarterlyCompanyValue(0, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  22.  if (GSCompany.ResolveCompanyID(1) != GSCompany.COMPANY_INVALID) local goalcid1 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 1, GSCompany.GetQuarterlyCompanyValue(1, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  23.  if (GSCompany.ResolveCompanyID(2) != GSCompany.COMPANY_INVALID) local goalcid2 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 2, GSCompany.GetQuarterlyCompanyValue(2, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  24.  if (GSCompany.ResolveCompanyID(3) != GSCompany.COMPANY_INVALID) local goalcid3 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 3, GSCompany.GetQuarterlyCompanyValue(3, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  25.  if (GSCompany.ResolveCompanyID(4) != GSCompany.COMPANY_INVALID) local goalcid4 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 4, GSCompany.GetQuarterlyCompanyValue(4, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  26.  if (GSCompany.ResolveCompanyID(5) != GSCompany.COMPANY_INVALID) local goalcid5 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 5, GSCompany.GetQuarterlyCompanyValue(5, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  27.  if (GSCompany.ResolveCompanyID(6) != GSCompany.COMPANY_INVALID) local goalcid6 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 6, GSCompany.GetQuarterlyCompanyValue(6, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  28.  if (GSCompany.ResolveCompanyID(7) != GSCompany.COMPANY_INVALID) local goalcid7 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 7, GSCompany.GetQuarterlyCompanyValue(7, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  29.  if (GSCompany.ResolveCompanyID(8) != GSCompany.COMPANY_INVALID) local goalcid8 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 8, GSCompany.GetQuarterlyCompanyValue(8, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  30.  if (GSCompany.ResolveCompanyID(9) != GSCompany.COMPANY_INVALID) local goalcid9 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 9, GSCompany.GetQuarterlyCompanyValue(9, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  31.  if (GSCompany.ResolveCompanyID(10) != GSCompany.COMPANY_INVALID) local goalcid10 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 10, GSCompany.GetQuarterlyCompanyValue(10, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  32.  if (GSCompany.ResolveCompanyID(11) != GSCompany.COMPANY_INVALID) local goalcid11 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 11, GSCompany.GetQuarterlyCompanyValue(11, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  33.  if (GSCompany.ResolveCompanyID(12) != GSCompany.COMPANY_INVALID) local goalcid12 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 12, GSCompany.GetQuarterlyCompanyValue(12, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  34.  if (GSCompany.ResolveCompanyID(13) != GSCompany.COMPANY_INVALID) local goalcid13 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 13, GSCompany.GetQuarterlyCompanyValue(13, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  35.  if (GSCompany.ResolveCompanyID(14) != GSCompany.COMPANY_INVALID) local goalcid14 = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_VALUE, 14, GSCompany.GetQuarterlyCompanyValue(14, GSCompany.CURRENT_QUARTER)), GSGoal.GT_NONE, 0)
  36.  local goal_reached = false
  37.   while (true) {
  38.    while (goal_reached == false) {
  39.     local goal = GSController.GetSetting("value")
  40.     local date = GSDate.GetCurrentDate()
  41.     GSGoal.SetText(goalid, GSText(GSText.STR_GOAL_CV, goal))
  42.     GSLog.Warning("Current Date: " + GSDate.GetYear(date) + "-" + GSDate.GetMonth(date) + "-" + GSDate.GetDayOfMonth(date) + " ; Goal: £" + goal)
  43.     local cid = 0
  44.     local best_cv = 0
  45.     while (cid != 15) {
  46.      local cv = GSCompany.GetQuarterlyCompanyValue(cid, GSCompany.CURRENT_QUARTER)
  47.      if (cv > best_cv) best_cv = cv
  48.      if (GSCompany.ResolveCompanyID(cid) != GSCompany.COMPANY_INVALID) {
  49.       local c_name = GSCompany.GetName(cid)
  50.       local string = GSText(GSText.STR_GOAL_VALUE, cid, cv)
  51.       if (cid == 0) GSGoal.SetText(goalcid0, string, GSGoal.GT_NONE, cid)
  52.       if (cid == 1) GSGoal.SetText(goalcid1, string, GSGoal.GT_NONE, cid)
  53.       if (cid == 2) GSGoal.SetText(goalcid2, string, GSGoal.GT_NONE, cid)
  54.       if (cid == 3) GSGoal.SetText(goalcid3, string, GSGoal.GT_NONE, cid)
  55.       if (cid == 4) GSGoal.SetText(goalcid4, string, GSGoal.GT_NONE, cid)
  56.       if (cid == 5) GSGoal.SetText(goalcid5, string, GSGoal.GT_NONE, cid)
  57.       if (cid == 6) GSGoal.SetText(goalcid6, string, GSGoal.GT_NONE, cid)
  58.       if (cid == 7) GSGoal.SetText(goalcid7, string, GSGoal.GT_NONE, cid)
  59.       if (cid == 8) GSGoal.SetText(goalcid8, string, GSGoal.GT_NONE, cid)
  60.       if (cid == 9) GSGoal.SetText(goalcid9, string, GSGoal.GT_NONE, cid)
  61.       if (cid == 10) GSGoal.SetText(goalcid10, string, GSGoal.GT_NONE, cid)
  62.       if (cid == 11) GSGoal.SetText(goalcid11, string, GSGoal.GT_NONE, cid)
  63.       if (cid == 12) GSGoal.SetText(goalcid12, string, GSGoal.GT_NONE, cid)
  64.       if (cid == 13) GSGoal.SetText(goalcid13, string, GSGoal.GT_NONE, cid)
  65.       if (cid == 14) GSGoal.SetText(goalcid14, string, GSGoal.GT_NONE, cid)
  66.       }
  67.      cid = cid + 1
  68.      GSLog.Info("Company " + cid + ": £" + cv)
  69.      if (cv >= goal) {
  70.       GSLog.Warning("Company " + cid + " has reached the company value goal of £" + goal)
  71.       GSGame.Pause()
  72.       goal_reached = true
  73.       break
  74.      }
  75.      local progress = (best_cv * 100) / goal
  76.      if (progress > 100) progress = 100
  77.      GSGoal.SetProgress(goalid, GSText(GSText.STR_GOAL_PROGRESS, progress))
  78.     }
  79.     GSLog.Warning(" ")
  80.     this.Sleep(74)
  81.    }
  82.    this.Sleep(500)
  83.   }
  84. }

Comments