Merge remote-tracking branch 'upstream/master'

This commit is contained in:
olebeck 2021-11-08 22:16:25 +01:00
commit 7a4f10cb26
15 changed files with 290 additions and 140 deletions

@ -1 +1 @@
Subproject commit 0f9268907fb3cd9d0da9c8ab1cba8308de0e5656
Subproject commit 98f385f4adaad7e58d265001f4f109869ca9c88d

View file

@ -348,7 +348,15 @@ namespace HISP.Game
public void AddEntry(User user, HorseInstance horse)
{
if (Entries.Length + 1 > Slots)
return;
{
if (Entries.Length + 1 > Slots)
{
byte[] enterFailed = PacketBuilder.CreateChat(Messages.ArenaFullErrorMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.LoggedinClient.SendPacket(enterFailed);
GameServer.UpdateArea(user.LoggedinClient);
return;
}
}
if(!UserHasHorseEntered(user))
{
@ -357,6 +365,14 @@ namespace HISP.Game
arenaEntry.EnteredHorse = horse;
entries.Add(arenaEntry);
}
user.TakeMoney(EntryCost);
byte[] enteredIntoCompetition = PacketBuilder.CreateChat(Messages.ArenaEnteredInto, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.LoggedinClient.SendPacket(enteredIntoCompetition);
GameServer.UpdateAreaForAll(user.X, user.Y, true);
return;
}
public static Arena GetArenaUserEnteredIn(User user)

View file

@ -101,7 +101,7 @@ namespace HISP.Game.Chat
if (message.ToUpper().StartsWith("%RULES"))
return Command.Rules(message, args, user);
if (message.ToUpper().StartsWith("%PRISON"))
return Command.Prision(message, args, user);
return Command.Prison(message, args, user);
if (message.ToUpper().StartsWith("%NOCLIP"))
return Command.NoClip(message, args, user);
if (message.ToUpper().StartsWith("%STEALTH"))
@ -114,6 +114,10 @@ namespace HISP.Game.Chat
return Command.Escape(message, args, user);
if (message.ToUpper().StartsWith("%MODHORSE"))
return Command.ModHorse(message, args, user);
if (message.ToUpper().StartsWith("%DELITEM"))
return Command.DelItem(message, args, user);
if (message.ToUpper().StartsWith("%SHUTDOWN"))
return Command.Shutdown(message, args, user);
if (message.ToUpper().StartsWith("%CALL HORSE"))
return Command.CallHorse(message, args, user);
return false;

View file

@ -6,6 +6,8 @@ using System.Collections.Generic;
using HISP.Game.Events;
using HISP.Game.Horse;
using System.Linq;
using HISP.Game.Inventory;
using System.Threading;
namespace HISP.Game.Chat
{
@ -20,7 +22,7 @@ namespace HISP.Game.Chat
continue;
if (client.LoggedIn)
{
if (client.LoggedinUser.Username.ToLower().Contains(name.ToLower()))
if (client.LoggedinUser.Username.ToLower().StartsWith(name.ToLower()))
{
return client.LoggedinUser;
}
@ -29,6 +31,40 @@ namespace HISP.Game.Chat
throw new KeyNotFoundException("name not found");
}
public static bool Shutdown(string message, string[] args, User user)
{
if (!user.Administrator)
return false;
try
{
foreach(GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
{
for(int i = 0; i < 2; i++)
{
ItemInstance rubyItem = new ItemInstance(Item.Ruby);
client.LoggedinUser.Inventory.AddIgnoringFull(rubyItem);
}
client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.GameUpdates).Count++;
}
client.Kick("%SHUTDOWN Command Executed by an Administrator (Probably a server restart)");
}
}
catch (Exception) { };
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
Program.ShuttingDown = true;
Thread.Sleep(1000); // give it a few seconds to shut down, if it doesnt force exit
Environment.Exit(0);
return true;
}
public static bool Give(string message, string[] args, User user)
{
if (args.Length <= 0)
@ -286,7 +322,7 @@ namespace HISP.Game.Chat
return true;
}
public static bool Prision(string message, string[] args, User user)
public static bool Prison(string message, string[] args, User user)
{
if (!(user.Administrator || user.Moderator))
return false;
@ -368,7 +404,41 @@ namespace HISP.Game.Chat
return true;
}
public static bool DelItem(string message, string[] args, User user)
{
if (args.Length <= 0)
return false;
if (!user.Administrator)
return false;
int itemId = 0;
try
{
itemId = int.Parse(args[0]);
User target = user;
if (args.Length > 1)
target = findNamePartial(args[1]);
if (target.Inventory.HasItemId(itemId))
{
InventoryItem itm = target.Inventory.GetItemByItemId(itemId);
foreach (ItemInstance instance in itm.ItemInstances)
{
target.Inventory.Remove(instance);
}
}
}
catch (Exception)
{
return false;
}
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
return true;
}
public static bool Goto(string message, string[] args, User user)
{
if (args.Length <= 0)
@ -464,7 +534,6 @@ namespace HISP.Game.Chat
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
return true;
}
@ -483,7 +552,8 @@ namespace HISP.Game.Chat
try
{
id = int.Parse(args[0]);
amount = int.Parse(args[2]);
if(args[1].ToUpper() != "COLOR")
amount = int.Parse(args[2]);
}
catch (Exception)
{
@ -511,6 +581,12 @@ namespace HISP.Game.Chat
case "PERSONALITY":
instance.AdvancedStats.Personality = amount;
break;
case "HEIGHT":
instance.AdvancedStats.Height = amount;
break;
case "COLOR":
instance.Color = args[2].ToLower();
break;
case "EXPERIENCE":
instance.BasicStats.Experience = amount;
break;
@ -540,6 +616,7 @@ namespace HISP.Game.Chat
user.LoggedinClient.SendPacket(chatPacket);
return true;
}
public static bool Warp(string message, string[] args, User user)
{
@ -571,10 +648,13 @@ namespace HISP.Game.Chat
}
else
{
string areaName = string.Join(" ", args).ToLower();
string areaName = string.Join(" ", args).ToLower();
areaName = areaName.Trim();
if (areaName == "")
areaName = "Horse Isle";
try
{
User tp = findNamePartial(areaName);
User tp = GameServer.GetUserByName(areaName);
user.Teleport(tp.X, tp.Y);
formattedmessage += Messages.SuccessfullyWarpedToPlayer;
@ -585,7 +665,7 @@ namespace HISP.Game.Chat
{
foreach (World.Waypoint waypoint in World.Waypoints)
{
if (waypoint.Name.ToLower().Contains(areaName))
if (waypoint.Name.ToLower().StartsWith(areaName))
{
user.Teleport(waypoint.PosX, waypoint.PosY);
formattedmessage += Messages.SuccessfullyWarpedToLocation;

View file

@ -57,7 +57,11 @@ namespace HISP.Game.Events
return;
if (Database.HasPlayerCompletedRealTimeRiddle(RiddleId, winner.Id))
{
byte[] alreadyWonRiddleMessage = PacketBuilder.CreateChat(Messages.EventAlreadySovledRealTimeRiddle, PacketBuilder.CHAT_BOTTOM_RIGHT);
winner.LoggedinClient.SendPacket(alreadyWonRiddleMessage);
return;
}
LastWon = true;
@ -86,10 +90,13 @@ namespace HISP.Game.Events
}
public void EndEvent()
{
Active = false;
if(Active)
{
Active = false;
riddleTimeout.Dispose();
riddleTimeout = null;
riddleTimeout.Dispose();
riddleTimeout = null;
}
}
private void riddleTimedOut(object state)

View file

@ -101,6 +101,7 @@ namespace HISP.Game.Items
public static int BirthdayToken;
public static int MagicBean;
public static int MagicDroplet;
public static int Ruby;
public static int StallionTradingCard;
public static int MareTradingCard;

View file

@ -119,6 +119,7 @@ namespace HISP.Game
public static string EventEndRealTimeRiddle;
public static string EventWonRealTimeRiddleForOthersFormat;
public static string EventWonRealTimeRiddleForYouFormat;
public static string EventAlreadySovledRealTimeRiddle;
// Events : Tack Shop Giveaway
public static string EventStartTackShopGiveawayFormat;
@ -332,6 +333,7 @@ namespace HISP.Game
public static string ArenaNeedsVet;
public static string ArenaEventNameFormat;
public static string ArenaFullErrorMessage;
public static string ArenaCurrentlyTakingEntriesFormat;
public static string ArenaCompetitionInProgress;
@ -997,6 +999,7 @@ namespace HISP.Game
// Awards
public static string AwardOthersFormat;
public static string AwardHeader;
public static string NoAwards;
public static string AwardFormat;
@ -2514,6 +2517,10 @@ namespace HISP.Game
{
return ConsumeItemFormat.Replace("%ITEM%", itemName);
}
public static string FormatAwardHeaderOthers(string username)
{
return AwardOthersFormat.Replace("%USERNAME%", username);
}
public static string FormatAwardEntry(int iconId, string title, int moneyBonus)
{
return AwardFormat.Replace("%ICON%", iconId.ToString()).Replace("%NAME%", title).Replace("%BONUS%", moneyBonus.ToString("N0", CultureInfo.InvariantCulture));

View file

@ -258,13 +258,18 @@ namespace HISP.Game
// Insert LGBT Patch here
string pronoun = "";
if (other)
{
if (user.Gender == "FEMALE")
{
pronoun = Messages.PronounFemaleShe;
}
if (user.Gender == "MALE")
{
pronoun = Messages.PronounMaleHe;
}
}
if (!other)
@ -363,13 +368,19 @@ namespace HISP.Game
// Insert LGBT Patch Here
string pronoun = Messages.PronounYouYour;
if(other)
string pronoun2 = Messages.PronounYouYour;
if (other)
{
if (user.Gender == "FEMALE")
{
pronoun = Messages.PronounFemaleShe;
if (user.Gender == "MALE")
pronoun2 = Messages.PronounFemaleHer;
}
else if (user.Gender == "MALE")
{
pronoun = Messages.PronounMaleHe;
pronoun2 = Messages.PronounMaleHis;
}
message = Messages.FormatOtherCompetitionGear(pronoun);
}
@ -378,22 +389,22 @@ namespace HISP.Game
if (user.EquipedCompetitionGear.Head != null)
{
message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, pronoun, user.EquipedCompetitionGear.Head.IconId, other);
message += Messages.FormatCompetitionGearHead(user.EquipedCompetitionGear.Head.Name, pronoun2, user.EquipedCompetitionGear.Head.IconId, other);
hasMsg = true;
}
if (user.EquipedCompetitionGear.Body != null)
{
message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, pronoun, user.EquipedCompetitionGear.Body.IconId, other);
message += Messages.FormatCompetitionGearBody(user.EquipedCompetitionGear.Body.Name, pronoun2, user.EquipedCompetitionGear.Body.IconId, other);
hasMsg = true;
}
if (user.EquipedCompetitionGear.Legs != null)
{
message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, pronoun, user.EquipedCompetitionGear.Legs.IconId, other);
message += Messages.FormatCompetitionGearLegs(user.EquipedCompetitionGear.Legs.Name, pronoun2, user.EquipedCompetitionGear.Legs.IconId, other);
hasMsg = true;
}
if (user.EquipedCompetitionGear.Feet != null)
{
message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, pronoun, user.EquipedCompetitionGear.Feet.IconId, other);
message += Messages.FormatCompetitionGearFeet(user.EquipedCompetitionGear.Feet.Name, pronoun2, user.EquipedCompetitionGear.Feet.IconId, other);
hasMsg = true;
}
@ -525,7 +536,7 @@ namespace HISP.Game
message += Messages.FormatTradeOfferHorse(horse.Name, tacked, horse.RandomId);
}
if(trade.Trader.Inventory.Count >= trade.Trader.MaxItems)
if(trade.OtherTrade.Trader.Inventory.Count >= trade.OtherTrade.Trader.MaxItems)
{
message += Messages.TradeOfferItemOtherPlayerInvFull;
}
@ -919,7 +930,7 @@ namespace HISP.Game
if (highscore.Type == "SCORE")
message += Messages.FormatHighscoreStat(highscore.GameName, Database.GetRanking(highscore.Score, highscore.GameName), highscore.Score, highscore.TimesPlayed);
else if (highscore.Type == "TIME")
message += Messages.FormatBestTimeStat(highscore.GameName, Database.GetRanking(highscore.Score, highscore.GameName), highscore.Score, highscore.TimesPlayed);
message += Messages.FormatBestTimeStat(highscore.GameName, Database.GetRanking(highscore.Score, highscore.GameName, true), highscore.Score, highscore.TimesPlayed);
}
message += Messages.BackToMap;
message += Messages.MetaTerminator;
@ -1056,6 +1067,11 @@ namespace HISP.Game
message += Messages.FormatOtherHorsesMeta(pronoun);
message += buildHorseList(user, false);
message += Messages.FormatAwardHeaderOthers(user.Username);
foreach (Award.AwardEntry award in user.Awards.AwardsEarned)
message += Messages.FormatAwardEntry(award.IconId, award.Title, award.MoneyBonus);
}
@ -1089,9 +1105,6 @@ namespace HISP.Game
foreach (Award.AwardEntry award in user.Awards.AwardsEarned)
message += Messages.FormatAwardEntry(award.IconId, award.Title, award.MoneyBonus);
message += Messages.BackToMap;
message += Messages.MetaTerminator;
return message;
@ -1760,6 +1773,7 @@ namespace HISP.Game
if (mine) // This is My DS.
{
GameServer.CheckMail(user);
user.DoRanchActions();
string title = ranch.Title;
@ -2797,17 +2811,7 @@ namespace HISP.Game
}
private static string buildTownHall(User user)
{
if(user.MailBox.UnreadMailCount > 0)
{
byte[] RipOffAOLSound = PacketBuilder.CreatePlaysoundPacket(Messages.MailSe);
user.LoggedinClient.SendPacket(RipOffAOLSound);
byte[] mailReceivedText = PacketBuilder.CreateChat(Messages.MailReceivedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.LoggedinClient.SendPacket(mailReceivedText);
user.MailBox.ReadAllMail();
}
GameServer.CheckMail(user);
string message = Messages.CityHallMenu;
message += Messages.ExitThisPlace;

View file

@ -112,13 +112,13 @@ namespace HISP.Player
Trader.LoggedinClient.SendPacket(tradeYouHaveTooManyHorses);
fail = true;
}
if(OtherTrade.Trader.Money + MoneyOffered > 2100000000)
if(MoneyOffered > 0 && OtherTrade.Trader.Money + MoneyOffered > 2100000000)
{
byte[] tradeOtherHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveOtherTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.LoggedinClient.SendPacket(tradeOtherHasTooMuchMoney);
fail = true;
}
if(Trader.Money + OtherTrade.MoneyOffered > 2100000000)
if(OtherTrade.MoneyOffered > 0 && Trader.Money + OtherTrade.MoneyOffered > 2100000000)
{
byte[] tradeYouHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveYouTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.LoggedinClient.SendPacket(tradeYouHasTooMuchMoney);
@ -135,7 +135,7 @@ namespace HISP.Player
if (Trader.Inventory.HasItemId(inst[0].ItemId))
{
InventoryItem items = Trader.Inventory.GetItemByItemId(inst[0].ItemId);
if (items.ItemInstances.Length + inst.Length >= ConfigReader.MAX_STACK)
if (items.ItemInstances.Length + inst.Length > ConfigReader.MAX_STACK)
{
itemYouFail = true;
}
@ -155,7 +155,7 @@ namespace HISP.Player
if (OtherTrade.Trader.Inventory.HasItemId(inst[0].ItemId))
{
InventoryItem items = OtherTrade.Trader.Inventory.GetItemByItemId(inst[0].ItemId);
if (items.ItemInstances.Length + inst.Length >= ConfigReader.MAX_STACK)
if (items.ItemInstances.Length + inst.Length > ConfigReader.MAX_STACK)
{
itemOtherFail = true;
}
@ -218,7 +218,7 @@ namespace HISP.Player
foreach (ItemInstance itm in item)
{
Trader.Inventory.Remove(itm);
OtherTrade.Trader.Inventory.Add(itm);
OtherTrade.Trader.Inventory.AddIgnoringFull(itm);
}
}

View file

@ -525,13 +525,13 @@ namespace HISP.Player
icon = Messages.NewUserIcon;
if (Subscribed)
{
int months = (DateTime.UtcNow.Month - SubscribedUntil.Month) + 12 * (DateTime.UtcNow.Year - SubscribedUntil.Year);
if (months <= 1)
icon = Messages.MonthSubscriptionIcon;
else if (months <= 3)
int months = (SubscribedUntil.Month - DateTime.UtcNow.Month) + ((SubscribedUntil.Year - DateTime.UtcNow.Year) * 12);
if (months >= 3)
icon = Messages.ThreeMonthSubscripitionIcon;
else
else if(months >= (12+3))
icon = Messages.YearSubscriptionIcon;
else
icon = Messages.MonthSubscriptionIcon;
}
if (Moderator)
icon = Messages.ModeratorIcon;

View file

@ -12,6 +12,7 @@ namespace HISP
{
public class Program
{
public static bool ShuttingDown = false;
static void Main(string[] args)
{
#if (!DEBUG)
@ -54,7 +55,7 @@ namespace HISP
Logger.ErrorPrint("");
Logger.ErrorPrint(execpt.StackTrace);
while (true) { };
while (!ShuttingDown) { /*Allow asyncronous operations to happen.*/ };
}
}
}

View file

@ -3628,11 +3628,14 @@ namespace HISP.Server
return entires.ToArray();
}
public static int GetRanking(int score, string gameTitle)
public static int GetRanking(int score, string gameTitle, bool time=false)
{
using MySqlConnection db = Connect();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "SELECT DISTINCT score FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score DESC";
if(time)
sqlCommand.CommandText = "SELECT DISTINCT score FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score ASC";
else
sqlCommand.CommandText = "SELECT DISTINCT score FROM Leaderboards WHERE minigame=@gameTitle ORDER BY score DESC";
sqlCommand.Parameters.AddWithValue("@gameTitle", gameTitle);
sqlCommand.Prepare();
MySqlDataReader reader = sqlCommand.ExecuteReader();
@ -3643,7 +3646,6 @@ namespace HISP.Server
break;
i++;
}
return i;
}
public static void UpdateHighscoreWinGame(int playerId, string gameTitle)

View file

@ -181,7 +181,8 @@ namespace HISP.Server
Logger.DebugPrint("Sending keep-alive packet to " + LoggedinUser.Username);
byte[] updatePacket = PacketBuilder.CreateKeepAlive();
SendPacket(updatePacket);
keepAliveTimer.Change(oneMinute, oneMinute);
if(keepAliveTimer != null)
keepAliveTimer.Change(oneMinute, oneMinute);
}
private void minuteTimerTick(object state)
{
@ -409,96 +410,109 @@ namespace HISP.Server
if (warnTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE)
warnTimer.Change(warnInterval, warnInterval);
if (!LoggedIn) // Must be either login or policy-file-request
try
{
if (Encoding.UTF8.GetString(Packet).StartsWith("<policy-file-request/>")) // Policy File Request
if (!LoggedIn) // Must be either login or policy-file-request
{
GameServer.OnCrossdomainPolicyRequest(this);
if (Encoding.UTF8.GetString(Packet).StartsWith("<policy-file-request/>")) // Policy File Request
{
GameServer.OnCrossdomainPolicyRequest(this);
}
switch (identifier)
{
case PacketBuilder.PACKET_LOGIN:
GameServer.OnLoginRequest(this, Packet);
break;
}
}
switch (identifier)
else
{
case PacketBuilder.PACKET_LOGIN:
GameServer.OnLoginRequest(this, Packet);
break;
switch (identifier)
{
case PacketBuilder.PACKET_LOGIN:
GameServer.OnUserInfoRequest(this, Packet);
break;
case PacketBuilder.PACKET_MOVE:
GameServer.OnMovementPacket(this, Packet);
break;
case PacketBuilder.PACKET_PLAYERINFO:
GameServer.OnPlayerInfoPacket(this, Packet);
break;
case PacketBuilder.PACKET_PLAYER:
GameServer.OnProfilePacket(this, Packet);
break;
case PacketBuilder.PACKET_CHAT:
GameServer.OnChatPacket(this, Packet);
break;
case PacketBuilder.PACKET_CLICK:
GameServer.OnClickPacket(this, Packet);
break;
case PacketBuilder.PACKET_KEEP_ALIVE:
GameServer.OnKeepAlive(this, Packet);
break;
case PacketBuilder.PACKET_TRANSPORT:
GameServer.OnTransportUsed(this, Packet);
break;
case PacketBuilder.PACKET_INVENTORY:
GameServer.OnInventoryRequested(this, Packet);
break;
case PacketBuilder.PACKET_DYNAMIC_BUTTON:
GameServer.OnDynamicButtonPressed(this, Packet);
break;
case PacketBuilder.PACKET_DYNAMIC_INPUT:
GameServer.OnDynamicInputReceived(this, Packet);
break;
case PacketBuilder.PACKET_ITEM_INTERACTION:
GameServer.OnItemInteraction(this, Packet);
break;
case PacketBuilder.PACKET_ARENA_SCORE:
GameServer.OnArenaScored(this, Packet);
break;
case PacketBuilder.PACKET_QUIT:
GameServer.OnQuitPacket(this, Packet);
break;
case PacketBuilder.PACKET_NPC:
GameServer.OnNpcInteraction(this, Packet);
break;
case PacketBuilder.PACKET_BIRDMAP:
GameServer.OnBirdMapRequested(this, Packet);
break;
case PacketBuilder.PACKET_SWFMODULE:
GameServer.OnSwfModuleCommunication(this, Packet);
break;
case PacketBuilder.PACKET_HORSE:
GameServer.OnHorseInteraction(this, Packet);
break;
case PacketBuilder.PACKET_WISH:
GameServer.OnWish(this, Packet);
break;
case PacketBuilder.PACKET_RANCH:
GameServer.OnRanchPacket(this, Packet);
break;
case PacketBuilder.PACKET_AUCTION:
GameServer.OnAuctionPacket(this, Packet);
break;
case PacketBuilder.PACKET_PLAYER_INTERACTION:
GameServer.OnPlayerInteration(this, Packet);
break;
case PacketBuilder.PACKET_SOCIALS:
GameServer.OnSocialPacket(this, Packet);
break;
default:
Logger.ErrorPrint("Unimplemented Packet: " + BitConverter.ToString(Packet).Replace('-', ' '));
break;
}
}
}
else
catch(Exception e)
{
switch (identifier)
{
case PacketBuilder.PACKET_LOGIN:
GameServer.OnUserInfoRequest(this, Packet);
break;
case PacketBuilder.PACKET_MOVE:
GameServer.OnMovementPacket(this, Packet);
break;
case PacketBuilder.PACKET_PLAYERINFO:
GameServer.OnPlayerInfoPacket(this, Packet);
break;
case PacketBuilder.PACKET_PLAYER:
GameServer.OnProfilePacket(this, Packet);
break;
case PacketBuilder.PACKET_CHAT:
GameServer.OnChatPacket(this, Packet);
break;
case PacketBuilder.PACKET_CLICK:
GameServer.OnClickPacket(this, Packet);
break;
case PacketBuilder.PACKET_KEEP_ALIVE:
GameServer.OnKeepAlive(this, Packet);
break;
case PacketBuilder.PACKET_TRANSPORT:
GameServer.OnTransportUsed(this, Packet);
break;
case PacketBuilder.PACKET_INVENTORY:
GameServer.OnInventoryRequested(this, Packet);
break;
case PacketBuilder.PACKET_DYNAMIC_BUTTON:
GameServer.OnDynamicButtonPressed(this, Packet);
break;
case PacketBuilder.PACKET_DYNAMIC_INPUT:
GameServer.OnDynamicInputReceived(this, Packet);
break;
case PacketBuilder.PACKET_ITEM_INTERACTION:
GameServer.OnItemInteraction(this,Packet);
break;
case PacketBuilder.PACKET_ARENA_SCORE:
GameServer.OnArenaScored(this, Packet);
break;
case PacketBuilder.PACKET_QUIT:
GameServer.OnQuitPacket(this, Packet);
break;
case PacketBuilder.PACKET_NPC:
GameServer.OnNpcInteraction(this, Packet);
break;
case PacketBuilder.PACKET_BIRDMAP:
GameServer.OnBirdMapRequested(this, Packet);
break;
case PacketBuilder.PACKET_SWFMODULE:
GameServer.OnSwfModuleCommunication(this, Packet);
break;
case PacketBuilder.PACKET_HORSE:
GameServer.OnHorseInteraction(this, Packet);
break;
case PacketBuilder.PACKET_WISH:
GameServer.OnWish(this, Packet);
break;
case PacketBuilder.PACKET_RANCH:
GameServer.OnRanchPacket(this, Packet);
break;
case PacketBuilder.PACKET_AUCTION:
GameServer.OnAuctionPacket(this, Packet);
break;
case PacketBuilder.PACKET_PLAYER_INTERACTION:
GameServer.OnPlayerInteration(this, Packet);
break;
case PacketBuilder.PACKET_SOCIALS:
GameServer.OnSocialPacket(this, Packet);
break;
default:
Logger.ErrorPrint("Unimplemented Packet: " + BitConverter.ToString(Packet).Replace('-', ' '));
break;
}
Logger.ErrorPrint("Unhandled Exception: " + e.ToString());
Logger.ErrorPrint(e.Message);
Logger.ErrorPrint("");
Logger.ErrorPrint(e.StackTrace);
Kick("Unhandled Exception: " + e.ToString());
}
}

View file

@ -903,6 +903,7 @@ namespace HISP.Server
Item.ModSplatterball = gameData.item.special.mod_splatterball;
Item.MagicBean = gameData.item.special.magic_bean;
Item.MagicDroplet = gameData.item.special.magic_droplet;
Item.Ruby = gameData.item.special.ruby;
Item.StallionTradingCard = gameData.item.special.stallion_trading_card;
Item.MareTradingCard = gameData.item.special.mare_trading_card;
@ -1048,6 +1049,7 @@ namespace HISP.Server
Messages.EventEndRealTimeRiddle = gameData.messages.events.real_time_riddle.event_end;
Messages.EventWonRealTimeRiddleForOthersFormat = gameData.messages.events.real_time_riddle.event_won_others;
Messages.EventWonRealTimeRiddleForYouFormat = gameData.messages.events.real_time_riddle.event_won_you;
Messages.EventAlreadySovledRealTimeRiddle = gameData.messages.events.real_time_riddle.event_solved_already;
// Events : Tack Shop Giveaway
@ -1253,6 +1255,8 @@ namespace HISP.Server
Messages.ArenaYouHaveHorseEntered = gameData.messages.meta.arena.horse_entered;
Messages.ArenaCompetitionFull = gameData.messages.meta.arena.competiton_full;
Messages.ArenaFullErrorMessage = gameData.messages.meta.arena.arena_join_fail_full;
Messages.ArenaEnterHorseFormat = gameData.messages.meta.arena.enter_horse;
Messages.ArenaCurrentCompetitors = gameData.messages.meta.arena.current_competitors;
Messages.ArenaCompetingHorseFormat = gameData.messages.meta.arena.competing_horses;
@ -2042,6 +2046,7 @@ namespace HISP.Server
// Awards
Messages.AwardHeader = gameData.messages.meta.awards_page.awards_header;
Messages.AwardOthersFormat = gameData.messages.meta.awards_page.awards_others_header;
Messages.NoAwards = gameData.messages.meta.awards_page.no_awards;
Messages.AwardFormat = gameData.messages.meta.awards_page.award_format;

View file

@ -1678,11 +1678,6 @@ namespace HISP.Server
if (sender.LoggedinUser.Money >= arena.EntryCost)
{
arena.AddEntry(sender.LoggedinUser, horseInstance);
sender.LoggedinUser.TakeMoney(arena.EntryCost);
byte[] enteredIntoCompetition = PacketBuilder.CreateChat(Messages.ArenaEnteredInto, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(enteredIntoCompetition);
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true);
break;
}
else
@ -4594,7 +4589,7 @@ namespace HISP.Server
Logger.ErrorPrint(sender.LoggedinUser.Username + " Sent correct sec code, but invalid score value");
return;
}
Highscore.HighscoreTableEntry[] scores = Database.GetTopScores(gameTitle, 5);
Highscore.HighscoreTableEntry[] scores = Database.GetTopScores(gameTitle, 5, !time);
bool bestScoreEver = false;
if (scores.Length >= 1)
bestScoreEver = scores[0].Score <= value;
@ -7688,6 +7683,20 @@ namespace HISP.Server
return count;
}
public static void CheckMail(User user)
{
if (user.MailBox.UnreadMailCount > 0)
{
byte[] RipOffAOLSound = PacketBuilder.CreatePlaysoundPacket(Messages.MailSe);
user.LoggedinClient.SendPacket(RipOffAOLSound);
byte[] mailReceivedText = PacketBuilder.CreateChat(Messages.MailReceivedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.LoggedinClient.SendPacket(mailReceivedText);
user.MailBox.ReadAllMail();
}
}
public static int GetNumberOfModsOnline()
{
int count = 0;