feat: add specific dvar to unlock loot #1
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -58,6 +58,7 @@ build | ||||
|  | ||||
| # Visual Studio 2015 cache/options directory | ||||
| .vs/ | ||||
| .vscode | ||||
|  | ||||
| # MSTest test Results | ||||
| [Tt]est[Rr]esult*/ | ||||
|   | ||||
| @@ -13,44 +13,45 @@ namespace stats | ||||
| 	namespace | ||||
| 	{ | ||||
| 		game::dvar_t* cg_unlock_all_items; | ||||
| 		game::dvar_t* cg_unlock_all_loot; | ||||
|  | ||||
| 		utils::hook::detour is_item_unlocked_hook; | ||||
| 		utils::hook::detour is_item_unlocked_hook2; | ||||
| 		utils::hook::detour is_item_unlocked_hook3; | ||||
| 		utils::hook::detour is_item_locked_hook1; | ||||
| 		utils::hook::detour is_item_locked_hook2; | ||||
| 		utils::hook::detour is_item_locked_hook3; | ||||
|  | ||||
| 		int is_item_unlocked_stub(void* a1, void* a2, void* a3) | ||||
| 		int is_item_locked_stub1(void* a1, void* a2, void* a3) | ||||
| 		{ | ||||
| 			if (cg_unlock_all_items->current.enabled) | ||||
| 			{ | ||||
| 				return 0; | ||||
| 			} | ||||
|  | ||||
| 			return is_item_unlocked_hook.invoke<int>(a1, a2, a3); | ||||
| 			return is_item_locked_hook1.invoke<int>(a1, a2, a3); | ||||
| 		} | ||||
|  | ||||
| 		int is_item_unlocked_stub2(void* a1, void* a2, void* a3, void* a4, void* a5) | ||||
| 		int is_item_locked_stub2(void* a1, void* a2, void* a3, void* a4, void* a5) | ||||
| 		{ | ||||
| 			if (cg_unlock_all_items->current.enabled) | ||||
| 			{ | ||||
| 				return 0; | ||||
| 			} | ||||
|  | ||||
| 			return is_item_unlocked_hook2.invoke<int>(a1, a2, a3, a4, a5); | ||||
| 			return is_item_locked_hook2.invoke<int>(a1, a2, a3, a4, a5); | ||||
| 		} | ||||
|  | ||||
| 		int is_item_unlocked_stub3(void* a1) | ||||
| 		int is_loot_locked_stub(void* a1) | ||||
| 		{ | ||||
| 			if (cg_unlock_all_items->current.enabled) | ||||
| 			if (cg_unlock_all_loot->current.enabled) | ||||
| 			{ | ||||
| 				return 0; | ||||
| 			} | ||||
|  | ||||
| 			return is_item_unlocked_hook3.invoke<int>(a1); | ||||
| 			return is_item_locked_hook3.invoke<int>(a1); | ||||
| 		} | ||||
|  | ||||
| 		int is_item_unlocked() | ||||
| 		int is_item_locked() | ||||
| 		{ | ||||
| 			return 0; // 0 == yes | ||||
| 			return 0; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -66,23 +67,24 @@ namespace stats | ||||
|  | ||||
| 			if (game::environment::is_dedi()) | ||||
| 			{ | ||||
| 				// unlock all items | ||||
| 				utils::hook::jump(0x1403BD790, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable_LocalClient | ||||
| 				utils::hook::jump(0x1403BD290, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable | ||||
| 				utils::hook::jump(0x1403BAF60, is_item_unlocked); // idk ( unlocks loot etc ) | ||||
| 				// unlock all | ||||
| 				utils::hook::jump(0x1403BD790, is_item_locked); // LiveStorage_IsItemUnlockedFromTable_LocalClient | ||||
| 				utils::hook::jump(0x1403BD290, is_item_locked); // LiveStorage_IsItemUnlockedFromTable | ||||
| 				utils::hook::jump(0x1403BAF60, is_item_locked); // unlocks supply drop loot | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				// unlock all items | ||||
| 				cg_unlock_all_items = game::Dvar_RegisterBool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED, "Whether items should be locked based on the player's stats or always unlocked."); | ||||
| 				game::Dvar_RegisterBool("cg_unlockall_classes", false, game::DVAR_FLAG_SAVED, "Whether classes should be locked based on the player's stats or always unlocked."); | ||||
| 			 | ||||
| 				is_item_unlocked_hook.create(0x1403BD790, is_item_unlocked_stub); // LiveStorage_IsItemUnlockedFromTable_LocalClient | ||||
| 				is_item_unlocked_hook2.create(0x1403BD290, is_item_unlocked_stub2); // LiveStorage_IsItemUnlockedFromTable | ||||
| 				is_item_unlocked_hook3.create(0x1403BAF60, is_item_unlocked_stub3); // idk (unlocks loot etc) | ||||
| 			} | ||||
|                 // unlock all | ||||
|                 cg_unlock_all_items = game::Dvar_RegisterBool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED, "Unlock items that are level-locked by the player's stats."); | ||||
| 				cg_unlock_all_loot = game::Dvar_RegisterBool("cg_unlockall_loot", false, game::DVAR_FLAG_SAVED, "Unlock supply drop loot."); | ||||
|                 game::Dvar_RegisterBool("cg_unlockall_classes", false, game::DVAR_FLAG_SAVED, "Unlock extra class slots."); | ||||
|  | ||||
| 			command::add("setPlayerDataInt", [](const command::params& params) | ||||
|                 is_item_locked_hook1.create(0x1403BD790, is_item_locked_stub1); // LiveStorage_IsItemUnlockedFromTable_LocalClient | ||||
|                 is_item_locked_hook2.create(0x1403BD290, is_item_locked_stub2); // LiveStorage_IsItemUnlockedFromTable | ||||
|                 is_item_locked_hook3.create(0x1403BAF60, is_loot_locked_stub);  // unlocks supply drop loot | ||||
|             } | ||||
|  | ||||
|             command::add("setPlayerDataInt", [](const command::params& params) | ||||
| 			{ | ||||
| 				if (params.size() < 2) | ||||
| 				{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user