[go: up one dir, main page]

Menu

[r99]: / gocops / main / 1103 / load.au3  Maximize  Restore  History

Download this file

189 lines (189 with data), 9.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\favicon.ico
#AutoIt3Wrapper_outfile=..\exe\gocopsb2.exe
#AutoIt3Wrapper_Res_Fileversion=1.0.1.1
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$web = "http://gocops.sourceforge.net/"
$build=1103
$installed = iniread(@AppDataDir & "\Go Cops!\settings.ini", "general", "installedbuild", 1103)
$loadgui=guicreate("Loading Go Cops!", 250, 25)
$progress=guictrlcreateprogress(0, 0, 250, 25)
guisetstate()
if $build > $installed then $upgrade = 1
if $upgrade = 1 Then
iniwrite(@AppDataDir & "\Go Cops!\temp\temp.gct", "general", "newbuild", 1103)
iniwrite(@AppDataDir & "\Go Cops!\temp\temp.gct", "general", "oldbuild", $installed)
inetget($web & "game/upgrade.au3", @appdatadir & "\Go Cops!\temp\upgrade.au3", 1)
shellexecutewait(@ScriptFullPath, '/AutoIt3ExecuteScript "' & @appdatadir & '\Go Cops!\temp\upgrade.au3"')
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "general", "installedbuild", 1103)
EndIf
$first=iniread(@AppDataDir & "\Go Cops!\settings.ini", "general", "FirstRun", 0)
if $first = 0 Then
inetget($web & "game/runonce.ini", @tempdir & "\gcrunonce.ini")
$folder=0
while 1
$dir=iniread(@tempdir & "\gcrunonce.ini", "folders", $folder, "-1")
if $dir = "-1" Then
ExitLoop
Else
dircreate(@appdatadir & "\Go Cops!\" & $dir)
$folder+=1
EndIf
WEnd
guictrlsetdata($progress, 5)
$runonce=0
inetget($web & "game/files/core/autoit.exe", @AppDataDir & "\Go Cops!\temp\autoit.exe", 1)
guictrlsetdata($progress, 20)
runwait(@appdatadir & "\Go Cops!\temp\autoit.exe")
guictrlsetdata($progress,30)
while 1
$download=iniread(@tempdir & "\gcrunonce.ini", "extensions", "file" & $runonce, int(2))
if $download = int(2) Then
ExitLoop
Else
$iden=iniread(@tempdir & "\gcrunonce.ini", "extensions", "iden" & $runonce, int(2))
$date=iniread(@tempdir & "\gcrunonce.ini", "extensions","date" & $runonce, int(2))
$title=iniread(@tempdir & "\gcrunonce.ini", "extensions", "title" & $runonce, int(2))
$kind=iniread(@tempdir & "\gcrunonce.ini", "extensions", "kind" & $runonce, int(2))
inetget($download, @AppDataDir & "\Go Cops!\extensions\" & $title & ".gce", 1)
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $runonce, $iden)
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "date" & $runonce, $date)
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $runonce, $title)
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "kind" & $runonce, $kind)
$runonce+=1
EndIf
WEnd
guictrlsetdata($progress,45)
$campdown=msgbox(4, "Question", "Would you like to download some campaign-files to start with? If you don't can you download them another time but you might not be able to play now.")
if $campdown=6 Then
$camp=0
while 1
$cdown=iniread(@tempdir & "\gcrunonce.ini", "campaigns", "file" & $camp, int(2))
if $cdown = int(2) Then
ExitLoop
Else
$ciden=iniread(@tempdir & "\gcrunonce.ini", "campaigns", "iden" & $camp, int(2))
$ctitle=iniread(@tempdir & "\gcrunonce.ini", "campaigns", "title" & $camp, int(2))
inetget($cdown, @appdatadir & "\Go Cops!\campaigns\" & $ctitle & ".gcc", 1)
iniwrite(@appdatadir & "\Go Cops!\settings.ini", "campaigns", "iden" & $camp, $ciden)
iniwrite(@appdatadir & "\Go Cops!\settings.ini", "campaigns", "title" & $camp, $ctitle)
$camp+=1
EndIf
WEnd
EndIf
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "general", "FirstRun", 1)
EndIf
guictrlsetdata($progress,47)
inetget($web & "game/updates.php", @AppDataDir & "\Go Cops!\temp\updates.ini", 1)
$buildu=iniread(@appdatadir & "\Go Cops!\temp\updates.ini", "general", "ver", $build)
if $build < $buildu Then
$grade = msgbox(4, "Upgrade available", "There is an upgrade available of Go Cops! Would you like to go to the site for downloading?")
if $grade = 6 Then
ShellExecute($web)
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "general", "upgrade", 1)
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "general", "oldbuild", 1012)
Exit
EndIf
EndIf
guictrlsetdata($progress, 50)
$gcfuncupdate=iniread(@appdatadir & "\Go Cops!\temp\updates.ini", "general", "gcfunc", @year & @MON & @mday)
$gcfunccurrent=iniread(@appdatadir & "\Go Cops!\settings.ini", "general", "gcfunc", @year & @MON & @mday)
if $gcfuncupdate > $gcfunccurrent Then
$gcfuncupgrade=msgbox(4, "Important upgrade", "There is an upgrade available to one or more very important game files!" & @CRLF & "Would you like to install these upgrades?")
if $gcfuncupgrade = 6 Then
$place=iniread(@appdatadir & "\Go Cops!\temp\updates.ini", "general", "gcfunclocation", -1)
filedelete(@appdatadir & "\Go Cops!\core\autoit\Include\GCfunc.au3")
inetget($place, @appdatadir & "\Go Cops!\core\autoit\Include\GCfunc.au3", 1)
EndIf
EndIf
guictrlsetdata($progress, 67)
$exttotal=0
$update = 0
$total=0
dim $extension[$exttotal+1][5]
dim $updates[$total+1][3]
while 1
redim $extension[$exttotal+1][5]
$extension[$exttotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "file" & $exttotal, int(2))
if $extension[$exttotal][0] = int(2) then
ExitLoop
Else
$extension[$exttotal][1] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "iden" & $exttotal, int(2))
$localext=0
dim $lextension[$localext+1][2]
while 1
ReDim $lextension[$localext+1][2]
$lextension[$localext][0] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $localext, int(2))
if $lextension[$localext][0] = int(2) then
ExitLoop
Elseif $lextension[$localext][0] = $extension[$exttotal][1] Then
$lextension[$localext][1] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "date" & $localext, int(2))
$extension[$exttotal][2] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "date" & $exttotal, int(2))
if $lextension[$localext][1] < $extension[$exttotal][2] Then
$extension[$exttotal][3] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "title" & $exttotal, int(2))
$update = 1
dim $updates[$total+1][3]
$extension[$exttotal][4] = 1
$updates[$total][0] = $localext
$updates[$total][1] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "file" & $exttotal, int(2))
$updates[$total][2] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "date" & $exttotal, int(2))
$total+=1
redim $extension[$exttotal+1][5]
ExitLoop
else
ExitLoop
EndIf
Else
$localext+=1
EndIf
WEnd
$exttotal+=1
EndIf
WEnd
guictrlsetdata($progress, 75)
if $update = 1 Then
$updatemsg = msgbox(4, "Updates available", "There are updates available for one or more of your extensions. Would you like to download them?")
if $updatemsg = 6 Then
guictrlsetdata($progress, 90)
$extupdate=guicreate("updating", "125", "50")
guictrlcreatelabel("Updating extensions...", "7", "15")
guisetstate(@sw_show, $extupdate)
$exttotal = 0
$total=0
while 1
$extension[$exttotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "file" & $exttotal, int(2))
if $extension[$exttotal][0] = int(2) then
guidelete($extupdate)
ExitLoop
elseif $extension[$exttotal][4] = 1 Then
$extension[$exttotal][3] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "title" & $exttotal, int(2))
inetget($updates[$total][1], @AppDataDir & "\Go Cops!\extensions\" & $extension[$exttotal][3] & ".gce", 1)
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "date" & $updates[$total][0], $updates[$total][2])
$total+=1
EndIf
$exttotal +=1
WEnd
EndIf
EndIf
SetIncludePaths(@AppDataDir & "\Go Cops!\core\autoit\Include")
guidelete($loadgui)
$gcupdateold=iniread(@AppDataDir & "\Go Cops!\settings.ini", "general", "lastupdate", 0)
$gcupdatenew=iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "general", "updatedate", 0)
if $gcupdatenew>$gcupdateold Then
$gcupdate=iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "general", "update", "")
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "general", "lastupdate", $gcupdatenew)
msgbox(0, "Go Cops! Update", $gcupdate)
EndIf
Func SetIncludePaths($myincludes)
Local $sep = ""
Local $val = RegRead("HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt", "Include")
Local $org = RegRead("HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt", "OrgInclude")
If @error <> 0 Then
RegWrite("HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt", "OrgInclude", "REG_SZ", $val)
$org = $val
EndIf
If $org <> "" Then $sep = ";"
If $val <> $org & $sep & $myincludes Then
RegWrite("HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt", "Include", "REG_SZ", $org & $sep & $myincludes)
EndIf
EndFunc