<%
Dim Id_Arrenditi = Request.QueryString("id")
Id_Arrenditi = DeCripta(Id_Arrenditi)
Dim VR = Request.QueryString("VR")
VR = DeCripta(VR)
If VR <> "Confirm" Then
Dim There_Is_Mission = 0
sqlConn.Open()
sqlComm = New SqlCommand("SELECT * FROM Missioni WHERE ID = '"& Id_Arrenditi &"' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
If r("Type_Mission") = "Assedio" Then
There_Is_Mission = 1
End If
End While
r.Close()
sqlConn.Close()
If There_Is_Mission = 1 Then
%>
">Clicca qui per ritirare le tue truppe dalla Battaglia<%
End If
If There_Is_Mission = 0 Then
%>
Questo Assedio č giā terminato!<%
End If
End If
If VR = "Confirm" Then
%>
Le tue truppe si sono ritirate e stanno ritornando.<%
Dim Var_Dimensione_Arrive_Arr
Dim Var_Reame_Arrive_Arr
Dim Var_Paese_Arrive_Arr
Dim Var_Dimensione_Started_Arr
Dim Var_Reame_Started_Arr
Dim Var_Paese_Started_Arr
sqlConn.Open()
sqlComm = New SqlCommand("SELECT * FROM Missioni WHERE ID = '"& Id_Arrenditi &"' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
Var_Army_Of = r("Army_Of")
Var_Dimensione_Arrive_Arr = CStr(r("Dimensione_Arrive"))
Var_Reame_Arrive_Arr = CStr(r("Reame_Arrive"))
Var_Paese_Arrive_Arr = CStr(r("Paese_Arrive"))
Var_Dimensione_Started_Arr = CStr(r("Dimensione_Started"))
Var_Reame_Started_Arr = CStr(r("Reame_Started"))
Var_Paese_Started_Arr = CStr(r("Paese_Started"))
Var_Time_Started = r("Time_Started")
Var_Time_Arrive = r("Time_Arrive")
Var_Type_Mission = "Attacco"
End While
r.Close()
sqlConn.Close()
'INIZIO MESSAGGI
'sqlConn.Open()
'sqlComm = New SqlCommand("SELECT * FROM Missioni JOIN Pianeti ON Pianeti.DImensione = Missioni.Dimensione_Arrive AND Pianeti.Reame = Missioni.Reame_Arrive AND Pianeti.Paese = Missioni.Paese_Arrive WHERE Missioni.Id = '"& Id_Arrenditi &"' ", sqlConn)
'r = sqlComm.ExecuteReader()
'While r.Read()
'Var_Dimensione_Arrive_Arr = r("Dimensione_Arrive")
'Var_Reame_Arrive_Arr = r("Reame_Arrive")
'Var_Paese_Arrive_Arr = r("Paese_Arrive")
'End While
'r.Close()
'sqlConn.Close()
Var_Mex_Attacco = ""
Var_Mex_Attacco = Var_Mex_Attacco + "
SOLDATI DELL'ATTACCANTE
"
sqlConn.Open()
sqlComm = New SqlCommand("SELECT * FROM Soldati_In_Missione WHERE Id_Missione = '"& Id_Arrenditi &"' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
If r("Type_Soldato") = "E_Sold_Semp" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Soldato Semplice: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Sold_Cavallo" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Soldato a Cavallo: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Arcieri_Corto" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Arcieri (Arco Corto): " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Arcieri_Lungo" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Arcieri (Arco Lungo): " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Fanteria_Pesante" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Fanteria Pesante: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Balestrieri" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Balestrieri: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Cavalleria_Pesante" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Cavalleria Pesante: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Bombardieri" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Bombardieri: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Cannone" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Cannone: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Generale" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Generale: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Petardo" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Petardo: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Ballista" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Ballista: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Catapulta" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Catapulta: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Ariete" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Ariete: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
If r("Type_Soldato") = "E_Trabucco" AND r("QUantity_Soldato") > 0 %><% Var_Mex_Attacco = Var_Mex_Attacco + "Trabucco: " + CStr(r("QUantity_Soldato")) + " "%> <% End If
End While
r.Close()
sqlConn.Close()
Var_Mex_Attacco = Var_Mex_Attacco + "
----------------------"
Var_Mex_Attacco = Var_Mex_Attacco + "
SOLDATI DELL'ASSEDIATO
"
sqlConn.Open()
sqlComm = New SqlCommand("SELECT * FROM Pianeti WHERE Dimensione = '"& Var_Dimensione_Arrive_Arr &"' AND Reame = '"& Var_Reame_Arrive_Arr &"' AND Paese = '"& Var_Paese_Arrive_Arr &"' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
%>
<% If r("E_Sold_Semp") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Soldato Semplice: " + CStr(r("E_Sold_Semp")) + " "%> <% End If %>
<% If r("E_Sold_Cavallo") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Soldato a Cavallo: " + CStr(r("E_Sold_Cavallo")) + " "%> <% End If %>
<% If r("E_Arcieri_Corto") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Arcieri (Arco Corto): " + CStr(r("E_Arcieri_Corto")) + " "%> <% End If %>
<% If r("E_Arcieri_Lungo") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Arcieri (Arco Lungo): " + CStr(r("E_Arcieri_Lungo")) + " "%> <% End If %>
<% If r("E_Fanteria_Pesante") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Fanteria Pesante: " + CStr(r("E_Fanteria_Pesante")) + " "%> <% End If %>
<% If r("E_Balestrieri") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Balestrieri: " + CStr(r("E_Balestrieri")) + " "%> <% End If %>
<% If r("E_Cavalleria_Pesante") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Cavalleria Pesante: " + CStr(r("E_Cavalleria_Pesante")) + " "%> <% End If %>
<% If r("E_Bombardieri") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Bombardieri: " + CStr(r("E_Bombardieri")) + " "%> <% End If %>
<% If r("E_Cannone") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Cannone: " + CStr(r("E_Cannone")) + " "%> <% End If %>
<% If r("E_Generale") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Generale: " + CStr(r("E_Generale")) + " "%> <% End If %>
<% If r("E_Petardo") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Petardo: " + CStr(r("E_Petardo")) + " "%> <% End If %>
<% If r("E_Ballista") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Ballista: " + CStr(r("E_Ballista")) + " "%> <% End If %>
<% If r("E_Catapulta") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Catapulta " + CStr(r("E_Catapulta")) + " "%> <% End If %>
<% If r("E_Ariete") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Ariete: " + CStr(r("E_Ariete")) + " "%> <% End If %>
<% If r("E_Trabucco") > 0 Then %><% Var_Mex_Attacco = Var_Mex_Attacco + "Trabucco: " + CStr(r("E_Trabucco")) + " "%> <% End If %>
<%
End While
r.Close()
sqlConn.Close()
sqlConn.Open()
sqlComm = New SqlCommand("SELECT Pianeti.Proprietary, Pianeti.Dimensione, Pianeti.Reame, Pianeti.Paese, Utenti.ID as Id_Utente, Utenti.Username FROM Pianeti JOIN Utenti ON Pianeti.Proprietary = Utenti.Username WHERE Dimensione = '" & Dimensione & "' AND Reame = '" & Reame & "' AND Paese = '" & Paese & "' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
Var_Id_Utente = r("Id_Utente")
End While
r.Close()
sqlConn.Close()
m_sql = "INSERT INTO Messaggi (Messaggio, Data, Id_Utente) VALUES (@Messaggio, @Data, @Id_Utente)"
m_conn = New SqlConnection(strConn)
m_cmd = new SqlCommand
m_cmd.connection = m_conn
m_cmd.commandtext = m_sql
m_cmd.Parameters.Add("@Messaggio", sqldbtype.varchar).Value = "Le tue truppe si sono ritirate dall'Assedio della cittā nemica con sede in:
Continente: " + CStr(Var_Dimensione_Arrive) + " Reame: " + CStr(Var_Reame_Arrive) + " Paese: " + CStr(Var_Paese_Arrive) + "
ecco i due eserciti prima della ritirata:
" + Var_Mex_Attacco
m_cmd.Parameters.Add("@Data", sqldbtype.datetime).Value = Datetime.Now
m_cmd.Parameters.Add("@Id_Utente", sqldbtype.int).Value = Var_Id_Utente
m_conn.Open
m_cmd.ExecuteNonQuery
m_conn.Close
'MESSAGGIO ALL'ASSEDIATO
Dim Var_Id_Utente_Ass
sqlConn.Open()
sqlComm = New SqlCommand("SELECT Pianeti.Proprietary, Pianeti.Dimensione, Pianeti.Reame, Pianeti.Paese, Utenti.ID as Id_Utente, Utenti.Username FROM Pianeti JOIN Utenti ON Pianeti.Proprietary = Utenti.Username WHERE Dimensione = '" & Var_Dimensione_Arrive_Arr & "' AND Reame = '" & Var_Reame_Arrive_Arr & "' AND Paese = '" & Var_Paese_Arrive_Arr & "' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
Var_Id_Utente_Ass = r("Id_Utente")
End While
r.Close()
sqlConn.Close()
m_sql = "INSERT INTO Messaggi (Messaggio, Data, Id_Utente) VALUES (@Messaggio, @Data, @Id_Utente)"
m_conn = New SqlConnection(strConn)
m_cmd = new SqlCommand
m_cmd.connection = m_conn
m_cmd.commandtext = m_sql
m_cmd.Parameters.Add("@Messaggio", sqldbtype.varchar).Value = "Le truppe nemiche si sono ritirate dalla tua cittā, ecco i due eserciti prima della ritirata:
" + Var_Mex_Attacco
m_cmd.Parameters.Add("@Data", sqldbtype.datetime).Value = Datetime.Now
m_cmd.Parameters.Add("@Id_Utente", sqldbtype.int).Value = Var_Id_Utente_Ass
m_conn.Open
m_cmd.ExecuteNonQuery
m_conn.Close
sqlConn.Open()
sqlComm = New SqlCommand("SELECT * FROM Missioni WHERE ID = '"& Id_Arrenditi &"' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
Var_Army_Of = r("Army_Of")
Var_Dimensione_Arrive_Arr = CStr(r("Dimensione_Arrive"))
Var_Reame_Arrive_Arr = CStr(r("Reame_Arrive"))
Var_Paese_Arrive_Arr = CStr(r("Paese_Arrive"))
Var_Dimensione_Started_Arr = CStr(r("Dimensione_Started"))
Var_Reame_Started_Arr = CStr(r("Reame_Started"))
Var_Paese_Started_Arr = CStr(r("Paese_Started"))
Var_Time_Started = r("Time_Started")
Var_Time_Arrive = r("Time_Arrive")
Var_Type_Mission = "Attacco"
End While
r.Close()
sqlConn.Close()
Dim Orario = Var_Time_Arrive.Subtract(Var_Time_Started)
Dim Data_Adesso = Datetime.Now
Data_Adesso = Replace(Data_Adesso,".",":")
Data_Adesso_Added = Datetime.Now.Add(Orario)
Data_Adesso_Added = Replace(Data_Adesso_Added,".",":")
Var_Time_Started = Replace(Var_Time_Started,".",":")
Data_Adesso_Added = Format_Date(Data_Adesso_Added)
Var_Time_Started = Format_Date(Var_Time_Started)
sqlConn.Open()
sqlComm = New SqlCommand("UPDATE Missioni SET Type_Mission = 'Rinforzi', Time_Started = '"& Var_Time_Started &"', Time_Arrive = '"& Data_Adesso_Added &"', Dimensione_Started = '"& Var_Dimensione_Arrive_Arr &"', Reame_Started = '"& Var_Reame_Arrive_Arr &"', Paese_Started = '"& Var_Paese_Arrive_Arr &"', Dimensione_Arrive = '"& Var_Dimensione_Started_Arr &"', Reame_Arrive = '"& Var_Reame_Started_Arr &"', Paese_Arrive = '"& Var_Paese_Started_Arr &"' WHERE ID = '" & Id_Arrenditi & "' ",sqlConn)
result = sqlComm.ExecuteNonQuery()
sqlConn.Close()
End If
%>
|