fix weapon corrupt,add change knife,add webchange,linux no tested

master
宇宙遨游 11 months ago
parent 33a5f066e7
commit f8e945adc8

@ -0,0 +1,4 @@
# CSGO2 Server Preview Paint Demo Plugins
this demo plugin,Please use with caution
No support provided for this plugin

@ -39,26 +39,31 @@ typedef struct SkinParm
int m_nFallbackPaintKit; int m_nFallbackPaintKit;
int m_nFallbackSeed; int m_nFallbackSeed;
float m_flFallbackWear; float m_flFallbackWear;
}SkinParm;; }SkinParm;
#ifdef _WIN32 #ifdef _WIN32
typedef void*(FASTCALL* SubClassChange_t)(const CCommandContext &context, const CCommand &args);
typedef void*(FASTCALL* EntityRemove_t)(CGameEntitySystem*, void*, void*,uint64_t); typedef void*(FASTCALL* EntityRemove_t)(CGameEntitySystem*, void*, void*,uint64_t);
typedef void(FASTCALL* GiveNamedItem_t)(void* itemService,const char* pchName, void* iSubType,void* pScriptItem, void* a5,void* a6); typedef void(FASTCALL* GiveNamedItem_t)(void* itemService,const char* pchName, void* iSubType,void* pScriptItem, void* a5,void* a6);
typedef void(FASTCALL* UTIL_ClientPrintAll_t)(int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4); typedef void(FASTCALL* UTIL_ClientPrintAll_t)(int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4);
extern SubClassChange_t FnSubClassChange;
extern EntityRemove_t FnEntityRemove; extern EntityRemove_t FnEntityRemove;
extern GiveNamedItem_t FnGiveNamedItem; extern GiveNamedItem_t FnGiveNamedItem;
extern UTIL_ClientPrintAll_t FnUTIL_ClientPrintAll; extern UTIL_ClientPrintAll_t FnUTIL_ClientPrintAll;
EntityRemove_t FnEntityRemove; EntityRemove_t FnEntityRemove;
GiveNamedItem_t FnGiveNamedItem; GiveNamedItem_t FnGiveNamedItem;
UTIL_ClientPrintAll_t FnUTIL_ClientPrintAll; UTIL_ClientPrintAll_t FnUTIL_ClientPrintAll;
SubClassChange_t FnSubClassChange;
#else #else
void (*FnSubClassChange)(const CCommandContext &context, const CCommand &args) = nullptr;
void (*FnEntityRemove)(CGameEntitySystem*, void*, void*,uint64_t) = nullptr; void (*FnEntityRemove)(CGameEntitySystem*, void*, void*,uint64_t) = nullptr;
void (*FnGiveNamedItem)(void* itemService,const char* pchName, void* iSubType,void* pScriptItem, void* a5,void* a6) = nullptr; void (*FnGiveNamedItem)(void* itemService,const char* pchName, void* iSubType,void* pScriptItem, void* a5,void* a6) = nullptr;
void (*FnUTIL_ClientPrintAll)(int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4) = nullptr; void (*FnUTIL_ClientPrintAll)(int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4) = nullptr;
#endif #endif
std::map<int, std::string> g_WeaponsMap; std::map<int, std::string> g_WeaponsMap;
std::map<uint64_t, int> g_PlayerKnifes;
std::map<uint64_t, std::map<int, SkinParm>> g_PlayerSkins; std::map<uint64_t, std::map<int, SkinParm>> g_PlayerSkins;
class GameSessionConfiguration_t { }; class GameSessionConfiguration_t { };
@ -133,7 +138,8 @@ bool Skin::Load(PluginId id, ISmmAPI* ismm, char* error, size_t maxlen, bool lat
ConVar_Register(FCVAR_GAMEDLL); ConVar_Register(FCVAR_GAMEDLL);
g_WeaponsMap = { {26,"weapon_bizon"},{27,"weapon_mac10"},{34,"weapon_mp9"},{19,"weapon_p90"},{24,"weapon_ump45"},{7,"weapon_ak47"},{8,"weapon_aug"},{10,"weapon_famas"},{13,"weapon_galilar"},{16,"weapon_m4a1"},{60,"weapon_m4a1_silencer"},{39,"weapon_sg556"},{9,"weapon_awp"},{11,"weapon_g3sg1"},{38,"weapon_scar20"},{40,"weapon_ssg08"},{29,"weapon_mag7"},{35,"weapon_nova"},{29,"weapon_sawedoff"},{25,"weapon_xm1014"},{14,"weapon_m249"},{9,"weapon_awp"},{28,"weapon_negev"},{1,"weapon_deagle"},{2,"weapon_elite"},{3,"weapon_fiveseven"},{4,"weapon_glock"},{32,"weapon_hkp2000"},{36,"weapon_p250"},{30,"weapon_tec9"},{61,"weapon_usp_silencer"},{63,"weapon_cz75a"},{64,"weapon_revolver"}}; g_WeaponsMap = {{59,"weapon_knife"},{42,"weapon_knife"},{26,"weapon_bizon"},{27,"weapon_mac10"},{34,"weapon_mp9"},{19,"weapon_p90"},{24,"weapon_ump45"},{7,"weapon_ak47"},{8,"weapon_aug"},{10,"weapon_famas"},{13,"weapon_galilar"},{16,"weapon_m4a1"},{60,"weapon_m4a1_silencer"},{39,"weapon_sg556"},{9,"weapon_awp"},{11,"weapon_g3sg1"},{38,"weapon_scar20"},{40,"weapon_ssg08"},{29,"weapon_mag7"},{35,"weapon_nova"},{29,"weapon_sawedoff"},{25,"weapon_xm1014"},{14,"weapon_m249"},{9,"weapon_awp"},{28,"weapon_negev"},{1,"weapon_deagle"},{2,"weapon_elite"},{3,"weapon_fiveseven"},{4,"weapon_glock"},{32,"weapon_hkp2000"},{36,"weapon_p250"},{30,"weapon_tec9"},{61,"weapon_usp_silencer"},{63,"weapon_cz75a"},{64,"weapon_revolver"}};
#ifdef _WIN32 #ifdef _WIN32
byte* vscript = (byte*)FindSignature("vscript.dll", "\xBE\x01\x3F\x3F\x3F\x2B\xD6\x74\x61\x3B\xD6"); byte* vscript = (byte*)FindSignature("vscript.dll", "\xBE\x01\x3F\x3F\x3F\x2B\xD6\x74\x61\x3B\xD6");
if(vscript) if(vscript)
@ -173,11 +179,13 @@ void Skin::StartupServer(const GameSessionConfiguration_t& config, ISource2World
FnUTIL_ClientPrintAll = (UTIL_ClientPrintAll_t)FindSignature("server.dll", "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x81\xEC\x70\x01\x3F\x3F\x8B\xE9"); FnUTIL_ClientPrintAll = (UTIL_ClientPrintAll_t)FindSignature("server.dll", "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x81\xEC\x70\x01\x3F\x3F\x8B\xE9");
FnGiveNamedItem = (GiveNamedItem_t)FindSignature("server.dll", "\x48\x89\x5C\x24\x18\x48\x89\x74\x24\x20\x55\x57\x41\x54\x41\x56\x41\x57\x48\x8D\x6C\x24\xD9"); FnGiveNamedItem = (GiveNamedItem_t)FindSignature("server.dll", "\x48\x89\x5C\x24\x18\x48\x89\x74\x24\x20\x55\x57\x41\x54\x41\x56\x41\x57\x48\x8D\x6C\x24\xD9");
FnEntityRemove = (EntityRemove_t)FindSignature("server.dll", "\x48\x85\xD2\x0F\x3F\x3F\x3F\x3F\x3F\x57\x48\x3F\x3F\x3F\x48\x89\x3F\x3F\x3F\x48\x8B\xF9\x48\x8B"); FnEntityRemove = (EntityRemove_t)FindSignature("server.dll", "\x48\x85\xD2\x0F\x3F\x3F\x3F\x3F\x3F\x57\x48\x3F\x3F\x3F\x48\x89\x3F\x3F\x3F\x48\x8B\xF9\x48\x8B");
FnSubClassChange = (SubClassChange_t)FindSignature("server.dll", "\x40\x55\x41\x57\x48\x83\xEC\x78\x83\xBA\x38\x04");
#else #else
CModule libserver(g_pSource2Server); CModule libserver(g_pSource2Server);
FnUTIL_ClientPrintAll = libserver.FindPatternSIMD("55 48 89 E5 41 57 49 89 D7 41 56 49 89 F6 41 55 41 89 FD").RCast< decltype(FnUTIL_ClientPrintAll) >(); FnUTIL_ClientPrintAll = libserver.FindPatternSIMD("55 48 89 E5 41 57 49 89 D7 41 56 49 89 F6 41 55 41 89 FD").RCast< decltype(FnUTIL_ClientPrintAll) >();
FnGiveNamedItem = libserver.FindPatternSIMD("55 48 89 E5 41 57 41 56 49 89 CE 41 55 49 89 F5 41 54 49 89 D4 53 48 89").RCast<decltype(FnGiveNamedItem)>(); FnGiveNamedItem = libserver.FindPatternSIMD("55 48 89 E5 41 57 41 56 49 89 CE 41 55 49 89 F5 41 54 49 89 D4 53 48 89").RCast<decltype(FnGiveNamedItem)>();
FnEntityRemove = libserver.FindPatternSIMD("48 85 F6 74 0B 48 8B 76 10 E9 B2 FE FF FF").RCast<decltype(FnEntityRemove)>(); FnEntityRemove = libserver.FindPatternSIMD("48 85 F6 74 0B 48 8B 76 10 E9 B2 FE FF FF").RCast<decltype(FnEntityRemove)>();
FnSubClassChange = libserver.FindPatternSIMD("55 48 89 E5 41 57 41 56 41 55 41 54 53 48 81 EC C8").RCast<decltype(FnSubClassChange)>();
#endif #endif
g_pGameRules = nullptr; g_pGameRules = nullptr;
@ -235,6 +243,7 @@ void CEntityListener::OnEntitySpawned(CEntityInstance* pEntity)
{ {
CBasePlayerWeapon* pBasePlayerWeapon = dynamic_cast<CBasePlayerWeapon*>(pEntity); CBasePlayerWeapon* pBasePlayerWeapon = dynamic_cast<CBasePlayerWeapon*>(pEntity);
if(!pBasePlayerWeapon)return; if(!pBasePlayerWeapon)return;
g_Skin.NextFrame([pBasePlayerWeapon = pBasePlayerWeapon]() g_Skin.NextFrame([pBasePlayerWeapon = pBasePlayerWeapon]()
{ {
int64_t steamid = pBasePlayerWeapon->m_OriginalOwnerXuidLow(); int64_t steamid = pBasePlayerWeapon->m_OriginalOwnerXuidLow();
@ -249,12 +258,25 @@ void CEntityListener::OnEntitySpawned(CEntityInstance* pEntity)
pBasePlayerWeapon->m_nFallbackPaintKit() = skin_parm->second.m_nFallbackPaintKit; pBasePlayerWeapon->m_nFallbackPaintKit() = skin_parm->second.m_nFallbackPaintKit;
pBasePlayerWeapon->m_nFallbackSeed() = skin_parm->second.m_nFallbackSeed; pBasePlayerWeapon->m_nFallbackSeed() = skin_parm->second.m_nFallbackSeed;
pBasePlayerWeapon->m_flFallbackWear() = skin_parm->second.m_flFallbackWear; pBasePlayerWeapon->m_flFallbackWear() = skin_parm->second.m_flFallbackWear;
pBasePlayerWeapon->m_AttributeManager().m_Item().m_iItemIDHigh() = -1; pBasePlayerWeapon->m_AttributeManager().m_Item().m_iItemIDHigh() = -1;
pBasePlayerWeapon->m_CBodyComponent()->m_pSceneNode()->GetSkeletonInstance()->m_modelState().m_MeshGroupMask() = 2;
if(weaponId == 59 || weaponId == 42)
{
auto knife_idx = g_PlayerKnifes.find(steamid);
if(knife_idx == g_PlayerKnifes.end())return;
char buf[64] = {0};
int index = static_cast<CEntityInstance*>(pBasePlayerWeapon)->m_pEntity->m_EHandle.GetEntryIndex();
sprintf(buf,"i_subclass_change %d %d",knife_idx->second,index);
engine->ServerCommand(buf);
}
META_CONPRINTF( "class: %s\n", static_cast<CEntityInstance*>(pBasePlayerWeapon)->m_pEntity->m_designerName.String());
META_CONPRINTF( "steamId: %lld itemId: %d\n", steamid, weaponId); META_CONPRINTF( "steamId: %lld itemId: %d\n", steamid, weaponId);
}); });
} }
// weapon: skin 38 0 0 knife: skin 38 0 0 515
CON_COMMAND_F(skin, "修改皮肤", FCVAR_CLIENT_CAN_EXECUTE) CON_COMMAND_F(skin, "修改皮肤", FCVAR_CLIENT_CAN_EXECUTE)
{ {
if(context.GetPlayerSlot() == -1)return; if(context.GetPlayerSlot() == -1)return;
@ -262,13 +284,6 @@ CON_COMMAND_F(skin, "修改皮肤", FCVAR_CLIENT_CAN_EXECUTE)
CCSPlayerPawnBase* pPlayerPawn = pPlayerController->m_hPlayerPawn(); CCSPlayerPawnBase* pPlayerPawn = pPlayerController->m_hPlayerPawn();
if (!pPlayerPawn || pPlayerPawn->m_lifeState() != LIFE_ALIVE) if (!pPlayerPawn || pPlayerPawn->m_lifeState() != LIFE_ALIVE)
return; return;
char buf[255] = {0};
if(args.ArgC() != 4)
{
sprintf(buf, " \x04 %s 你使用skin命令修改皮肤需要三个参数!",pPlayerController->m_iszPlayerName());
FnUTIL_ClientPrintAll(3, buf,nullptr, nullptr, nullptr, nullptr);
return;
}
CPlayer_WeaponServices* pWeaponServices = pPlayerPawn->m_pWeaponServices(); CPlayer_WeaponServices* pWeaponServices = pPlayerPawn->m_pWeaponServices();
@ -278,6 +293,27 @@ CON_COMMAND_F(skin, "修改皮肤", FCVAR_CLIENT_CAN_EXECUTE)
auto weapon_name = g_WeaponsMap.find(weaponId); auto weapon_name = g_WeaponsMap.find(weaponId);
if(weapon_name == g_WeaponsMap.end())return; if(weapon_name == g_WeaponsMap.end())return;
char buf[255] = {0};
if(weaponId == 59 || weaponId == 42)
{
if(args.ArgC() != 5)
{
sprintf(buf, " \x04 %s 你使用skin命令修改刀皮肤需要四个参数!",pPlayerController->m_iszPlayerName());
FnUTIL_ClientPrintAll(3, buf,nullptr, nullptr, nullptr, nullptr);
return;
}
g_PlayerKnifes[steamid] = atoi(args.Arg(4));
}
else
{
if(args.ArgC() != 4)
{
sprintf(buf, " \x04 %s 你使用skin命令修改武器皮肤需要三个参数!",pPlayerController->m_iszPlayerName());
FnUTIL_ClientPrintAll(3, buf,nullptr, nullptr, nullptr, nullptr);
return;
}
}
g_PlayerSkins[steamid][weaponId].m_nFallbackPaintKit = atoi(args.Arg(1)); g_PlayerSkins[steamid][weaponId].m_nFallbackPaintKit = atoi(args.Arg(1));
g_PlayerSkins[steamid][weaponId].m_nFallbackSeed = atoi(args.Arg(2)); g_PlayerSkins[steamid][weaponId].m_nFallbackSeed = atoi(args.Arg(2));
g_PlayerSkins[steamid][weaponId].m_flFallbackWear = atof(args.Arg(3)); g_PlayerSkins[steamid][weaponId].m_flFallbackWear = atof(args.Arg(3));
@ -286,7 +322,7 @@ CON_COMMAND_F(skin, "修改皮肤", FCVAR_CLIENT_CAN_EXECUTE)
pWeaponServices->RemoveWeapon(pPlayerWeapon); pWeaponServices->RemoveWeapon(pPlayerWeapon);
FnEntityRemove(g_pGameEntitySystem,pPlayerWeapon,nullptr,-1); FnEntityRemove(g_pGameEntitySystem,pPlayerWeapon,nullptr,-1);
FnGiveNamedItem(pPlayerPawn->m_pItemServices(),weapon_name->second.c_str(),nullptr,nullptr,nullptr,nullptr); FnGiveNamedItem(pPlayerPawn->m_pItemServices(),weapon_name->second.c_str(),nullptr,nullptr,nullptr,nullptr);
pPlayerWeapon->m_AttributeManager().m_Item().m_iAccountID() = 271098320; // pPlayerWeapon->m_AttributeManager().m_Item().m_iAccountID() = 271098320;
//CCSPlayer_ItemServices* pItemServices = static_cast<CCSPlayer_ItemServices*>(pPlayerPawn->m_pItemServices()); //CCSPlayer_ItemServices* pItemServices = static_cast<CCSPlayer_ItemServices*>(pPlayerPawn->m_pItemServices());
//pItemServices->GiveNamedItem(weapon_name->second.c_str()); //pItemServices->GiveNamedItem(weapon_name->second.c_str());
// g_pGameRules->PlayerRespawn(static_cast<CCSPlayerPawn*>(pPlayerPawn)); // g_pGameRules->PlayerRespawn(static_cast<CCSPlayerPawn*>(pPlayerPawn));
@ -295,6 +331,11 @@ CON_COMMAND_F(skin, "修改皮肤", FCVAR_CLIENT_CAN_EXECUTE)
FnUTIL_ClientPrintAll(3, buf,nullptr, nullptr, nullptr, nullptr); FnUTIL_ClientPrintAll(3, buf,nullptr, nullptr, nullptr, nullptr);
} }
CON_COMMAND_F(i_subclass_change, "subclass change", FCVAR_NONE)
{
FnSubClassChange(context,args);
}
const char* Skin::GetLicense() const char* Skin::GetLicense()
{ {
return "GPL"; return "GPL";

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

13559
mdui.css

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

6474
mdui.js

File diff suppressed because it is too large Load Diff

@ -26,6 +26,7 @@ public:
class CEconItemView class CEconItemView
{ {
public: public:
SCHEMA_FIELD(int32_t, CEconItemView, m_iEntityQuality);
SCHEMA_FIELD(CAttributeList, CEconItemView, m_AttributeList); SCHEMA_FIELD(CAttributeList, CEconItemView, m_AttributeList);
SCHEMA_FIELD(int32_t, CEconItemView, m_iItemIDHigh); SCHEMA_FIELD(int32_t, CEconItemView, m_iItemIDHigh);
SCHEMA_FIELD(int32_t, CEconItemView, m_iAccountID); SCHEMA_FIELD(int32_t, CEconItemView, m_iAccountID);
@ -38,9 +39,36 @@ public:
SCHEMA_FIELD(CEconItemView, CAttributeContainer, m_Item); SCHEMA_FIELD(CEconItemView, CAttributeContainer, m_Item);
}; };
class CModelState
{
public:
SCHEMA_FIELD(uint64_t, CModelState, m_MeshGroupMask);
};
class CSkeletonInstance
{
public:
SCHEMA_FIELD(CModelState, CSkeletonInstance, m_modelState);
};
class CGameSceneNode
{
public:
CSkeletonInstance* GetSkeletonInstance() {
return CALL_VIRTUAL(CSkeletonInstance*, 8, this);
}
};
class CBodyComponent
{
public:
SCHEMA_FIELD(CGameSceneNode*, CBodyComponent, m_pSceneNode);
};
class CBasePlayerWeapon : public CEconEntity class CBasePlayerWeapon : public CEconEntity
{ {
public: public:
SCHEMA_FIELD(CBodyComponent*, CBaseEntity, m_CBodyComponent);
SCHEMA_FIELD(CAttributeContainer, CEconEntity, m_AttributeManager); SCHEMA_FIELD(CAttributeContainer, CEconEntity, m_AttributeManager);
SCHEMA_FIELD(int32_t, CEconEntity, m_nFallbackPaintKit); SCHEMA_FIELD(int32_t, CEconEntity, m_nFallbackPaintKit);
SCHEMA_FIELD(int32_t, CEconEntity, m_nFallbackSeed); SCHEMA_FIELD(int32_t, CEconEntity, m_nFallbackSeed);

@ -1,224 +0,0 @@
import re
import math
# Define some regex stuff
STEAM_ID_REGEX = "^STEAM_"
STEAM_ID_3_REGEX = "^\[.*\]$"
# steamID64 are all offset from this value
ID64_BASE = 76561197960265728
def convert_steamID(steamID, target_format:str, as_int=False):
"""
Wrapper for conversion methods to allow you to call different conversions via the same function
Parameters
----------
steamID : int or str
steamID of any format to convert
target_format : str
Format to convert steamId to
Possible values are: SteamID, SteamID3, SteamID64
as_int : bool
If a SteamId64 is returned as an int or a string
Only used when target_format = SteamId64
Default = False
Returns
-------
int or str
steamID value
"""
if target_format == 'SteamID':
return to_steamID(steamID)
elif target_format == 'SteamID3':
return to_steamID3(steamID)
elif target_format == 'SteamID64':
return to_steamID64(steamID, as_int)
else:
raise ValueError("Incorrect target Steam ID format. Target_format must be one of: SteamID, SteamID3, SteamID64")
def to_steamID(steamID):
"""
Convert to steamID
A steamID is unique to each steam account,
Formatted with digits as x "STEAM_0:x:xxxxxxxx"
Parameters
----------
steamID : int or str
steamID3 or steamID64 to convert to steamID
Returns
-------
str
steamID value
"""
id_str = str(steamID)
if re.search(STEAM_ID_REGEX, id_str): # Already a steamID
return id_str
elif re.search(STEAM_ID_3_REGEX, id_str): # If passed steamID3
id_split = id_str.split(":") # Split string into 'Universe', Account type, and Account number
account_id3 = int(id_split[2][:-1]) # Remove ] from end of steamID3
account_type = account_id3 % 2
account_id = (account_id3 - account_type) // 2
elif id_str.isnumeric(): # Passed steamID64
check_steamID64_length(id_str) # Validate id passed in
offset_id = int(id_str) - ID64_BASE
# Get the account type and id
account_type = offset_id % 2
account_id = ((offset_id - account_type) // 2)
return "STEAM_0:" + str(account_type) + ":" + str(account_id)
def to_steamID3(steamID):
"""
Convert to steamID3
A steamID3 is unique to each steam account,
Formatted with digits as x "[U:1:xxxxxxxx]"
Parameters
----------
steamID : int or str
steamID or steamID64 to convert to steamID3
Returns
-------
str
steamID3 value
"""
id_str = str(steamID)
if re.search(STEAM_ID_3_REGEX, id_str): # Already a steamID3
return id_str
elif re.search(STEAM_ID_REGEX, id_str): # If passed steamID
id_split = id_str.split(":") # Split string into 'Universe', Account type, and Account number
account_type = int(id_split[1]) # Check for account type
account_id = int(id_split[2]) # Account number, needs to be doubled when added to id3
# Join together in steamID3 format
return "[U:1:" + str(((account_id + account_type) * 2) - account_type) + "]"
elif id_str.isnumeric(): # Passed steamID64
check_steamID64_length(id_str) # Validate id passed in
offset_id = int(id_str) - ID64_BASE
# Get the account type and id
account_type = offset_id % 2
account_id = ((offset_id - account_type) // 2) + account_type
# Join together in steamID3 format
return "[U:1:" + str((account_id * 2) - account_type) + "]"
else:
raise ValueError(f"Unable to decode steamID: {steamID}")
def to_steamID64(steamID, as_int = False):
"""
Convert to steamID64
A steamID64 is a 17 digit number, unique to each steam account
Parameters
----------
steamID : int or str
steamID or steamID3 to convert to steamID64
as_int : bool
If the steamID64 is returned as an integer rather than string, Default = False
Returns
-------
int or str
steamID64 value
"""
id_str = str(steamID)
id_split = id_str.split(":") # Split string into 'Universe', Account type, and Account number
if id_str.isnumeric(): # Already a steamID64
check_steamID64_length(id_str) # Validate id passed in
if as_int:
return int(id_str)
else:
return id_str
elif re.search(STEAM_ID_REGEX, id_str): # If passed steamID
account_type = int(id_split[1]) # Check for account type
account_id = int(id_split[2]) # Account number, needs to be doubled when added to id64
elif re.search(STEAM_ID_3_REGEX, id_str): # If passed steamID3
account_id3 = int(id_split[2][:-1]) # Remove ] from end of steamID3
account_type = account_id3 % 2
account_id = (account_id3 - account_type) // 2
print(account_id3)
print(account_type)
print(account_id)
else:
raise ValueError(f"Unable to decode steamID: {steamID}")
id64 = ID64_BASE + (account_id * 2) + account_type
# Check if returning as string or integer
if as_int:
return id64
else:
return str(id64)
def check_steamID64_length(id_str :str):
"""
Check if a steamID64 is of the correct length, raises ValueError if not.
Not really for you to use
Parameters
----------
id_str : str
steamID64 to check length of
"""
if len(id_str) != 17:
raise ValueError(f"Incorrect length for steamID64: {id_str}")
print(to_steamID64('[U:1:271098320]'))

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save