Fix treasures

This commit is contained in:
SilicaAndPina 2021-02-19 18:35:23 +13:00
parent c0a03641c8
commit ff91d7bafb
11 changed files with 245 additions and 18 deletions

View file

@ -0,0 +1,134 @@
<HEAD>
<TITLE>HORSE ISLE - Online Multiplayer Horse Game</TITLE>
<META NAME="keywords" CONTENT="Horse Game Online MMORPG Multiplayer Horses RPG Girls Girly Isle World Island Virtual Horseisle Sim Virtual">
<META NAME="description" CONTENT="A multiplayer online horse world where players can capture, train, care for and compete their horses against other players. A very unique virtual sim horse game.">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="meta" href="http://horseisle.com/labels.rdf" type="application/rdf+xml" title="ICRA labels" />
<meta http-equiv="pics-Label" content='(pics-1.1 "http://www.icra.org/pics/vocabularyv03/" l gen true for "http://horseisle.com" r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 1) gen true for "http://hi1.horseisle.com" r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 1))' />
<style type="text/css">
hr {
height: 1;
color: #000000;
background-color: #000000;
border: 0;
}
a {
font: bold 14px arial;
color: #6E3278;
}
TH {
background-color: #EDE5B4;
padding: 1px 6px;
border: 2px dotted #6E3278;
font: small-caps 900 14px arial;
color: #000000;
}
TR.a0 {
background-color: #EDE5B4;
}
TR.a1 {
background-color: #D4CCA1;
}
TD {
font: 14px arial;
color: #000000;
}
TD.forum {
font: 12px arial;
color: #000000;
}
TD.forumlist {
padding: 1px 6px;
border: 2px dotted #6E3278;
background-color: #EDE5B4;
text-align: center;
font: bold 14px arial;
color: #000000;
}
TD.forumpost {
padding: 5px 10px;
border: 2px dotted #6E3278;
background-color: #EDE5B4;
text-align: left;
}
TD.adminforumpost {
padding: 5px 20px;
border: 2px dotted #6E3278;
background-color: #BFE9C9;
text-align: left;
}
TD.newslist {
padding: 4px 4px;
border: 2px dotted #6E3278;
background-color: #FFDDEE;
text-align: left;
font: 14px arial;
color: #000000;
}
FORUMSUBJECT {
font: bold 14px arial;
color: #004400;
}
FORUMUSER {
font: 12px arial;
color: #000044;
}
FORUMDATE {
font: 12px arial;
color: #444444;
}
FORUMTEXT {
font: 14px arial;
color: #440000;
}
</style>
</HEAD>
<BODY BGCOLOR=E0D8AA>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR WIDTH=100%>
<TD WIDTH=512 ROWSPAN=3><A HREF=/><IMG SRC=/web/hoilgui1.gif ALT="Welcome to Horse Isle" BORDER=0></A></TD>
<TD WIDTH=100% BACKGROUND=/web/hoilgui2.gif>&nbsp;</TD>
<TD WIDTH=29><IMG SRC=/web/hoilgui3.gif></TD>
</TR>
<TR>
<TD WIDTH=100% BACKGROUND=/web/hoilgui4.gif align=right>
<B>
<TABLE CELLPADDING=0 CELLSPACING=2 BORDER=0><FORM METHOD=POST ACTION=/account.php>
<TR><TD><B>USER:</B></TD><TD><INPUT TYPE=TEXT SIZE=14 NAME=USER></TD></TR>
<TR><TD><B>PASS:</B></TD><TD><INPUT TYPE=PASSWORD SIZE=14 NAME=PASS></TD></TR>
<TR><TD></TD><TD><INPUT TYPE=SUBMIT VALUE=LOGIN> (<A HREF=/web/forgotpass.php>Forgot?</A>)</TD></TR></FORM></TABLE>
</TD>
<TD WIDTH=29><IMG SRC=/web/hoilgui5.gif></TD></TR>
<TR>
<TD WIDTH=100% BACKGROUND=/web/hoilgui6.gif>&nbsp;</TD>
<TD WIDTH=29><IMG SRC=/web/hoilgui7.gif></TD></TR>
</TABLE>
<CENTER>
<B>Username or Password is not valid or your account has timed out. Please Log in again.</B><BR><BR></TD></TR></TABLE><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR>
<TD><IMG SRC=/web/hoilgui10.gif></TD>
<TD WIDTH=100% BACKGROUND=/web/hoilgui11.gif></TD>
<TD><IMG SRC=/web/hoilgui12.gif></TD>
</TR></TABLE>
<CENTER><B>
[ <A HREF=//master.horseisle.com/beginnerguide/>New Player Guide</A> ]<BR>
[ <A HREF=/web/rules.php>Rules</A> ]
[ <A HREF=/web/termsandconditions.php>Terms and Conditions</A> ]
[ <A HREF=/web/privacypolicy.php>Privacy Policy</A> ]</B><BR>
[ <A HREF=/web/expectedbehavior.php>Expected Behavior</A> ]
[ <A HREF=/web/contactus.php>Contact Us</A> ]
[ <A HREF=/web/credits.php>Credits</A> ]<BR>
<FONT FACE=Verdana,Arial SIZE=-2>Copyright &copy; 2021 Horse Isle</FONT>
<!-- Google Analytics -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1805076-1";
urchinTracker();
</script>

View file

@ -59,6 +59,7 @@
"incorrect_password":"Incorrect. You will have to find the correct answer somewhere...",
"player_here":"%USERNAME% here",
"no_telescope":"You do not have a telescope to use! You try making circles with your hands and placing them in front of one eye, but it is of minimal aid...",
"starved_horse":"You have been sent to Prison Isle for starving one of your horses! They have been fed for you.",
"horse_leaser":{
"cant_afford":"You cannot afford the lease fee.",
"temporary_horse_added":"New temporary horse added to your horse list.",
@ -209,6 +210,26 @@
"password_input":"<BR>^PLReply:|^PS14|ANSWER^R1",
"last_poet":"^R1^LLast Player Poet:%USERNAME% ^R1",
"hammock":"You and all of your horses have fully rested.",
"auction":{
"auctions_running":"The following auctions are running:<BR>",
"auction_horse_entry":"^I252^T8%USERNAME%'s %COLOR% %BREED% %GENDER% (%EXP%exp)^B3L%RANDOMID%^R1^T8In %TIME%m going to %WINNINGPLAYER% for $%WINNINGBID%^R1^B72%RANDOMID%^B73%RANDOMID%^B74%RANDOMID%^B75%RANDOMID%^B76%RANDOMID%^B77%RANDOMID%^B78%RANDOMID%^R1",
"players_here":"^HPlayers Here: %USERNAMES%",
"auction_horse":"^T0(2b max)^D41|AUCTION A HORSE^R1",
"list_horse":"^HIt costs you $1,000 to auction. If you wish to set a minimum bid for your horse, bid on it yourself. All auctions run for 8 minutes.<BR>Select from one of your horses to auction:^R1",
"horse_list_entry":"^I252^T3%HORSENAME%%TACKEDORNO%^D42c%RANDOMID%|AUCTION^R1",
"tacked":"[tacked!]",
"bid_raised":"Your bid raised $%AMOUNT% to $%NEWAMOUNT%.",
"top_bid":" TOP BID",
"existing_higher":" Existing Bid is Higher",
"outbid_by":"You have been outbid by %USERNAME%. High bid is now $%AMOUNT%.",
"cant_afford_bid":"You cannot afford that bid.",
"brought_horse":"You bought a horse at auction for $%MONEY%",
"no_one_brought":"No one bought your horse at auction.",
"horse_sold":"You sold a horse at auction for $%MONEY%"
},
"horse_games":{
"select_a_horse":"<BR>^LSelect a horse to compete with:^R1",
"horse_entry":"^I252^T7#%PLACING%: %HORSENAME%^BM%SWF%^R1"
@ -466,7 +487,7 @@
"horse_status":"^LYour horse %HORSENAME%: (tired %TIREDNESS%)(hunger %HUNGER%) (thirst %THIRST%)^R1",
"horse_maxed":"^I241^T9This barn cannot help this horse in any way.^R1",
"let_relax":"^I241^T8Let the horse relax for $%PRICE% ^B3B%RANDOMID%^R1",
"relax_all":"^R1^LYou could also rest all of your horses at once:^R1^I241^T7Let all the horses relax for $%PRICE% ^B3H^R1^"
"relax_all":"^LYou could also rest all of your horses at once:^R1^I241^T7Let all the horses relax for $%PRICE% ^B3H^R1^"
},
"pond":{
"header":"^LYou can go fishing at this pond!^R1",

View file

@ -6,7 +6,7 @@ namespace HISP.Game.Horse
{
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)
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)
{
RandomId = RandomID.NextRandomId(randomId);
Owner = 0;
@ -56,11 +56,25 @@ namespace HISP.Game.Horse
spoiled = loadSpoiled;
magicUsed = loadMagicUsed;
leaseTime = leaseTimer;
hidden = loadHidden;
Leaser = 0;
}
public int Leaser;
public int RandomId;
public int Owner;
public bool Hidden
{
get
{
return hidden;
}
set
{
hidden = value;
Database.SetHorseHidden(RandomId, value);
}
}
public int LeaseTime
{
get
@ -171,6 +185,7 @@ namespace HISP.Game.Horse
private string description;
private int spoiled;
private int leaseTime;
private bool hidden;
private int magicUsed;
private int autosell;
private string category;

View file

@ -324,6 +324,8 @@ namespace HISP.Game
public static string ModChatFormat;
public static string AdminChatFormat;
public static string YouWereSentToPrisionIsle;
public static string AdminCommandFormat;
public static string PlayerCommandFormat;

View file

@ -1495,6 +1495,8 @@ namespace HISP.Game
{
string message = "";
int totalPrice = 0;
foreach (HorseInstance horse in user.HorseInventory.HorseList)
{
message += Messages.FormatVetServiceHorseMeta(horse.Name, horse.BasicStats.Health, 1000);
@ -1510,7 +1512,8 @@ namespace HISP.Game
}
}
message += Messages.FormatVetApplyAllServiceMeta(totalPrice);
if (user.HorseInventory.HorseList.Length > 0)
message += Messages.FormatVetApplyAllServiceMeta(totalPrice);
message += Messages.ExitThisPlace;
message += Messages.MetaTerminator;
return message;

View file

@ -136,6 +136,7 @@ namespace HISP.Game
{
treasures.Remove(this);
Database.DeleteTreasure(this.RandomId);
GenerateTreasure();
byte[] MovementPacket = PacketBuilder.CreateMovementPacket(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);

View file

@ -456,6 +456,7 @@ namespace HISP.Player
byte[] MovementPacket = PacketBuilder.CreateMovementPacket(X, Y, CharacterId, Facing, PacketBuilder.DIRECTION_TELEPORT, true);
LoggedinClient.SendPacket(MovementPacket);
GameServer.UpdateWeather(LoggedinClient);
GameServer.Update(LoggedinClient);
}

View file

@ -41,7 +41,7 @@ namespace HISP.Server
string PoetryRooms = "CREATE TABLE PoetryRooms(poetId INT, X INT, Y INT, roomId INT)";
string SavedDrawings = "CREATE TABLE SavedDrawings(playerId INT, Drawing1 TEXT(65535), Drawing2 TEXT(65535), Drawing3 TEXT(65535))";
string DrawingRooms = "CREATE TABLE DrawingRooms(roomId INT, Drawing TEXT(65535))";
string Horses = "CREATE TABLE Horses(randomId INT, ownerId INT, leaseTime INT, leaser INT, breed INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT)";
string Horses = "CREATE TABLE Horses(randomId INT, ownerId INT, leaseTime INT, leaser INT, breed INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT, hidden TEXT(3))";
string WildHorse = "CREATE TABLE WildHorse(randomId INT, originalOwner INT, breed INT, x INT, y INT, name TEXT(128), description TEXT(1028), sex TEXT(128), color TEXT(128), health INT, shoes INT, hunger INT, thirst INT, mood INT, groom INT, tiredness INT, experience INT, speed INT, strength INT, conformation INT, agility INT, endurance INT, inteligence INT, personality INT, height INT, saddle INT, saddlepad INT, bridle INT, companion INT, timeout INT, autoSell INT, trainTimer INT, category TEXT(128), spoiled INT, magicUsed INT)";
string LastPlayer = "CREATE TABLE LastPlayer(roomId TEXT(1028), playerId INT)";
string TrackingStats = "CREATE TABLE Tracking(playerId INT, what TEXT(128), count INT)";
@ -1157,7 +1157,8 @@ namespace HISP.Server
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "UPDATE Treasure SET value=@value";
sqlCommand.CommandText = "UPDATE Treasure SET value=@value WHERE randomId=@randomId";
sqlCommand.Parameters.AddWithValue("@randomId", randomId);
sqlCommand.Parameters.AddWithValue("@value", value);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
@ -1166,6 +1167,21 @@ namespace HISP.Server
}
}
public static void DeleteTreasure(int randomId)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "DELETE FROM Treasure WHERE randomId=@randomId";
sqlCommand.Parameters.AddWithValue("@randomId", randomId);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
sqlCommand.Dispose();
}
}
public static void AddTreasure(int randomId, int x, int y, int value, string type)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
@ -1448,6 +1464,7 @@ namespace HISP.Server
int magicUsed = reader.GetInt32(33);
int autosell = reader.GetInt32(29);
int leaseTime = reader.GetInt32(2);
bool hidden = reader.GetString(33) == "YES";
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell, leaseTime);
inst.Owner = reader.GetInt32(1);
@ -1485,6 +1502,8 @@ namespace HISP.Server
inst.Equipment.Bridle = Item.GetItemById(reader.GetInt32(27));
if (!reader.IsDBNull(28))
inst.Equipment.Companion = Item.GetItemById(reader.GetInt32(28));
return inst;
}
@ -1642,6 +1661,7 @@ namespace HISP.Server
}
public static void LoadWildHorses()
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
@ -2106,6 +2126,8 @@ namespace HISP.Server
}
public static bool WeatherExists(string Area)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
@ -2236,6 +2258,22 @@ namespace HISP.Server
return trainTimer;
}
}
public static void SetHorseHidden(int randomId, bool hidden)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "UPDATE Horses SET hidden=@hidden WHERE randomId=@randomId";
sqlCommand.Parameters.AddWithValue("@hidden", hidden ? "YES" : "NO");
sqlCommand.Parameters.AddWithValue("@randomId", randomId);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
sqlCommand.Dispose();
}
}
public static void SetHorseTrainTimeout(int horseRandomId, int trainTimeout)
{
using (MySqlConnection db = new MySqlConnection(ConnectionString))

View file

@ -53,7 +53,7 @@ namespace HISP.Server
}
}
bool gotoPrision = false;
foreach(HorseInstance horse in LoggedinUser.HorseInventory.HorseList)
{
if (totalMinutesElapsed % 2 == 0)
@ -61,16 +61,21 @@ namespace HISP.Server
horse.BasicStats.Thirst--;
horse.BasicStats.Hunger--;
if (horse.BasicStats.Thirst <= 0)
if (horse.BasicStats.Thirst <= 0 && horse.BasicStats.Hunger <= 0)
{
horse.BasicStats.Health -= 5;
if(horse.BasicStats.Hunger <= 0)
{
gotoPrision = true; // Goto jail, go directly to jail, do not pass go, do not collect 200$
horse.BasicStats.Health = 10;
horse.BasicStats.Hunger = 500;
horse.BasicStats.Thirst = 500;
}
}
}
if (totalMinutesElapsed % 60 == 0)
{
horse.BasicStats.Shoes--;
horse.BasicStats.Tiredness--;
}
if(horse.Leaser > 0)
{
horse.LeaseTime--;
@ -149,7 +154,12 @@ namespace HISP.Server
}
}
if(gotoPrision)
{
byte[] sendToPrision = PacketBuilder.CreateChat(Messages.YouWereSentToPrisionIsle, PacketBuilder.CHAT_BOTTOM_RIGHT);
SendPacket(sendToPrision);
LoggedinUser.Teleport(45, 35);
}
if (totalMinutesElapsed % 2 == 0)
{
@ -162,7 +172,9 @@ namespace HISP.Server
LoggedinUser.Tiredness--;
}
if(!isDisconnecting)
if (!isDisconnecting)
minuteTimer.Change(oneMinute, oneMinute);
dcLock = false;
}

View file

@ -1395,6 +1395,7 @@ namespace HISP.Server
Messages.GlobalChatFormatForModerators = gameData.messages.chat.for_others.global_format_moderator;
Messages.DirectChatFormatForModerators = gameData.messages.chat.for_others.dm_format_moderator;
Messages.YouWereSentToPrisionIsle = gameData.messages.starved_horse;
Messages.HereChatFormat = gameData.messages.chat.for_others.here_format;
Messages.IsleChatFormat = gameData.messages.chat.for_others.isle_format;

View file

@ -5128,7 +5128,7 @@ namespace HISP.Server
sender.LoggedinUser.Money += sellPrice;
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y);
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true);
if(message == 1)
{
byte[] soldItemMessage = PacketBuilder.CreateChat(Messages.FormatSellMessage(itemInfo.Name, sellPrice), PacketBuilder.CHAT_BOTTOM_RIGHT);
@ -5306,7 +5306,7 @@ namespace HISP.Server
// Send chat message to client.
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y);
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true);
if (message == 1)
{
byte[] broughtItemMessage = PacketBuilder.CreateChat(Messages.FormatBuyMessage(itemInfo.Name, buyCost), PacketBuilder.CHAT_BOTTOM_RIGHT);
@ -5898,7 +5898,6 @@ namespace HISP.Server
if(!nearbyUser.MetaPriority)
UpdateArea(nearbyUser.LoggedinClient);
UpdateWeather(client);
UpdateUserInfo(client.LoggedinUser);
}