Improved how ragfair offer creator status is checked - store creator type in offer
Converted `IsTraderOffer` into extension method string to mongoid conversions
This commit is contained in:
@@ -123,7 +123,7 @@ public class TradeController(
|
||||
);
|
||||
}
|
||||
|
||||
if (ragfairOfferHelper.OfferIsFromTrader(fleaOffer))
|
||||
if (fleaOffer.IsTraderOffer())
|
||||
{
|
||||
BuyTraderItemFromRagfair(sessionID, pmcData, fleaOffer, offer, output);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class TradeController(
|
||||
var offerOwnerId = fleaOffer.User.Id;
|
||||
var offerBuyCount = requestOffer.Count;
|
||||
|
||||
if (IsPlayerOffer(fleaOffer.Id, fleaOffer.User?.Id))
|
||||
if (fleaOffer.IsPlayerOffer())
|
||||
{
|
||||
// Complete selling the offer now it has been purchased
|
||||
ragfairOfferHelper.CompleteOffer(offerOwnerId, fleaOffer, offerBuyCount ?? 0);
|
||||
@@ -256,31 +256,6 @@ public class TradeController(
|
||||
ragfairServer.ReduceOfferQuantity(fleaOffer.Id, requestOffer.Count ?? 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is the provided offerId and ownerId from a player made offer
|
||||
/// </summary>
|
||||
/// <param name="offerId">id of the offer</param>
|
||||
/// <param name="offerOwnerId">Owner id</param>
|
||||
/// <returns>true if offer was made by a player</returns>
|
||||
protected bool IsPlayerOffer(string offerId, MongoId? offerOwnerId)
|
||||
{
|
||||
// No ownerId, not player offer
|
||||
if (offerOwnerId is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var offerCreatorProfile = profileHelper.GetPmcProfile(offerOwnerId.Value);
|
||||
if (offerCreatorProfile is null || offerCreatorProfile.RagfairInfo.Offers?.Count == 0)
|
||||
// No profile or no offers
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Does offer id exist in profile
|
||||
return offerCreatorProfile.RagfairInfo.Offers.Any(offer => offer.Id == offerId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does Player have necessary trader loyalty to purchase flea offer
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user