/**
 * Do not edit this file.  Any changes will be overwritten by the gamedata
 * updater or by upgrading your SourceMod install.
 *
 * To override data in this file, create a subdirectory named "custom" and
 * place your own gamedata file(s) inside of it.  Such files will be parsed
 * after SM's own.
 *
 * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod)
 */

"Games"
{
	/* Sounds */
	"#default"
	{
		"Keys"
		{
			"SlapSoundCount"	"7"
			"SlapSound1"		"vo/axe/axe_pain_01.mp3"
			"SlapSound1"		"vo/axe/axe_pain_02.mp3"
			"SlapSound1"		"vo/axe/axe_pain_03.mp3"
			"SlapSound1"		"vo/axe/axe_pain_04.mp3"
			"SlapSound1"		"vo/axe/axe_pain_05.mp3"
			"SlapSound1"		"vo/axe/axe_pain_06.mp3"
			"SlapSound1"		"vo/axe/axe_pain_07.mp3"
		}
	}
	
	/* General Temp Entities */
	"#default"
	{
		"Offsets"
		{
			//Offset into CBaseTempEntity constructor
			"s_pTempEntities"
			{
				"windows"	"1"
			}
			"GetTEName"
			{
				"windows"	"4"
			}
			"GetTENext"
			{
				"windows"	"8"
			}
			"TE_GetServerClass"
			{
				"windows"	"0"
			}
		}

		"Signatures"
		{
			"CBaseTempEntity"
			{
				"library"	"server"
				"windows"	"\xA1\x2A\x2A\x2A\x2A\xF3\x0F\x10\x15\x2A\x2A\x2A\x2A\xF3"
			}
		}
	}

	/* General GameRules */
	"#default"
	{
		"Keys"
		{
			"GameRulesProxy"	"CDOTAGamerulesProxy"
		}
		
		"Offsets"
		{
			/* Offset into CreateGameRulesObject */
			"g_pGameRules"
			{
				"windows"	"3"
			}
		}
		
		"Signatures"
		{
			/* This signature sometimes has multiple matches, but this
			 * does not matter as g_pGameRules is involved in all of them.
			 * The same g_pGameRules offset applies to each match.
			 *
			 * Sometimes this block of bytes is at the beginning of the static
			 * CreateGameRulesObject function and sometimes it is in the middle
			 * of an entirely different function. This depends on the game.
			 */
			"CreateGameRulesObject"
			{
				"library"	"server"
				"windows"	"\x51\x8B\x0D\x2A\x2A\x2A\x2A\x85\xC9\x74\x08\x8B\x01\x8B\x10\x6A\x01\xFF\xD2\xC7\x05\x2A\x2A\x2A\x2A\x00\x00\x00\x00\xE8"
			}
			"g_pGameRules"
			{
				"library"	"server"
			}
		}
	}

	/* IServer interface pointer */
	"#default"
	{
		"Keys"
		{
			/* Signature for the beginning of IVEngineServer::CreateFakeClient.
			 *
			 * The engine binary is not actually scanned in order to look for
			 * this. SourceHook is used to used to determine the address of the
			 * function and this signature is used to verify that it contains
			 * the expected code. A pointer to sv (IServer interface) is used
			 * here.
			 */
			"CreateFakeClient_Windows"	"\x55\x8B\xEC\x8B\x2A\x2A\x56\x50\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75"
		}
		
		"Offsets"
		{
			/* Offset into IVEngineServer::CreateFakeClient */
			"sv"
			{
				"windows"	"9"
			}
		}
	}
	
	/* Resource Entity override */
	"#default"
	{
		// Dota's player manager does not have DT_PlayerResource embedded, unlike most other games
		"Keys"
		{
			"ResourceEntityClassname"	"dota_player_manager"
		}
	}
	
	/* EntityFactoryDictionary function */
	"#default"
	{
		"Signatures"
		{
			"EntityFactoryFinder"
			{
				// EntityFactoryDictionary gets inlined on Windows in Dota 2. The pointer to the static factory becomes a global.
				"library"	"server"
				"windows"	"\x8B\x15\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x57\xB9\x2A\x2A\x2A\x2A\xFF\xD0\xC7"
				//"linux"		"@_Z23EntityFactoryDictionaryv"
				//"mac"		"@_Z23EntityFactoryDictionaryv"
			}
		}
		
		"Offsets"
		{
			"EntityFactoryOffset"
			{
				"windows" 	"2"
			}
		}
	}

	/* CBaseEntityOutput::FireOutput */
	"#default"
	{
		"Signatures"
		{
			"FireOutput"
			{
				"library"	"server"
				"windows"	"\x55\x8B\xEC\x83\x2A\x2A\x81\xEC\x2A\x2A\x2A\x2A\x8B\x45\x2A\x53\x8B\x58\x2A\x56\x57\xC7"
			}
		}
	}
	
	/* SetUserInfo data */
	"#default"
	{
		"Offsets"
		{
			/**
			 * CBaseClient::SetUserCVar(char  const*,char  const*);
			 * Linux offset straight from VTable dump.
			 * Windows offset is crazy. Found the windows SetName function using string "(%d)%-.*s" (aD_S in IDA)
			 * Cross referenced back to the vtable and counted manually (SetUserCvar is 1 higher, offsets start from 1)
			 */
			"SetUserCvar"
			{
				"windows"	"26"
			}
			/**
			 * Offset into CBaseClient - Used by CBaseServer::UpdateUserSettings to determine when changes have been made.
			 * Find CBaseClient::UpdateUserSettings (strings "net_maxroutable", "cl_updaterate" etc) and the offset is set to 0 near the end.
			 * Linux: 	mov     byte ptr [esi+0B0h], 0
			 * Win:		mov     byte ptr [esi+0B0h], 0
			 *
			 * L4D2: This has been moved into CBaseClient::UpdateUserSettings(), rest of the details are still relevant.
			 */
			"InfoChanged"
			{
				"windows"	"212"
			}
		}
	}
	
	"dota"
	{
		"Offsets"
		{
			"GiveNamedItem"
			{
				"windows"	"438"
			}
			"RemovePlayerItem"
			{
				"windows"	"300"
			}
			"Weapon_GetSlot"
			{
				"windows"	"289"
			}
			"Ignite"
			{
				"windows"	"231"
			}
			"Extinguish"
			{
				"windows"	"234"
			}
			"Teleport"
			{
				"windows"	"114"
			}
			"CommitSuicide"
			{
				"windows"	"482"
			}
			"GetVelocity"
			{
				"windows"	"147"
			}
			"EyeAngles"
			{
				"windows"	"138"
			}
			"AcceptInput"
			{
				"windows"	"41"
			}
			"SetEntityModel"
			{
				"windows"	"26"
			}
			"WeaponEquip"
			{
				"windows"	"292"
			}
			"Activate"
			{
				"windows"	"37"
			}
			"PlayerRunCmd"
			{
				"windows"	"458"
			}
		}
	}
}