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 190 191
| Public Class Form1
Dim destination As String
Dim selection As String
Dim ajoutattaque As String
Dim ajoutdéfense As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
selection = ListBox1.SelectedItem
'Pour le beug d'affichage
If selection = Nothing Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\nothing.txt")
End If
'Le fichier à lire pour tous les objets
If selection = ("Collier d'ours") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\collierdours.txt")
End If
If selection = ("Cape du mage Tanzou") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cape du mage tanzou.txt")
End If
If selection = ("Capuchon du mage Tanzou") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\capuchon du mage tanzou.txt")
End If
If selection = ("Batte de tanball du mage Tanzou") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\batte de tanball du mage tanzou.txt")
End If
If selection = ("Cuirasse du mage Tanzou") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse du mage tanzou.txt")
End If
If selection = ("Chapeau parasol") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\chapeau parasol.txt")
End If
If selection = ("Cape de l'aventurier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cape de l'aventurier.txt")
End If
If selection = ("Cuirasse en cuir de cochon") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse en cuir de cochon.txt")
End If
If selection = ("Cuirasse en cuir de sanglier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse en cuir de sanglier.txt")
End If
If selection = ("Heaume du chevalier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\heaume du chevalier.txt")
End If
If selection = ("Bouclier d'Irthanne") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\bouclier d'irthanne.txt")
End If
If selection = ("Troublon de nain") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\troublon de nain.txt")
End If
If selection = ("Epée d'aventurier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\épée d'aventurier.txt")
End If
If selection = ("Arc Sylvain") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\arc sylvain.txt")
End If
If selection = ("Cuirasse de Kaslocks") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse de kaslocks.txt")
End If
If selection = ("Chapeau de l'aventurier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\chapeau de l'aventurier.txt")
End If
If selection = ("Bonnet de laine blindé") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\bonnet de laine blindé.txt")
End If
'Le système de lecture des fichiers (c'est la racine du code). NE SURTOUT PAS TOUCHER
Dim stream As New System.IO.StreamReader(destination, _
System.Text.Encoding.Default, False, 512)
Dim description = stream.ReadLine
Label1.Text = description
Dim effet = stream.ReadLine
Label2.Text = effet
Dim prix = stream.ReadLine
Label3.Text = prix
Dim emplacement = stream.ReadLine
Label4.Text = emplacement
stream.Close()
'FIN DE L'INTERDICTION DE TOUCHER
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Return
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim argent As New System.IO.StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\stats\argent.txt")
Dim money = argent.ReadLine
argent.Close()
'Ajout des effets au personnage.
If selection = ("Collier d'ours") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\collierdours.txt")
End If
If selection = ("Cape du mage Tanzou") Then
End If
If selection = ("Capuchon du mage Tanzou") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\capuchon du mage tanzou.txt")
End If
If selection = ("Batte de tanball du mage Tanzou") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\batte de tanball du mage tanzou.txt")
End If
If selection = ("Cuirasse du mage Tanzou") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse du mage tanzou.txt")
End If
If selection = ("Chapeau parasol") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\chapeau parasol.txt")
End If
If selection = ("Cape de l'aventurier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cape de l'aventurier.txt")
End If
If selection = ("Cuirasse en cuir de cochon") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse en cuir de cochon.txt")
End If
If selection = ("Cuirasse en cuir de sanglier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse en cuir de sanglier.txt")
End If
If selection = ("Heaume du chevalier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\heaume du chevalier.txt")
End If
If selection = ("Bouclier d'Irthanne") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\bouclier d'irthanne.txt")
End If
If selection = ("Troublon de nain") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\troublon de nain.txt")
End If
If selection = ("Epée d'aventurier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\épée d'aventurier.txt")
End If
If selection = ("Arc Sylvain") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\arc sylvain.txt")
End If
If selection = ("Cuirasse de Kaslocks") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cuirasse de kaslocks.txt")
End If
If selection = ("Chapeau de l'aventurier") Then
destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\chapeau de l'aventurier.txt")
End If
If selection = ("Bonnet de laine blindé") Then
If money >= Label3.Text Then
ajoutattaque = (+0)
ajoutdéfense = (+30)
End If
End If
'Déclaration des variables de changement des effets.
'Déclaration pour la défense.
Dim filedéfense = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\effet\defense.txt")
Dim linedéfense As String = ""
Try
'Lecture de la premiere ligne du fichier
Dim srdéfense As New System.IO.StreamReader(filedéfense)
linedéfense = srdéfense.ReadLine
srdéfense.Close()
Kill(filedéfense)
If IsNumeric(linedéfense.Trim) AndAlso Integer.Parse(linedéfense.Trim) Then
linedéfense = (Integer.Parse(linedéfense.Trim) + ajoutdéfense).ToString
End If
'Reecriture du fichier
Dim swdéfense As New System.IO.StreamWriter(filedéfense)
swdéfense.WriteLine(linedéfense)
swdéfense.Close()
Catch ex As Exception
MsgBox("Une erreur est survenue, veuillez réessayer l'action souhaitée. Si le problème persiste, veuillez informer OdekProduction")
End Try
'Déclaration pour l'attaque.
Dim fileattaque = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\effet\attaque.txt")
Dim lineattaque As String = ""
Try
'Lecture de la premiere ligne du fichier
Dim srattaque As New System.IO.StreamReader(fileattaque)
lineattaque = srattaque.ReadLine
srattaque.Close()
Kill(fileattaque)
If IsNumeric(lineattaque.Trim) AndAlso Integer.Parse(lineattaque.Trim) Then
lineattaque = (Integer.Parse(lineattaque.Trim) + ajoutattaque).ToString
End If
'Reecriture du fichier
Dim swattaque As New System.IO.StreamWriter(fileattaque)
swattaque.WriteLine(lineattaque)
swattaque.Close()
Catch ex As Exception
MsgBox("Une erreur est survenue, veuillez réessayer l'action souhaitée. Si le problème persiste, veuillez informer OdekProduction")
End Try
End Sub |
Partager