Not add now skin(default)
FlameProfi opened this issue · 2 comments
FlameProfi commented
I use cheat Osiris, and you skinchanger but new skin don't automaticly added, can you help me?
FlameProfi commented
I have this code.
` static void initializeKits() noexcept
{
static bool initalized = false;
if (initalized)
return;
initalized = true;
const auto itemSchema = memory->itemSystem()->getItemSchema();
std::vector<std::pair<int, WeaponId>> kitsWeapons;
kitsWeapons.reserve(itemSchema->alternateIcons.numElements);
for (int i = 0; i < itemSchema->alternateIcons.numElements; ++i) {
const auto encoded = itemSchema->alternateIcons.memory[i].key;
kitsWeapons.emplace_back(int((encoded & 0xFFFF) >> 2), WeaponId(encoded >> 16)); // https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/econ/econ_item_schema.cpp#L325-L329
}
std::sort(kitsWeapons.begin(), kitsWeapons.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
skinKits.reserve(itemSchema->paintKits.lastAlloc);
gloveKits.reserve(itemSchema->paintKits.lastAlloc);
for (int i = 0; i <= itemSchema->paintKits.lastAlloc; i++) {
const auto paintKit = itemSchema->paintKits.memory[i].value;
if (paintKit->id == 0 || paintKit->id == 9001) // ignore workshop_default
continue;
if (paintKit->id >= 10000) {
std::wstring name;
if (const auto it = std::lower_bound(kitsWeapons.begin(), kitsWeapons.end(), paintKit->id, [](const auto& p, auto id) { return p.first < id; }); it != kitsWeapons.end() && it->first == paintKit->id) {
if (const auto itemDef = itemSchema->getItemDefinitionInterface(it->second)) {
name = interfaces->localize->findSafe(itemDef->getItemBaseName());
name += L" | ";
}
}
name += interfaces->localize->findSafe(paintKit->itemName.data() + 1);
gloveKits.emplace_back(paintKit->id, std::move(name), paintKit->rarity);
} else {
std::unordered_set<WeaponId> weapons;
for (auto it = std::lower_bound(kitsWeapons.begin(), kitsWeapons.end(), paintKit->id, [](const auto& p, auto id) { return p.first < id; }); it != kitsWeapons.end() && it->first == paintKit->id; ++it) {
weapons.insert(it->second);
}
for (auto weapon : weapons) {
const auto itemDef = itemSchema->getItemDefinitionInterface(weapon);
if (!itemDef)
continue;
std::wstring name = interfaces->localize->findSafe(itemDef->getItemBaseName());
name += L" | ";
name += interfaces->localize->findSafe(paintKit->itemName.data() + 1);
skinKits.emplace_back(paintKit->id, std::move(name), std::clamp(itemDef->getRarity() + paintKit->rarity - 1, 0, (paintKit->rarity == 7) ? 7 : 6));
}
if (weapons.empty()) {
assert(false);
std::wstring name = interfaces->localize->findSafe(paintKit->itemName.data() + 1);
skinKits.emplace_back(paintKit->id, std::move(name));
}
}
}
std::sort(skinKits.begin() + 1, skinKits.end());
skinKits.shrink_to_fit();
std::sort(gloveKits.begin(), gloveKits.end());
gloveKits.shrink_to_fit();
}`
namazso commented
no, here you might get support for upstream nSkinz if i feel like it. Either reproduce it in this or go away to whoever is the maintainer of your fork.