mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-09-30 13:16:36 -05:00
Added column to track the number of times a battle video is watched.
This commit is contained in:
@@ -263,7 +263,7 @@ namespace PkmnFoundations.GlobalTerminalService
|
||||
}
|
||||
|
||||
long serial = BitConverter.ToInt64(data, 0x140);
|
||||
BattleVideoRecord4 record = DataAbstract.Instance.BattleVideoGet4(serial);
|
||||
BattleVideoRecord4 record = DataAbstract.Instance.BattleVideoGet4(serial, true);
|
||||
if (record == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x02, 0x00 }, 0, 2);
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace PkmnFoundations.GlobalTerminalService
|
||||
}
|
||||
|
||||
long serial = BitConverter.ToInt64(data, 0x140);
|
||||
BattleVideoRecord5 record = DataAbstract.Instance.BattleVideoGet5(serial);
|
||||
BattleVideoRecord5 record = DataAbstract.Instance.BattleVideoGet5(serial, true);
|
||||
if (record == null)
|
||||
{
|
||||
response.Write(new byte[] { 0x02, 0x00 }, 0, 2);
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace PkmnFoundations.Data
|
||||
|
||||
public abstract long BattleVideoUpload4(BattleVideoRecord4 record);
|
||||
public abstract BattleVideoHeader4[] BattleVideoSearch4(ushort species, BattleVideoRankings4 ranking, BattleVideoMetagames4 metagame, byte country, byte region, int count);
|
||||
public abstract BattleVideoRecord4 BattleVideoGet4(long serial);
|
||||
public abstract BattleVideoRecord4 BattleVideoGet4(long serial, bool incrementViews = false);
|
||||
#endregion
|
||||
|
||||
#region Global Terminal 5
|
||||
@@ -103,7 +103,7 @@ namespace PkmnFoundations.Data
|
||||
|
||||
public abstract long BattleVideoUpload5(BattleVideoRecord5 record);
|
||||
public abstract BattleVideoHeader5[] BattleVideoSearch5(ushort species, BattleVideoRankings5 ranking, BattleVideoMetagames5 metagame, byte country, byte region, int count);
|
||||
public abstract BattleVideoRecord5 BattleVideoGet5(long serial);
|
||||
public abstract BattleVideoRecord5 BattleVideoGet5(long serial, bool incrementViews = false);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1057,12 +1057,16 @@ namespace PkmnFoundations.Data
|
||||
return new BattleVideoHeader4(reader.GetInt32(0), reader.GetInt64(1), data);
|
||||
}
|
||||
|
||||
public override BattleVideoRecord4 BattleVideoGet4(long serial)
|
||||
public override BattleVideoRecord4 BattleVideoGet4(long serial, bool incrementViews = false)
|
||||
{
|
||||
String update = incrementViews ? "UPDATE TerminalBattleVideos4 " +
|
||||
"SET Views = Views + 1 WHERE SerialNumber = @serial; "
|
||||
: "";
|
||||
|
||||
using (MySqlConnection db = CreateConnection())
|
||||
{
|
||||
db.Open();
|
||||
MySqlDataReader reader = (MySqlDataReader)db.ExecuteReader("SELECT pid, " +
|
||||
MySqlDataReader reader = (MySqlDataReader)db.ExecuteReader(update + "SELECT pid, " +
|
||||
"SerialNumber, Header, Data FROM TerminalBattleVideos4 " +
|
||||
"WHERE SerialNumber = @serial",
|
||||
new MySqlParameter("@serial", serial));
|
||||
@@ -1403,12 +1407,16 @@ namespace PkmnFoundations.Data
|
||||
return new BattleVideoHeader5(reader.GetInt32(0), reader.GetInt64(1), data);
|
||||
}
|
||||
|
||||
public override BattleVideoRecord5 BattleVideoGet5(long serial)
|
||||
public override BattleVideoRecord5 BattleVideoGet5(long serial, bool incrementViews = false)
|
||||
{
|
||||
String update = incrementViews ? "UPDATE TerminalBattleVideos5 " +
|
||||
"SET Views = Views + 1 WHERE SerialNumber = @serial; "
|
||||
: "";
|
||||
|
||||
using (MySqlConnection db = CreateConnection())
|
||||
{
|
||||
db.Open();
|
||||
MySqlDataReader reader = (MySqlDataReader)db.ExecuteReader("SELECT pid, " +
|
||||
MySqlDataReader reader = (MySqlDataReader)db.ExecuteReader(update + "SELECT pid, " +
|
||||
"SerialNumber, Header, Data FROM TerminalBattleVideos5 " +
|
||||
"WHERE SerialNumber = @serial",
|
||||
new MySqlParameter("@serial", serial));
|
||||
|
||||
Reference in New Issue
Block a user