add water balloon game functionality

This commit is contained in:
SilicaAndPina 2021-04-29 19:49:38 +12:00
parent e95140d708
commit 79b4b76c5d
7 changed files with 82 additions and 4 deletions

View file

@ -1593,6 +1593,26 @@ namespace HISP.Server
}
}
public static void EradicateItemFromExistance(int itemId)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "DELETE FROM Inventory WHERE itemId=@itemId";
sqlCommand.Parameters.AddWithValue("@itemId", itemId);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "DELETE FROM DroppedItems WHERE itemId=@itemId";
sqlCommand.Parameters.AddWithValue("@itemId", itemId);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
sqlCommand.Dispose();
}
}
public static void SetTrackedItemCount(int playerId, Tracking.TrackableItem what, int count)

View file

@ -871,6 +871,7 @@ namespace HISP.Server
Item.FishingPole = gameData.item.special.fishing_poll;
Item.Earthworm = gameData.item.special.earthworm;
Item.BirthdayToken = gameData.item.special.birthday_token;
Item.WaterBalloon = gameData.item.special.water_balloon;
Item.ModSplatterball = gameData.item.special.mod_splatterball;
Item.MagicBean = gameData.item.special.magic_bean;
Item.MagicDroplet = gameData.item.special.magic_droplet;

View file

@ -5984,7 +5984,12 @@ namespace HISP.Server
sender.SendPacket(thrownHitYourself);
break;
}
if(itemId == Item.WaterBalloon)
{
if (WaterBalloonEvent != null)
if (WaterBalloonEvent.Active)
WaterBalloonEvent.AddWaterBallon(userAt[userIndx]);
}
if(itemId == Item.ModSplatterball)
{
byte[] otherEarned = PacketBuilder.CreateChat(Messages.FormatModSplatterBallAwardedOther(sender.LoggedinUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
@ -7046,7 +7051,12 @@ namespace HISP.Server
// Remove Trade Reference
sender.LoggedinUser.TradingWith = null;
sender.LoggedinUser.PendingTradeTo = 0;
// Leave open water balloon game
if (WaterBalloonEvent != null)
if(WaterBalloonEvent.Active)
WaterBalloonEvent.LeaveEvent(sender.LoggedinUser);
// Leave open quiz.
if (QuizEvent != null)
QuizEvent.LeaveEvent(sender.LoggedinUser);