<script runat="server">

Sub Page_Load(sender As Object, e As System.EventArgs)


If Request.Cookies("Reign_Of_Darkness")("Coord").ToString() = "" Then
 Response.Write("<p align='center'><font face='Arial' size='2'><b>C'è stato un problema, non sono stati trovati i Cookie relativi a Reign Of Darkness sul tuo computer. Prova a riloggare.")
 Response.End
End If

If Request.Browser.Type = "Unknown" Then
 Response.Write("<p align='center'><font face='Arial' size='2'><b>C'è stato un problema, Reign Of Darkness non è compatibile con il tuo internet browser. Per questo gioco si consiglia di utilizzare il browser Internet Explorer 6.0")
 Response.End
End If


Dim There_Is_Account = 0

Dim Check_Morale = 0

Dim Initial_Ip

Dim Punti_Fama = 0
Dim Cont_Fama = 0
Dim New_Paese = 0

Var_Livello_Generale = 0

Dim Punti_Fama_Gen = 0

Dim arr_Cookie_Paese = Split((Request.Cookies("Reign_Of_Darkness")("Coord").ToString()),".")
Session("Reign_Of_Darkness_Dimensione") = arr_Cookie_Paese(0)
Session("Reign_Of_Darkness_Reame") = arr_Cookie_Paese(1)
Session("Reign_Of_Darkness_Paese") = arr_Cookie_Paese(2) 


Dim Cookie_ROD_Username = Decripta(Request.Cookies("Reign_Of_Darkness")("Username").ToString())
Dim Cookie_ROD_Password = Decripta(Request.Cookies("Reign_Of_Darkness")("Password").ToString())


Dim Tuo_Paese = 0

sqlConn.Open()
sqlComm = New SqlCommand("SELECT Username, Password, Pianeti.Proprietary, Data_Costr_Eser, Cosa_Costr_Eser, Data_Costr_Res, Cosa_Costr_Res, Pianeti.Id as Id_Paese, Is_Dead, Pianeti.Dimensione, Pianeti.Reame, Pianeti.Paese, Livello, Morale, P_Cittadini, C_Taverna, Data_Last_Access, P_Taglialegna, P_Min_Pietra, P_Min_Ferro, P_Min_Zolfo, P_Min_Oro, P_Fattorie, Tasse, Initial_Ip ,Exp ,Ris_Legna ,Ris_Ferro ,Ris_Pietra ,Ris_Zolfo ,Ris_Oro ,C_Fattorie ,C_TagliaLegna ,C_Min_Ferro ,C_Min_Pietra ,C_Min_Zolfo ,C_Min_Oro ,C_Case ,C_Poligono_Tiro ,C_Scuderia ,C_Centro_Villaggio ,C_Laboratorio ,C_Prigione ,C_Torture ,C_Tesoreria ,C_Mercato ,C_Taverna ,C_Torrette ,C_Mura ,C_Caserma ,R_Add_Cavalli ,R_Filoni_Oro ,R_Armi ,R_Tempr_Ferro ,R_Scudi ,R_Gerarchia ,R_Mura ,R_Guardie ,R_Torrette ,R_Assedio ,R_Esplorazione, R_Velocita ,E_Sold_Semp ,E_Sold_Cavallo ,E_Carovana ,E_Arcieri_Corto ,E_Arcieri_Lungo ,E_Fanteria_Pesante ,E_Balestrieri ,E_Cavalleria_Pesante ,E_Bombardieri ,E_Cannone ,E_Esploratore ,E_Ladro ,E_Generale ,E_Carretto_Piccolo ,E_Carretto_Grande ,E_Petardo ,E_Ballista ,E_Catapulta ,E_Ariete ,E_Trabucco FROM Pianeti JOIN Generali ON Pianeti.Proprietary = Generali.Proprietary JOIN Utenti ON Utenti.Username = Pianeti.Proprietary WHERE Pianeti.Proprietary = '"& Cookie_ROD_Username &"' AND Utenti.Username = '"& Cookie_ROD_Username &"' AND Utenti.Password = '"& Cookie_ROD_Password &"' ORDER BY Pianeti.ID ", sqlConn)
r = sqlComm.ExecuteReader()

While r.Read()



Initial_Ip = r("Initial_Ip")


There_Is_Account = 1


If r("Dimensione") = Session("Reign_Of_Darkness_Dimensione") AND r("Reame") = Session("Reign_Of_Darkness_Reame") AND r("Paese") = Session("Reign_Of_Darkness_Paese") Then


Tuo_Paese = 1


Proprietary  = CStr(r("Proprietary"))

Session("Reign_Of_Darkness_Username") = r("Username")
Session("Reign_Of_Darkness_Password") = r("Password")


Dimensione = Session("Reign_Of_Darkness_Dimensione")
Reame = Session("Reign_Of_Darkness_Reame")
Paese = Session("Reign_Of_Darkness_Paese")


Dragon_Tooth, Utenti.Id as Id_Utente, Last_Id, Ponte_Lev


Pugnale_Dragon_Tooth = r("Dragon_Tooth")

Last_Messaggio = r("Last_Id")
Var_Id_Utente = r("Id_Utente")

Ris_Legna = r("Ris_Legna")
Ris_Ferro = r("Ris_Ferro")
Ris_Zolfo = r("Ris_Zolfo")
Ris_Pietra = r("Ris_Pietra")
Ris_Oro = r("Ris_Oro")

Is_Ponte = r("Ponte_Lev")


If r("Premium_Check") <> "X" AND r("Premium_Check") <> "Y" Then
 Errore_Premium_RLS = "Si"
End If

Dim Durata_Settimana = New System.TimeSpan(7, 0, 0, 0)
Dim Durata_Tre_Mesi = New System.TimeSpan(91, 0, 0, 0)


If (r("Premium_Check") = "X") AND r("Premium_Data").Add(Durata_Tre_Mesi) < Datetime.Now Then
 Errore_Premium_RLS = "Si"
End If

If (r("Premium_Check") = "Y") AND r("Premium_Data").Add(Durata_Settimana) < Datetime.Now Then
 Errore_Premium_RLS = "Si"
End If



Nome_Paese_Upper.Text = "<a href=""rinomina_paese.aspx?id="& Cripta(r("Id_Paese")) &"""><font face=""Arial"" size=""2"" color=""white""><b>"& r("Nome") &" ["& r("Dimensione") &"."& r("Reame") &"."& r("Paese") &"]</a>"











'CHECK CODA SOLDATI
Var_Data_Costr_Eser = r("Data_Costr_Eser")
Cosa_Costr = r("Cosa_Costr_Eser")

Dim Lavoro_CCS = (DateDiff("s",Var_Data_Costr_Eser, DateTime.Now))
Ore = Tempo_Costruzione(Cosa_Costr, "1")

Secondi_Ore(((Minuti * 60) + (Ore * 60 * 60)) - Lavoro_CCS)

If (Ore < 1) AND (Minuti < 1) AND (Secondi < 1) Then
 Is_Costruct_Sold = 1
End If

'FINE CHECK CODA SOLDATI




'CHECK CODA RICERCHE
Var_Data_Costr_Res = r("Data_Costr_Res")
Cosa_Costr_Res = r("Cosa_Costr_Res")

If Cosa_Costr_Res <> "" Then
Dim Level_Res = r(Cosa_Costr_Res)

If CStr(Level_Res) = "" Then
 Level_Res = 1
End If

Lavoro_CCS = (DateDiff("s",Var_Data_Costr_Res, DateTime.Now))
Ore = Tempo_Costruzione(Cosa_Costr_Res, Level_Res)

Secondi_Ore(((Minuti * 60) + (Ore * 60 * 60)) - Lavoro_CCS)

If (Ore < 1) AND (Minuti < 1) AND (Secondi < 1) Then
 Is_Costruct_Res = 1
End If


End If


'FINE CHECK CODA RICERCHE


End If






If Cont_Fama = 0 Then
 Punti_Fama = Punti_Fama + (CInt(r("Exp")) * 10)
End If

Cont_Fama = Cont_Fama + 1


If New_Paese <> r("Id_Paese") Then
New_Paese = r("Id_Paese")

Punti_Fama = Punti_Fama + CInt(r("Ris_Legna")) / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Ferro")) * 3 / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Pietra")) * 2 / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Zolfo")) * 4 / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Oro")) * 5 / 30

Punti_Fama = Punti_Fama + r("C_Fattorie") * 10
Punti_Fama = Punti_Fama + r("C_TagliaLegna") * 15
Punti_Fama = Punti_Fama + r("C_Min_Ferro") * 25
Punti_Fama = Punti_Fama + r("C_Min_Pietra") * 20
Punti_Fama = Punti_Fama + r("C_Min_Zolfo") * 40
Punti_Fama = Punti_Fama + r("C_Min_Oro") * 50
Punti_Fama = Punti_Fama + r("C_Case") * 10
Punti_Fama = Punti_Fama + r("C_Poligono_Tiro") * 60
Punti_Fama = Punti_Fama + r("C_Centro_Villaggio") * 100
Punti_Fama = Punti_Fama + r("C_Laboratorio") * 50
Punti_Fama = Punti_Fama + r("C_Tesoreria") * 75
Punti_Fama = Punti_Fama + r("C_Mercato") * 60
Punti_Fama = Punti_Fama + r("C_Taverna") * 40
Punti_Fama = Punti_Fama + r("C_Torrette") * 80
Punti_Fama = Punti_Fama + r("C_Mura") * 70
Punti_Fama = Punti_Fama + r("C_Caserma") * 50

Punti_Fama = Punti_Fama + r("R_Add_Cavalli") * 40
Punti_Fama = Punti_Fama + r("R_Filoni_Oro") * 30
Punti_Fama = Punti_Fama + r("R_Armi") * 100
Punti_Fama = Punti_Fama + r("R_Tempr_Ferro") * 50
Punti_Fama = Punti_Fama + r("R_Scudi") * 100
Punti_Fama = Punti_Fama + r("R_Gerarchia") * 80
Punti_Fama = Punti_Fama + r("R_Mura") * 100
Punti_Fama = Punti_Fama + r("R_Guardie") * 90
Punti_Fama = Punti_Fama + r("R_Torrette") * 120
Punti_Fama = Punti_Fama + r("R_Assedio") * 75
Punti_Fama = Punti_Fama + r("R_Esplorazione") * 35

Punti_Fama = Punti_Fama + r("E_Sold_Semp") * 20
Punti_Fama = Punti_Fama + r("E_Sold_Cavallo") * 30
Punti_Fama = Punti_Fama + r("E_Carovana") * 100
Punti_Fama = Punti_Fama + r("E_Arcieri_Corto") * 40
Punti_Fama = Punti_Fama + r("E_Arcieri_Lungo") * 50
Punti_Fama = Punti_Fama + r("E_Fanteria_Pesante") * 60
Punti_Fama = Punti_Fama + r("E_Balestrieri") * 80
Punti_Fama = Punti_Fama + r("E_Cavalleria_Pesante") * 100
Punti_Fama = Punti_Fama + r("E_Bombardieri") * 120
Punti_Fama = Punti_Fama + r("E_Cannone") * 150
Punti_Fama = Punti_Fama + r("E_Esploratore") * 40
Punti_Fama = Punti_Fama + r("E_Ladro") * 80
Punti_Fama = Punti_Fama + r("E_Generale") * 500
Punti_Fama = Punti_Fama + r("E_Carretto_Piccolo") * 10
Punti_Fama = Punti_Fama + r("E_Carretto_Grande") * 20
Punti_Fama = Punti_Fama + r("E_Petardo") * 120
Punti_Fama = Punti_Fama + r("E_Ballista") * 200
Punti_Fama = Punti_Fama + r("E_Catapulta") * 250
Punti_Fama = Punti_Fama + r("E_Ariete") * 150
Punti_Fama = Punti_Fama + r("E_Trabucco") * 300

End If



If r("Dimensione") = Dimensione AND r("Reame") = Reame AND r("Paese") = Paese Then

If r("Is_Dead") = 0 Then
 Var_Livello_Generale = r("Livello")
End If

Ris_Legna = r("Ris_Legna")
Ris_Ferro = r("Ris_Ferro")
Ris_Zolfo = r("Ris_Zolfo")
Ris_Pietra = r("Ris_Pietra")
Ris_Oro = r("Ris_Oro")
Livello_Legna = r("C_Taglialegna")
Livello_Ferro = r("C_Min_Ferro")
Livello_Zolfo = r("C_Min_Zolfo")
Livello_Pietra = r("C_Min_Pietra")
Livello_Oro = r("C_Min_Oro")
Last_Access = r("Data_Last_Access")

Var_P_Taglialegna = r("P_Taglialegna")
Var_P_Min_Pietra = r("P_Min_Pietra")
Var_P_Min_Ferro = r("P_Min_Ferro")
Var_P_Min_Zolfo = r("P_Min_Zolfo")
Var_P_Min_Oro = r("P_Min_Oro")
Var_P_Fattorie = r("P_Fattorie")

Var_R_Filoni_Oro = r("R_Filoni_Oro")

Var_Morale = r("Morale")

Var_Tasse = r("Tasse")
Var_Capienza_Case = r("C_Case")*20

Var_Cittadini_Occupati = r("P_Fattorie")+r("P_Taglialegna")+r("P_Min_Pietra")+r("P_Min_Ferro")+r("P_Min_Zolfo")+r("P_Min_Oro")
Var_Cittadini_Tassabili = r("P_Cittadini")
Var_Cittadini_Liberi = r("P_Cittadini") - Var_Cittadini_Occupati
Var_Cittadini_Totali = r("C_Centro_Villaggio")*100
Var_C_Centro_Villaggio = r("C_Centro_Villaggio")
Var_C_Taverna = r("C_Taverna")
Var_C_Tesoreria = r("C_Tesoreria")







If (r("P_Fattorie") * 5) = 0 Then
Check_Morale = -50
End If

If (r("P_Fattorie") * 5) > 0 Then
Check_Morale = -40
End If

If (r("P_Fattorie") * 5) > (Cint(Var_Cittadini_Tassabili)) / 3 Then
Check_Morale = -30
End If

If (r("P_Fattorie") * 5) > (Cint(Var_Cittadini_Tassabili)) / 2 Then
Check_Morale = -20
End If

If (r("P_Fattorie") * 5) > (Cint(Var_Cittadini_Tassabili)) Then
Check_Morale = +20
End If

If (r("P_Fattorie") * 5) > (Cint(Var_Cittadini_Tassabili) * 2) Then
Check_Morale = +40
End If


If r("Tasse") = 1 Then
Check_Morale = Check_Morale +20
End If

If r("Tasse") = 2 Then
Check_Morale = Check_Morale
End If

If r("Tasse") = 3 Then
Check_Morale = Check_Morale -20
End If

If r("Tasse") = 4 Then
Check_Morale = Check_Morale -40
End If

If r("Tasse") = 5 Then
Check_Morale = Check_Morale -50
End If

If r("Tasse") = 6 Then
Check_Morale = Check_Morale -60
End If

If r("Tasse") = 7 Then
Check_Morale = Check_Morale -80
End If



If r("C_Taverna") = 1 Then
Check_Morale = Check_Morale +3
End If

If r("C_Taverna") = 2 Then
Check_Morale = Check_Morale +5
End If

If r("C_Taverna") = 3 Then
Check_Morale = Check_Morale +8
End If

If r("C_Taverna") = 4 Then
Check_Morale = Check_Morale +10
End If

If r("C_Taverna") = 5 Then
Check_Morale = Check_Morale +13
End If

If r("C_Taverna") = 6 Then
Check_Morale = Check_Morale +15
End If

If r("C_Taverna") = 7 Then
Check_Morale = Check_Morale +20
End If

If r("C_Taverna") = 8 Then
Check_Morale = Check_Morale +25
End If

If r("C_Taverna") = 9 Then
Check_Morale = Check_Morale +30
End If

If r("C_Taverna") = 10 Then
Check_Morale = Check_Morale +35
End If

If r("C_Taverna") = 11 Then
Check_Morale = Check_Morale +40
End If

If r("C_Taverna") = 12 Then
Check_Morale = Check_Morale +45
End If

If r("C_Taverna") > 12 Then
Check_Morale = Check_Morale +50
End If






If Var_Livello_Generale > 0 Then
Check_Morale = Check_Morale + Var_Livello_Generale
End If





End If



End While
r.Close()
sqlConn.Close()


















Ris_Legna = Ris_Legna + (((0.008 * (Var_P_Taglialegna/50)) + ((0.008 * (Var_P_Taglialegna/50))/4)) * (DateDiff("s",Last_Access, DateTime.Now)))*5 + ((0.015) * (DateDiff("s",Last_Access, DateTime.Now)))
Ris_Ferro = Ris_Ferro + (((0.005 * (Var_P_Min_Ferro/50)) + ((0.005 * (Var_P_Min_Ferro/50))/4)) * (DateDiff("s",Last_Access, DateTime.Now)))*5 + ((0.005) * (DateDiff("s",Last_Access, DateTime.Now)))
Ris_Zolfo = Ris_Zolfo + (((0.004 * (Var_P_Min_Zolfo/50)) + ((0.004 * (Var_P_Min_Zolfo/50))/4)) * (DateDiff("s",Last_Access, DateTime.Now)))*5
Ris_Pietra = Ris_Pietra + (((0.007 * (Var_P_Min_Pietra/50)) + ((0.007 * (Var_P_Min_Pietra/50))/4)) * (DateDiff("s",Last_Access, DateTime.Now)))*5 + ((0.010) * (DateDiff("s",Last_Access, DateTime.Now)))
'Ris_Oro = Ris_Oro + (((0.003 * (Var_P_Min_Oro/50)) + ((0.003 * (Var_P_Min_Oro/50))/4)) * (DateDiff("s",Last_Access, DateTime.Now)))*5
Ris_Oro = Ris_Oro + (((0.003 * (Var_P_Min_Oro/50)) + ((0.003 * (Var_P_Min_Oro/50))/4)) * (DateDiff("s",Last_Access, DateTime.Now)))*5    +    ((((0.003 * (Var_P_Min_Oro/50)) + ((0.003 * (Var_P_Min_Oro/50))/4)) * (DateDiff("s",Last_Access, DateTime.Now)))*5  * (Var_R_Filoni_Oro/20))
Var_Cittadini_Tassabili = Var_Cittadini_Tassabili + ((0.003 * Var_C_Centro_Villaggio/4) * (DateDiff("s",Last_Access, DateTime.Now)))




If Var_Tasse = 1 AND RIs_Oro > ((Var_Cittadini_Tassabili) * 0.0000100 *  (DateDiff("s",Last_Access, DateTime.Now))) Then
Ris_Oro = Ris_Oro - (Var_Cittadini_Tassabili) * 0.0000200 *  (DateDiff("s",Last_Access, DateTime.Now))
End If

If Var_Tasse = 1 AND RIs_Oro < ((Var_Cittadini_Tassabili) * 0.0000100 *  (DateDiff("s",Last_Access, DateTime.Now))) Then
Var_Tasse = 2
End If


If Var_Tasse = 3 Then
Ris_Oro = Ris_Oro + ((Var_Cittadini_Tassabili) * 0.0000200 *  (DateDiff("s",Last_Access, DateTime.Now))/10*(Var_C_Tesoreria+10))
End If

If Var_Tasse = 4 Then
Ris_Oro = Ris_Oro + ((Var_Cittadini_Tassabili) * 0.0000300 *  (DateDiff("s",Last_Access, DateTime.Now))/10*(Var_C_Tesoreria+10))
End If

If Var_Tasse = 5 Then
Ris_Oro = Ris_Oro + ((Var_Cittadini_Tassabili) * 0.0000400 *  (DateDiff("s",Last_Access, DateTime.Now))/10*(Var_C_Tesoreria+10))
End If

If Var_Tasse = 6 Then
Ris_Oro = Ris_Oro + ((Var_Cittadini_Tassabili) * 0.0000500 *  (DateDiff("s",Last_Access, DateTime.Now))/10*(Var_C_Tesoreria+10))
End If

If Var_Tasse = 7 Then
Ris_Oro = Ris_Oro + ((Var_Cittadini_Tassabili) * 0.0000600 *  (DateDiff("s",Last_Access, DateTime.Now))/10*(Var_C_Tesoreria+10))
End If


If Var_Cittadini_Tassabili > Var_Cittadini_Totali Then
Var_Cittadini_Tassabili = Var_Cittadini_Totali 
End If

If Var_Cittadini_Tassabili > Var_Capienza_Case Then
Var_Cittadini_Tassabili = Var_Capienza_Case
End If





Var_Morale = Var_Morale + ((0.0000315 * Check_Morale) * (DateDiff("s",Last_Access, DateTime.Now)))


If Var_Morale < - 100 Then
Var_Morale = -100
End If

If Var_Morale > 100 Then
Var_Morale = 100
End If

Dim Tempo_Trascorso = (DateDiff("s",Last_Access, DateTime.Now))


Dim Data_Odierna as DateTime = Datetime.Now

Dim Data_Odierna_x = Replace(Data_Odierna,".",":")
Data_Odierna_x = Format_Date(Data_Odierna_x)

'Dim Data_Odierna_x as String = "22/11/2005 17:15:19"


'response.write (Data_Odierna_x)
'response.end

Ris_Legna = Replace(Ris_Legna,",",".")
Ris_Ferro = Replace(Ris_Ferro,",",".")
Ris_Zolfo = Replace(Ris_Zolfo,",",".")
Ris_Pietra = Replace(Ris_Pietra,",",".")
Ris_Oro = Replace(Ris_Oro,",",".")
Var_Cittadini_Tassabili = Replace(Var_Cittadini_Tassabili,",",".")
Var_Morale = Replace(Var_Morale,",",".")



sqlConn.Open()
sqlComm = New SqlCommand("UPDATE Pianeti SET Morale = "& Var_Morale &", Tasse = "& Var_Tasse &", P_Cittadini = "& Var_Cittadini_Tassabili &",Ris_Legna = "& Ris_Legna &", Ris_Ferro = "& Ris_Ferro &" ,Ris_Zolfo = "& Ris_Zolfo &" ,Ris_Pietra = "& Ris_Pietra &" ,Ris_Oro = "& Ris_Oro &", Data_Last_Access = '"& Data_Odierna_x &"' WHERE Dimensione = '" + Dimensione + "' AND Reame = '" + Reame + "' AND Paese = '" + Paese + "'   ",sqlConn)
result = sqlComm.ExecuteNonQuery()
sqlConn.Close()















If Initial_Ip <> Request.ServerVariables("REMOTE_ADDR") Then
 Response.Write("<p align='center'><font face='Arial' size='2'><b>C'è stato un problema, il tuo Ip non coincide più con quello con cui hai loggato. Alcune delle cause possono essere che ti sei disconnesso e riconnesso mentre giocavi, oppure che hai tentato di usare due account contemporaneamente!!!<br>Per risolvere il problema, rieseguire il Login")
 Response.End
End If






Dim Actual_Mission = 0


sqlConn.Open()
sqlComm = New SqlCommand("SELECT ID, Ris_Legna, Ris_Ferro, Ris_Pietra, Ris_Zolfo, Ris_Oro, Type_Soldato, Quantity_Soldato FROM Missioni JOIN Soldati_In_Missione ON Missioni.Id = Soldati_In_Missione.Id_Missione WHERE Missioni.Army_Of = '"& Proprietary &"' ORDER BY ID ", sqlConn)
r = sqlComm.ExecuteReader()

While r.Read()

If r("ID") <> Actual_Mission Then

Punti_Fama = Punti_Fama + CInt(r("Ris_Legna")) / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Ferro")) * 3 / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Pietra")) * 2 / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Zolfo")) * 4 / 30
Punti_Fama = Punti_Fama + CInt(r("Ris_Oro")) * 5 / 30

 Actual_Mission = r("ID")
End If

If r("Type_Soldato") = "E_Sold_Semp" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 20
End If

If r("Type_Soldato") = "E_Sold_Cavallo" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 30
End If

If r("Type_Soldato") = "E_Carovana" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 100
End If

If r("Type_Soldato") = "E_Arcieri_Corto" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 40
End If

If r("Type_Soldato") = "E_Arcieri_Lungo" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 50
End If

If r("Type_Soldato") = "E_Fanteria_Pesante" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 60
End If

If r("Type_Soldato") = "E_Balestrieri" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 80
End If

If r("Type_Soldato") = "E_Cavalleria_Pesante" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 100
End If

If r("Type_Soldato") = "E_Bombardieri" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 120
End If

If r("Type_Soldato") = "E_Cannone" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 150
End If

If r("Type_Soldato") = "E_Esploratore" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 40
End If

If r("Type_Soldato") = "E_Ladro" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 80
End If

If r("Type_Soldato") = "E_Generale" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 500
End If

If r("Type_Soldato") = "E_Carretto_Piccolo" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 10
End If

If r("Type_Soldato") = "E_Carretto_Grande" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 20
End If

If r("Type_Soldato") = "E_Petardo" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 120
End If

If r("Type_Soldato") = "E_Ballista" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 200
End If

If r("Type_Soldato") = "E_Catapulta" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 250
End If

If r("Type_Soldato") = "E_Ariete" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 150
End If

If r("Type_Soldato") = "E_Trabucco" Then
Punti_Fama = Punti_Fama + CInt(r("Quantity_Soldato")) * 300
End If


End While
r.Close()
sqlConn.Close()











Punti_Fama = CInt(Punti_Fama/1000)

sqlConn.Open()
sqlComm = New SqlCommand("UPDATE Utenti SET Fama = '"& Punti_Fama &"' WHERE Username = '" & Proprietary & "' ",sqlConn)
result = sqlComm.ExecuteNonQuery()
sqlConn.Close()






'CONTROLLA CHE IL PAESE CHE STAI USANDO SIA ANCORA IL TUO

If Tuo_Paese = 0 Then
Response.Write("<p align='center'><font face='Arial' size='2'><b>C'è stato un problema, la Colonia che stavi usando ti è stata conquistata oppure l'hai ceduta! Ricaricare la pagina e rieseguire il Login")
Response.End
End If







End Sub

</script>