Comment improvements

This commit is contained in:
Chomp
2025-03-05 14:27:51 +00:00
parent c5864ad2e4
commit e66da4abf4
14 changed files with 302 additions and 278 deletions
+4 -3
View File
@@ -171,9 +171,10 @@ public class HideoutCallbacks(
return _hideoutController.HideoutCustomizationApply(sessionID, pmcData, request);
}
/**
* Handle client/game/profile/items/moving - hideoutCustomizationSetMannequinPose
*/
/// <summary>
/// Handle client/game/profile/items/moving - hideoutCustomizationSetMannequinPose
/// </summary>
/// <returns></returns>
public ItemEventRouterResponse HideoutCustomizationSetMannequinPose(PmcData pmcData, HideoutCustomizationSetMannequinPoseRequest request, string sessionId)
{
return _hideoutController.HideoutCustomizationSetMannequinPose(sessionId, pmcData, request);
+14 -18
View File
@@ -18,12 +18,12 @@ public class NotifierCallbacks(
)
{
/**
* If we don't have anything to send, it's ok to not send anything back
* because notification requests can be long-polling. In fact, we SHOULD wait
* until we actually have something to send because otherwise we'd spam the client
* and the client would abort the connection due to spam.
*/
/// <summary>
/// If we don't have anything to send, it's ok to not send anything back
/// because notification requests can be long-polling. In fact, we SHOULD wait
/// until we actually have something to send because otherwise we'd spam the client
/// and the client would abort the connection due to spam.
/// </summary>
public void SendNotification(string sessionID, HttpRequest req, HttpResponse resp, object data)
{
var splittedUrl = req.Path.Value.Split("/");
@@ -38,9 +38,14 @@ public class NotifierCallbacks(
.ContinueWith(text => httpServerHelper.SendTextJson(resp, text.Result));
}
/** Handle push/notifier/get */
/** Handle push/notifier/getwebsocket */
// TODO: removed from client?
/// <summary>
/// TODO: removed from client?
/// Handle push/notifier/get
/// Handle push/notifier/getwebsocket
/// </summary>
/// <returns></returns>
public string GetNotifier(string url, IRequestData info, string sessionID)
{
return _httpResponseUtil.EmptyArrayResponse();
@@ -49,9 +54,6 @@ public class NotifierCallbacks(
/// <summary>
/// Handle client/notifier/channel/create
/// </summary>
/// <param name="url"></param>
/// <param name="info"></param>
/// <param name="sessionID">Session/player id</param>
/// <returns></returns>
public string CreateNotifierChannel(string url, EmptyRequestData _, string sessionID)
{
@@ -61,9 +63,6 @@ public class NotifierCallbacks(
/// <summary>
/// Handle client/game/profile/select
/// </summary>
/// <param name="url"></param>
/// <param name="info"></param>
/// <param name="sessionID">Session/player id</param>
/// <returns></returns>
public string SelectProfile(string url, UIDRequestData info, string sessionID)
{
@@ -77,9 +76,6 @@ public class NotifierCallbacks(
/// <summary>
/// </summary>
/// <param name="url"></param>
/// <param name="info"></param>
/// <param name="sessionID">Session/player id</param>
/// <returns></returns>
public string Notify(string url, object info, string sessionID)
{
+58 -49
View File
@@ -17,9 +17,10 @@ public class ProfileCallbacks(
ProfileHelper _profileHelper
)
{
/**
* Handle client/game/profile/create
*/
/// <summary>
/// Handle client/game/profile/create
/// </summary>
/// <returns></returns>
public string CreateProfile(string url, ProfileCreateRequestData info, string sessionID)
{
var id = _profileController.CreateProfile(info, sessionID);
@@ -31,24 +32,22 @@ public class ProfileCallbacks(
);
}
/**
* Handle client/game/profile/list
* Get the complete player profile (scav + pmc character)
*/
/// <summary>
/// Handle client/game/profile/list
/// Get the complete player profile (scav + pmc character)
/// </summary>
/// <returns></returns>
public string GetProfileData(string url, EmptyRequestData _, string sessionID)
{
return _httpResponse.GetBody(_profileController.GetCompleteProfile(sessionID));
}
/**
* Handle client/game/profile/savage/regenerate
* Handle the creation of a scav profile for player
* Occurs post-raid and when profile first created immediately after character details are confirmed by player
* @param url
* @param info empty
* @param sessionID Session id
* @returns Profile object
*/
/// <summary>
/// Handle client/game/profile/savage/regenerate
/// Handle the creation of a scav profile for player
/// Occurs post-raid and when profile first created immediately after character details are confirmed by player
/// </summary>
/// <returns></returns>
public string RegenerateScav(string url, EmptyRequestData _, string sessionID)
{
return _httpResponse.GetBody(
@@ -59,19 +58,21 @@ public class ProfileCallbacks(
);
}
/**
* Handle client/game/profile/voice/change event
*/
/// <summary>
/// Handle client/game/profile/voice/change event
/// </summary>
/// <returns></returns>
public string ChangeVoice(string url, ProfileChangeVoiceRequestData info, string sessionID)
{
_profileController.ChangeVoice(info, sessionID);
return _httpResponse.NullResponse();
}
/**
* Handle client/game/profile/nickname/change event
* Client allows player to adjust their profile name
*/
/// <summary>
/// Handle client/game/profile/nickname/change event
/// Client allows player to adjust their profile name
/// </summary>
/// <returns></returns>
public string ChangeNickname(string url, ProfileChangeNicknameRequestData info, string sessionID)
{
var output = _profileController.ChangeNickname(info, sessionID);
@@ -90,9 +91,10 @@ public class ProfileCallbacks(
};
}
/**
* Handle client/game/profile/nickname/validate
*/
/// <summary>
/// Handle client/game/profile/nickname/validate
/// </summary>
/// <returns></returns>
public string ValidateNickname(string url, ValidateNicknameRequestData info, string sessionID)
{
var output = _profileController.ValidateNickname(info, sessionID);
@@ -110,9 +112,10 @@ public class ProfileCallbacks(
};
}
/**
* Handle client/game/profile/nickname/reserved
*/
/// <summary>
/// Handle client/game/profile/nickname/reserved
/// </summary>
/// <returns></returns>
public string GetReservedNickname(string url, EmptyRequestData _, string sessionID)
{
var fullProfile = _profileHelper.GetFullProfile(sessionID);
@@ -124,51 +127,57 @@ public class ProfileCallbacks(
return _httpResponse.GetBody("SPTarkov");
}
/**
* Handle client/profile/status
* Called when creating a character when choosing a character face/voice
*/
/// <summary>
/// Handle client/profile/status
/// Called when creating a character when choosing a character face/voice
/// </summary>
/// <returns></returns>
public string GetProfileStatus(string url, EmptyRequestData _, string sessionID)
{
return _httpResponse.GetBody(_profileController.GetProfileStatus(sessionID));
}
/**
* Handle client/profile/view
* Called when viewing another players profile
*/
/// <summary>
/// Handle client/profile/view
/// Called when viewing another players profile
/// </summary>
/// <returns></returns>
public string GetOtherProfile(string url, GetOtherProfileRequest request, string sessionID)
{
return _httpResponse.GetBody(_profileController.GetOtherProfile(sessionID, request));
}
/**
* Handle client/profile/settings
*/
/// <summary>
/// Handle client/profile/settings
/// </summary>
/// <returns></returns>
public string GetProfileSettings(string url, GetProfileSettingsRequest info, string sessionID)
{
return _httpResponse.GetBody(_profileController.SetChosenProfileIcon(sessionID, info));
}
/**
* Handle client/game/profile/search
*/
/// <summary>
/// Handle client/game/profile/search
/// </summary>
/// <returns></returns>
public string SearchProfiles(string url, SearchProfilesRequestData info, string sessionID)
{
return _httpResponse.GetBody(_profileController.SearchProfiles(info, sessionID));
}
/**
* Handle launcher/profile/info
*/
/// <summary>
/// Handle launcher/profile/info
/// </summary>
/// <returns></returns>
public string GetMiniProfile(string url, GetMiniProfileRequestData info, string sessionID)
{
return _httpResponse.NoBody(_profileController.GetMiniProfile(sessionID));
}
/**
* Handle /launcher/profiles
*/
/// <summary>
/// Handle /launcher/profiles
/// </summary>
/// <returns></returns>
public string GetAllMiniProfiles(string url, EmptyRequestData _, string sessionID)
{
return _httpResponse.NoBody(_profileController.GetMiniProfiles());
+1 -1
View File
@@ -157,6 +157,6 @@ public class RagfairCallbacks(
/// <returns></returns>
public string GetFleaOfferById(string url, GetRagfairOfferByIdRequest info, string sessionID)
{
return _httpResponseUtil.GetBody(_ragfairController.GetOfferById(sessionID, info));
return _httpResponseUtil.GetBody(_ragfairController.GetOfferByInternalId(sessionID, info));
}
}
+5 -15
View File
@@ -2,30 +2,20 @@
public enum ContextVariableType
{
/**
* Logged in users session id
*/
// Logged-in users session id
SESSION_ID = 0,
/**
* Currently acive raid information
*/
// Currently active raid information
RAID_CONFIGURATION = 1,
/**
* SessionID + Timestamp when client first connected, has _ between values
*/
// SessionID + Timestamp when client first connected, has _ between values
CLIENT_START_TIMESTAMP = 2,
/**
* When player is loading into map and loot is requested
*/
// When player is loading into map and loot is requested
REGISTER_PLAYER_REQUEST = 3,
RAID_ADJUSTMENTS = 4,
/**
* Data returned from client request object from endLocalRaid()
*/
// Data returned from client request object from endLocalRaid()
TRANSIT_INFO = 5,
APP_BUILDER = 6,
LOADED_MOD_ASSEMBLIES = 7,
@@ -339,12 +339,12 @@ public class DialogueController(
return newAttachmentCount;
}
/**
* Get messages from a specific dialog that have items not expired
* @param sessionId Session id
* @param dialogueId Dialog to get mail attachments from
* @returns Message array
*/
/// <summary>
/// Get messages from a specific dialog that have items not expired
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <param name="dialogueId">Dialog to get mail attachments from</param>
/// <returns>Message array</returns>
protected List<Message> GetActiveMessagesFromDialog(string sessionId, string dialogueId)
{
var timeNow = _timeUtil.GetTimeStamp();
@@ -552,11 +552,11 @@ public class DialogueController(
}
}
/**
* Has a dialog message expired
* @param message Message to check expiry of
* @returns true or false
*/
/// <summary>
/// Has a dialog message expired
/// </summary>
/// <param name="message">Message to check expiry of</param>
/// <returns>True = expired</returns>
protected bool MessageHasExpired(Message message)
{
return _timeUtil.GetTimeStamp() > message.DateTime + (message.MaxStorageTime ?? 0);
+4 -4
View File
@@ -456,10 +456,10 @@ public class GameController(
}
}
/**
* Mechanic sends players a measuring tape on profile start for some reason
* @param pmcProfile Player profile
*/
/// <summary>
/// Mechanic sends players a measuring tape on profile start for some reason
/// </summary>
/// <param name="pmcProfile"></param>
protected void SendMechanicGiftsToNewProfile(PmcData pmcProfile)
{
_giftService.SendGiftWithSilentReceivedCheck("MechanicGiftDay1", pmcProfile.SessionId, 1);
@@ -1552,9 +1552,9 @@ public class HideoutController(
return _databaseService.GetHideout().Qte;
}
/**
* Function called every `hideoutConfig.runIntervalSeconds` seconds as part of onUpdate event
*/
/// <summary>
/// Function called every `hideoutConfig.runIntervalSeconds` seconds as part of onUpdate event
/// </summary>
public void Update()
{
foreach (var sessionID in _saveServer.GetProfiles())
@@ -294,7 +294,7 @@ public class InventoryController(
public void OpenRandomLootContainer(PmcData pmcData, OpenRandomLootContainerRequestData request, string sessionId,
ItemEventRouterResponse output)
{
/** Container player opened in their inventory */
// Container player opened in their inventory
var openedItem = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == request.Item);
var containerDetailsDb = _itemHelper.GetItem(openedItem.Template);
var isSealedWeaponBox = containerDetailsDb.Value.Name.Contains("event_container_airdrop");
@@ -55,10 +55,10 @@ public class LauncherController(
};
}
/**
* Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness"
* @returns Dictionary of profile types with related descriptive text
*/
/// <summary>
/// Get descriptive text for each of the profile editions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness"
/// </summary>
/// <returns>Dictionary of profile types with related descriptive text</returns>
protected Dictionary<string, string> GetProfileDescriptions()
{
var result = new Dictionary<string, string>();
@@ -212,11 +212,11 @@ public class LauncherController(
return sessionID;
}
/**
* Handle launcher requesting profile be wiped
* @param info IRegisterData
* @returns Session id
*/
/// <summary>
/// Handle launcher requesting profile be wiped
/// </summary>
/// <param name="info">Registration data</param>
/// <returns>Session id</returns>
public string? Wipe(RegisterData info)
{
if (!_coreConfig.AllowProfileWipe)
@@ -245,10 +245,10 @@ public class LauncherController(
return _coreConfig.CompatibleTarkovVersion;
}
/**
* Get the mods the server has currently loaded
* @returns Dictionary of mod name and mod details
*/
/// <summary>
/// Get the mods the server has currently loaded
/// </summary>
/// <returns>Dictionary of mod name and mod details</returns>
public Dictionary<string, PackageJsonData> GetLoadedServerMods()
{
var mods = _applicationContext?.GetLatestValue(ContextVariableType.LOADED_MOD_ASSEMBLIES).GetValue<List<SptMod>>();
@@ -262,11 +262,11 @@ public class LauncherController(
return result;
}
/**
* Get the mods a profile has ever loaded into game with
* @param sessionId Player id
* @returns Array of mod details
*/
/// <summary>
/// Get the mods a profile has ever loaded into game with
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <returns>Array of mod details</returns>
public List<ModDetails> GetServerModsProfileUsed(string sessionId)
{
var profile = _profileHelper.GetFullProfile(sessionId);
+20 -13
View File
@@ -37,17 +37,20 @@ public class ProfileController(
ProfileHelper _profileHelper
)
{
/**
* Handle /launcher/profiles
*/
/// <summary>
/// Handle /launcher/profiles
/// </summary>
/// <returns></returns>
public virtual List<MiniProfile> GetMiniProfiles()
{
return _saveServer.GetProfiles().Select(kvp => GetMiniProfile(kvp.Key)).ToList();
}
/**
* Handle launcher/profile/info
*/
/// <summary>
/// Handle launcher/profile/info
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <returns></returns>
public virtual MiniProfile GetMiniProfile(string sessionID)
{
var profile = _saveServer.GetProfile(sessionID);
@@ -98,10 +101,11 @@ public class ProfileController(
};
}
/**
* Handle client/game/profile/list
* Return a full profile, scav and pmc profiles + meta data
*/
/// <summary>
/// Handle client/game/profile/list
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <returns>Return a full profile, scav and pmc profiles + meta data</returns>
public virtual List<PmcData> GetCompleteProfile(string sessionID)
{
return _profileHelper.GetCompleteProfile(sessionID);
@@ -129,9 +133,12 @@ public class ProfileController(
return _playerScavGenerator.Generate(sessionID);
}
/**
* Handle client/game/profile/nickname/validate
*/
/// <summary>
/// Handle client/game/profile/nickname/validate
/// </summary>
/// <param name="request">Validate nickname request</param>
/// <param name="sessionID">Session/Player id</param>
/// <returns></returns>
public virtual string ValidateNickname(ValidateNicknameRequestData request, string sessionID)
{
if (request.Nickname.Length < 3)
+148 -127
View File
@@ -104,9 +104,9 @@ public class RagfairController
_ragfairConfig = _configServer.GetConfig<RagfairConfig>();
}
/**
* Check all profiles and sell player offers / send player money for listing if it sold
*/
/// <summary>
/// Check all profiles and sell player offers / send player money for listing if it sold
/// </summary>
public void Update()
{
foreach (var (sessionId, profile) in _profileHelper.GetProfiles())
@@ -123,13 +123,12 @@ public class RagfairController
}
}
/**
* Handles client/ragfair/find
* Returns flea offers that match required search parameters
* @param sessionID Player id
* @param searchRequest Search request data
* @returns IGetOffersResult
*/
/// <summary>
/// Handles client/ragfair/find
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <param name="searchRequest">Search request data</param>
/// <returns>Flea offers that match required search parameters</returns>
public GetOffersResult GetOffers(string sessionID, SearchRequestData searchRequest)
{
var profile = _profileHelper.GetFullProfile(sessionID);
@@ -188,10 +187,10 @@ public class RagfairController
return result;
}
/**
* Adjust ragfair offer stack count to match same value as traders assort stack count
* @param offer Flea offer to adjust stack size of
*/
/// <summary>
/// Adjust ragfair offer stack count to match same value as traders assort stack count
/// </summary>
/// <param name="offer">Flea offer to adjust stack size of</param>
private void SetTraderOfferStackSize(RagfairOffer offer)
{
var firstItem = offer.Items[0];
@@ -217,11 +216,11 @@ public class RagfairController
firstItem.Upd.StackObjectsCount = assortPurchased.Upd.StackObjectsCount;
}
/**
* Update a trader flea offer with buy restrictions stored in the traders assort
* @param offer Flea offer to update
* @param fullProfile Players full profile
*/
/// <summary>
/// Update a trader flea offer with buy restrictions stored in the traders assort
/// </summary>
/// <param name="offer">Flea offer to update</param>
/// <param name="fullProfile">Players full profile</param>
private void SetTraderOfferPurchaseLimits(RagfairOffer offer, SptProfile fullProfile)
{
var offerRootItem = offer.Items.First();
@@ -256,10 +255,10 @@ public class RagfairController
offer.BuyRestrictionMax = offerRootItem.Upd.BuyRestrictionMax;
}
/**
* Add index to all offers passed in (0-indexed)
* @param offers Offers to add index value to
*/
/// <summary>
/// Add index to all offers passed in (0-indexed)
/// </summary>
/// <param name="offers">Offers to add index value to</param>
protected void AddIndexValueToOffers(List<RagfairOffer> offers)
{
var counter = 0;
@@ -270,12 +269,13 @@ public class RagfairController
}
}
/**
* Get categories for the type of search being performed, linked/required/all
* @param searchRequest Client search request data
* @param offers Ragfair offers to get categories for
* @returns record with templates + counts
*/
/// <summary>
/// Get categories for the type of search being performed, linked/required/all
/// </summary>
/// <param name="pmcProfile"></param>
/// <param name="searchRequest">Client search request data</param>
/// <param name="offers">Ragfair offers to get categories for</param>
/// <returns>Record with templates + counts</returns>
protected Dictionary<string, int> GetSpecificCategories(PmcData pmcProfile, SearchRequestData searchRequest,
List<RagfairOffer> offers)
{
@@ -306,34 +306,34 @@ public class RagfairController
return _ragfairServer.GetAllActiveCategories(playerHasFleaUnlocked, searchRequest, offerPool);
}
/**
* Is the flea search being performed a 'linked' search type
* @param info Search request
* @returns True if it is a 'linked' search type
*/
/// <summary>
/// Is the flea search being performed a 'linked' search type
/// </summary>
/// <param name="searchRequest">Search request</param>
/// <returns>True = a 'linked' search type</returns>
protected bool IsLinkedSearch(SearchRequestData searchRequest)
{
return !string.IsNullOrEmpty(searchRequest.LinkedSearchId);
}
/**
* Is the flea search being performed a 'required' search type
* @param info Search request
* @returns True if it is a 'required' search type
*/
/// <summary>
/// Is the flea search being performed a 'required' search type
/// </summary>
/// <param name="searchRequest">Search request</param>
/// <returns>True if it is a 'required' search type</returns>
protected bool IsRequiredSearch(SearchRequestData searchRequest)
{
return !string.IsNullOrEmpty(searchRequest.NeededSearchId);
}
/**
* Get offers for the client based on type of search being performed
* @param searchRequest Client search request data
* @param itemsToAdd Comes from ragfairHelper.filterCategories()
* @param traderAssorts Trader assorts
* @param pmcProfile Player profile
* @returns array of offers
*/
/// <summary>
/// Get offers for the client based on type of search being performed
/// </summary>
/// <param name="searchRequest">Client search request data</param>
/// <param name="itemsToAdd">Comes from ragfairHelper.filterCategories()</param>
/// <param name="traderAssorts">Trader assorts</param>
/// <param name="pmcProfile"></param>
/// <returns>Array of offers</returns>
protected List<RagfairOffer> GetOffersForSearchType(SearchRequestData searchRequest, List<string> itemsToAdd,
Dictionary<string, TraderAssort> traderAssorts,
PmcData pmcProfile)
@@ -353,12 +353,12 @@ public class RagfairController
return _ragfairOfferHelper.GetValidOffers(searchRequest, itemsToAdd, traderAssorts, pmcProfile);
}
/**
* Called when creating an offer on flea, fills values in top right corner
* @param getPriceRequest Client request object
* @param ignoreTraderOffers Should trader offers be ignored in the calculation
* @returns min/avg/max values for an item based on flea offers available
*/
/// <summary>
/// Called when creating an offer on flea, fills values in top right corner
/// </summary>
/// <param name="getPriceRequest">Client request object</param>
/// <param name="ignoreTraderOffers">OPTIONAL - Should trader offers be ignored in the calculation</param>
/// <returns>min/avg/max values for an item based on flea offers available</returns>
public GetItemPriceResult GetItemMinAvgMaxFleaPriceValues(GetMarketPriceRequestData getPriceRequest,
bool ignoreTraderOffers = true)
{
@@ -444,13 +444,13 @@ public class RagfairController
return sum / totalOfferCount;
}
/**
* List item(s) on flea for sale
* @param pmcData Player profile
* @param offerRequest Flea list creation offer
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
/// <summary>
/// List item(s) on flea for sale
/// </summary>
/// <param name="pmcData">Players PMC profile</param>
/// <param name="offerRequest">Flea list creation offer</param>
/// <param name="sessionID">Session/Player id</param>
/// <returns>ItemEventRouterResponse</returns>
public ItemEventRouterResponse AddPlayerOffer(PmcData pmcData, AddOfferRequestData offerRequest, string sessionID)
{
var output = _eventOutputHolder.GetOutput(sessionID);
@@ -488,12 +488,12 @@ public class RagfairController
}
}
/**
* Is the item to be listed on the flea valid
* @param offerRequest Client offer request
* @param errorMessage message to show to player when offer is invalid
* @returns Is offer valid
*/
/// <summary>
/// Is the item to be listed on the flea valid
/// </summary>
/// <param name="offerRequest">Client offer request</param>
/// <param name="validationMessage">message to show to player when offer is invalid</param>
/// <returns>Is offer valid</returns>
protected bool IsValidPlayerOfferRequest(AddOfferRequestData offerRequest, string validationMessage)
{
if (offerRequest?.Items is null || offerRequest.Items.Count == 0)
@@ -513,12 +513,11 @@ public class RagfairController
return true;
}
/**
* Given a client request, determine what type of offer is being created
* single/multi/pack
* @param offerRequest Client request
* @returns FleaOfferType
*/
/// <summary>
/// Given a client request, determine what type of offer is being created single/multi/pack
/// </summary>
/// <param name="offerRequest">Client request</param>
/// <returns>FleaOfferType</returns>
protected FleaOfferType GetOfferType(AddOfferRequestData offerRequest)
{
var sellInOncePiece = offerRequest.SellInOnePiece.GetValueOrDefault(false);
@@ -544,16 +543,16 @@ public class RagfairController
return FleaOfferType.UNKNOWN;
}
/**
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
* e.g. 2 ammo stacks of 30 cartridges each
* Each item can be purchased individually
* @param sessionID Session id
* @param offerRequest Offer request from client
* @param fullProfile Full profile of player
* @param output Response to send to client
* @returns IItemEventRouterResponse
*/
/// <summary>
/// Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
/// e.g. 2 ammo stacks of 30 cartridges each
/// Each item can be purchased individually
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <param name="offerRequest">Offer request from client</param>
/// <param name="fullProfile">Full profile of player</param>
/// <param name="output">output Response to send to client</param>
/// <returns>ItemEventRouterResponse</returns>
protected ItemEventRouterResponse CreateMultiOffer(string sessionID, AddOfferRequestData offerRequest,
SptProfile fullProfile, ItemEventRouterResponse output)
{
@@ -579,9 +578,7 @@ public class RagfairController
// When listing identical items on flea, condense separate items into one stack with a merged stack count
// e.g. 2 ammo items, stackObjectCount = 3 for each, will result in 1 stack of 6
firstListingAndChidren[0].Upd ??= new Upd();
firstListingAndChidren[0].Upd.StackObjectsCount = stackCountTotal;
// Create flea object
@@ -656,16 +653,16 @@ public class RagfairController
return output;
}
/**
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
* e.g. 2 ammo stacks of 30 cartridges each
* The entire package must be purchased in one go
* @param sessionID Session id
* @param offerRequest Offer request from client
* @param fullProfile Full profile of player
* @param output Response to send to client
* @returns IItemEventRouterResponse
*/
/// <summary>
/// Create a flea offer for multiple items, can be single items or items with multiple in the stack
/// e.g. 2 ammo stacks of 30 cartridges each
/// The entire package must be purchased in one go
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <param name="offerRequest">Offer request from client</param>
/// <param name="fullProfile">Full profile of player</param>
/// <param name="output">Response to send to client</param>
/// <returns>ItemEventRouterResponse</returns>
protected ItemEventRouterResponse CreatePackOffer(string sessionID, AddOfferRequestData offerRequest,
SptProfile fullProfile, ItemEventRouterResponse output)
{
@@ -766,15 +763,15 @@ public class RagfairController
return output;
}
/**
* Create a flea offer for a single item - includes an item with > 1 sized stack
* e.g. 1 ammo stack of 30 cartridges
* @param sessionID Session id
* @param offerRequest Offer request from client
* @param fullProfile Full profile of player
* @param output Response to send to client
* @returns IItemEventRouterResponse
*/
/// <summary>
/// Create a flea offer for a single item - includes an item with > 1 sized stack
/// e.g. 1 ammo stack of 30 cartridges
/// </summary>
/// <param name="sessionID">Session/Player id</param>
/// <param name="offerRequest">Offer request from client</param>
/// <param name="fullProfile">Full profile of player</param>
/// <param name="output">Response to send to client</param>
/// <returns>ItemEventRouterResponse</returns>
protected ItemEventRouterResponse CreateSingleOffer(string sessionID, AddOfferRequestData offerRequest,
SptProfile fullProfile,
ItemEventRouterResponse output)
@@ -863,17 +860,17 @@ public class RagfairController
return output;
}
/**
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
* @param sessionID Player id
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
* @param pmcData Player profile
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
* @param offerRequest Add offer request object from client
* @param output IItemEventRouterResponse
* @returns True if charging tax to player failed
*/
/// <summary>
/// Charge player a listing fee for using flea, pulls charge from data previously sent by client
/// </summary>
/// <param name="sessionId"></param>
/// <param name="rootItem">Base item being listed (used when client tax cost not found and must be done on server)</param>
/// <param name="pmcData"></param>
/// <param name="requirementsPriceInRub">Rouble cost player chose for listing (used when client tax cost not found and must be done on server)</param>
/// <param name="itemStackCount">How many items were listed by player (used when client tax cost not found and must be done on server)</param>
/// <param name="offerRequest">Add offer request object from client</param>
/// <param name="output">ItemEventRouterResponse</param>
/// <returns>True if charging tax to player failed</returns>
protected bool ChargePlayerTaxFee(
string sessionId,
Item rootItem,
@@ -917,6 +914,14 @@ public class RagfairController
return false;
}
/// <summary>
/// Create a flea offer for a player
/// </summary>
/// <param name="sessionId">Session/Player id</param>
/// <param name="requirements"></param>
/// <param name="items">Item(s) to list on flea (with children)</param>
/// <param name="sellInOnePiece">Is this a pack offer</param>
/// <returns>RagfairOffer</returns>
protected RagfairOffer CreatePlayerOffer(string sessionId, List<Requirement> requirements, List<Item> items,
bool sellInOnePiece)
{
@@ -957,11 +962,11 @@ public class RagfairController
);
}
/**
* Get the handbook price in roubles for the items being listed
* @param requirements
* @returns Rouble price
*/
/// <summary>
/// Get the handbook price in roubles for the items being listed
/// </summary>
/// <param name="requirements"></param>
/// <returns>Rouble price</returns>
protected double CalculateRequirementsPriceInRub(List<Requirement> requirements)
{
return requirements.Sum(requirement =>
@@ -978,6 +983,12 @@ public class RagfairController
);
}
/// <summary>
/// Find items with their children from players inventory
/// </summary>
/// <param name="pmcData">Players PMC profile</param>
/// <param name="itemIdsFromFleaOfferRequest">Request</param>
/// <returns>GetItemsToListOnFleaFromInventoryResult</returns>
protected GetItemsToListOnFleaFromInventoryResult GetItemsToListOnFleaFromInventory(PmcData pmcData,
List<string> itemIdsFromFleaOfferRequest)
{
@@ -1034,7 +1045,7 @@ public class RagfairController
/// </summary>
/// <param name="offerId">Id of offer to remove</param>
/// <param name="sessionId">Session id of requesting player</param>
/// <returns></returns>
/// <returns>ItemEventRouterResponse</returns>
public ItemEventRouterResponse FlagOfferForRemoval(string offerId, string sessionId)
{
var output = _eventOutputHolder.GetOutput(sessionId);
@@ -1088,6 +1099,12 @@ public class RagfairController
return output;
}
/// <summary>
/// Extend a flea offers active time
/// </summary>
/// <param name="extendRequest">Extend time request</param>
/// <param name="sessionId">Session/Player id</param>
/// <returns>ItemEventRouterResponse</returns>
public ItemEventRouterResponse ExtendOffer(ExtendOfferRequestData extendRequest, string sessionId)
{
var output = _eventOutputHolder.GetOutput(sessionId);
@@ -1151,12 +1168,12 @@ public class RagfairController
return output;
}
/**
* Create a basic trader request object with price and currency type
* @param currency What currency: RUB, EURO, USD
* @param value Amount of currency
* @returns IProcessBuyTradeRequestData
*/
/// <summary>
/// Create a basic trader request object with price and currency type
/// </summary>
/// <param name="currency">What currency: RUB, EURO, USD</param>
/// <param name="value">Amount of currency</param>
/// <returns>ProcessBuyTradeRequestData</returns>
protected ProcessBuyTradeRequestData CreateBuyTradeRequestObject(CurrencyType currency, double value)
{
return new ProcessBuyTradeRequestData
@@ -1178,6 +1195,10 @@ public class RagfairController
};
}
/// <summary>
/// Get prices for all items on flea
/// </summary>
/// <returns>Dictionary of tpl and item price</returns>
public Dictionary<string, double> GetAllFleaPrices()
{
return _ragfairPriceService.GetAllFleaPrices();
@@ -1188,7 +1209,7 @@ public class RagfairController
return _ragfairPriceService.GetAllStaticPrices();
}
public RagfairOffer? GetOfferById(string sessionId, GetRagfairOfferByIdRequest request)
public RagfairOffer? GetOfferByInternalId(string sessionId, GetRagfairOfferByIdRequest request)
{
var offers = _ragfairOfferService.GetOffers();
var offerToReturn = offers.FirstOrDefault(offer => offer.InternalId == request.Id);
@@ -46,9 +46,9 @@ public class RepeatableQuestController(
/// <summary>
/// Handle RepeatableQuestChange event
/// </summary>
/// <param name="pmcData"></param>
/// <param name="pmcData">Players PMC profile</param>
/// <param name="changeRequest">Change quest request</param>
/// <param name="sessionID"></param>
/// <param name="sessionID">Session/Player id</param>
/// <returns></returns>
public ItemEventRouterResponse ChangeRepeatableQuest(PmcData pmcData, RepeatableQuestChangeRequest changeRequest,
string sessionID)
@@ -250,8 +250,8 @@ public class RepeatableQuestController(
/// <summary>
/// Generate a repeatable quest
/// </summary>
/// <param name="sessionId"></param>
/// <param name="pmcData"></param>
/// <param name="sessionID">Session/Player id</param>
/// <param name="pmcData">Players PMC profile</param>
/// <param name="questTypePool">What type/level range of quests can be generated for player</param>
/// <param name="repeatableConfig">Config for the quest type to generate</param>
/// <returns></returns>
@@ -359,7 +359,7 @@ public class RepeatableQuestController(
/// (if the are on "Succeed" but not "Completed" we keep them, to allow the player to complete them and get the rewards)
/// The new quests generated are again persisted in profile.RepeatableQuests
/// </summary>
/// <param name="sessionID"></param>
/// <param name="sessionID">Session/Player id</param>
/// <returns>Array of repeatable quests</returns>
public List<PmcDataRepeatableQuest> GetClientRepeatableQuests(string sessionID)
{
@@ -495,7 +495,7 @@ public class RepeatableQuestController(
/// Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists
/// </summary>
/// <param name="repeatableConfig">daily/weekly config</param>
/// <param name="pmcData"></param>
/// <param name="pmcData">Players PMC profile</param>
/// <returns>PmcDataRepeatableQuest</returns>
protected PmcDataRepeatableQuest GetRepeatableQuestSubTypeFromProfile(RepeatableQuestConfig repeatableConfig,
PmcData pmcData)
@@ -530,7 +530,7 @@ public class RepeatableQuestController(
/// Check if a repeatable quest type (daily/weekly) is active for the given profile
/// </summary>
/// <param name="repeatableConfig">Repeatable quest config</param>
/// <param name="pmcData"></param>
/// <param name="pmcData">Players PMC profile</param>
/// <returns>True if profile has access to repeatables</returns>
protected bool CanProfileAccessRepeatableQuests(RepeatableQuestConfig repeatableConfig, PmcData pmcData)
{
@@ -557,7 +557,7 @@ public class RepeatableQuestController(
/// <summary>
/// Does player have daily pmc quests unlocked
/// </summary>
/// <param name="pmcData"></param>
/// <param name="pmcData">Players PMC profile</param>
/// <param name="repeatableConfig">Config of daily type to check</param>
/// <returns>True if unlocked</returns>
protected static bool PlayerHasDailyPmcQuestsUnlocked(PmcData pmcData, RepeatableQuestConfig repeatableConfig)
@@ -568,7 +568,7 @@ public class RepeatableQuestController(
/// <summary>
/// Does player have daily scav quests unlocked
/// </summary>
/// <param name="pmcData"></param>
/// <param name="pmcData">Players PMC profile</param>
/// <returns>True if unlocked</returns>
protected bool PlayerHasDailyScavQuestsUnlocked(PmcData pmcData)
{
@@ -581,7 +581,7 @@ public class RepeatableQuestController(
/// Expire quests and replace expired quests with ready-to-hand-in quests inside generatedRepeatables.activeQuests
/// </summary>
/// <param name="generatedRepeatables">Repeatables to process (daily/weekly)</param>
/// <param name="pmcData"></param>
/// <param name="pmcData">Players PMC profile</param>
protected void ProcessExpiredQuests(PmcDataRepeatableQuest generatedRepeatables, PmcData pmcData)
{
var questsToKeep = new List<RepeatableQuest>();
+5 -5
View File
@@ -125,11 +125,11 @@ public class Watermark
Draw();
}
/**
* Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx))
* @param withEftVersion Include the eft version this spt version was made for
* @returns string
*/
/// <summary>
/// Get a version string (x.x.x) or (x.x.x-BLEEDINGEDGE) OR (X.X.X (18xxx))
/// </summary>
/// <param name="withEftVersion">Include the eft version this spt version was made for</param>
/// <returns></returns>
public string GetVersionTag(bool withEftVersion = false)
{
var sptVersion = ProgramStatics.SPT_VERSION() ?? sptConfig.SptVersion;