mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-12 07:59:48 +12:00
Finish Auctions? (finally??)
This commit is contained in:
parent
0f95462294
commit
69e7ef1baa
10 changed files with 235 additions and 69 deletions
|
@ -213,20 +213,24 @@
|
||||||
"auction":{
|
"auction":{
|
||||||
"auctions_running":"The following auctions are running:<BR>",
|
"auctions_running":"The following auctions are running:<BR>",
|
||||||
"players_here":"^HPlayers Here: %USERNAMES%",
|
"players_here":"^HPlayers Here: %USERNAMES%",
|
||||||
"auction_horse_entry":"^I252^T8%USERNAME%'s %COLOR% %BREED% %GENDER% (%EXP%exp)^B3L%RANDOMID%^R1",
|
"auction_horse_entry":"^I252^T8%USERNAME%'s %COLOR% %BREED% %GENDER% (%EXP%exp)%LOOKBUTTON%^R1",
|
||||||
"going_to":"^T8In %TIME%m going to %WINNINGPLAYER% for $%WINNINGBID%^R1^B72%AUCTIONRANDOMID%^B73%AUCTIONRANDOMID%^B74%AUCTIONRANDOMID%^B75%AUCTIONRANDOMID%^B76%RANDOMID%^B77%AUCTIONRANDOMID%^B78%AUCTIONRANDOMID%^R1",
|
"view_button":"^B3L%RANDOMID%",
|
||||||
"not_sold":"^T8Auction Ended. Horse was not sold.",
|
"going_to":"^T8In %TIME%m going to %WINNINGPLAYER% for $%WINNINGBID%^R1^B72%AUCTIONRANDOMID%^B73%AUCTIONRANDOMID%^B74%AUCTIONRANDOMID%^B75%AUCTIONRANDOMID%^B76%AUCTIONRANDOMID%^B77%AUCTIONRANDOMID%^B78%AUCTIONRANDOMID%^R1",
|
||||||
|
"not_sold":"^T8Auction Ended. Horse was not sold.^R1",
|
||||||
"sold_to":"^T8Auction Ended. %PLAYERNAME% won it for $%PRICE%^R1",
|
"sold_to":"^T8Auction Ended. %PLAYERNAME% won it for $%PRICE%^R1",
|
||||||
"auction_horse":"^T0(2b max)^D41|AUCTION A HORSE^R1",
|
"auction_horse":"^T0(2b max)^D41|AUCTION A HORSE^R1",
|
||||||
|
|
||||||
|
"one_horse_at_a_time":"Only one horse per player allowed up for auction at a time.",
|
||||||
"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",
|
"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",
|
"horse_list_entry":"^I252^T3%HORSENAME%%TACKEDORNO%^D42c%RANDOMID%|AUCTION^R1",
|
||||||
"tacked":"[tacked!]",
|
"tacked":"[tacked!]",
|
||||||
|
|
||||||
|
"max_bid":"Max auction bidding is 2b.",
|
||||||
"bid_raised":"Your bid raised $%AMOUNT% to $%NEWAMOUNT%.",
|
"bid_raised":"Your bid raised $%AMOUNT% to $%NEWAMOUNT%.",
|
||||||
"top_bid":" TOP BID",
|
"top_bid":" TOP BID",
|
||||||
"existing_higher":" Existing Bid is Higher",
|
"existing_higher":" Existing Bid is Higher",
|
||||||
|
|
||||||
|
"no_other_transaction_allowed":"No other money transactions allowed while bidding on a Horse at auction.",
|
||||||
"outbid_by":"You have been outbid by %USERNAME%. High bid is now $%AMOUNT%.",
|
"outbid_by":"You have been outbid by %USERNAME%. High bid is now $%AMOUNT%.",
|
||||||
"cant_afford_bid":"You cannot afford that bid.",
|
"cant_afford_bid":"You cannot afford that bid.",
|
||||||
"cant_afford_listing":"You cannot afford the auction fee.",
|
"cant_afford_listing":"You cannot afford the auction fee.",
|
||||||
|
|
|
@ -6,10 +6,10 @@ 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)
|
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)
|
||||||
{
|
{
|
||||||
RandomId = RandomID.NextRandomId(randomId);
|
RandomId = RandomID.NextRandomId(randomId);
|
||||||
Owner = 0;
|
owner = loadOwner;
|
||||||
if(loadName == null)
|
if(loadName == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -61,7 +61,19 @@ namespace HISP.Game.Horse
|
||||||
}
|
}
|
||||||
public int Leaser;
|
public int Leaser;
|
||||||
public int RandomId;
|
public int RandomId;
|
||||||
public int Owner;
|
public int owner;
|
||||||
|
public int Owner
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
owner = value;
|
||||||
|
Database.SetHorseOwner(RandomId, owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool Hidden
|
public bool Hidden
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,17 @@ namespace HISP.Game.Inventory
|
||||||
Database.LoadHorseInventory(this, baseUser.Id);
|
Database.LoadHorseInventory(this, baseUser.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UnHide(int randomId)
|
||||||
|
{
|
||||||
|
foreach(HorseInstance inst in horsesList)
|
||||||
|
{
|
||||||
|
if (inst.RandomId == randomId)
|
||||||
|
{
|
||||||
|
inst.Hidden = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public void AddHorse(HorseInstance horse, bool addToDb=true)
|
public void AddHorse(HorseInstance horse, bool addToDb=true)
|
||||||
{
|
{
|
||||||
if (HorseList.Length + 1 > baseUser.MaxHorses)
|
if (HorseList.Length + 1 > baseUser.MaxHorses)
|
||||||
|
@ -41,9 +52,10 @@ namespace HISP.Game.Inventory
|
||||||
horsesList.Add(horse);
|
horsesList.Add(horse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteHorse(HorseInstance horse)
|
public void DeleteHorse(HorseInstance horse, bool removeFromDb=true)
|
||||||
{
|
{
|
||||||
Database.RemoveHorse(horse.RandomId);
|
if(removeFromDb)
|
||||||
|
Database.RemoveHorse(horse.RandomId);
|
||||||
horsesList.Remove(horse);
|
horsesList.Remove(horse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,10 @@ namespace HISP.Game
|
||||||
public static string AuctionListHorse;
|
public static string AuctionListHorse;
|
||||||
|
|
||||||
public static string AuctionHorseListEntryFormat;
|
public static string AuctionHorseListEntryFormat;
|
||||||
|
public static string AuctionHorseViewButton;
|
||||||
public static string AuctionHorseIsTacked;
|
public static string AuctionHorseIsTacked;
|
||||||
|
|
||||||
|
public static string AuctionBidMax;
|
||||||
public static string AuctionBidRaisedFormat;
|
public static string AuctionBidRaisedFormat;
|
||||||
public static string AuctionTopBid;
|
public static string AuctionTopBid;
|
||||||
public static string AuctionExistingBidHigher;
|
public static string AuctionExistingBidHigher;
|
||||||
|
@ -31,6 +33,7 @@ namespace HISP.Game
|
||||||
public static string AuctionYouveBeenOutbidFormat;
|
public static string AuctionYouveBeenOutbidFormat;
|
||||||
public static string AuctionCantAffordBid;
|
public static string AuctionCantAffordBid;
|
||||||
public static string AuctionCantAffordAuctionFee;
|
public static string AuctionCantAffordAuctionFee;
|
||||||
|
public static string AuctionOneHorsePerPlayer;
|
||||||
|
|
||||||
public static string AuctionYouBroughtAHorseFormat;
|
public static string AuctionYouBroughtAHorseFormat;
|
||||||
public static string AuctionNoHorseBrought;
|
public static string AuctionNoHorseBrought;
|
||||||
|
@ -41,6 +44,8 @@ namespace HISP.Game
|
||||||
public static string AuctionNotSold;
|
public static string AuctionNotSold;
|
||||||
public static string AuctionGoingToFormat;
|
public static string AuctionGoingToFormat;
|
||||||
|
|
||||||
|
public static string AuctionNoOtherTransactionAllowed;
|
||||||
|
|
||||||
// Warp Command
|
// Warp Command
|
||||||
public static string SuccessfullyWarpedToLocation;
|
public static string SuccessfullyWarpedToLocation;
|
||||||
public static string SuccessfullyWarpedToPlayer;
|
public static string SuccessfullyWarpedToPlayer;
|
||||||
|
@ -894,7 +899,7 @@ namespace HISP.Game
|
||||||
|
|
||||||
public static string FormatAuctionSoldTo(string playerName, int money)
|
public static string FormatAuctionSoldTo(string playerName, int money)
|
||||||
{
|
{
|
||||||
return AuctionSoldToFormat.Replace("%PLAYERNAME%", playerName).Replace("%MONEY%", money.ToString("N0", CultureInfo.InvariantCulture));
|
return AuctionSoldToFormat.Replace("%PLAYERNAME%", playerName).Replace("%PRICE%", money.ToString("N0", CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
public static string FormatAuctionGoingTo(int timeRemaining, string winningPlayer, int winningBid, int auctionRandomId)
|
public static string FormatAuctionGoingTo(int timeRemaining, string winningPlayer, int winningBid, int auctionRandomId)
|
||||||
{
|
{
|
||||||
|
@ -920,11 +925,15 @@ namespace HISP.Game
|
||||||
{
|
{
|
||||||
return AuctionHorseListEntryFormat.Replace("%HORSENAME%", horseName).Replace("%TACKEDORNO%", tacked ? Messages.AuctionHorseIsTacked : "").Replace("%RANDOMID%", randomId.ToString());
|
return AuctionHorseListEntryFormat.Replace("%HORSENAME%", horseName).Replace("%TACKEDORNO%", tacked ? Messages.AuctionHorseIsTacked : "").Replace("%RANDOMID%", randomId.ToString());
|
||||||
}
|
}
|
||||||
public static string FormatAuctionHorseEntry(string username, string color, string breedName, string gender, int experience, int horseRandomId)
|
public static string FormatAuctionHorseEntry(string username, string color, string breedName, string gender, int experience, string lookButton)
|
||||||
{
|
{
|
||||||
return AuctionHorseEntryFormat.Replace("%USERNAME%", username).Replace("%COLOR%", color).Replace("%BREED%", breedName).Replace("%GENDER%", gender).Replace("%EXP%", experience.ToString("N0", CultureInfo.InvariantCulture)).Replace("%RANDOMID%", horseRandomId.ToString());
|
return AuctionHorseEntryFormat.Replace("%USERNAME%", username).Replace("%COLOR%", color).Replace("%BREED%", breedName).Replace("%GENDER%", gender).Replace("%EXP%", experience.ToString("N0", CultureInfo.InvariantCulture)).Replace("%LOOKBUTTON%", lookButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static string FormatAuctionViewHorseButton(int randomId)
|
||||||
|
{
|
||||||
|
return AuctionHorseViewButton.Replace("%RANDOMID%", randomId.ToString());
|
||||||
|
}
|
||||||
public static string FormatAuctionPlayersHere(string usernames)
|
public static string FormatAuctionPlayersHere(string usernames)
|
||||||
{
|
{
|
||||||
return AuctionPlayersHereFormat.Replace("%USERNAMES%", usernames);
|
return AuctionPlayersHereFormat.Replace("%USERNAMES%", usernames);
|
||||||
|
|
|
@ -1469,7 +1469,7 @@ namespace HISP.Game
|
||||||
message += Messages.AuctionsRunning;
|
message += Messages.AuctionsRunning;
|
||||||
foreach(Auction.AuctionEntry entry in auction.AuctionEntries.ToArray())
|
foreach(Auction.AuctionEntry entry in auction.AuctionEntries.ToArray())
|
||||||
{
|
{
|
||||||
message += Messages.FormatAuctionHorseEntry(Database.GetUsername(entry.OwnerId), entry.Horse.Color, entry.Horse.Breed.Name, entry.Horse.Gender, entry.Horse.BasicStats.Experience, entry.Horse.RandomId);
|
message += Messages.FormatAuctionHorseEntry(Database.GetUsername(entry.OwnerId), entry.Horse.Color, entry.Horse.Breed.Name, entry.Horse.Gender, entry.Horse.BasicStats.Experience, entry.Completed ? "" : Messages.FormatAuctionViewHorseButton(entry.Horse.RandomId));
|
||||||
if (!entry.Completed)
|
if (!entry.Completed)
|
||||||
message += Messages.FormatAuctionGoingTo(entry.TimeRemaining, Database.GetUsername(entry.HighestBidder), entry.HighestBid, entry.RandomId);
|
message += Messages.FormatAuctionGoingTo(entry.TimeRemaining, Database.GetUsername(entry.HighestBidder), entry.HighestBid, entry.RandomId);
|
||||||
else
|
else
|
||||||
|
|
|
@ -18,19 +18,44 @@ namespace HISP.Game.Services
|
||||||
|
|
||||||
public class AuctionBid
|
public class AuctionBid
|
||||||
{
|
{
|
||||||
|
public const int MAX_BID = 2000000000;
|
||||||
public User BidUser;
|
public User BidUser;
|
||||||
public AuctionEntry AuctionItem;
|
public AuctionEntry AuctionItem;
|
||||||
public int BidAmount;
|
public int BidAmount;
|
||||||
|
|
||||||
|
|
||||||
public void PlaceBid(int bidAmount)
|
public void PlaceBid(int bidAmount)
|
||||||
{
|
{
|
||||||
string yourBidRaisedTo = Messages.FormatAuctionBidRaised(BidAmount, BidAmount + bidAmount);
|
string yourBidRaisedTo = Messages.FormatAuctionBidRaised(BidAmount, BidAmount + bidAmount);
|
||||||
|
|
||||||
|
if(BidAmount >= MAX_BID)
|
||||||
|
{
|
||||||
|
byte[] maxBidReached = PacketBuilder.CreateChat(Messages.AuctionBidMax, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
BidUser.LoggedinClient.SendPacket(maxBidReached);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BidAmount + bidAmount > BidUser.Money && (AuctionItem.OwnerId != BidUser.Id))
|
||||||
|
{
|
||||||
|
|
||||||
|
byte[] cantAffordBid = PacketBuilder.CreateChat(Messages.AuctionCantAffordBid, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
BidUser.LoggedinClient.SendPacket(cantAffordBid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BidAmount += bidAmount;
|
BidAmount += bidAmount;
|
||||||
|
if(BidAmount > MAX_BID) // no u
|
||||||
|
{
|
||||||
|
yourBidRaisedTo = Messages.FormatAuctionBidRaised(BidAmount, MAX_BID);
|
||||||
|
BidAmount = MAX_BID;
|
||||||
|
}
|
||||||
|
|
||||||
if (BidAmount > AuctionItem.HighestBid)
|
if (BidAmount > AuctionItem.HighestBid)
|
||||||
{
|
{
|
||||||
AuctionItem.HighestBid += BidAmount;
|
int oldBid = AuctionItem.HighestBid;
|
||||||
if(AuctionItem.HighestBidder != BidUser.Id)
|
AuctionItem.HighestBid = BidAmount;
|
||||||
|
if(AuctionItem.HighestBidder != BidUser.Id && oldBid > 0)
|
||||||
{
|
{
|
||||||
if (GameServer.IsUserOnline(AuctionItem.HighestBidder))
|
if (GameServer.IsUserOnline(AuctionItem.HighestBidder))
|
||||||
{
|
{
|
||||||
|
@ -42,7 +67,6 @@ namespace HISP.Game.Services
|
||||||
|
|
||||||
AuctionItem.HighestBidder = BidUser.Id;
|
AuctionItem.HighestBidder = BidUser.Id;
|
||||||
yourBidRaisedTo += Messages.AuctionTopBid;
|
yourBidRaisedTo += Messages.AuctionTopBid;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -51,6 +75,7 @@ namespace HISP.Game.Services
|
||||||
|
|
||||||
byte[] bidPlacedMsg = PacketBuilder.CreateChat(yourBidRaisedTo, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] bidPlacedMsg = PacketBuilder.CreateChat(yourBidRaisedTo, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
BidUser.LoggedinClient.SendPacket(bidPlacedMsg);
|
BidUser.LoggedinClient.SendPacket(bidPlacedMsg);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class AuctionEntry
|
public class AuctionEntry
|
||||||
|
@ -65,7 +90,8 @@ namespace HISP.Game.Services
|
||||||
|
|
||||||
public HorseInstance Horse;
|
public HorseInstance Horse;
|
||||||
public int OwnerId;
|
public int OwnerId;
|
||||||
|
public List<AuctionBid> Bidders = new List<AuctionBid>();
|
||||||
|
|
||||||
public bool Completed
|
public bool Completed
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -77,26 +103,42 @@ namespace HISP.Game.Services
|
||||||
done = value;
|
done = value;
|
||||||
if(done)
|
if(done)
|
||||||
{
|
{
|
||||||
Horse.Owner = HighestBidder;
|
Horse.Owner = highestBidder;
|
||||||
Horse.Hidden = false;
|
Horse.Hidden = false;
|
||||||
|
|
||||||
|
if(OwnerId == highestBidder)
|
||||||
|
{
|
||||||
|
if(GameServer.IsUserOnline(OwnerId))
|
||||||
|
{
|
||||||
|
User auctionRunner = GameServer.GetUserById(highestBidder);
|
||||||
|
auctionRunner.HorseInventory.UnHide(Horse.RandomId);
|
||||||
|
byte[] notSold = PacketBuilder.CreateChat(Messages.AuctionNoHorseBrought, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
auctionRunner.LoggedinClient.SendPacket(notSold);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(GameServer.IsUserOnline(highestBidder))
|
if(GameServer.IsUserOnline(highestBidder))
|
||||||
{
|
{
|
||||||
User userWon = GameServer.GetUserById(highestBidder);
|
User userWon = GameServer.GetUserById(highestBidder);
|
||||||
byte[] wonAuction = PacketBuilder.CreateChat(Messages.FormatAuctionBroughtHorse(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] wonAuction = PacketBuilder.CreateChat(Messages.FormatAuctionBroughtHorse(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
userWon.LoggedinClient.SendPacket(wonAuction);
|
userWon.LoggedinClient.SendPacket(wonAuction);
|
||||||
userWon.Money -= highestBid;
|
userWon.Money -= highestBid;
|
||||||
|
userWon.HorseInventory.AddHorse(Horse, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Database.SetPlayerMoney(Database.GetPlayerMoney(highestBidder) - highestBid, highestBidder);
|
Database.SetPlayerMoney(Database.GetPlayerMoney(highestBidder) - highestBid, highestBidder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GameServer.IsUserOnline(OwnerId))
|
if(GameServer.IsUserOnline(OwnerId))
|
||||||
{
|
{
|
||||||
User userSold = GameServer.GetUserById(highestBidder);
|
User userSold = GameServer.GetUserById(OwnerId);
|
||||||
byte[] horseSold = PacketBuilder.CreateChat(Messages.FormatAuctionHorseSold(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] horseSold = PacketBuilder.CreateChat(Messages.FormatAuctionHorseSold(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
userSold.LoggedinClient.SendPacket(horseSold);
|
userSold.LoggedinClient.SendPacket(horseSold);
|
||||||
userSold.Money += highestBid;
|
userSold.Money += highestBid;
|
||||||
|
userSold.HorseInventory.DeleteHorse(Horse, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -104,6 +146,13 @@ namespace HISP.Game.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Database.SetAuctionDone(RandomId, done);
|
Database.SetAuctionDone(RandomId, done);
|
||||||
|
|
||||||
|
foreach(AuctionBid bid in Bidders) // Cleanup some stuffs
|
||||||
|
{
|
||||||
|
if(bid.BidUser != null)
|
||||||
|
bid.BidUser.Bids.Remove(bid);
|
||||||
|
}
|
||||||
|
Bidders.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +164,7 @@ namespace HISP.Game.Services
|
||||||
if (bid.AuctionItem.RandomId == this.RandomId)
|
if (bid.AuctionItem.RandomId == this.RandomId)
|
||||||
{
|
{
|
||||||
bid.PlaceBid(bidAmount);
|
bid.PlaceBid(bidAmount);
|
||||||
|
auctionRoomPlacedIn.UpdateAuctionRoom();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,11 +172,17 @@ namespace HISP.Game.Services
|
||||||
AuctionBid newBid = new AuctionBid();
|
AuctionBid newBid = new AuctionBid();
|
||||||
newBid.AuctionItem = this;
|
newBid.AuctionItem = this;
|
||||||
newBid.BidUser = bidder;
|
newBid.BidUser = bidder;
|
||||||
newBid.BidAmount = 0;
|
if (HighestBidder == bidder.Id)
|
||||||
|
newBid.BidAmount = HighestBid;
|
||||||
|
else
|
||||||
|
newBid.BidAmount = 0;
|
||||||
newBid.PlaceBid(bidAmount);
|
newBid.PlaceBid(bidAmount);
|
||||||
bidder.Bids.Add(newBid);
|
bidder.Bids.Add(newBid);
|
||||||
|
Bidders.Add(newBid);
|
||||||
|
auctionRoomPlacedIn.UpdateAuctionRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Auction auctionRoomPlacedIn;
|
||||||
public int RandomId;
|
public int RandomId;
|
||||||
private int timeRemaining;
|
private int timeRemaining;
|
||||||
private bool done;
|
private bool done;
|
||||||
|
@ -200,6 +256,7 @@ namespace HISP.Game.Services
|
||||||
|
|
||||||
public void AddEntry(AuctionEntry entry)
|
public void AddEntry(AuctionEntry entry)
|
||||||
{
|
{
|
||||||
|
entry.auctionRoomPlacedIn = this;
|
||||||
Database.AddAuctionRoom(entry, this.RoomId);
|
Database.AddAuctionRoom(entry, this.RoomId);
|
||||||
AuctionEntries.Add(entry);
|
AuctionEntries.Add(entry);
|
||||||
|
|
||||||
|
@ -232,6 +289,15 @@ namespace HISP.Game.Services
|
||||||
throw new KeyNotFoundException("Auction Entry with RandomID: " + randomId + " NOT FOUND");
|
throw new KeyNotFoundException("Auction Entry with RandomID: " + randomId + " NOT FOUND");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasUserPlacedAuctionAllready(User user)
|
||||||
|
{
|
||||||
|
foreach(AuctionEntry entry in AuctionEntries)
|
||||||
|
{
|
||||||
|
if (entry.OwnerId == user.Id)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public static Auction GetAuctionRoomById(int roomId)
|
public static Auction GetAuctionRoomById(int roomId)
|
||||||
{
|
{
|
||||||
foreach(Auction auction in AuctionRooms)
|
foreach(Auction auction in AuctionRooms)
|
||||||
|
|
|
@ -555,6 +555,29 @@ namespace HISP.Player
|
||||||
LoggedinClient = baseClient;
|
LoggedinClient = baseClient;
|
||||||
Inventory = new PlayerInventory(this);
|
Inventory = new PlayerInventory(this);
|
||||||
Quests = new PlayerQuests(this);
|
Quests = new PlayerQuests(this);
|
||||||
|
|
||||||
|
// Get auctions
|
||||||
|
foreach(Auction auction in Auction.AuctionRooms)
|
||||||
|
{
|
||||||
|
foreach(Auction.AuctionEntry auctionEntry in auction.AuctionEntries)
|
||||||
|
{
|
||||||
|
if(auctionEntry.HighestBidder == this.Id)
|
||||||
|
{
|
||||||
|
Auction.AuctionBid bid = new Auction.AuctionBid();
|
||||||
|
bid.BidUser = this;
|
||||||
|
bid.BidAmount = auctionEntry.HighestBid;
|
||||||
|
bid.AuctionItem = auctionEntry;
|
||||||
|
|
||||||
|
if(bid.BidAmount > 0)
|
||||||
|
{
|
||||||
|
Bids.Add(bid);
|
||||||
|
auctionEntry.Bidders.Add(bid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1481,9 +1481,10 @@ namespace HISP.Server
|
||||||
int autosell = reader.GetInt32(29);
|
int autosell = reader.GetInt32(29);
|
||||||
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);
|
||||||
|
|
||||||
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell, leaseTime);
|
HorseInstance inst = new HorseInstance(horseBreed, randomId, name, description, spoiled, category, magicUsed, autosell, leaseTime, hidden, owner);
|
||||||
inst.Owner = reader.GetInt32(1);
|
|
||||||
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);
|
inst.Color = reader.GetString(8);
|
||||||
|
@ -1568,6 +1569,7 @@ namespace HISP.Server
|
||||||
auctionEntry.Horse = GetPlayerHorse(horseId);
|
auctionEntry.Horse = GetPlayerHorse(horseId);
|
||||||
auctionEntry.OwnerId = reader.GetInt32(3);
|
auctionEntry.OwnerId = reader.GetInt32(3);
|
||||||
auctionEntry.Completed = reader.GetString(7) == "YES";
|
auctionEntry.Completed = reader.GetString(7) == "YES";
|
||||||
|
auctionEntry.auctionRoomPlacedIn = auction;
|
||||||
auction.AuctionEntries.Add(auctionEntry);
|
auction.AuctionEntries.Add(auctionEntry);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2402,6 +2404,21 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void SetHorseOwner(int randomId, int owner)
|
||||||
|
{
|
||||||
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
MySqlCommand sqlCommand = db.CreateCommand();
|
||||||
|
sqlCommand.CommandText = "UPDATE Horses SET ownerId=@owner WHERE randomId=@randomId";
|
||||||
|
sqlCommand.Parameters.AddWithValue("@owner", owner);
|
||||||
|
sqlCommand.Parameters.AddWithValue("@randomId", randomId);
|
||||||
|
sqlCommand.Prepare();
|
||||||
|
sqlCommand.ExecuteNonQuery();
|
||||||
|
sqlCommand.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void SetHorseHidden(int randomId, bool hidden)
|
public static void SetHorseHidden(int randomId, bool hidden)
|
||||||
{
|
{
|
||||||
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
using (MySqlConnection db = new MySqlConnection(ConnectionString))
|
||||||
|
|
|
@ -15,10 +15,10 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
public class GameDataJson
|
public class GameDataJson
|
||||||
{
|
{
|
||||||
|
|
||||||
public static void ReadGamedata()
|
public static void ReadGamedata()
|
||||||
{
|
{
|
||||||
if(!File.Exists(ConfigReader.GameDataFile))
|
if (!File.Exists(ConfigReader.GameDataFile))
|
||||||
{
|
{
|
||||||
Logger.ErrorPrint("Game Data JSON File: " + ConfigReader.GameDataFile + " Does not exist!");
|
Logger.ErrorPrint("Game Data JSON File: " + ConfigReader.GameDataFile + " Does not exist!");
|
||||||
throw new FileNotFoundException(ConfigReader.GameDataFile + " Not found :(");
|
throw new FileNotFoundException(ConfigReader.GameDataFile + " Not found :(");
|
||||||
|
@ -76,7 +76,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
// Register Isles
|
// Register Isles
|
||||||
int totalIsles = gameData.places.isles.Count;
|
int totalIsles = gameData.places.isles.Count;
|
||||||
for(int i = 0; i < totalIsles; i++)
|
for (int i = 0; i < totalIsles; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
World.Isle isle = new World.Isle();
|
World.Isle isle = new World.Isle();
|
||||||
|
@ -92,7 +92,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalWaypoints = gameData.places.waypoints.Count;
|
int totalWaypoints = gameData.places.waypoints.Count;
|
||||||
for(int i = 0; i < totalWaypoints; i++)
|
for (int i = 0; i < totalWaypoints; i++)
|
||||||
{
|
{
|
||||||
World.Waypoint waypoint = new World.Waypoint();
|
World.Waypoint waypoint = new World.Waypoint();
|
||||||
waypoint.Name = gameData.places.waypoints[i].name;
|
waypoint.Name = gameData.places.waypoints[i].name;
|
||||||
|
@ -101,7 +101,7 @@ namespace HISP.Server
|
||||||
waypoint.Type = gameData.places.waypoints[i].type;
|
waypoint.Type = gameData.places.waypoints[i].type;
|
||||||
waypoint.Description = gameData.places.waypoints[i].description;
|
waypoint.Description = gameData.places.waypoints[i].description;
|
||||||
waypoint.WeatherTypesAvalible = gameData.places.waypoints[i].weather_avalible.ToObject<string[]>();
|
waypoint.WeatherTypesAvalible = gameData.places.waypoints[i].weather_avalible.ToObject<string[]>();
|
||||||
Logger.DebugPrint("Registered Waypoint: "+waypoint.PosX.ToString()+", "+waypoint.PosY.ToString() +" TYPE: "+waypoint.Type);
|
Logger.DebugPrint("Registered Waypoint: " + waypoint.PosX.ToString() + ", " + waypoint.PosY.ToString() + " TYPE: " + waypoint.Type);
|
||||||
World.Waypoints.Add(waypoint);
|
World.Waypoints.Add(waypoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,9 +116,9 @@ namespace HISP.Server
|
||||||
specialTile.Title = gameData.places.special_tiles[i].title;
|
specialTile.Title = gameData.places.special_tiles[i].title;
|
||||||
specialTile.Description = gameData.places.special_tiles[i].description;
|
specialTile.Description = gameData.places.special_tiles[i].description;
|
||||||
specialTile.Code = gameData.places.special_tiles[i].code;
|
specialTile.Code = gameData.places.special_tiles[i].code;
|
||||||
if(gameData.places.special_tiles[i].exit_x != null)
|
if (gameData.places.special_tiles[i].exit_x != null)
|
||||||
specialTile.ExitX = gameData.places.special_tiles[i].exit_x;
|
specialTile.ExitX = gameData.places.special_tiles[i].exit_x;
|
||||||
if(gameData.places.special_tiles[i].exit_x != null)
|
if (gameData.places.special_tiles[i].exit_x != null)
|
||||||
specialTile.ExitY = gameData.places.special_tiles[i].exit_y;
|
specialTile.ExitY = gameData.places.special_tiles[i].exit_y;
|
||||||
specialTile.AutoplaySwf = gameData.places.special_tiles[i].autoplay_swf;
|
specialTile.AutoplaySwf = gameData.places.special_tiles[i].autoplay_swf;
|
||||||
specialTile.TypeFlag = gameData.places.special_tiles[i].type_flag;
|
specialTile.TypeFlag = gameData.places.special_tiles[i].type_flag;
|
||||||
|
@ -129,7 +129,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
// Register Filter Reasons
|
// Register Filter Reasons
|
||||||
int totalReasons = gameData.messages.chat.reason_messages.Count;
|
int totalReasons = gameData.messages.chat.reason_messages.Count;
|
||||||
for(int i = 0; i < totalReasons; i++)
|
for (int i = 0; i < totalReasons; i++)
|
||||||
{
|
{
|
||||||
Chat.Reason reason = new Chat.Reason();
|
Chat.Reason reason = new Chat.Reason();
|
||||||
reason.Name = gameData.messages.chat.reason_messages[i].name;
|
reason.Name = gameData.messages.chat.reason_messages[i].name;
|
||||||
|
@ -141,7 +141,7 @@ namespace HISP.Server
|
||||||
// Register Filters
|
// Register Filters
|
||||||
|
|
||||||
int totalFilters = gameData.messages.chat.filter.Count;
|
int totalFilters = gameData.messages.chat.filter.Count;
|
||||||
for(int i = 0; i < totalFilters; i++)
|
for (int i = 0; i < totalFilters; i++)
|
||||||
{
|
{
|
||||||
Chat.Filter filter = new Chat.Filter();
|
Chat.Filter filter = new Chat.Filter();
|
||||||
filter.FilteredWord = gameData.messages.chat.filter[i].word;
|
filter.FilteredWord = gameData.messages.chat.filter[i].word;
|
||||||
|
@ -149,7 +149,7 @@ namespace HISP.Server
|
||||||
filter.Reason = Chat.GetReason((string)gameData.messages.chat.filter[i].reason_type);
|
filter.Reason = Chat.GetReason((string)gameData.messages.chat.filter[i].reason_type);
|
||||||
Chat.FilteredWords.Add(filter);
|
Chat.FilteredWords.Add(filter);
|
||||||
|
|
||||||
Logger.DebugPrint("Registered Filtered Word: " + filter.FilteredWord + " With reason: "+filter.Reason.Name+" (Matching all: " + filter.MatchAll + ")");
|
Logger.DebugPrint("Registered Filtered Word: " + filter.FilteredWord + " With reason: " + filter.Reason.Name + " (Matching all: " + filter.MatchAll + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register Corrections
|
// Register Corrections
|
||||||
|
@ -161,7 +161,7 @@ namespace HISP.Server
|
||||||
correction.ReplacedWord = gameData.messages.chat.correct[i].new_word;
|
correction.ReplacedWord = gameData.messages.chat.correct[i].new_word;
|
||||||
Chat.CorrectedWords.Add(correction);
|
Chat.CorrectedWords.Add(correction);
|
||||||
|
|
||||||
Logger.DebugPrint("Registered Word Correction: " + correction.FilteredWord + " to "+correction.ReplacedWord);
|
Logger.DebugPrint("Registered Word Correction: " + correction.FilteredWord + " to " + correction.ReplacedWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register Transports
|
// Register Transports
|
||||||
|
@ -190,7 +190,7 @@ namespace HISP.Server
|
||||||
transportPlace.LocationTitle = gameData.transport.transport_places[i].place_title;
|
transportPlace.LocationTitle = gameData.transport.transport_places[i].place_title;
|
||||||
Transport.TransportLocations.Add(transportPlace);
|
Transport.TransportLocations.Add(transportPlace);
|
||||||
|
|
||||||
Logger.DebugPrint("Registered Transport Location: "+ transportPlace.LocationTitle+" To Goto X: " + transportPlace.GotoX + " Y: " + transportPlace.GotoY);
|
Logger.DebugPrint("Registered Transport Location: " + transportPlace.LocationTitle + " To Goto X: " + transportPlace.GotoX + " Y: " + transportPlace.GotoY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register Items
|
// Register Items
|
||||||
|
@ -212,7 +212,7 @@ namespace HISP.Server
|
||||||
int effectsCount = gameData.item.item_list[i].effects.Count;
|
int effectsCount = gameData.item.item_list[i].effects.Count;
|
||||||
|
|
||||||
Item.Effects[] effectsList = new Item.Effects[effectsCount];
|
Item.Effects[] effectsList = new Item.Effects[effectsCount];
|
||||||
for(int ii = 0; ii < effectsCount; ii++)
|
for (int ii = 0; ii < effectsCount; ii++)
|
||||||
{
|
{
|
||||||
effectsList[ii] = new Item.Effects();
|
effectsList[ii] = new Item.Effects();
|
||||||
effectsList[ii].EffectsWhat = gameData.item.item_list[i].effects[ii].effect_what;
|
effectsList[ii].EffectsWhat = gameData.item.item_list[i].effects[ii].effect_what;
|
||||||
|
@ -227,12 +227,12 @@ namespace HISP.Server
|
||||||
item.SpawnParamaters.SpawnOnSpecialTile = gameData.item.item_list[i].spawn_parameters.spawn_on_special_tile;
|
item.SpawnParamaters.SpawnOnSpecialTile = gameData.item.item_list[i].spawn_parameters.spawn_on_special_tile;
|
||||||
item.SpawnParamaters.SpawnNearSpecialTile = gameData.item.item_list[i].spawn_parameters.spawn_near_special_tile;
|
item.SpawnParamaters.SpawnNearSpecialTile = gameData.item.item_list[i].spawn_parameters.spawn_near_special_tile;
|
||||||
|
|
||||||
Logger.DebugPrint("Registered Item ID: " + item.Id + " Name: " + item.Name + " spawns on: "+item.SpawnParamaters.SpawnOnTileType);
|
Logger.DebugPrint("Registered Item ID: " + item.Id + " Name: " + item.Name + " spawns on: " + item.SpawnParamaters.SpawnOnTileType);
|
||||||
Item.Items.Add(item);
|
Item.Items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalThrowable = gameData.item.throwable.Count;
|
int totalThrowable = gameData.item.throwable.Count;
|
||||||
for(int i = 0; i < totalThrowable; i++)
|
for (int i = 0; i < totalThrowable; i++)
|
||||||
{
|
{
|
||||||
Item.ThrowableItem throwableItem = new Item.ThrowableItem();
|
Item.ThrowableItem throwableItem = new Item.ThrowableItem();
|
||||||
throwableItem.Id = gameData.item.throwable[i].id;
|
throwableItem.Id = gameData.item.throwable[i].id;
|
||||||
|
@ -243,7 +243,7 @@ namespace HISP.Server
|
||||||
// Register NPCs
|
// Register NPCs
|
||||||
Logger.DebugPrint("Registering NPCS: ");
|
Logger.DebugPrint("Registering NPCS: ");
|
||||||
int totalNpcs = gameData.npc_list.Count;
|
int totalNpcs = gameData.npc_list.Count;
|
||||||
for(int i = 0; i < totalNpcs; i++)
|
for (int i = 0; i < totalNpcs; i++)
|
||||||
{
|
{
|
||||||
int id = gameData.npc_list[i].id;
|
int id = gameData.npc_list[i].id;
|
||||||
int x = gameData.npc_list[i].x;
|
int x = gameData.npc_list[i].x;
|
||||||
|
@ -259,12 +259,12 @@ namespace HISP.Server
|
||||||
udlrStartY = gameData.npc_list[i].udlr_start_y;
|
udlrStartY = gameData.npc_list[i].udlr_start_y;
|
||||||
|
|
||||||
Npc.NpcEntry npcEntry = new Npc.NpcEntry(id, x, y, moves, udlrStartX, udlrStartY);
|
Npc.NpcEntry npcEntry = new Npc.NpcEntry(id, x, y, moves, udlrStartX, udlrStartY);
|
||||||
|
|
||||||
npcEntry.Name = gameData.npc_list[i].name;
|
npcEntry.Name = gameData.npc_list[i].name;
|
||||||
npcEntry.AdminDescription = gameData.npc_list[i].admin_description;
|
npcEntry.AdminDescription = gameData.npc_list[i].admin_description;
|
||||||
npcEntry.ShortDescription = gameData.npc_list[i].short_description;
|
npcEntry.ShortDescription = gameData.npc_list[i].short_description;
|
||||||
npcEntry.LongDescription = gameData.npc_list[i].long_description;
|
npcEntry.LongDescription = gameData.npc_list[i].long_description;
|
||||||
|
|
||||||
|
|
||||||
if (gameData.npc_list[i].stay_on != null)
|
if (gameData.npc_list[i].stay_on != null)
|
||||||
npcEntry.StayOn = gameData.npc_list[i].stay_on;
|
npcEntry.StayOn = gameData.npc_list[i].stay_on;
|
||||||
|
@ -320,12 +320,12 @@ namespace HISP.Server
|
||||||
|
|
||||||
Logger.DebugPrint("Registering Quests: ");
|
Logger.DebugPrint("Registering Quests: ");
|
||||||
int totalQuests = gameData.quest_list.Count;
|
int totalQuests = gameData.quest_list.Count;
|
||||||
for(int i = 0; i < totalQuests; i++)
|
for (int i = 0; i < totalQuests; i++)
|
||||||
{
|
{
|
||||||
Quest.QuestEntry quest = new Quest.QuestEntry();
|
Quest.QuestEntry quest = new Quest.QuestEntry();
|
||||||
quest.Id = gameData.quest_list[i].id;
|
quest.Id = gameData.quest_list[i].id;
|
||||||
quest.Notes = gameData.quest_list[i].notes;
|
quest.Notes = gameData.quest_list[i].notes;
|
||||||
if(gameData.quest_list[i].title != null)
|
if (gameData.quest_list[i].title != null)
|
||||||
quest.Title = gameData.quest_list[i].title;
|
quest.Title = gameData.quest_list[i].title;
|
||||||
quest.RequiresQuestIdCompleteStatsMenu = gameData.quest_list[i].requires_questid_statsmenu.ToObject<int[]>();
|
quest.RequiresQuestIdCompleteStatsMenu = gameData.quest_list[i].requires_questid_statsmenu.ToObject<int[]>();
|
||||||
if (gameData.quest_list[i].alt_activation != null)
|
if (gameData.quest_list[i].alt_activation != null)
|
||||||
|
@ -341,7 +341,7 @@ namespace HISP.Server
|
||||||
int itemsRequiredCount = gameData.quest_list[i].items_required.Count;
|
int itemsRequiredCount = gameData.quest_list[i].items_required.Count;
|
||||||
|
|
||||||
List<Quest.QuestItemInfo> itmInfo = new List<Quest.QuestItemInfo>();
|
List<Quest.QuestItemInfo> itmInfo = new List<Quest.QuestItemInfo>();
|
||||||
for(int ii = 0; ii < itemsRequiredCount; ii++)
|
for (int ii = 0; ii < itemsRequiredCount; ii++)
|
||||||
{
|
{
|
||||||
Quest.QuestItemInfo itemInfo = new Quest.QuestItemInfo();
|
Quest.QuestItemInfo itemInfo = new Quest.QuestItemInfo();
|
||||||
itemInfo.ItemId = gameData.quest_list[i].items_required[ii].item_id;
|
itemInfo.ItemId = gameData.quest_list[i].items_required[ii].item_id;
|
||||||
|
@ -349,7 +349,7 @@ namespace HISP.Server
|
||||||
itmInfo.Add(itemInfo);
|
itmInfo.Add(itemInfo);
|
||||||
}
|
}
|
||||||
quest.ItemsRequired = itmInfo.ToArray();
|
quest.ItemsRequired = itmInfo.ToArray();
|
||||||
if(gameData.quest_list[i].fail_npc_chat != null)
|
if (gameData.quest_list[i].fail_npc_chat != null)
|
||||||
quest.FailNpcChat = gameData.quest_list[i].fail_npc_chat;
|
quest.FailNpcChat = gameData.quest_list[i].fail_npc_chat;
|
||||||
quest.MoneyEarned = gameData.quest_list[i].money_gained;
|
quest.MoneyEarned = gameData.quest_list[i].money_gained;
|
||||||
|
|
||||||
|
@ -367,13 +367,13 @@ namespace HISP.Server
|
||||||
quest.QuestPointsEarned = gameData.quest_list[i].quest_points;
|
quest.QuestPointsEarned = gameData.quest_list[i].quest_points;
|
||||||
quest.SetNpcChatpoint = gameData.quest_list[i].set_npc_chatpoint;
|
quest.SetNpcChatpoint = gameData.quest_list[i].set_npc_chatpoint;
|
||||||
quest.GotoNpcChatpoint = gameData.quest_list[i].goto_npc_chatpoint;
|
quest.GotoNpcChatpoint = gameData.quest_list[i].goto_npc_chatpoint;
|
||||||
if(gameData.quest_list[i].warp_x != null)
|
if (gameData.quest_list[i].warp_x != null)
|
||||||
quest.WarpX = gameData.quest_list[i].warp_x;
|
quest.WarpX = gameData.quest_list[i].warp_x;
|
||||||
if(gameData.quest_list[i].warp_y != null)
|
if (gameData.quest_list[i].warp_y != null)
|
||||||
quest.WarpY = gameData.quest_list[i].warp_y;
|
quest.WarpY = gameData.quest_list[i].warp_y;
|
||||||
if(gameData.quest_list[i].success_message != null)
|
if (gameData.quest_list[i].success_message != null)
|
||||||
quest.SuccessMessage = gameData.quest_list[i].success_message;
|
quest.SuccessMessage = gameData.quest_list[i].success_message;
|
||||||
if(gameData.quest_list[i].success_npc_chat != null)
|
if (gameData.quest_list[i].success_npc_chat != null)
|
||||||
quest.SuccessNpcChat = gameData.quest_list[i].success_npc_chat;
|
quest.SuccessNpcChat = gameData.quest_list[i].success_npc_chat;
|
||||||
if (gameData.quest_list[i].requires_awardid != null)
|
if (gameData.quest_list[i].requires_awardid != null)
|
||||||
quest.AwardRequired = gameData.quest_list[i].requires_awardid;
|
quest.AwardRequired = gameData.quest_list[i].requires_awardid;
|
||||||
|
@ -387,12 +387,12 @@ namespace HISP.Server
|
||||||
if (gameData.quest_list[i].chained_questid != null)
|
if (gameData.quest_list[i].chained_questid != null)
|
||||||
quest.ChainedQuestId = gameData.quest_list[i].chained_questid;
|
quest.ChainedQuestId = gameData.quest_list[i].chained_questid;
|
||||||
quest.Minigame = gameData.quest_list[i].minigame;
|
quest.Minigame = gameData.quest_list[i].minigame;
|
||||||
Logger.DebugPrint("Registered Quest: " + quest.Id +" - "+ quest.Title);
|
Logger.DebugPrint("Registered Quest: " + quest.Id + " - " + quest.Title);
|
||||||
Quest.QuestList.Add(quest);
|
Quest.QuestList.Add(quest);
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalShops = gameData.shop_list.Count;
|
int totalShops = gameData.shop_list.Count;
|
||||||
for(int i = 0; i < totalShops; i++)
|
for (int i = 0; i < totalShops; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
Shop shop = new Shop(gameData.shop_list[i].stocks_itemids.ToObject<int[]>());
|
Shop shop = new Shop(gameData.shop_list[i].stocks_itemids.ToObject<int[]>());
|
||||||
|
@ -400,8 +400,8 @@ namespace HISP.Server
|
||||||
shop.BuyPricePercentage = gameData.shop_list[i].buy_percent;
|
shop.BuyPricePercentage = gameData.shop_list[i].buy_percent;
|
||||||
shop.SellPricePercentage = gameData.shop_list[i].sell_percent;
|
shop.SellPricePercentage = gameData.shop_list[i].sell_percent;
|
||||||
shop.BuysItemTypes = gameData.shop_list[i].buys_item_types.ToObject<string[]>();
|
shop.BuysItemTypes = gameData.shop_list[i].buys_item_types.ToObject<string[]>();
|
||||||
|
|
||||||
Logger.DebugPrint("Registered Shop ID: "+ shop.Id + " Selling items at " + shop.SellPricePercentage + "% and buying at " + shop.BuyPricePercentage);
|
Logger.DebugPrint("Registered Shop ID: " + shop.Id + " Selling items at " + shop.SellPricePercentage + "% and buying at " + shop.BuyPricePercentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register awards
|
// Register awards
|
||||||
|
@ -412,7 +412,7 @@ namespace HISP.Server
|
||||||
{
|
{
|
||||||
|
|
||||||
Award.AwardEntry award = new Award.AwardEntry();
|
Award.AwardEntry award = new Award.AwardEntry();
|
||||||
award.Id = i+1;
|
award.Id = i + 1;
|
||||||
award.Sort = gameData.award_list[i].sort_by;
|
award.Sort = gameData.award_list[i].sort_by;
|
||||||
award.Title = gameData.award_list[i].title;
|
award.Title = gameData.award_list[i].title;
|
||||||
award.IconId = gameData.award_list[i].icon_id;
|
award.IconId = gameData.award_list[i].icon_id;
|
||||||
|
@ -428,7 +428,7 @@ namespace HISP.Server
|
||||||
// Register Abuse Report Reasons
|
// Register Abuse Report Reasons
|
||||||
|
|
||||||
int totalAbuseReportReasons = gameData.messages.meta.abuse_report.reasons.Count;
|
int totalAbuseReportReasons = gameData.messages.meta.abuse_report.reasons.Count;
|
||||||
for(int i = 0; i < totalAbuseReportReasons; i++)
|
for (int i = 0; i < totalAbuseReportReasons; i++)
|
||||||
{
|
{
|
||||||
AbuseReport.ReportReason reason = new AbuseReport.ReportReason();
|
AbuseReport.ReportReason reason = new AbuseReport.ReportReason();
|
||||||
reason.Id = gameData.messages.meta.abuse_report.reasons[i].id;
|
reason.Id = gameData.messages.meta.abuse_report.reasons[i].id;
|
||||||
|
@ -469,7 +469,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalPoets = gameData.poetry.Count;
|
int totalPoets = gameData.poetry.Count;
|
||||||
for(int i = 0; i < totalPoets; i++)
|
for (int i = 0; i < totalPoets; i++)
|
||||||
{
|
{
|
||||||
Brickpoet.PoetryEntry entry = new Brickpoet.PoetryEntry();
|
Brickpoet.PoetryEntry entry = new Brickpoet.PoetryEntry();
|
||||||
entry.Id = gameData.poetry[i].id;
|
entry.Id = gameData.poetry[i].id;
|
||||||
|
@ -482,7 +482,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
// Register Horse Breeds
|
// Register Horse Breeds
|
||||||
int totalBreeds = gameData.horses.breeds.Count;
|
int totalBreeds = gameData.horses.breeds.Count;
|
||||||
for(int i = 0; i < totalBreeds; i++)
|
for (int i = 0; i < totalBreeds; i++)
|
||||||
{
|
{
|
||||||
HorseInfo.Breed horseBreed = new HorseInfo.Breed();
|
HorseInfo.Breed horseBreed = new HorseInfo.Breed();
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
// Register Breed Prices @ Pawneer Order
|
// Register Breed Prices @ Pawneer Order
|
||||||
int totalBreedPrices = gameData.horses.pawneer_base_price.Count;
|
int totalBreedPrices = gameData.horses.pawneer_base_price.Count;
|
||||||
for(int i = 0; i < totalBreedPrices; i++)
|
for (int i = 0; i < totalBreedPrices; i++)
|
||||||
{
|
{
|
||||||
int id = gameData.horses.pawneer_base_price[i].breed_id;
|
int id = gameData.horses.pawneer_base_price[i].breed_id;
|
||||||
int price = gameData.horses.pawneer_base_price[i].price;
|
int price = gameData.horses.pawneer_base_price[i].price;
|
||||||
|
@ -523,7 +523,7 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalCategories = gameData.horses.categorys.Count;
|
int totalCategories = gameData.horses.categorys.Count;
|
||||||
for(int i = 0; i < totalCategories; i++)
|
for (int i = 0; i < totalCategories; i++)
|
||||||
{
|
{
|
||||||
HorseInfo.Category category = new HorseInfo.Category();
|
HorseInfo.Category category = new HorseInfo.Category();
|
||||||
category.Name = gameData.horses.categorys[i].name;
|
category.Name = gameData.horses.categorys[i].name;
|
||||||
|
@ -533,7 +533,7 @@ namespace HISP.Server
|
||||||
Logger.DebugPrint("Registered horse category type: " + category.Name);
|
Logger.DebugPrint("Registered horse category type: " + category.Name);
|
||||||
}
|
}
|
||||||
int totalTrackedItems = gameData.messages.meta.misc_stats.tracked_items.Count;
|
int totalTrackedItems = gameData.messages.meta.misc_stats.tracked_items.Count;
|
||||||
for(int i = 0; i < totalTrackedItems; i++)
|
for (int i = 0; i < totalTrackedItems; i++)
|
||||||
{
|
{
|
||||||
Tracking.TrackedItemStatsMenu trackedItem = new Tracking.TrackedItemStatsMenu();
|
Tracking.TrackedItemStatsMenu trackedItem = new Tracking.TrackedItemStatsMenu();
|
||||||
trackedItem.What = gameData.messages.meta.misc_stats.tracked_items[i].id;
|
trackedItem.What = gameData.messages.meta.misc_stats.tracked_items[i].id;
|
||||||
|
@ -610,14 +610,14 @@ namespace HISP.Server
|
||||||
wkShop.X = gameData.workshop[i].pos_x;
|
wkShop.X = gameData.workshop[i].pos_x;
|
||||||
wkShop.Y = gameData.workshop[i].pos_y;
|
wkShop.Y = gameData.workshop[i].pos_y;
|
||||||
int totalCraftableItems = gameData.workshop[i].craftable_items.Count;
|
int totalCraftableItems = gameData.workshop[i].craftable_items.Count;
|
||||||
for(int ii = 0; ii < totalCraftableItems; ii++)
|
for (int ii = 0; ii < totalCraftableItems; ii++)
|
||||||
{
|
{
|
||||||
Workshop.CraftableItem craftableItem = new Workshop.CraftableItem();
|
Workshop.CraftableItem craftableItem = new Workshop.CraftableItem();
|
||||||
craftableItem.Id = gameData.workshop[i].craftable_items[ii].id;
|
craftableItem.Id = gameData.workshop[i].craftable_items[ii].id;
|
||||||
craftableItem.GiveItemId = gameData.workshop[i].craftable_items[ii].give_item;
|
craftableItem.GiveItemId = gameData.workshop[i].craftable_items[ii].give_item;
|
||||||
craftableItem.MoneyCost = gameData.workshop[i].craftable_items[ii].money_cost;
|
craftableItem.MoneyCost = gameData.workshop[i].craftable_items[ii].money_cost;
|
||||||
int totalItemsRequired = gameData.workshop[i].craftable_items[ii].required_items.Count;
|
int totalItemsRequired = gameData.workshop[i].craftable_items[ii].required_items.Count;
|
||||||
for(int iii = 0; iii < totalItemsRequired; iii++)
|
for (int iii = 0; iii < totalItemsRequired; iii++)
|
||||||
{
|
{
|
||||||
Workshop.RequiredItem requiredItem = new Workshop.RequiredItem();
|
Workshop.RequiredItem requiredItem = new Workshop.RequiredItem();
|
||||||
requiredItem.RequiredItemId = gameData.workshop[i].craftable_items[ii].required_items[iii].req_item;
|
requiredItem.RequiredItemId = gameData.workshop[i].craftable_items[ii].required_items[iii].req_item;
|
||||||
|
@ -646,9 +646,9 @@ namespace HISP.Server
|
||||||
building.Cost = cost;
|
building.Cost = cost;
|
||||||
building.Title = title;
|
building.Title = title;
|
||||||
building.Description = description;
|
building.Description = description;
|
||||||
|
|
||||||
Ranch.RanchBuilding.RanchBuildings.Add(building);
|
Ranch.RanchBuilding.RanchBuildings.Add(building);
|
||||||
Logger.DebugPrint("Registered Ranch Building: "+building.Title);
|
Logger.DebugPrint("Registered Ranch Building: " + building.Title);
|
||||||
|
|
||||||
}
|
}
|
||||||
// Register Ranch Upgrades
|
// Register Ranch Upgrades
|
||||||
|
@ -701,7 +701,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
// Register BBCODE
|
// Register BBCODE
|
||||||
int totalBBocdes = gameData.bbcode.Count;
|
int totalBBocdes = gameData.bbcode.Count;
|
||||||
for(int i = 0; i < totalBBocdes; i++)
|
for (int i = 0; i < totalBBocdes; i++)
|
||||||
{
|
{
|
||||||
string tag = gameData.bbcode[i].tag;
|
string tag = gameData.bbcode[i].tag;
|
||||||
string meta = gameData.bbcode[i].meta;
|
string meta = gameData.bbcode[i].meta;
|
||||||
|
@ -728,7 +728,7 @@ namespace HISP.Server
|
||||||
|
|
||||||
// Register Arenas
|
// Register Arenas
|
||||||
int totalArenas = gameData.arena.Count;
|
int totalArenas = gameData.arena.Count;
|
||||||
for(int i = 0; i < totalArenas; i++)
|
for (int i = 0; i < totalArenas; i++)
|
||||||
{
|
{
|
||||||
int arenaId = gameData.arena[i].arena_id;
|
int arenaId = gameData.arena[i].arena_id;
|
||||||
string arenaType = gameData.arena[i].arena_type;
|
string arenaType = gameData.arena[i].arena_type;
|
||||||
|
@ -738,7 +738,7 @@ namespace HISP.Server
|
||||||
int timeout = gameData.arena[i].timeout;
|
int timeout = gameData.arena[i].timeout;
|
||||||
|
|
||||||
Arena arena = new Arena(arenaId, arenaType, arenaEntryCost, raceEvery, slots, timeout);
|
Arena arena = new Arena(arenaId, arenaType, arenaEntryCost, raceEvery, slots, timeout);
|
||||||
Logger.DebugPrint("Registered Arena: " + arena.Id.ToString()+" as " + arena.Type);
|
Logger.DebugPrint("Registered Arena: " + arena.Id.ToString() + " as " + arena.Type);
|
||||||
}
|
}
|
||||||
// Register Leaser
|
// Register Leaser
|
||||||
int totalLeasers = gameData.leaser.Count;
|
int totalLeasers = gameData.leaser.Count;
|
||||||
|
@ -771,7 +771,7 @@ namespace HISP.Server
|
||||||
leaser.Gender = gameData.leaser[i].horse.gender;
|
leaser.Gender = gameData.leaser[i].horse.gender;
|
||||||
leaser.Height = gameData.leaser[i].horse.hands;
|
leaser.Height = gameData.leaser[i].horse.hands;
|
||||||
leaser.Experience = gameData.leaser[i].horse.exp;
|
leaser.Experience = gameData.leaser[i].horse.exp;
|
||||||
leaser.HorseName = gameData.leaser[i].horse.name;
|
leaser.HorseName = gameData.leaser[i].horse.name;
|
||||||
|
|
||||||
leaser.Health = gameData.leaser[i].horse.basic_stats.health;
|
leaser.Health = gameData.leaser[i].horse.basic_stats.health;
|
||||||
leaser.Hunger = gameData.leaser[i].horse.basic_stats.hunger;
|
leaser.Hunger = gameData.leaser[i].horse.basic_stats.hunger;
|
||||||
|
@ -829,15 +829,19 @@ namespace HISP.Server
|
||||||
|
|
||||||
Messages.AuctionListHorse = gameData.messages.meta.auction.list_horse;
|
Messages.AuctionListHorse = gameData.messages.meta.auction.list_horse;
|
||||||
Messages.AuctionHorseListEntryFormat = gameData.messages.meta.auction.horse_list_entry;
|
Messages.AuctionHorseListEntryFormat = gameData.messages.meta.auction.horse_list_entry;
|
||||||
|
Messages.AuctionHorseViewButton = gameData.messages.meta.auction.view_button;
|
||||||
Messages.AuctionHorseIsTacked = gameData.messages.meta.auction.tacked;
|
Messages.AuctionHorseIsTacked = gameData.messages.meta.auction.tacked;
|
||||||
|
|
||||||
|
Messages.AuctionBidMax = gameData.messages.meta.auction.max_bid;
|
||||||
Messages.AuctionBidRaisedFormat = gameData.messages.meta.auction.bid_raised;
|
Messages.AuctionBidRaisedFormat = gameData.messages.meta.auction.bid_raised;
|
||||||
Messages.AuctionTopBid = gameData.messages.meta.auction.top_bid;
|
Messages.AuctionTopBid = gameData.messages.meta.auction.top_bid;
|
||||||
Messages.AuctionExistingBidHigher = gameData.messages.meta.auction.existing_higher;
|
Messages.AuctionExistingBidHigher = gameData.messages.meta.auction.existing_higher;
|
||||||
|
|
||||||
|
Messages.AuctionOneHorsePerPlayer = gameData.messages.meta.auction.one_horse_at_a_time;
|
||||||
Messages.AuctionYouveBeenOutbidFormat = gameData.messages.meta.auction.outbid_by;
|
Messages.AuctionYouveBeenOutbidFormat = gameData.messages.meta.auction.outbid_by;
|
||||||
Messages.AuctionCantAffordBid = gameData.messages.meta.auction.cant_afford_bid;
|
Messages.AuctionCantAffordBid = gameData.messages.meta.auction.cant_afford_bid;
|
||||||
Messages.AuctionCantAffordAuctionFee = gameData.messages.meta.auction.cant_afford_listing;
|
Messages.AuctionCantAffordAuctionFee = gameData.messages.meta.auction.cant_afford_listing;
|
||||||
|
Messages.AuctionNoOtherTransactionAllowed = gameData.messages.meta.auction.no_other_transaction_allowed;
|
||||||
|
|
||||||
Messages.AuctionYouBroughtAHorseFormat = gameData.messages.meta.auction.brought_horse;
|
Messages.AuctionYouBroughtAHorseFormat = gameData.messages.meta.auction.brought_horse;
|
||||||
Messages.AuctionNoHorseBrought = gameData.messages.meta.auction.no_one_brought;
|
Messages.AuctionNoHorseBrought = gameData.messages.meta.auction.no_one_brought;
|
||||||
|
|
|
@ -152,8 +152,7 @@ namespace HISP.Server
|
||||||
entry.TimeRemaining--;
|
entry.TimeRemaining--;
|
||||||
if (entry.Completed)
|
if (entry.Completed)
|
||||||
auction.DeleteEntry(entry);
|
auction.DeleteEntry(entry);
|
||||||
|
else if (entry.TimeRemaining <= 0)
|
||||||
if (entry.TimeRemaining <= 0)
|
|
||||||
entry.Completed = true;
|
entry.Completed = true;
|
||||||
|
|
||||||
auction.UpdateAuctionRoom();
|
auction.UpdateAuctionRoom();
|
||||||
|
@ -2582,7 +2581,12 @@ namespace HISP.Server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Auction auctionRoom = Auction.GetAuctionRoomById(int.Parse(tile.Code.Split('-')[1]));
|
Auction auctionRoom = Auction.GetAuctionRoomById(int.Parse(tile.Code.Split('-')[1]));
|
||||||
|
if(auctionRoom.HasUserPlacedAuctionAllready(sender.LoggedinUser))
|
||||||
|
{
|
||||||
|
byte[] cantPlaceAuction = PacketBuilder.CreateChat(Messages.AuctionOneHorsePerPlayer, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(cantPlaceAuction);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (sender.LoggedinUser.Money >= 1000)
|
if (sender.LoggedinUser.Money >= 1000)
|
||||||
{
|
{
|
||||||
sender.LoggedinUser.Money -= 1000;
|
sender.LoggedinUser.Money -= 1000;
|
||||||
|
@ -4020,6 +4024,14 @@ namespace HISP.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sender.LoggedinUser.Bids.Count > 0)
|
||||||
|
{
|
||||||
|
byte[] cantBuyWhileAuctioning = PacketBuilder.CreateChat(Messages.AuctionNoOtherTransactionAllowed, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(cantBuyWhileAuctioning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sender.LoggedinUser.Money >= cost)
|
if (sender.LoggedinUser.Money >= cost)
|
||||||
{
|
{
|
||||||
string swfToLoad = Messages.BoatCutscene;
|
string swfToLoad = Messages.BoatCutscene;
|
||||||
|
@ -5401,6 +5413,13 @@ namespace HISP.Server
|
||||||
if (shop != null)
|
if (shop != null)
|
||||||
{
|
{
|
||||||
int buyCost = shop.CalculateBuyCost(itemInfo) * count;
|
int buyCost = shop.CalculateBuyCost(itemInfo) * count;
|
||||||
|
if (sender.LoggedinUser.Bids.Count > 0)
|
||||||
|
{
|
||||||
|
byte[] cantBuyWhileAuctioning = PacketBuilder.CreateChat(Messages.AuctionNoOtherTransactionAllowed, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
sender.SendPacket(cantBuyWhileAuctioning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (sender.LoggedinUser.Money < buyCost)
|
if (sender.LoggedinUser.Money < buyCost)
|
||||||
{
|
{
|
||||||
byte[] cantAffordMessage = PacketBuilder.CreateChat(Messages.CantAfford1, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
byte[] cantAffordMessage = PacketBuilder.CreateChat(Messages.CantAfford1, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue