Add Magic Pellets and Droplets

This commit is contained in:
SilicaAndPina 2021-04-21 21:23:02 +12:00
parent 160688bf2d
commit 375731ada9
9 changed files with 129 additions and 19 deletions

View file

@ -780,7 +780,12 @@
"horse_could_not_finish":"The horse could not finish it all. Some was wasted.", "horse_could_not_finish":"The horse could not finish it all. Some was wasted.",
"current_status":"<B>%HORSENAME%'s current stats:</B>", "current_status":"<B>%HORSENAME%'s current stats:</B>",
"holding_horse_feed":"^H<BR><B>You are currently carrying the following horse feed:</B><BR>", "holding_horse_feed":"^H<BR><B>You are currently carrying the following horse feed:</B><BR>",
"horsefeed_format":"^I%ICONID%^T3[ %COUNT% ] %NAME%^B3I%RANDOMID%^R1" "horsefeed_format":"^I%ICONID%^T3[ %COUNT% ] %NAME%^B3I%RANDOMID%^R1",
"feed_special_personality":"Amazingly, your horse suddenly has slightly more personality!",
"feed_special_inteligence":"Wonderously, your horse suddenly is slightly smarter!",
"feed_special_magic_bean":"Shockingly, your horse suddenly has changed height from %PREVHANDS%h to %NEWHANDS%h!",
"feed_special_magic_droplet":"Before your eyes, your horse has changed color from %PREVCOLOR% to %NEWCOLOR%!",
}, },
"horse_inventory":{ "horse_inventory":{
"your_horse_format":"Your horse: <B>%NAME%:</B><BR>", "your_horse_format":"Your horse: <B>%NAME%:</B><BR>",
@ -9511,7 +9516,9 @@
"mod_splatterball":713, "mod_splatterball":713,
"fishing_poll":146, "fishing_poll":146,
"earthworm":83, "earthworm":83,
"birthday_token":1082 "birthday_token":1082,
"magic_droplet":1567,
"magic_bean":1566
}, },
"throwable":[ "throwable":[
{"id":144,"message_hit":"SMACK!! %USERNAME% hit you with a Snowball, blanketing wet snow on you.", "message_throw":"SMACK!! You nailed %USERNAME% with a Snowball, blanketing wet snow on them.", "message_hit_yourself":"You toss the Snowball high into the air! SMACK! It comes back down and hits you on the head, blanketing wet snow on you."}, {"id":144,"message_hit":"SMACK!! %USERNAME% hit you with a Snowball, blanketing wet snow on you.", "message_throw":"SMACK!! You nailed %USERNAME% with a Snowball, blanketing wet snow on them.", "message_hit_yourself":"You toss the Snowball high into the air! SMACK! It comes back down and hits you on the head, blanketing wet snow on you."},

View file

@ -238,7 +238,7 @@ namespace HISP.Game.Horse
endurance = newEndurance; endurance = newEndurance;
inteligence = newInteligence; inteligence = newInteligence;
personality = newPersonality; personality = newPersonality;
Height = newHeight; height = newHeight;
} }
@ -342,7 +342,18 @@ namespace HISP.Game.Horse
personality = value; personality = value;
} }
} }
public int Height; public int Height
{
get
{
return height;
}
set
{
height = value;
Database.SetHorseHeight(baseHorse.RandomId, value);
}
}
public int MinHeight; public int MinHeight;
public int MaxHeight; public int MaxHeight;
@ -354,6 +365,7 @@ namespace HISP.Game.Horse
private int endurance; private int endurance;
private int inteligence; private int inteligence;
private int personality; private int personality;
private int height;
} }
public class BasicStats public class BasicStats
{ {

View file

@ -6,7 +6,7 @@ namespace HISP.Game.Horse
{ {
public class HorseInstance public class HorseInstance
{ {
public HorseInstance(HorseInfo.Breed breed, int randomId = -1, string loadName=null, string loadDescription = "", int loadSpoiled=0, string loadCategory="KEEPER", int loadMagicUsed=0, int loadAutoSell=0, int leaseTimer=0, bool loadHidden=false, int loadOwner=0) public HorseInstance(HorseInfo.Breed breed, int randomId = -1, string loadColor = null ,string loadName=null, string loadDescription = "", int loadSpoiled=0, string loadCategory="KEEPER", int loadMagicUsed=0, int loadAutoSell=0, int leaseTimer=0, bool loadHidden=false, int loadOwner=0)
{ {
RandomId = RandomID.NextRandomId(randomId); RandomId = RandomID.NextRandomId(randomId);
owner = loadOwner; owner = loadOwner;
@ -42,7 +42,7 @@ namespace HISP.Game.Horse
description = loadDescription; description = loadDescription;
Breed = breed; Breed = breed;
Color = breed.Colors[GameServer.RandomNumberGenerator.Next(0, breed.Colors.Length)];
BasicStats = new HorseInfo.BasicStats(this, 1000, 0, 1000, 1000, 500, 200, 1000, 0); BasicStats = new HorseInfo.BasicStats(this, 1000, 0, 1000, 1000, 500, 200, 1000, 0);
int inteligence = (GameServer.RandomNumberGenerator.Next(breed.BaseStats.Inteligence, (breed.BaseStats.Inteligence * 2)) - breed.BaseStats.Inteligence); int inteligence = (GameServer.RandomNumberGenerator.Next(breed.BaseStats.Inteligence, (breed.BaseStats.Inteligence * 2)) - breed.BaseStats.Inteligence);
@ -57,11 +57,14 @@ namespace HISP.Game.Horse
magicUsed = loadMagicUsed; magicUsed = loadMagicUsed;
leaseTime = leaseTimer; leaseTime = leaseTimer;
hidden = loadHidden; hidden = loadHidden;
if(color != null)
color = loadColor;
else
color = breed.Colors[GameServer.RandomNumberGenerator.Next(0, breed.Colors.Length)];
Leaser = 0; Leaser = 0;
} }
public int Leaser; public int Leaser;
public int RandomId; public int RandomId;
public int owner;
public int Owner public int Owner
{ {
get get
@ -124,7 +127,18 @@ namespace HISP.Game.Horse
} }
} }
public string Gender; public string Gender;
public string Color; public string Color
{
get
{
return color;
}
set
{
color = value;
Database.SetHorseColor(this.RandomId, color);
}
}
public int TrainTimer public int TrainTimer
{ {
get get
@ -193,6 +207,8 @@ namespace HISP.Game.Horse
} }
} }
private string color;
private int owner;
private string name; private string name;
private string description; private string description;
private int spoiled; private int spoiled;

View file

@ -60,9 +60,8 @@ namespace HISP.Game.Horse
public HorseInstance GenerateLeaseHorse() public HorseInstance GenerateLeaseHorse()
{ {
HorseInstance instance = new HorseInstance(this.Breed, -1, null, "", 0, "LEASED", 0, 0, this.Minutes); HorseInstance instance = new HorseInstance(this.Breed, loadColor: this.Color, loadCategory: "LEASED", leaseTimer: this.Minutes);
instance.Name = this.HorseName; instance.Name = this.HorseName;
instance.Color = this.Color;
instance.Gender = this.Gender; instance.Gender = this.Gender;
instance.Leaser = this.LeaseId; instance.Leaser = this.LeaseId;

View file

@ -72,7 +72,8 @@ namespace HISP.Game.Items
public static int FishingPole; public static int FishingPole;
public static int Earthworm; public static int Earthworm;
public static int BirthdayToken; public static int BirthdayToken;
public static int MagicBean;
public static int MagicDroplet;
public static ItemInformation[] GetAllWishableItems() public static ItemInformation[] GetAllWishableItems()
{ {
List<ItemInformation> itemInfo = new List<ItemInformation>(); List<ItemInformation> itemInfo = new List<ItemInformation>();

View file

@ -810,6 +810,11 @@ namespace HISP.Game
public static string HorseNeighsThanks; public static string HorseNeighsThanks;
public static string HorseCouldNotFinish; public static string HorseCouldNotFinish;
public static string HorseFeedPersonalityIncreased;
public static string HorseFeedInteligenceIncreased;
public static string HorseFeedMagicBeanFormat;
public static string HorseFeedMagicDropletFormat;
// Tack horse menu // Tack horse menu
public static string HorseTackedAsFollowsFormat; public static string HorseTackedAsFollowsFormat;
public static string HorseUnEquipSaddleFormat; public static string HorseUnEquipSaddleFormat;
@ -1132,6 +1137,7 @@ namespace HISP.Game
// Throwables // Throwables
public static string FormatModSplatterBallAwardedOther(string username) public static string FormatModSplatterBallAwardedOther(string username)
{ {
@ -1604,7 +1610,14 @@ namespace HISP.Game
{ {
return TrainedInStatFormat.Replace("%HORSENAME%", horseName).Replace("%STAT%", stat); return TrainedInStatFormat.Replace("%HORSENAME%", horseName).Replace("%STAT%", stat);
} }
public static string FormatHorseFeedMagicDropletUsed(string oldColor, string newColor)
{
return HorseFeedMagicDropletFormat.Replace("%PREVCOLOR%", oldColor).Replace("%NEWCOLOR%", newColor);
}
public static string FormatHorseFeedMagicBeanUsed(double oldH, double newH)
{
return HorseFeedMagicBeanFormat.Replace("%PREVHANDS%", oldH.ToString(CultureInfo.InvariantCulture)).Replace("%NEWHANDS%", newH.ToString(CultureInfo.InvariantCulture));
}
public static string FormatSantaOpenPresent(string itemName) public static string FormatSantaOpenPresent(string itemName)
{ {
return SantaItemOpenedFormat.Replace("%ITEM%", itemName); return SantaItemOpenedFormat.Replace("%ITEM%", itemName);

View file

@ -1786,12 +1786,13 @@ namespace HISP.Server
int leaseTime = reader.GetInt32(2); int leaseTime = reader.GetInt32(2);
bool hidden = reader.GetString(34) == "YES"; bool hidden = reader.GetString(34) == "YES";
int owner = reader.GetInt32(1); int owner = reader.GetInt32(1);
string color = reader.GetString(8);
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell, leaseTime, hidden, owner); HorseInstance inst = new HorseInstance(horseBreed, randomId, color, name, description, spoiled, category, magicUsed, autosell, leaseTime, hidden, owner);
inst.Leaser = reader.GetInt32(3); inst.Leaser = reader.GetInt32(3);
inst.Gender = reader.GetString(7); inst.Gender = reader.GetString(7);
inst.Color = reader.GetString(8);
int health = reader.GetInt32(9); int health = reader.GetInt32(9);
@ -2778,7 +2779,20 @@ namespace HISP.Server
sqlCommand.Dispose(); sqlCommand.Dispose();
} }
} }
public static void SetHorseColor(int horseRandomId, string Color)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "UPDATE Horses SET color=@color WHERE randomId=@randomId";
sqlCommand.Parameters.AddWithValue("@color", Color);
sqlCommand.Parameters.AddWithValue("@randomId", horseRandomId);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
sqlCommand.Dispose();
}
}
public static void SetHorseCategory(int horseRandomId, string Category) public static void SetHorseCategory(int horseRandomId, string Category)
{ {
using (MySqlConnection db = new MySqlConnection(ConnectionString)) using (MySqlConnection db = new MySqlConnection(ConnectionString))

View file

@ -872,6 +872,8 @@ namespace HISP.Server
Item.Earthworm = gameData.item.special.earthworm; Item.Earthworm = gameData.item.special.earthworm;
Item.BirthdayToken = gameData.item.special.birthday_token; Item.BirthdayToken = gameData.item.special.birthday_token;
Item.ModSplatterball = gameData.item.special.mod_splatterball; Item.ModSplatterball = gameData.item.special.mod_splatterball;
Item.MagicBean = gameData.item.special.magic_bean;
Item.MagicDroplet = gameData.item.special.magic_droplet;
GameServer.IdleWarning = Convert.ToInt32(gameData.messages.disconnect.client_timeout.warn_after); GameServer.IdleWarning = Convert.ToInt32(gameData.messages.disconnect.client_timeout.warn_after);
GameServer.IdleTimeout = Convert.ToInt32(gameData.messages.disconnect.client_timeout.kick_after); GameServer.IdleTimeout = Convert.ToInt32(gameData.messages.disconnect.client_timeout.kick_after);
@ -1696,6 +1698,11 @@ namespace HISP.Server
Messages.HorseNeighsThanks = gameData.messages.meta.horse.feed_horse.horse_neigh; Messages.HorseNeighsThanks = gameData.messages.meta.horse.feed_horse.horse_neigh;
Messages.HorseCouldNotFinish = gameData.messages.meta.horse.feed_horse.horse_could_not_finish; Messages.HorseCouldNotFinish = gameData.messages.meta.horse.feed_horse.horse_could_not_finish;
Messages.HorseFeedPersonalityIncreased = gameData.messages.meta.horse.feed_horse.feed_special_personality;
Messages.HorseFeedInteligenceIncreased = gameData.messages.meta.horse.feed_horse.feed_special_inteligence;
Messages.HorseFeedMagicBeanFormat = gameData.messages.meta.horse.feed_horse.feed_special_magic_bean;
Messages.HorseFeedMagicDropletFormat = gameData.messages.meta.horse.feed_horse.feed_special_magic_droplet;
// Tack menu (horses) // Tack menu (horses)
Messages.HorseTackedAsFollowsFormat = gameData.messages.meta.horse.tack_menu.tacked_as_follows; Messages.HorseTackedAsFollowsFormat = gameData.messages.meta.horse.tack_menu.tacked_as_follows;
Messages.HorseUnEquipSaddleFormat = gameData.messages.meta.horse.tack_menu.dequip_saddle; Messages.HorseUnEquipSaddleFormat = gameData.messages.meta.horse.tack_menu.dequip_saddle;

View file

@ -1439,6 +1439,9 @@ namespace HISP.Server
Item.ItemInformation itemInfo = item.ItemInstances[0].GetItemInfo(); Item.ItemInformation itemInfo = item.ItemInstances[0].GetItemInfo();
HorseInstance horseInstance = sender.LoggedinUser.LastViewedHorse; HorseInstance horseInstance = sender.LoggedinUser.LastViewedHorse;
bool tooMuch = false; bool tooMuch = false;
bool changePersonality = false;
bool changeInteligence = false;
foreach(Item.Effects effect in itemInfo.Effects) foreach(Item.Effects effect in itemInfo.Effects)
{ {
switch(effect.EffectsWhat) switch(effect.EffectsWhat)
@ -1478,14 +1481,13 @@ namespace HISP.Server
tooMuch = true; tooMuch = true;
horseInstance.BasicStats.Tiredness += effect.EffectAmount; horseInstance.BasicStats.Tiredness += effect.EffectAmount;
break; break;
case "INTELLIGENCEOFFSET": case "INTELLIGENCEOFFSET":
horseInstance.AdvancedStats.Inteligence += effect.EffectAmount; horseInstance.AdvancedStats.Inteligence += effect.EffectAmount;
horseInstance.MagicUsed++; changeInteligence = true;
break; break;
case "PERSONALITYOFFSET": case "PERSONALITYOFFSET":
horseInstance.AdvancedStats.Personality += effect.EffectAmount; horseInstance.AdvancedStats.Personality += effect.EffectAmount;
horseInstance.MagicUsed++; changePersonality = true;
break; break;
case "SPOILED": case "SPOILED":
horseInstance.Spoiled += effect.EffectAmount; horseInstance.Spoiled += effect.EffectAmount;
@ -1494,6 +1496,42 @@ namespace HISP.Server
} }
sender.LoggedinUser.Inventory.Remove(item.ItemInstances[0]); sender.LoggedinUser.Inventory.Remove(item.ItemInstances[0]);
if(changePersonality)
{
byte[] personalityIncreased = PacketBuilder.CreateChat(Messages.HorseFeedPersonalityIncreased, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(personalityIncreased);
}
if (changeInteligence)
{
byte[] inteligenceIncreased = PacketBuilder.CreateChat(Messages.HorseFeedInteligenceIncreased, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(inteligenceIncreased);
}
if(item.ItemId == Item.MagicDroplet)
{
string oldColor = horseInstance.Color;
string newColor = horseInstance.Breed.Colors[RandomNumberGenerator.Next(0, horseInstance.Breed.Colors.Length)];
horseInstance.Color = newColor;
horseInstance.MagicUsed++;
byte[] magicDropletUsed = PacketBuilder.CreateChat(Messages.FormatHorseFeedMagicDropletUsed(oldColor, newColor), PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(magicDropletUsed);
}
if(item.ItemId == Item.MagicBean)
{
double oldH = HorseInfo.CalculateHands(horseInstance.AdvancedStats.Height, false);
int newHeight = RandomNumberGenerator.Next(horseInstance.Breed.BaseStats.MinHeight, horseInstance.Breed.BaseStats.MaxHeight);
double newH = HorseInfo.CalculateHands(newHeight, false);
horseInstance.AdvancedStats.Height = newHeight;
horseInstance.MagicUsed++;
byte[] magicBeansUsed = PacketBuilder.CreateChat(Messages.FormatHorseFeedMagicBeanUsed(oldH, newH), PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(magicBeansUsed);
}
byte[] horseNeighThanksPacket = PacketBuilder.CreateChat(Messages.HorseNeighsThanks, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] horseNeighThanksPacket = PacketBuilder.CreateChat(Messages.HorseNeighsThanks, PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(horseNeighThanksPacket); sender.SendPacket(horseNeighThanksPacket);
@ -7431,8 +7469,11 @@ namespace HISP.Server
forClient.SendPacket(swfModulePacket); forClient.SendPacket(swfModulePacket);
} }
if (forClient.LoggedinUser.InRealTimeQuiz) if (forClient.LoggedinUser.InRealTimeQuiz && QuizEvent != null)
{
QuizEvent.JoinEvent(forClient.LoggedinUser).UpdateParticipent();
return; return;
}
if (specialTile.Code != null) if (specialTile.Code != null)
if (!ProcessMapCodeWithArg(forClient, specialTile)) if (!ProcessMapCodeWithArg(forClient, specialTile))