Tidy up weapon code and data dumper

This commit is contained in:
sardelka9515
2022-11-16 17:37:31 +08:00
parent 822a69573f
commit 50153d860a
35 changed files with 323192 additions and 743 deletions

315114
Client/Data/Animations.json Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
{
"Bullet": {
"2861067768": "VEHICLE_WEAPON_INSURGENT_MINIGUN",
"3683206664": "VEHICLE_WEAPON_TECHNICAL_MINIGUN",
"3048454573": "VEHICLE_WEAPON_AKULA_TURRET_SINGLE",
"476907586": "VEHICLE_WEAPON_AKULA_TURRET_DUAL",
"431576697": "VEHICLE_WEAPON_AKULA_MINIGUN",
"3405172033": "VEHICLE_WEAPON_ANNIHILATOR2_MINI",
"1000258817": "VEHICLE_WEAPON_BARRAGE_TOP_MINIGUN",
"525623141": "VEHICLE_WEAPON_BARRAGE_REAR_MINIGUN",
"1338760315": "VEHICLE_WEAPON_CARACARA_MINIGUN",
"490982948": "VEHICLE_WEAPON_DEATHBIKE_DUALMINIGUN",
"3909880809": "VEHICLE_WEAPON_DEATHBIKE2_MINIGUN_LASER",
"2600428406": "VEHICLE_WEAPON_DELUXO_MG",
"1416047217": "VEHICLE_WEAPON_DUNE_MINIGUN",
"3003147322": "VEHICLE_WEAPON_FLAMETHROWER",
"2182329506": "VEHICLE_WEAPON_FLAMETHROWER_SCIFI",
"855547631": "VEHICLE_WEAPON_HAVOK_MINIGUN",
"2263283790": "VEHICLE_WEAPON_POUNDER2_MINI",
"2431961420": "VEHICLE_WEAPON_SEASPARROW2_MINIGUN",
"2667462330": "VEHICLE_WEAPON_SPEEDO4_TURRET_MINI",
"3670375085": "VEHICLE_WEAPON_TAMPA_FIXEDMINIGUN",
"1744687076": "VEHICLE_WEAPON_TAMPA_DUALMINIGUN",
"1697521053": "VEHICLE_WEAPON_THRUSTER_MG",
"376489128": "VEHICLE_WEAPON_TULA_MINIGUN",
"4109257098": "VEHICLE_WEAPON_RCTANK_FLAME",
"3959029566": "VEHICLE_WEAPON_CANNON_BLAZER",
"1119849093": "WEAPON_MINIGUN",
"4256881901": "WEAPON_DIGISCANNER",
"1186503822": "VEHICLE_WEAPON_PLAYER_BUZZARD",
"3056410471": "WEAPON_RAYMINIGUN",
"729375873": "VEHICLE_WEAPON_TURRET_LIMO",
"2756787765": "VEHICLE_WEAPON_TURRET_VALKYRIE",
"50118905": "VEHICLE_WEAPON_RUINER_BULLET"
},
"Lazer": {
"955522731": "VEHICLE_WEAPON_STRIKEFORCE_CANNON",
"539292904": "WEAPON_EXPLOSION",
"1638077257": "VEHICLE_WEAPON_PLAYER_SAVAGE"
},
"Others": {
"3441901897": "WEAPON_BATTLEAXE",
"4192643659": "WEAPON_BOTTLE",
"2460120199": "WEAPON_DAGGER",
"2343591895": "WEAPON_FLASHLIGHT",
"3794977420": "WEAPON_GARBAGEBAG",
"3494679629": "WEAPON_HANDCUFFS",
"4191993645": "WEAPON_HATCHET",
"3638508604": "WEAPON_KNUCKLE",
"3713923289": "WEAPON_MACHETE",
"2484171525": "WEAPON_POOLCUE",
"2725352035": "WEAPON_UNARMED",
"4194021054": "WEAPON_ANIMAL",
"148160082": "WEAPON_COUGAR",
"2578778090": "WEAPON_KNIFE",
"1737195953": "WEAPON_NIGHTSTICK",
"1317494643": "WEAPON_HAMMER",
"2508868239": "WEAPON_BAT",
"1141786504": "WEAPON_GOLFCLUB",
"2227010557": "WEAPON_CROWBAR",
"101631238": "WEAPON_FIREEXTINGUISHER",
"883325847": "WEAPON_PETROLCAN",
"2294779575": "WEAPON_BRIEFCASE",
"28811031": "WEAPON_BRIEFCASE_02",
"3450622333": "VEHICLE_WEAPON_SEARCHLIGHT",
"3530961278": "VEHICLE_WEAPON_RADAR",
"1223143800": "WEAPON_BARBED_WIRE",
"4284007675": "WEAPON_DROWNING",
"1936677264": "WEAPON_DROWNING_IN_VEHICLE",
"2339582971": "WEAPON_BLEEDING",
"2461879995": "WEAPON_ELECTRIC_FENCE",
"3452007600": "WEAPON_FALL",
"910830060": "WEAPON_EXHAUSTION",
"3425972830": "WEAPON_HIT_BY_WATER_CANNON",
"133987706": "WEAPON_RAMMED_BY_CAR",
"2741846334": "WEAPON_RUN_OVER_BY_CAR",
"341774354": "WEAPON_HELI_CRASH",
"2971687502": "VEHICLE_WEAPON_ROTORS",
"3750660587": "WEAPON_FIRE",
"3854032506": "WEAPON_ANIMAL_RETRIEVER",
"3146768957": "WEAPON_SMALL_DOG",
"743550225": "WEAPON_TIGER_SHARK",
"3030980043": "WEAPON_HAMMERHEAD_SHARK",
"4198358245": "WEAPON_KILLER_WHALE",
"861723357": "WEAPON_BOAR",
"1205296881": "WEAPON_PIG",
"1161062353": "WEAPON_COYOTE",
"4106648222": "WEAPON_DEER",
"955837630": "WEAPON_HEN",
"2793925639": "WEAPON_RABBIT",
"3799318422": "WEAPON_CAT",
"94548753": "WEAPON_COW",
"940833800": "WEAPON_STONE_HATCHET",
"3756226112": "WEAPON_SWITCHBLADE",
"419712736": "WEAPON_WRENCH",
"406929569": "WEAPON_FERTILIZERCAN",
"3126027122": "WEAPON_HAZARDCAN"
}
}

329
Client/Data/WeaponHash.cs Normal file
View File

@ -0,0 +1,329 @@
public enum WeaponHash : uint
{
Advancedrifle = 0xAF113F99,
AirDefenceGun = 0x2C082D7D,
AirstrikeRocket = 0x13579279,
Animal = 0xF9FBAEBE,
AnimalRetriever = 0xE5B7DE7A,
Appistol = 0x22D8FE39,
ArenaHomingMissile = 0x648A81D0,
ArenaMachineGun = 0x34FDFF66,
Assaultrifle = 0xBFEFFF6D,
AssaultrifleMk2 = 0x394F415C,
Assaultshotgun = 0xE284C527,
Assaultsmg = 0xEFE7E2DF,
Autoshotgun = 0x12E82D3D,
Ball = 0x23C9F95C,
BarbedWire = 0x48E7B178,
Bat = 0x958A4A8F,
Battleaxe = 0xCD274149,
BirdCrap = 0x6D5E2801,
Bleeding = 0x8B7333FB,
Boar = 0x335CDADD,
Bottle = 0xF9E6AA4B,
Briefcase = 0x88C78EB7,
Briefcase02 = 0x1B79F17,
Bullpuprifle = 0x7F229F94,
BullpuprifleMk2 = 0x84D6FAFD,
Bullpupshotgun = 0x9D61E50F,
Bzgas = 0xA0973D5E,
Carbinerifle = 0x83BF0278,
CarbinerifleMk2 = 0xFAD1F1C9,
Cat = 0xE274FF96,
Ceramicpistol = 0x2B5EF5EC,
Combatmg = 0x7FD62962,
CombatmgMk2 = 0xDBBD7280,
Combatpdw = 0xA3D4D34,
Combatpistol = 0x5EF9FEC4,
Combatshotgun = 0x5A96BA4,
Compactlauncher = 0x781FE4A,
Compactrifle = 0x624FE830,
Cougar = 0x8D4BE52,
Cow = 0x5A2B311,
Coyote = 0x453467D1,
Crowbar = 0x84BD7BFD,
Dagger = 0x92A27487,
Dbshotgun = 0xEF951FBB,
Deer = 0xF4C67A9E,
Digiscanner = 0xFDBADCED,
Doubleaction = 0x97EA20B8,
Drowning = 0xFF58C4FB,
DrowningInVehicle = 0x736F5990,
ElectricFence = 0x92BD4EBB,
Emplauncher = 0xDB26713A,
Exhaustion = 0x364A29EC,
Explosion = 0x2024F4E8,
Fall = 0xCDC174B0,
Fertilizercan = 0x184140A1,
Fire = 0xDF8E89EB,
Fireextinguisher = 0x60EC506,
Firework = 0x7F7497E5,
Flare = 0x497FACC3,
Flaregun = 0x47757124,
Flashlight = 0x8BB05FD7,
Gadgetpistol = 0x57A4368C,
Garbagebag = 0xE232C28C,
Golfclub = 0x440E4788,
Grenade = 0x93E220BD,
Grenadelauncher = 0xA284510B,
GrenadelauncherSmoke = 0x4DD2DC56,
Gusenberg = 0x61012683,
Hammer = 0x4E875F73,
HammerheadShark = 0xB4A915CB,
Handcuffs = 0xD04C944D,
Hatchet = 0xF9DCBF2D,
Hazardcan = 0xBA536372,
Heavypistol = 0xD205520E,
Heavyrifle = 0xC78D71B4,
Heavyshotgun = 0x3AABBBAA,
Heavysniper = 0xC472FE2,
HeavysniperMk2 = 0xA914799,
HeliCrash = 0x145F1012,
Hen = 0x38F8ECBE,
HitByWaterCannon = 0xCC34325E,
Hominglauncher = 0x63AB0442,
KillerWhale = 0xFA3DDCE5,
Knife = 0x99B507EA,
Knuckle = 0xD8DF3C3C,
Machete = 0xDD5DF8D9,
Machinepistol = 0xDB1AA450,
Marksmanpistol = 0xDC4DB296,
Marksmanrifle = 0xC734385A,
MarksmanrifleMk2 = 0x6A6C02E0,
Mg = 0x9D07F764,
Microsmg = 0x13532244,
Militaryrifle = 0x9D1F17E6,
Minigun = 0x42BF8A85,
Minismg = 0xBD248B55,
Molotov = 0x24B17070,
Musket = 0xA89CB99E,
Navyrevolver = 0x917F6C8C,
Nightstick = 0x678B81B1,
PassengerRocket = 0x166218FF,
Petrolcan = 0x34A67B97,
Pig = 0x47D75EF1,
Pipebomb = 0xBA45E8B8,
Pistol = 0x1B06D571,
Pistol50 = 0x99AEEB3B,
PistolMk2 = 0xBFE256D4,
Poolcue = 0x94117305,
Proxmine = 0xAB564B93,
Pumpshotgun = 0x1D073A89,
PumpshotgunMk2 = 0x555AF99A,
Rabbit = 0xA687EC07,
Railgun = 0x6D544C99,
RammedByCar = 0x7FC7D7A,
Raycarbine = 0x476BF155,
Rayminigun = 0xB62D1F67,
Raypistol = 0xAF3696A1,
Remotesniper = 0x33058E22,
Revolver = 0xC1B3C3D1,
RevolverMk2 = 0xCB96392F,
Rpg = 0xB1CA77B1,
RunOverByCar = 0xA36D413E,
Sawnoffshotgun = 0x7846A318,
SmallDog = 0xBB8FE23D,
Smg = 0x2BE6766B,
SmgMk2 = 0x78A97CD0,
Smokegrenade = 0xFDBC8A50,
Sniperrifle = 0x5FC3C11,
Snowball = 0x787F0BB,
Snspistol = 0xBFD21232,
SnspistolMk2 = 0x88374054,
Specialcarbine = 0xC0A3098D,
SpecialcarbineMk2 = 0x969C3D67,
Stickybomb = 0x2C3731D9,
Stinger = 0x687652CE,
StoneHatchet = 0x3813FC08,
Stungun = 0x3656C8C1,
StungunMp = 0x45CD9CF3,
Switchblade = 0xDFE37640,
TigerShark = 0x2C51AD11,
Tranquilizer = 0x32A888BD,
Unarmed = 0xA2719263,
VehicleRocket = 0xBEFDC581,
Vintagepistol = 0x83839C4,
Wrench = 0x19044EE0,
}
public enum VehicleWeaponHash : uint
{
Invalid = 0xFFFFFFFF,
AkulaBarrage = 0x880D14F2,
AkulaMinigun = 0x19B95679,
AkulaMissile = 0x7CBE304C,
AkulaTurretDual = 0x1C6D0842,
AkulaTurretSingle = 0xB5B3B9AD,
Annihilator2Barrage = 0x35D8CC90,
Annihilator2Mini = 0xCAF6CD41,
Annihilator2Missile = 0xC76BC6B7,
ApcCannon = 0x138F71D8,
ApcMg = 0xB56E4E4,
ApcMissile = 0x44A56189,
ArdentMg = 0xC44E4341,
AvengerCannon = 0x9867203B,
BarrageRearGl = 0xA44C228D,
BarrageRearMg = 0x47894765,
BarrageRearMinigun = 0x1F545F65,
BarrageTopMg = 0xF7498994,
BarrageTopMinigun = 0x3B9EBD01,
Bomb = 0x9AF0B90C,
BombCluster = 0xD28BCA3,
BombGas = 0x5540A91E,
BombIncendiary = 0x6AF7A717,
BombStandardWide = 0x6EA548D0,
BombushkaCannon = 0xD8443A59,
BombushkaDualmg = 0x2C2B2D58,
BombWater = 0xF444C4C8,
Bruiser250calLaser = 0x3D6A0196,
Bruiser50cal = 0xD73DC601,
Brutus250calLaser = 0x68C7A4C3,
Brutus50cal = 0xEB5E5C0A,
CannonBlazer = 0xEBF9FF3E,
CaracaraMg = 0x6C516BA8,
CaracaraMinigun = 0x4FCBDC7B,
ChernoMissile = 0xA247D03E,
CometMg = 0xEAA835F3,
Deathbike2MinigunLaser = 0xE90C0BE9,
DeathbikeDualminigun = 0x1D43CE24,
DeluxoMg = 0x9AFF6376,
DeluxoMissile = 0xB4F96934,
DogfighterMg = 0x5F1834E2,
DogfighterMissile = 0xCA46F87D,
Dominator450cal = 0xF80C9B0F,
Dominator550calLaser = 0xB4246A5F,
DuneGrenadelauncher = 0xA0FC710D,
DuneMg = 0xD11507CF,
DuneMinigun = 0x54672A71,
EnemyLaser = 0x5D6660AB,
Flamethrower = 0xB300643A,
FlamethrowerScifi = 0x8213B4A2,
Granger2Mg = 0xEAE2E19A,
HackerMissile = 0x766FF7B1,
HackerMissileHoming = 0x77EACF96,
HalftrackDualmg = 0x4F6384FB,
HalftrackQuadmg = 0x491B2E74,
HavokMinigun = 0x32FE9EEF,
HunterBarrage = 0x2ED14835,
HunterCannon = 0x2A00AB1A,
HunterMg = 0x42BA80A7,
HunterMissile = 0x924A5F5,
Impaler250cal = 0x5F565C09,
Impaler350calLaser = 0x8CBDFC88,
Imperator250calLaser = 0x7817C526,
Imperator50cal = 0xB662C67B,
InsurgentMinigun = 0xAA886DF8,
Issi450cal = 0x7648E34D,
Issi550calLaser = 0x767F6925,
Jb700Mg = 0x373AD53C,
KhanjaliCannon = 0x1E3ACFA0,
KhanjaliCannonHeavy = 0x838B716D,
KhanjaliGl = 0x178605E2,
KhanjaliMg = 0x2A6F8E1D,
KosatkaTorpedo = 0x62E2140E,
MenacerMg = 0xDFCAF8A4,
MicrolightMg = 0xC4E0216C,
Mine = 0x59EAE9A4,
MineEmp = 0x69E10D60,
MineEmpRc = 0x5454B4C6,
MineKinetic = 0x3C09584E,
MineKineticRc = 0x252AF560,
MineSlick = 0x56FACAC7,
MineSlickRc = 0x84E87B17,
MineSpike = 0xD96DA06C,
MineSpikeRc = 0x7C2AFE51,
MineTar = 0xF4418BA0,
MineTarRc = 0x7D3474D6,
MobileopsCannon = 0xE53E69A4,
MogulDualnose = 0xE5F3AE2F,
MogulDualturret = 0xBA277C01,
MogulNose = 0xF6189F4A,
MogulTurret = 0xE2FD135E,
Monster3Glkin = 0xE5AE53DD,
MortarExplosive = 0xA1A8CCD2,
MortarKinetic = 0x632A22FD,
Mule4Mg = 0x84558727,
Mule4Missile = 0x4772F84B,
Mule4TurretGl = 0xDD124A65,
NightsharkMg = 0xA61AC574,
NoseTurretValkyrie = 0x4170E491,
Oppressor2Cannon = 0xD64D3469,
Oppressor2Mg = 0xE2451DD6,
Oppressor2Missile = 0x753A78F1,
OppressorMg = 0xD9322EDD,
OppressorMissile = 0x8BB7C63E,
Paragon2Mg = 0x2CAC4286,
PatrolboatDualmg = 0x4C2FB4E9,
PlaneRocket = 0xCF0896E0,
PlayerBullet = 0x4B139B2D,
PlayerBuzzard = 0x46B89C8E,
PlayerHunter = 0x9F1A91DE,
PlayerLaser = 0xEFFD014B,
PlayerLazer = 0xE2822A29,
PlayerSavage = 0x61A31349,
Pounder2Barrage = 0x926B8CE4,
Pounder2Gl = 0x9318FF16,
Pounder2Mini = 0x86E6F84E,
Pounder2Missile = 0x9A8EA9A,
Radar = 0xD276317E,
RctankFlame = 0xF4EE498A,
RctankGun = 0x52FCA619,
RctankLazer = 0x57F22C50,
RctankRocket = 0x76F744CB,
RevolterMg = 0xBD5E626A,
RogueCannon = 0xE72ABBC2,
RogueMg = 0x97273CD,
RogueMissile = 0x6C88E47D,
Rotors = 0xB1205A4E,
RuinerBullet = 0x2FCC0F9,
RuinerRocket = 0x50DC6AB,
SavestraMg = 0xEB41E84E,
Scarab250calLaser = 0xE22DEDCC,
Scarab50cal = 0x217FEF28,
ScramjetMg = 0xDCE6112,
ScramjetMissile = 0xBCE908DB,
SeabreezeMg = 0x51B8D4E8,
Searchlight = 0xCDAC517D,
Seasparrow2Minigun = 0x90F4C94C,
Slamvan450cal = 0x3AAB6E6B,
Slamvan550calLaser = 0x519543AE,
SpaceRocket = 0xF8A3939F,
Speedo4Mg = 0xC7FCF93C,
Speedo4TurretMg = 0xD6561141,
Speedo4TurretMini = 0x9EFE3EBA,
StrikeforceBarrage = 0x39BC6683,
StrikeforceCannon = 0x38F41EAB,
StrikeforceMissile = 0x1EF01D8A,
SubcarMg = 0x461DDDB0,
SubcarMissile = 0xD4897C0E,
SubcarTorpedo = 0xE783C3BA,
SubMissileHoming = 0xAAE74AC1,
TampaDualminigun = 0x67FDCFE4,
TampaFixedminigun = 0xDAC57AAD,
TampaMissile = 0x9E5840A2,
TampaMortar = 0x3C83C410,
Tank = 0x73F7C04B,
TechnicalMinigun = 0xDB894608,
ThrusterMg = 0x652E1D9D,
ThrusterMissile = 0x4635DD15,
TrailerDualaa = 0x808C4D4C,
TrailerMissile = 0x145599F7,
TrailerQuadmg = 0x4711B02C,
TulaDualmg = 0xB0D15C0B,
TulaMg = 0x488BD081,
TulaMinigun = 0x1670C4A8,
TulaNosemg = 0x419D8E15,
TurretBoxville = 0xB54F4918,
TurretDinghy550cal = 0xB3B155FD,
TurretInsurgent = 0x44DB5498,
TurretLimo = 0x2B796481,
TurretPatrolboat50cal = 0xDF4EA041,
TurretTechnical = 0x7FD2EA0B,
TurretValkyrie = 0xA4513E35,
VigilanteMg = 0xF4077EE7,
VigilanteMissile = 0x504DA665,
ViserisMg = 0x87A02E06,
VolatolDualmg = 0x4497AC40,
Zr380250calLaser = 0x220093BC,
Zr38050cal = 0x6AB93C82,
}

2891
Client/Data/Weapons.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ using System.Windows;
using System.Windows.Forms;
using System.Windows.Input;
using RageCoop.Core;
using static RageCoop.Client.Shared;
using MessageBox = System.Windows.MessageBox;
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
@ -101,7 +102,7 @@ namespace RageCoop.Client.Installer
checkKeys:
UpdateStatus("Checking conflicts");
var menyooConfig = Path.Combine(root, @"menyooStuff\menyooConfig.ini");
var settingsPath = Path.Combine(root, Util.SettingsPath);
var settingsPath = Path.Combine(root, SettingsPath);
Settings settings = null;
try
{
@ -171,7 +172,7 @@ namespace RageCoop.Client.Installer
}
UpdateStatus("Completed!");
MessageBox.Show("Installation sucessful!");
MessageBox.Show("Installation successful!");
Environment.Exit(0);
}
}

View File

@ -11,16 +11,6 @@
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Resources\**" />
<EmbeddedResource Remove="Resources\**" />
<None Remove="Resources\**" />
<Page Remove="Resources\**" />
</ItemGroup>
<ItemGroup>
<None Remove="bg.png" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<OutDir>..\..\bin\Debug\Client</OutDir>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -34,9 +24,8 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\RageCoop.Core.csproj" />
<ProjectReference Include="..\Loader\RageCoop.Client.Loader.csproj" />
<ProjectReference Include="..\Scripts\RageCoop.Client.csproj" />
<ProjectReference Include="..\Loader\RageCoop.Client.Loader.csproj" />
<ProjectReference Include="..\Scripts\RageCoop.Client.csproj" />
</ItemGroup>
<ItemGroup>
@ -59,10 +48,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

View File

@ -9,6 +9,7 @@ using GTA.Native;
using RageCoop.Client.CefHost;
using RageCoop.Client.Scripting;
using RageCoop.Core;
using static RageCoop.Client.Shared;
namespace RageCoop.Client.GUI
{
@ -27,23 +28,13 @@ namespace RageCoop.Client.GUI
{
Main.CefRunning = true;
HookManager.Initialize();
CefController.Initialize(@"RageCoop\SubProcess\RageCoop.Client.CefHost.exe");
CefController.Initialize(CefSubProcessPath);
CefController.OnCefMessage = m => API.Logger.Debug(m);
HookManager.AddOverLay(CefOverlay);
}
public static CefClient ActiveClient { get; set; }
public static void Test()
{
var c = CreateClient(new Size(640, 480));
c.Scale = 0.8f;
c.Opacity = 128;
Script.Wait(2000);
c.Controller.LoadUrl("https://ragecoop.online/");
ActiveClient = c;
}
public static void Tick()
{
if (ActiveClient != null)

View File

@ -21,6 +21,7 @@ using Console = GTA.Console;
using Control = GTA.Control;
using Screen = System.Windows.Forms.Screen;
using Script = GTA.Script;
using static RageCoop.Client.Shared;
namespace RageCoop.Client
{
@ -57,36 +58,22 @@ namespace RageCoop.Client
/// </summary>
public Main()
{
Util.StartUpCheck();
Util.StartUpCheck();
Directory.CreateDirectory(DataPath);
Console.Info(
$"Starting {typeof(Main).FullName}, domain: {AppDomain.CurrentDomain.Id} {AppDomain.CurrentDomain.FriendlyName}");
try
{
Settings = Util.ReadSettings();
if (Settings.DataDirectory.StartsWith("Scripts"))
{
var defaultDir = new Settings().DataDirectory;
Console.Warning("Data directory must be outside scripts folder, migrating to default direcoty: " +
defaultDir);
if (Directory.Exists(Settings.DataDirectory))
{
CoreUtils.CopyFilesRecursively(new DirectoryInfo(Settings.DataDirectory),
new DirectoryInfo(defaultDir));
Directory.Delete(Settings.DataDirectory, true);
}
Settings.DataDirectory = defaultDir;
Util.SaveSettings();
}
}
catch
{
// GTA.UI.Notification.Show("Malformed configuration, overwriting with default values...");
Notification.Show("Malformed configuration, overwriting with default values...");
Settings = new Settings();
Util.SaveSettings();
}
Directory.CreateDirectory(Settings.DataDirectory);
Logger = new Logger()
{
Writers = new List<StreamWriter> { CoreUtils.OpenWriter(LogPath) },
@ -153,9 +140,6 @@ namespace RageCoop.Client
Counter.Restart();
}
public static string LogPath => $"{Settings.DataDirectory}\\RageCoop.Client.log";
private static void OnAborted(object sender, EventArgs e)
{
try
@ -264,13 +248,13 @@ namespace RageCoop.Client
{
new ScaledText(new PointF(Screen.PrimaryScreen.Bounds.Width / 2, 0),
$"L: {Networking.Latency * 1000:N0}ms", 0.5f)
{ Alignment = Alignment.Center }.Draw();
{ Alignment = Alignment.Center }.Draw();
new ScaledText(new PointF(Screen.PrimaryScreen.Bounds.Width / 2, 30),
$"R: {NetUtility.ToHumanReadable(Statistics.BytesDownPerSecond)}/s", 0.5f)
{ Alignment = Alignment.Center }.Draw();
{ Alignment = Alignment.Center }.Draw();
new ScaledText(new PointF(Screen.PrimaryScreen.Bounds.Width / 2, 60),
$"S: {NetUtility.ToHumanReadable(Statistics.BytesUpPerSecond)}/s", 0.5f)
{ Alignment = Alignment.Center }.Draw();
{ Alignment = Alignment.Center }.Draw();
}
MainChat.Tick();
@ -484,7 +468,10 @@ namespace RageCoop.Client
Resources.Unload();
});
Memory.RestorePatches();
CefManager.CleanUp();
if (CefRunning)
{
CefManager.CleanUp();
}
HookManager.CleanUp();
DownloadManager.Cleanup();
Voice.ClearAll();

View File

@ -6,19 +6,15 @@ using GTA.Native;
using GTA.UI;
using LemonUI.Menus;
using Newtonsoft.Json;
using RageCoop.Core;
using Console = GTA.Console;
using static RageCoop.Client.Shared;
namespace RageCoop.Client
{
internal class AnimDic
{
public string[] Animations;
public string DictionaryName;
}
internal static class DevToolMenu
{
private const string AnimationsPath = @"RageCoop\Data\animDictsCompact.json";
public static NativeMenu Menu = new NativeMenu("RAGECOOP", "DevTool", "Internal testing tools")
{
@ -26,31 +22,24 @@ namespace RageCoop.Client
Alignment = Main.Settings.FlipMenu ? Alignment.Right : Alignment.Left
};
private static readonly NativeCheckboxItem enableItem = new NativeCheckboxItem("Enable");
public static readonly NativeItem dumpItem = new NativeItem("Dump vehicle weapons");
public static readonly NativeItem dumpFixItem = new NativeItem("Dump weapon fixes");
public static readonly NativeItem dumpWHashItem = new NativeItem("Dump WeaponHash.cs");
public static readonly NativeItem getAnimItem = new NativeItem("Get current animation");
public static readonly NativeItem dumpVWHashItem = new NativeItem("Dump VehicleWeaponHash.cs");
private static readonly NativeCheckboxItem enableItem = new NativeCheckboxItem("Show weapon bones");
public static readonly NativeItem DumpFixItem = new NativeItem("Dump weapon fixes");
public static readonly NativeItem GetAnimItem = new NativeItem("Get current animation");
public static readonly NativeItem DumpVwHashItem = new NativeItem("Dump VehicleWeaponHash.cs");
static DevToolMenu()
{
Menu.Banner.Color = Color.FromArgb(225, 0, 0, 0);
Menu.Title.Color = Color.FromArgb(255, 165, 0);
enableItem.Activated += enableItem_Activated;
enableItem.Activated += ShowBones;
enableItem.Checked = false;
dumpItem.Activated += DumpItem_Activated;
dumpVWHashItem.Activated += (s, e) => WeaponUtil.DumpVehicleWeaponHashes();
dumpWHashItem.Activated += (s, e) => WeaponUtil.DumpWeaponHashes();
dumpFixItem.Activated += (s, e) => WeaponUtil.DumpWeaponFix();
getAnimItem.Activated += (s, e) =>
DumpFixItem.Activated += (s, e) => WeaponUtil.DumpWeaponFix(WeaponFixDataPath);
GetAnimItem.Activated += (s, e) =>
{
if (File.Exists(AnimationsPath))
if (File.Exists(AnimationsDataPath))
{
var anims = JsonConvert.DeserializeObject<AnimDic[]>(File.ReadAllText(AnimationsPath));
var anims = JsonConvert.DeserializeObject<AnimDic[]>(File.ReadAllText(AnimationsDataPath));
foreach (var anim in anims)
foreach (var a in anim.Animations)
if (Function.Call<bool>(Hash.IS_ENTITY_PLAYING_ANIM, Main.P, anim.DictionaryName, a, 3))
@ -61,40 +50,17 @@ namespace RageCoop.Client
}
else
{
Notification.Show($"~r~{AnimationsPath} not found");
Notification.Show($"~r~{AnimationsDataPath} not found");
}
};
Menu.Add(enableItem);
Menu.Add(dumpItem);
Menu.Add(dumpVWHashItem);
Menu.Add(dumpWHashItem);
Menu.Add(dumpFixItem);
Menu.Add(getAnimItem);
Menu.Add(DumpVwHashItem);
Menu.Add(DumpFixItem);
Menu.Add(GetAnimItem);
}
private static void DumpItem_Activated(object sender, EventArgs e)
{
dumpItem.Enabled = false;
Directory.CreateDirectory(@"RageCoop\Data\tmp");
var input = @"RageCoop\Data\tmp\vehicles.json";
var dumpLocation = @"RageCoop\Data\VehicleWeapons.json";
try
{
VehicleWeaponInfo.Dump(input, dumpLocation);
Console.Info("Weapon info dumped to " + dumpLocation);
}
catch (Exception ex)
{
Console.Error("~r~" + ex);
}
finally
{
dumpItem.Enabled = true;
}
}
private static void enableItem_Activated(object sender, EventArgs e)
private static void ShowBones(object sender, EventArgs e)
{
if (enableItem.Checked)
{

View File

@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using RageCoop.Client.Scripting;
using RageCoop.Core;
using static RageCoop.Client.Shared;
namespace RageCoop.Client
{
@ -45,6 +47,7 @@ namespace RageCoop.Client
{
try
{
Directory.CreateDirectory(ResourceFolder);
Main.Resources.Load(ResourceFolder, _resources.ToArray());
return new Packets.FileTransferResponse { ID = 0, Response = FileResponse.Loaded };
}
@ -57,8 +60,8 @@ namespace RageCoop.Client
});
}
public static string ResourceFolder => Path.GetFullPath(Path.Combine(Main.Settings.DataDirectory, "Resources",
Main.Settings.LastServerAddress.Replace(":", ".")));
public static string ResourceFolder => Path.GetFullPath(Path.Combine(DataPath, "Resources",
API.ServerEndPoint.ToString().Replace(":", ".")));
public static event EventHandler<string> DownloadCompleted;

View File

@ -16,7 +16,7 @@ using System.Resources;
// Version informationr(
[assembly: AssemblyVersion("1.5.7.356")]
[assembly: AssemblyFileVersion("1.5.7.356")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]

View File

@ -45,7 +45,6 @@
<Compile Include="Menus\Sub\DevToolMenu.cs" />
<Compile Include="Menus\Sub\ServersMenu.cs" />
<Compile Include="Menus\Sub\SettingsMenu.cs" />
<Compile Include="Menus\Sub\UpdateMenu.cs" />
<Compile Include="Networking\Chat.cs" />
<Compile Include="Networking\DownloadManager.cs" />
<Compile Include="Networking\HolePunch.cs" />
@ -54,6 +53,11 @@
<Compile Include="Networking\Send.cs" />
<Compile Include="Networking\Statistics.cs" />
<Compile Include="PlayerList.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>AssemblyInfo.tt</DependentUpon>
</Compile>
<Compile Include="Scripting\API.cs" />
<Compile Include="Scripting\BaseScript.cs" />
<Compile Include="Scripting\ClientScript.cs" />
@ -71,11 +75,11 @@
<Compile Include="Sync\EntityPool.cs" />
<Compile Include="Sync\SyncEvents.cs" />
<Compile Include="Sync\Voice.cs" />
<Compile Include="Util\AddOnDataProvider.cs" />
<Compile Include="Util\Memory.cs" />
<Compile Include="Util\NativeCaller.cs" />
<Compile Include="Util\PedConfigFlags.cs" />
<Compile Include="Util\PedExtensions.cs" />
<Compile Include="Shared\Shared.cs" />
<Compile Include="Util\TaskType.cs" />
<Compile Include="Util\Util.cs" />
<Compile Include="Util\VehicleExtensions.cs" />
@ -143,6 +147,9 @@
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
@ -183,8 +190,13 @@
<PostBuildEvent Condition=" '$(DevEnvDir)' != '*Undefined*'">
"$(DevEnvDir)TextTransform.exe" -a !!BuildConfiguration!$(Configuration) "$(ProjectDir)Properties\AssemblyInfo.tt"
</PostBuildEvent>
<PostBuildEvent Condition="'$(Configuration)' != 'API' AND '$(SolutionDir)' != '*Undefined*'">
copy "$(SolutionDir)Client\Data" "..\Data" /y
</PostBuildEvent>
<PreBuildEvent Condition=" '$(SolutionDir)' != '*Undefined*'">
dotnet build -c $(Configuration) "$(SolutionDir)Client\CefHost\RageCoop.Client.CefHost.csproj"
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' != 'API'">
</PropertyGroup>
</Project>

View File

@ -1,2 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=shared/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=util/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -85,24 +85,6 @@ namespace RageCoop.Client.Scripting
/// </summary>
public static class Events
{
/// <summary>
/// This is equivalent of <see cref="Script.KeyDown" />
/// </summary>
/// <remarks>
/// Calling <see cref="GTA.Script.Yield" /> in the handler will interfer other scripts, subscribe to
/// <see cref="GTA.Script.KeyDown" /> instead.
/// </remarks>
[Obsolete] public static KeyEventHandler OnKeyDown;
/// <summary>
/// This is equivalent of <see cref="Script.KeyUp" />
/// </summary>
/// <remarks>
/// Calling <see cref="GTA.Script.Yield" /> in the handler will interfer other scripts, subscribe to
/// <see cref="GTA.Script.KeyUp" /> instead.
/// </remarks>
[Obsolete] public static KeyEventHandler OnKeyUp;
/// <summary>
/// The local player is dead
/// </summary>
@ -128,16 +110,6 @@ namespace RageCoop.Client.Scripting
/// </summary>
public static event EventHandler<SyncedPed> OnPedDeleted;
/// <summary>
/// This is equivalent of <see cref="GTA.Script.Tick" />.
/// </summary>
/// <remarks>
/// Calling <see cref="GTA.Script.Yield" /> in the handler will interfer other scripts, subscribe to
/// <see cref="GTA.Script.Tick" /> instead.
/// </remarks>
[Obsolete]
public static event EmptyEvent OnTick;
#region DELEGATES
/// <summary>
@ -178,22 +150,7 @@ namespace RageCoop.Client.Scripting
{
OnPlayerDied?.Invoke();
}
internal static void InvokeTick()
{
OnTick?.Invoke();
}
internal static void InvokeKeyDown(object s, KeyEventArgs e)
{
OnKeyDown?.Invoke(s, e);
}
internal static void InvokeKeyUp(object s, KeyEventArgs e)
{
OnKeyUp?.Invoke(s, e);
}
internal static void InvokeCustomEventReceived(Packets.CustomEvent p)
{
var args = new CustomEventReceivedArgs { Hash = p.Hash, Args = p.Args };

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using GTA;
@ -264,32 +265,7 @@ namespace RageCoop.Client.Scripting
private static InputArgument GetInputArgument(object obj)
{
// Implicit conversion
switch (obj)
{
case byte _:
return (byte)obj;
case short _:
return (short)obj;
case ushort _:
return (ushort)obj;
case int _:
return (int)obj;
case uint _:
return (uint)obj;
case long _:
return (long)obj;
case ulong _:
return (ulong)obj;
case float _:
return (float)obj;
case bool _:
return (bool)obj;
case string _:
return obj as string;
default:
return null;
}
return Unsafe.As<InputArgument>(obj);
}
}
}

View File

@ -73,11 +73,7 @@ namespace RageCoop.Client
/// The game won't spawn more NPC traffic if the limit is exceeded. -1 for unlimited (not recommended).
/// </summary>
public int WorldPedSoftLimit { get; set; } = 30;
/// <summary>
/// The directory where log and resources downloaded from server will be placed.
/// </summary>
public string DataDirectory { get; set; } = "RageCoop\\Data";
/// <summary>
/// Show the owner name of the entity you're aiming at

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RageCoop.Client
{
internal static partial class Shared
{
public static string BasePath = "RageCoop";
public static string DataPath = Path.Combine(BasePath, "Data");
public static string LogPath = Path.Combine(DataPath, "RageCoop.Client.log");
public static string SettingsPath = Path.Combine(DataPath,"Setting.json");
public static string VehicleWeaponDataPath = Path.Combine(DataPath, "VehicleWeapons.json");
public static string WeaponFixDataPath = Path.Combine(DataPath, "WeaponFixes.json");
public static string WeaponInfoDataPath = Path.Combine(DataPath, "Weapons.json");
public static string AnimationsDataPath = Path.Combine(DataPath, "Animations.json");
public static string CefSubProcessPath = Path.Combine(BasePath, "SubProcess", "RageCoop.Client.CefHost.exe");
}
}

View File

@ -1,59 +0,0 @@
using GTA;
namespace RageCoop.Client
{
/// <summary>
/// Class providing support for addon mods
/// </summary>
internal class AddOnDataProvider
{
public static int GetMuzzleIndex(Model model)
{
switch (model.Hash)
{
// f14a2
case -848721350:
return 48;
// f15e
case 881261972:
return 32;
// f16c
case -2051171080:
return 25;
// F22A
case 2061630439:
return 14;
// f35c
case -343547392:
return 44;
// mig29a
case 513887552:
return 18;
// su30sm
case -733985185:
return 34;
// su33
case -722216722:
return 34;
// su35s
case -268602544:
return 28;
// su57
case 1490050781:
return 21;
default:
return -1;
}
}
}
}

View File

@ -11,6 +11,7 @@ using LemonUI.Elements;
using Newtonsoft.Json;
using RageCoop.Core;
using Font = GTA.UI.Font;
using static RageCoop.Client.Shared;
[assembly: InternalsVisibleTo("RageCoop.Client.Installer")]
@ -18,7 +19,6 @@ namespace RageCoop.Client
{
internal static class Util
{
public static string SettingsPath = "RageCoop\\Settings.json";
/// <summary>
/// The location of the cursor on screen between 0 and 1.

View File

@ -7,240 +7,97 @@ using GTA;
using GTA.Math;
using GTA.Native;
using Newtonsoft.Json;
using RageCoop.Client.Scripting;
using RageCoop.Core;
using Console = GTA.Console;
using static RageCoop.Client.Shared;
namespace RageCoop.Client
{
#region DUMP
internal class VehicleInfo
{
public VehicleBone[] Bones;
public uint Hash;
public string Name;
public string[] Weapons;
}
internal class VehicleBone
{
public uint BoneID;
public uint BoneIndex;
public string BoneName;
}
internal class WeaponBones
{
public VehicleBone[] Bones;
public string Name;
}
internal class VehicleWeaponInfo
{
public uint Hash;
public string Name;
public Dictionary<uint, WeaponBones> Weapons = new Dictionary<uint, WeaponBones>();
public static void Dump(string input, string output)
{
Console.Info("Generating " + output);
if (!File.Exists(input))
{
Console.Info("Downloading");
HttpHelper.DownloadFile(
"https://raw.githubusercontent.com/DurtyFree/gta-v-data-dumps/master/vehicles.json", input);
}
Console.Info("Deserialising");
var infos = JsonConvert.DeserializeObject<VehicleInfo[]>(File.ReadAllText(input));
Console.Info("Serialising");
File.WriteAllText(output,
JsonConvert.SerializeObject(
infos.Select(x => FromVehicle(x)).Where(x => x != null),
Formatting.Indented));
}
public static VehicleWeaponInfo FromVehicle(VehicleInfo info)
{
if (info.Weapons.Length == 0) return null;
var result = new VehicleWeaponInfo { Hash = info.Hash, Name = info.Name };
for (var i = 0; i < info.Weapons.Length; i++)
result.Weapons.Add((uint)Game.GenerateHash(info.Weapons[i])
, new WeaponBones
{
Name = info.Weapons[i],
Bones = info.Bones.Where(x =>
x.BoneName.StartsWith($"weapon_{i + 1}") && !x.BoneName.EndsWith("rot")).ToArray()
});
return result;
}
}
internal class WeaponInfo
{
public uint Hash;
public string Name;
}
[StructLayout(LayoutKind.Explicit, Size = 312)]
public struct DlcWeaponData
{
}
internal class WeaponFix
{
public Dictionary<uint, string> Bullet = new Dictionary<uint, string>();
public Dictionary<uint, string> Lazer = new Dictionary<uint, string>();
public Dictionary<uint, string> Others = new Dictionary<uint, string>();
}
#endregion
internal static class WeaponUtil
{
public const string VehicleWeaponLocation = @"RageCoop\Data\VehicleWeapons.json";
public const string WeaponFixLocation = @"RageCoop\Data\WeaponFixes.json";
public static Dictionary<uint, VehicleWeaponInfo> VehicleWeapons = new Dictionary<uint, VehicleWeaponInfo>();
public static WeaponFix WeaponFix;
public static readonly HashSet<uint> ExplosiveBullets = new HashSet<uint>
{
(uint)VehicleWeaponHash.PlayerLazer,
(uint)WeaponHash.Railgun,
1638077257
};
public static readonly HashSet<WeaponHash> ProjectileWeapons = new HashSet<WeaponHash>
{
WeaponHash.HomingLauncher,
WeaponHash.RPG,
WeaponHash.Firework,
WeaponHash.UpNAtomizer,
WeaponHash.GrenadeLauncher,
WeaponHash.GrenadeLauncherSmoke,
WeaponHash.CompactGrenadeLauncher,
WeaponHash.FlareGun
};
public static readonly HashSet<VehicleWeaponHash> VehicleProjectileWeapons = new HashSet<VehicleWeaponHash>
{
VehicleWeaponHash.PlaneRocket,
VehicleWeaponHash.SpaceRocket,
VehicleWeaponHash.Tank,
(VehicleWeaponHash)3565779982, // STROMBERG missiles
(VehicleWeaponHash)3169388763 // SCRAMJET missiles
};
public static Dictionary<uint, WeaponInfo> Weapons;
static WeaponUtil()
{
if (!File.Exists(VehicleWeaponLocation))
{
Directory.CreateDirectory(@"RageCoop\Data\tmp");
var input = @"RageCoop\Data\tmp\vehicles.json";
VehicleWeaponInfo.Dump(input, VehicleWeaponLocation);
}
// Parse and load to memory
foreach (var w in JsonConvert.DeserializeObject<VehicleWeaponInfo[]>(
File.ReadAllText(VehicleWeaponLocation))) VehicleWeapons.Add(w.Hash, w);
WeaponFix = JsonConvert.DeserializeObject<WeaponFix>(File.ReadAllText(WeaponFixLocation));
}
File.ReadAllText(VehicleWeaponDataPath))) VehicleWeapons.Add(w.Hash, w);
public static void DumpWeaponFix(string path = WeaponFixLocation)
Weapons = JsonConvert.DeserializeObject<Dictionary<uint, WeaponInfo>>(
File.ReadAllText(WeaponInfoDataPath));
if (File.Exists(WeaponFixDataPath))
{
WeaponFix = JsonConvert.DeserializeObject<WeaponFix>(File.ReadAllText(WeaponFixDataPath));
}
else
{
API.Logger.Warning("Weapon fix data not found");
}
}
public static void DumpWeaponFix(string path)
{
var P = Game.Player.Character;
var pos = P.Position + Vector3.WorldUp * 3;
var types = new HashSet<int> { 3 };
P.IsInvincible = true;
var fix = new WeaponFix();
foreach (VehicleWeaponHash v in Enum.GetValues(typeof(VehicleWeaponHash)))
foreach (var w in Weapons)
{
Console.Info("Testing: " + v);
if (types.Contains(v.GetWeaponDamageType()))
Console.Info("Testing " + w.Value.Name);
if (w.Value.FireType != "PROJECTILE")
{
var asset = new WeaponAsset((int)v);
var asset = new WeaponAsset(w.Key);
asset.Request(1000);
World.ShootBullet(pos, pos + Vector3.WorldUp, P, asset, 0, 1000);
if (!Function.Call<bool>(Hash.IS_BULLET_IN_AREA, pos.X, pos.Y, pos.Z, 10f, true) &&
!Function.Call<bool>(Hash.IS_PROJECTILE_IN_AREA, pos.X - 10, pos.Y - 10, pos.Z - 10, pos.X + 10,
pos.Y + 10, pos.Z + 10, true))
fix.Bullet.Add((uint)v, $"{nameof(VehicleWeaponHash)}.{v}");
{
switch (w.Value.DamageType)
{
case "BULLET":
fix.Bullet.Add(w.Key, w.Value.Name);
break;
case "EXPLOSIVE":
fix.Lazer.Add(w.Key, w.Value.Name);
break;
default:
fix.Others.Add(w.Key, w.Value.Name);
break;
}
}
foreach (var p in World.GetAllProjectiles()) p.Delete();
Script.Wait(50);
}
}
foreach (WeaponHash w in Enum.GetValues(typeof(WeaponHash)))
if (types.Contains(w.GetWeaponDamageType()))
{
Console.Info("Testing: " + w);
var asset = new WeaponAsset((int)w);
asset.Request(1000);
World.ShootBullet(pos, pos + Vector3.WorldUp, P, asset, 0, 1000);
if (!Function.Call<bool>(Hash.IS_BULLET_IN_AREA, pos.X, pos.Y, pos.Z, 10f, true) &&
!Function.Call<bool>(Hash.IS_PROJECTILE_IN_AREA, pos.X - 10, pos.Y - 10, pos.Z - 10, pos.X + 10,
pos.Y + 10, pos.Z + 10, true))
fix.Bullet.Add((uint)w, $"{nameof(WeaponHash)}.{w}");
foreach (var p in World.GetAllProjectiles()) p.Delete();
Script.Wait(50);
}
AddLazer(VehicleWeaponHash.PlayerSavage);
AddLazer(VehicleWeaponHash.StrikeforceCannon);
void AddLazer(dynamic hash)
{
fix.Lazer.Add((uint)hash, $"{hash.GetType().Name}.{hash.ToString()}");
}
File.WriteAllText(path, JsonConvert.SerializeObject(fix, Formatting.Indented));
P.IsInvincible = false;
}
public static void DumpWeaponHashes(string path = VehicleWeaponLocation)
{
var hashes = new Dictionary<uint, string>();
foreach (var wep in JsonConvert.DeserializeObject<WeaponInfo[]>(
HttpHelper.DownloadString(
"https://raw.githubusercontent.com/DurtyFree/gta-v-data-dumps/master/weapons.json")))
{
if (!wep.Name.StartsWith("WEAPON")) continue;
hashes.Add(wep.Hash, wep.Name);
}
var output = "public enum WeaponHash : uint\r\n{";
var lines = new List<string>();
foreach (var hash in hashes)
lines.Add($"{CoreUtils.FormatToSharpStyle(hash.Value, 7)} = {hash.Key.ToHex()}");
lines.Sort();
foreach (var l in lines) output += $"\r\n\t{l},";
output += "\r\n}";
File.WriteAllText(path, output);
}
public static void DumpVehicleWeaponHashes(string path = @"RageCoop\Data\VehicleWeaponHash.cs")
{
var hashes = new Dictionary<uint, string>();
foreach (var veh in VehicleWeapons.Values)
foreach (var hash in veh.Weapons)
if (!hashes.ContainsKey(hash.Key))
hashes.Add(hash.Key, hash.Value.Name);
var output = "public enum VehicleWeaponHash : uint\r\n{\r\n\tInvalid = 0xFFFFFFFF,";
var lines = new List<string>();
foreach (var hash in hashes) lines.Add($"{CoreUtils.FormatToSharpStyle(hash.Value)} = {hash.Key.ToHex()}");
lines.Sort();
foreach (var l in lines) output += $"\r\n\t{l},";
output += "\r\n}";
File.WriteAllText(path, output);
}
public static uint GetWeaponFix(uint hash)
{
if (WeaponFix.Bullet.TryGetValue(hash, out var _)) return (uint)VehicleWeaponHash.SubcarMg;
if (WeaponFix.Lazer.TryGetValue(hash, out var _)) return (uint)VehicleWeaponHash.PlayerLazer;
if (WeaponFix.Bullet.TryGetValue(hash, out _)) return 0x461DDDB0;
if (WeaponFix.Lazer.TryGetValue(hash, out _)) return 0xE2822A29;
return hash;
}
public static Dictionary<uint, bool> GetWeaponComponents(this Weapon weapon)
{
Dictionary<uint, bool> result = null;
@ -289,21 +146,10 @@ namespace RageCoop.Client
public static bool IsUsingProjectileWeapon(this Ped p)
{
var vp = p.VehicleWeapon;
var type = Function.Call<int>(Hash.GET_WEAPON_DAMAGE_TYPE, vp);
if (vp != VehicleWeaponHash.Invalid)
return type == 3
? false
: VehicleProjectileWeapons.Contains(vp) || (type == 5 && !ExplosiveBullets.Contains((uint)vp));
var w = p.Weapons.Current;
return w.Group == WeaponGroup.Thrown || ProjectileWeapons.Contains(w.Hash);
return Weapons.TryGetValue(vp != VehicleWeaponHash.Invalid ?
(uint)vp : (uint)p.Weapons.Current.Hash, out var info)
&& info.FireType == "PROJECTILE";
}
public static int GetWeaponDamageType<T>(this T hash) where T : Enum
{
return Function.Call<int>(Hash.GET_WEAPON_DAMAGE_TYPE, hash);
}
public static string GetFlashFX(this WeaponHash w, bool veh)
{
if (veh)
@ -361,18 +207,4 @@ namespace RageCoop.Client
return Function.Call<WeaponGroup>(Hash.GET_WEAPONTYPE_GROUP, hash);
}
}
/*
class WeaponInfo
{
public string Name;
public string MuzzleFx;
}
public class AimingInfo
{
public string Name;
public float HeadingLimit;
public float SweepPitchMin;
public float SweepPitchMax;
}
*/
}

View File

@ -11,6 +11,10 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -1,69 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Extensions.ObjectPool" version="6.0.8" targetFramework="net48" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net48" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net48" />
<package id="Microsoft.Win32.Registry" version="4.7.0" targetFramework="net481" />
<package id="NAudio" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Asio" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Core" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Midi" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Wasapi" version="2.1.0" targetFramework="net48" />
<package id="NAudio.WinForms" version="2.1.0" targetFramework="net48" />
<package id="NAudio.WinMM" version="2.1.0" targetFramework="net48" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="SharpZipLib" version="1.4.0" targetFramework="net48" />
<package id="System.AppContext" version="4.3.0" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Collections" version="4.3.0" targetFramework="net48" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net48" />
<package id="System.Console" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net48" />
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net48" />
<package id="System.Globalization" version="4.3.0" targetFramework="net48" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net48" />
<package id="System.IO" version="4.3.0" targetFramework="net48" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net48" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net48" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net48" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Linq" version="4.3.0" targetFramework="net48" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net48" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net48" />
<package id="System.Security.AccessControl" version="4.7.0" targetFramework="net481" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Principal.Windows" version="4.7.0" targetFramework="net481" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net48" />
<package id="System.Threading" version="4.3.0" targetFramework="net48" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net48" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net48" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net48" />
<package id="Microsoft.Extensions.ObjectPool" version="6.0.8" targetFramework="net48" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net48" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net48" />
<package id="Microsoft.Win32.Registry" version="4.7.0" targetFramework="net481" />
<package id="NAudio" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Asio" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Core" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Midi" version="2.1.0" targetFramework="net48" />
<package id="NAudio.Wasapi" version="2.1.0" targetFramework="net48" />
<package id="NAudio.WinForms" version="2.1.0" targetFramework="net48" />
<package id="NAudio.WinMM" version="2.1.0" targetFramework="net48" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="SharpZipLib" version="1.4.0" targetFramework="net48" />
<package id="System.AppContext" version="4.3.0" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Collections" version="4.3.0" targetFramework="net48" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net48" />
<package id="System.Console" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net48" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net48" />
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net48" />
<package id="System.Globalization" version="4.3.0" targetFramework="net48" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net48" />
<package id="System.IO" version="4.3.0" targetFramework="net48" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net48" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net48" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net48" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Linq" version="4.3.0" targetFramework="net48" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net48" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net48" />
<package id="System.Security.AccessControl" version="4.7.0" targetFramework="net481" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Principal.Windows" version="4.7.0" targetFramework="net481" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net48" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net48" />
<package id="System.Threading" version="4.3.0" targetFramework="net48" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net48" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net48" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net48" />
</packages>

View File

@ -11,6 +11,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using GTA;
using GTA.Math;
using Lidgren.Network;
@ -42,7 +43,7 @@ namespace RageCoop.Core
"ScriptHookVDotNet"
};
public static string FormatToSharpStyle(string input, int offset = 14)
public static string FormatToSharpStyle(string input, int offset)
{
var ss = input.Substring(offset).Split("_".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
// Replace first character with upper case
@ -354,6 +355,35 @@ namespace RageCoop.Core
{
return new StreamWriter(File.Open(path, mode, access, share));
}
public static float GetFloat(this XmlNode n)
{
return float.Parse(n.Attributes["value"].Value);
}
/// <summary>
/// Generate jenkins one-at-a-time hash from specified string (lower)
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static uint JoaatHash(string key)
{
var i = 0;
uint hash = 0;
while (i != key.Length)
{
hash += char.ToLowerInvariant(key[i++]);
hash += hash << 10;
hash ^= hash >> 6;
}
hash += hash << 3;
hash ^= hash >> 11;
hash += hash << 15;
return hash;
}
}
internal class IpInfo

136
Core/VehicleWeaponInfo.cs Normal file
View File

@ -0,0 +1,136 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Console = System.Console;
using System.Xml;
using Formatting = Newtonsoft.Json.Formatting;
namespace RageCoop.Core
{
internal class AnimDic
{
public string[] Animations;
public string DictionaryName;
public static AnimDic[] Dump(string input, string output)
{
Console.WriteLine("Generating " + output);
if (!File.Exists(input))
{
Console.WriteLine("Downloading");
HttpHelper.DownloadFile(
"https://raw.githubusercontent.com/DurtyFree/gta-v-data-dumps/master/animDictsCompact.json", input);
}
Console.WriteLine("Deserializing");
var anims = JsonConvert.DeserializeObject<AnimDic[]>(File.ReadAllText(input));
Console.WriteLine("Serializing");
File.WriteAllText(output, JsonConvert.SerializeObject(anims, Formatting.Indented));
return anims;
}
}
internal class WeaponInfo
{
public string Audio;
public float Damage;
public string DamageType;
public string FireType;
public bool IsVehicleWeapon;
public string Name;
public float Speed;
public WeaponInfo() { }
public WeaponInfo(XmlNode node)
{
if (node.Attributes["type"].Value != "CWeaponInfo") throw new Exception("Not a CWeaponInfo node");
foreach (XmlNode info in node.ChildNodes)
switch (info.Name)
{
case "Name":
Name = info.InnerText;
break;
case "Audio":
Audio = info.InnerText;
break;
case "FireType":
FireType = info.InnerText;
break;
case "DamageType":
DamageType = info.InnerText;
break;
case "Damage":
Damage = info.GetFloat();
break;
case "Speed":
Speed = info.GetFloat();
break;
}
IsVehicleWeapon = Name.StartsWith("VEHICLE_WEAPON");
}
}
internal class VehicleInfo
{
public VehicleBone[] Bones;
public uint Hash;
public string Name;
public string[] Weapons;
}
internal class VehicleBone
{
public uint BoneID;
public uint BoneIndex;
public string BoneName;
}
internal class WeaponBones
{
public VehicleBone[] Bones;
public string Name;
}
internal class VehicleWeaponInfo
{
public uint Hash;
public string Name;
public Dictionary<uint, WeaponBones> Weapons = new Dictionary<uint, WeaponBones>();
public static void Dump(string input, string output)
{
Console.WriteLine("Generating " + output);
if (!File.Exists(input))
{
Console.WriteLine("Downloading");
HttpHelper.DownloadFile(
"https://raw.githubusercontent.com/DurtyFree/gta-v-data-dumps/master/vehicles.json", input);
}
Console.WriteLine("Deserializing");
var infos = JsonConvert.DeserializeObject<VehicleInfo[]>(File.ReadAllText(input));
Console.WriteLine("Serializing");
File.WriteAllText(output,
JsonConvert.SerializeObject(
infos.Select(FromVehicle).Where(x => x != null),
Formatting.Indented));
}
public static VehicleWeaponInfo FromVehicle(VehicleInfo info)
{
if (info.Weapons.Length == 0) return null;
var result = new VehicleWeaponInfo { Hash = info.Hash, Name = info.Name };
for (var i = 0; i < info.Weapons.Length; i++)
result.Weapons.Add(CoreUtils.JoaatHash(info.Weapons[i])
, new WeaponBones
{
Name = info.Weapons[i],
Bones = info.Bones.Where(x =>
x.BoneName.StartsWith($"weapon_{i + 1}") && !x.BoneName.EndsWith("rot")).ToArray()
});
return result;
}
}
}

View File

@ -21,9 +21,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RageCoop.Client.CefHost", "
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{70A1F09D-648D-4C8B-8947-E920B1A587A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefTest", "Tools\CefTest\CefTest.csproj", "{874944F4-2D01-4423-B55C-C651CCBA6630}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CefTest", "Tools\CefTest\CefTest.csproj", "{874944F4-2D01-4423-B55C-C651CCBA6630}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataDumper", "Tools\DataDumper\DataDumper.csproj", "{6387D897-09AF-4464-B440-80438E3BB8D0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataDumper", "Tools\DataDumper\DataDumper.csproj", "{6387D897-09AF-4464-B440-80438E3BB8D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Joaat/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -15,7 +15,7 @@ using System.Resources;
[assembly: AssemblyCulture("")]
// Version information
[assembly: AssemblyVersion("1.5.8.34")]
[assembly: AssemblyFileVersion("1.5.8.34")]
[assembly: AssemblyVersion("1.6.0.3")]
[assembly: AssemblyFileVersion("1.6.0.3")]
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]

View File

@ -1,117 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{874944F4-2D01-4423-B55C-C651CCBA6630}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CefTest</RootNamespace>
<AssemblyName>CefTest</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="BitmapUtil">
<HintPath>..\libs\BitmapUtil.dll</HintPath>
</Reference>
<Reference Include="PInvoke.Kernel32, Version=0.7.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
<HintPath>..\..\packages\PInvoke.Kernel32.0.7.124\lib\net46\PInvoke.Kernel32.dll</HintPath>
</Reference>
<Reference Include="PInvoke.User32, Version=0.7.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
<HintPath>..\..\packages\PInvoke.User32.0.7.124\lib\net45\PInvoke.User32.dll</HintPath>
</Reference>
<Reference Include="PInvoke.Windows.Core, Version=0.7.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
<HintPath>..\..\packages\PInvoke.Windows.Core.0.7.124\lib\net45\PInvoke.Windows.Core.dll</HintPath>
</Reference>
<Reference Include="PInvoke.Windows.ShellScalingApi, Version=0.7.0.0, Culture=neutral, PublicKeyToken=9e300f9f87f04a7a, processorArchitecture=MSIL">
<HintPath>..\..\packages\PInvoke.Windows.ShellScalingApi.0.7.124\lib\net45\PInvoke.Windows.ShellScalingApi.dll</HintPath>
</Reference>
<Reference Include="SharpD2D, Version=0.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\SharpD2D.0.1.1\lib\netstandard2.0\SharpD2D.dll</HintPath>
</Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct2D1, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\..\packages\SharpDX.Direct2D1.4.2.0\lib\net45\SharpDX.Direct2D1.dll</HintPath>
</Reference>
<Reference Include="SharpDX.DXGI, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\..\packages\SharpDX.DXGI.4.2.0\lib\net45\SharpDX.DXGI.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.4.5.0\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Validation, Version=2.4.0.0, Culture=neutral, PublicKeyToken=2fc06f0d701809a7, processorArchitecture=MSIL">
<HintPath>..\..\packages\Validation.2.4.15\lib\net45\Validation.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="D2DWindow.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Client\CefHost\RageCoop.Client.CefHost.csproj">
<Project>{ba750e08-5e41-4b56-8ad5-875716d2ccea}</Project>
<Name>RageCoop.Client.CefHost</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<OutputType>Exe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutDir>..\..\bin\Tools\CefTest</OutDir>
</PropertyGroup>
<ItemGroup>
<Reference Include="BitmapUtil">
<HintPath>..\libs\BitmapUtil.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Remoting" />
</ItemGroup>
<ItemGroup>
<Compile Update="D2DWindow.cs">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Client\CefHost\RageCoop.Client.CefHost.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="SharpD2D" Version="0.1.1" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.355802">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -144,4 +144,4 @@ namespace CefTest
}
}
}
}
}

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="PInvoke.Kernel32" version="0.7.124" targetFramework="net48" />
<package id="PInvoke.User32" version="0.7.124" targetFramework="net48" />
<package id="PInvoke.Windows.Core" version="0.7.124" targetFramework="net48" />
<package id="PInvoke.Windows.ShellScalingApi" version="0.7.124" targetFramework="net48" />
<package id="SharpD2D" version="0.1.1" targetFramework="net48" />
<package id="SharpDX" version="4.2.0" targetFramework="net48" />
<package id="SharpDX.Direct2D1" version="4.2.0" targetFramework="net48" />
<package id="SharpDX.DXGI" version="4.2.0" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
<package id="Validation" version="2.4.15" targetFramework="net48" />
</packages>

View File

@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<OutDir>..\..\bin\Tools\DataDumper</OutDir>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\RageCoop.Core.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\RageCoop.Core.csproj" />
</ItemGroup>
</Project>

View File

@ -6,60 +6,59 @@ using Formatting = Newtonsoft.Json.Formatting;
namespace DataDumper;
internal class WeaponInfo
[Flags]
public enum GenFlags
{
public string Audio;
public float Damage;
public string DamageType;
public string FireType;
public bool IsVehicleWeapon;
public string Name;
public float Speed;
public WeaponInfo(XmlNode node)
{
if (node.Attributes["type"].Value != "CWeaponInfo") throw new Exception("Not a CWeaponInfo node");
foreach (XmlNode info in node.ChildNodes)
switch (info.Name)
{
case "Name":
Name = info.InnerText;
break;
case "Audio":
Audio = info.InnerText;
break;
case "FireType":
FireType = info.InnerText;
break;
case "DamageType":
DamageType = info.InnerText;
break;
case "Damage":
Damage = info.GetFloat();
break;
case "Speed":
Speed = info.GetFloat();
break;
}
IsVehicleWeapon = Name.StartsWith("VEHICLE_WEAPON");
}
WeaponInfo = 1,
WeaponHash = 2,
VehicleWeaponInfo = 4,
Animations = 8,
All = ~0
}
public static class Program
{
public static float GetFloat(this XmlNode n)
public static GenFlags ToGenerate = GenFlags.All;
public static void Main(string[] args)
{
return float.Parse(n.Attributes["value"].Value);
}
if (args.Length > 0 && Enum.TryParse<GenFlags>(args[0], true, out var flags))
{
ToGenerate = flags;
}
Directory.CreateDirectory("out");
public static void Main()
{
Dictionary<uint, WeaponInfo> weapons = new();
foreach (var f in Directory.GetFiles("meta", "*.meta")) Parse(f, weapons);
Directory.CreateDirectory("Weapons");
File.WriteAllText("Weapons\\Weapons.json", JsonConvert.SerializeObject(weapons, Formatting.Indented));
DumpWeaponHash(weapons, true);
#region META
// Dumps from the game's xml documents, needs to have all *.meta file extracted to "meta" directory. OpenIV is recommended
if (ToGenerate.HasFlag(GenFlags.WeaponInfo))
{
Dictionary<uint, WeaponInfo> weapons = new();
foreach (var f in Directory.GetFiles("meta", "*.meta")) Parse(f, weapons);
File.WriteAllText("out/Weapons.json", JsonConvert.SerializeObject(weapons, Formatting.Indented));
if (ToGenerate.HasFlag(GenFlags.WeaponHash))
{
DumpWeaponHash(weapons, true);
}
}
#endregion
#region EXTERNAL
// External data from DurtyFree's data dumps: https://github.com/DurtyFree/gta-v-data-dumps
Directory.CreateDirectory("ext");
if (ToGenerate.HasFlag(GenFlags.VehicleWeaponInfo))
{
VehicleWeaponInfo.Dump("ext/vehicles.json", "out/VehicleWeapons.json");
}
if (ToGenerate.HasFlag(GenFlags.Animations))
{
AnimDic.Dump("ext/animDictsCompact.json", "out/Animations.json");
}
#endregion
}
private static void Parse(string filename, Dictionary<uint, WeaponInfo> weap)
@ -85,7 +84,7 @@ public static class Program
{
var info = new WeaponInfo(n);
if (!info.Name.StartsWith("VEHICLE_WEAPON") && !info.Name.StartsWith("WEAPON")) continue;
var hash = Hash(info.Name);
var hash = CoreUtils.JoaatHash(info.Name);
if (weap.ContainsKey(hash))
weap[hash] = info;
else
@ -95,7 +94,7 @@ public static class Program
}
private static void DumpWeaponHash(Dictionary<uint, WeaponInfo> weapons, bool sort = false,
string path = @"Weapons\WeaponHash.cs")
string path = @"out/WeaponHash.cs")
{
StringBuilder output = new();
List<string> lines = new();
@ -111,7 +110,7 @@ public static class Program
output.Append("public enum VehicleWeaponHash : uint\r\n{\r\n\tInvalid = 0xFFFFFFFF,");
lines = new List<string>();
foreach (var info in vehWeaps)
lines.Add($"{CoreUtils.FormatToSharpStyle(info.Value.Name)} = {info.Key.ToHex()}");
lines.Add($"{CoreUtils.FormatToSharpStyle(info.Value.Name, 14)} = {info.Key.ToHex()}");
if (sort) lines.Sort();
foreach (var l in lines) output.Append($"\r\n\t{l},");
output.Append("\r\n}");
@ -125,21 +124,4 @@ public static class Program
return nodes;
}
private static uint Hash(string key)
{
key = key.ToLower();
var i = 0;
uint hash = 0;
while (i != key.Length)
{
hash += key[i++];
hash += hash << 10;
hash ^= hash >> 6;
}
hash += hash << 3;
hash ^= hash >> 11;
hash += hash << 15;
return hash;
}
}

Binary file not shown.

BIN
libs/ScriptHookVDotNet3.pdb Normal file

Binary file not shown.