Add more auction checks

This commit is contained in:
SilicaAndPina 2021-02-23 01:51:18 +13:00
parent f35456385d
commit 35a1d00dd3
8 changed files with 689 additions and 4 deletions

View file

@ -51,8 +51,22 @@ namespace HISP.Server
string BannedPlayers = "CREATE TABLE BannedPlayers(playerId INT, ipAddress TEXT(1028), reason TEXT(1028))";
string RiddlesComplete = "CREATE TABLE RiddlesComplete(playerId INT, riddleId INT, solved TEXT(1028))";
string AuctionTable = "CREATE TABLE Auctions(roomId INT, randomId INT, horseRandomId INT, ownerId INT, timeRemaining INT, highestBid INT, highestBidder INT, Done TEXT(3))";
string SolvedRealTimeRiddle = "CREATE TABLE SolvedRealTimeRiddles(playerId INT, riddleId INT)";
string DeleteOnlineUsers = "DELETE FROM OnlineUsers";
try
{
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = SolvedRealTimeRiddle;
sqlCommand.ExecuteNonQuery();
sqlCommand.Dispose();
}
catch (Exception e)
{
Logger.WarnPrint(e.Message);
};
try
{
MySqlCommand sqlCommand = db.CreateCommand();
@ -496,6 +510,26 @@ namespace HISP.Server
return count >= 1;
}
}
public static int[] GetSolvedRealTimeRiddles(int playerId)
{
List<int> solvedRiddleId = new List<int>();
using (MySqlConnection db = new MySqlConnection(ConnectionString))
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "SELECT riddleId FROM SolvedRealTimeRiddles WHERE playerId=@playerId";
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
sqlCommand.Prepare();
MySqlDataReader reader = sqlCommand.ExecuteReader();
while(reader.Read())
{
solvedRiddleId.Add(reader.GetInt32(0));
}
sqlCommand.Dispose();
return solvedRiddleId.ToArray();
}
}
public static int GetRanchInvestment(int ranchId)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))

View file

@ -837,6 +837,9 @@ namespace HISP.Server
Messages.AuctionTopBid = gameData.messages.meta.auction.top_bid;
Messages.AuctionExistingBidHigher = gameData.messages.meta.auction.existing_higher;
Messages.AuctionYouHaveTooManyHorses = gameData.messages.meta.auction.you_have_too_many_horses;
Messages.AuctionOnlyOneWinningBidAllowed = gameData.messages.meta.auction.only_one_winning_bid_allowed;
Messages.AuctionOneHorsePerPlayer = gameData.messages.meta.auction.one_horse_at_a_time;
Messages.AuctionYouveBeenOutbidFormat = gameData.messages.meta.auction.outbid_by;
Messages.AuctionCantAffordBid = gameData.messages.meta.auction.cant_afford_bid;

View file

@ -16,6 +16,7 @@ using HISP.Game.Services;
using HISP.Game.Inventory;
using HISP.Game.SwfModules;
using HISP.Game.Horse;
using HISP.Game.Events;
using HISP.Game.Items;
namespace HISP.Server
@ -37,6 +38,9 @@ namespace HISP.Server
public static Random RandomNumberGenerator = new Random();
// Events
public static RealTimeRiddle ActiveRiddleEvent;
/*
* Private stuff
*/