class CompanyValue extends GSController
{
function Start()
function Save()
function Load(version, data);
}
function CompanyValue::Save()
{
return{}
}
function CompanyValue::Load(version, data)
{
}
function CompanyValue::Start()
{
if (GSGoal.IsValidGoal(0)) GSGoal.Remove(0)
local goalid = GSGoal.New(GSCompany.COMPANY_INVALID, GSText(GSText.STR_GOAL_CV, GSController.GetSetting("value")), GSGoal.GT_NONE, 0)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
local goal_reached = false
while (true) {
while (goal_reached == false) {
local goal = GSController.GetSetting("value")
local date = GSDate.GetCurrentDate()
GSGoal.SetText(goalid, GSText(GSText.STR_GOAL_CV, goal))
GSLog.Warning("Current Date: " + GSDate.GetYear(date) + "-" + GSDate.GetMonth(date) + "-" + GSDate.GetDayOfMonth(date) + " ; Goal: £" + goal)
local cid = 0
local best_cv = 0
while (cid != 15) {
local cv = GSCompany.GetQuarterlyCompanyValue(cid, GSCompany.CURRENT_QUARTER)
if (cv > best_cv) best_cv = cv
if (GSCompany.ResolveCompanyID(cid) != GSCompany.COMPANY_INVALID) {
local c_name = GSCompany.GetName(cid)
local string = GSText(GSText.STR_GOAL_VALUE, cid, cv)
if (cid == 0) GSGoal.SetText(goalcid0, string, GSGoal.GT_NONE, cid)
if (cid == 1) GSGoal.SetText(goalcid1, string, GSGoal.GT_NONE, cid)
if (cid == 2) GSGoal.SetText(goalcid2, string, GSGoal.GT_NONE, cid)
if (cid == 3) GSGoal.SetText(goalcid3, string, GSGoal.GT_NONE, cid)
if (cid == 4) GSGoal.SetText(goalcid4, string, GSGoal.GT_NONE, cid)
if (cid == 5) GSGoal.SetText(goalcid5, string, GSGoal.GT_NONE, cid)
if (cid == 6) GSGoal.SetText(goalcid6, string, GSGoal.GT_NONE, cid)
if (cid == 7) GSGoal.SetText(goalcid7, string, GSGoal.GT_NONE, cid)
if (cid == 8) GSGoal.SetText(goalcid8, string, GSGoal.GT_NONE, cid)
if (cid == 9) GSGoal.SetText(goalcid9, string, GSGoal.GT_NONE, cid)
if (cid == 10) GSGoal.SetText(goalcid10, string, GSGoal.GT_NONE, cid)
if (cid == 11) GSGoal.SetText(goalcid11, string, GSGoal.GT_NONE, cid)
if (cid == 12) GSGoal.SetText(goalcid12, string, GSGoal.GT_NONE, cid)
if (cid == 13) GSGoal.SetText(goalcid13, string, GSGoal.GT_NONE, cid)
if (cid == 14) GSGoal.SetText(goalcid14, string, GSGoal.GT_NONE, cid)
}
cid = cid + 1
GSLog.Info("Company " + cid + ": £" + cv)
if (cv >= goal) {
GSLog.Warning("Company " + cid + " has reached the company value goal of £" + goal)
GSGame.Pause()
goal_reached = true
break
}
local progress = (best_cv * 100) / goal
if (progress > 100) progress = 100
GSGoal.SetProgress(goalid, GSText(GSText.STR_GOAL_PROGRESS, progress))
}
GSLog.Warning(" ")
this.Sleep(74)
}
this.Sleep(500)
}
}