Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 5 additions & 24 deletions csgo_gc/gc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,6 @@ std::string ClientGC::RconGiveItem(const RconRequest &request)
}

Inventory::ParameterizedItemOptions options;
bool hasParameters = parameterStart < request.args.size();

for (size_t i = parameterStart; i < request.args.size(); i++)
{
std::string_view parameter{ request.args[i] };
Expand Down Expand Up @@ -883,30 +881,13 @@ std::string ClientGC::RconGiveItem(const RconRequest &request)

for (uint32_t i = 0; i < count; i++)
{
uint64_t itemId = 0;
if (hasParameters)
{
CMsgSOSingleObject &update = updates.emplace_back();
std::string error;
itemId = m_inventory.CreateParameterizedItem(defIndex, options, update, error);
if (!itemId)
{
updates.pop_back();
if (error == "unknown defindex")
{
return "ERR unknown defindex";
}
return std::string{ "ERR " }.append(error);
}
}
else
{
itemId = m_inventory.PurchaseItem(defIndex, updates);
}

CMsgSOSingleObject &update = updates.emplace_back();
std::string error;
uint64_t itemId = m_inventory.CreateRconItem(defIndex, options, update, error);
if (!itemId)
{
return "ERR unknown defindex";
updates.pop_back();
return std::string{ "ERR " }.append(error);
}

itemIds.push_back(itemId);
Expand Down
1 change: 1 addition & 0 deletions csgo_gc/gc_const_csgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ enum SOTypeId : uint32_t
enum ItemOrigin
{
ItemOriginPurchased = 2,
ItemOriginTraded = 3,
ItemOriginCrate = 8,
ItemOriginBaseItem = 22
};
Expand Down
6 changes: 4 additions & 2 deletions csgo_gc/inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ uint64_t Inventory::PurchaseItem(uint32_t defIndex, std::vector<CMsgSOSingleObje
return item.id();
}

uint64_t Inventory::CreateParameterizedItem(uint32_t defIndex,
uint64_t Inventory::CreateRconItem(uint32_t defIndex,
const ParameterizedItemOptions &options,
CMsgSOSingleObject &update,
std::string &error)
Expand Down Expand Up @@ -2014,7 +2014,9 @@ uint64_t Inventory::CreateParameterizedItem(uint32_t defIndex,
}
}

CSOEconItem &item = CreateItem(defIndex, ItemOriginPurchased, UnacknowledgedPurchased);
// RCON grants mimic an incoming trade so the game can use its native
// server-wide item-found announcement.
CSOEconItem &item = CreateItem(defIndex, ItemOriginTraded, UnacknowledgedTraded);

if (options.level)
{
Expand Down
5 changes: 4 additions & 1 deletion csgo_gc/inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ class Inventory
// returns the item id and adds the item to the provided CMsgSOMultipleObjects
// on failure returns 0 and does nothing
uint64_t PurchaseItem(uint32_t defIndex, std::vector<CMsgSOSingleObject> &update);
uint64_t CreateParameterizedItem(uint32_t defIndex,

// Creates an item granted through RCON with the traded acquisition reason.
// Returns the item id on success, or 0 and an error string on failure.
uint64_t CreateRconItem(uint32_t defIndex,
const ParameterizedItemOptions &options,
CMsgSOSingleObject &update,
std::string &error);
Expand Down
11 changes: 9 additions & 2 deletions csgo_gc/souvenir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,15 @@ bool SouvenirOpening::OpenPackage(const CSOEconItem &package, CSOEconItem &item)
return false;
}

// create the item with souvenir quality
if (!m_itemSchema.CreateItemFromLootListItem(m_random, *selectedItem, false, ItemOriginCrate, UnacknowledgedTournamentDrop, item))
// Opening a souvenir package is a crate acquisition. TournamentDrop is
// reserved for packages awarded directly for watching tournament matches.
if (!m_itemSchema.CreateItemFromLootListItem(
m_random,
*selectedItem,
false,
ItemOriginCrate,
UnacknowledgedFoundInCrate,
item))
{
Platform::Print("SouvenirOpening: failed to create item\n");
return false;
Expand Down
289 changes: 0 additions & 289 deletions docs/rcon.md

This file was deleted.

Loading
Loading