Пример #1
0
void Siege::SiegeAudioCalc(uint basehash, uint iSystemID, Vector pos, int level)
{
	// For all players in system...
	struct PlayerData *pPD = 0;
	while(pPD = Players.traverse_active(pPD))
	{
		// Get the this player's current system and location in the system.
		uint iClientID = HkGetClientIdFromPD(pPD);

		uint iClientSystem = 0;
		pub::Player::GetSystem(iClientID, iClientSystem);
		if (iSystemID != iClientSystem)
			continue;

		uint iShip;
		pub::Player::GetShip(iClientID, iShip);

		Vector vShipLoc;
		Matrix mShipDir;
		pub::SpaceObj::GetLocation(iShip, vShipLoc, mShipDir);

		// Is player within (15K) of the sending char.
		float fDistance = HkDistance3D(vShipLoc, pos);
		if (fDistance>15000)
			continue;

		SiegeAudioNotification(iClientID, level);
	}
	return;
}
Пример #2
0
HK_ERROR HkResolveShortCut(const wstring &wscShortcut, uint &_iClientID)
{
	wstring wscShortcutLower = ToLower(wscShortcut);
	if(wscShortcutLower.find(L"sc ") != 0)
		return HKE_INVALID_SHORTCUT_STRING;

	wscShortcutLower = wscShortcutLower.substr(3);

	uint iClientIDFound = -1;
	struct PlayerData *pPD = 0;
	while(pPD = Players.traverse_active(pPD))
	{
		uint iClientID = HkGetClientIdFromPD(pPD);

		const wchar_t *wszCharname = (wchar_t*)Players.GetActiveCharacterName(iClientID);
		if(!wszCharname)
			continue;

		wstring wscCharname = wszCharname;
		if(ToLower(wscCharname).find(wscShortcutLower) != -1)
		{
			if(iClientIDFound == -1)
				iClientIDFound = iClientID;
			else
				return HKE_AMBIGUOUS_SHORTCUT;
		}
	}

	if(iClientIDFound == -1)
		return HKE_NO_MATCHING_PLAYER;

	_iClientID = iClientIDFound;
	return HKE_OK;
}
Пример #3
0
/// Return true if this player is within the specified distance of any other player.
bool IsInRange(uint client, float fDistance)
{
	list<GROUP_MEMBER> lstMembers;
	HkGetGroupMembers((const wchar_t*) Players.GetActiveCharacterName(client), lstMembers);

	uint iShip;
	pub::Player::GetShip(client, iShip);

	Vector pos;
	Matrix rot;
	pub::SpaceObj::GetLocation(iShip, pos, rot);

	uint iSystem;
	pub::Player::GetSystem(client, iSystem);

	// For all players in system...
	struct PlayerData *pPD = 0;
	while(pPD = Players.traverse_active(pPD))
	{
		// Get the this player's current system and location in the system.
		uint client2 = HkGetClientIdFromPD(pPD);
		uint iSystem2 = 0;
		pub::Player::GetSystem(client2, iSystem2);
		if (iSystem != iSystem2)
			continue;

		uint iShip2;
		pub::Player::GetShip(client2, iShip2);

		Vector pos2;
		Matrix rot2;
		pub::SpaceObj::GetLocation(iShip2, pos2, rot2);

		// Ignore players who are in your group.
		bool bGrouped = false;
		foreach (lstMembers, GROUP_MEMBER, gm)
		{
			if (gm->iClientID==client2)
			{
				bGrouped = true;
				break;
			}
		}
		if (bGrouped)
			continue;

		// Is player within the specified range of the sending char.
		if (HkDistance3D(pos, pos2) < fDistance)
			return true;
	}
	return false;
}
Пример #4
0
list<HKPLAYERINFO> HkGetPlayers()
{
	list<HKPLAYERINFO> lstRet;
	wstring wscRet;

	struct PlayerData *pPD = 0;
	while(pPD = Players.traverse_active(pPD))
	{
		uint iClientID = HkGetClientIdFromPD(pPD);

		if(HkIsInCharSelectMenu(iClientID))
			continue;

		HKPLAYERINFO pi;
		HkGetPlayerInfo(ARG_CLIENTID(iClientID), pi, false);
		lstRet.push_back(pi);
	}

	return lstRet;
}
Пример #5
0
/// Load the configuration
void LoadSettings()
{
	returncode = DEFAULT_RETURNCODE;

	// The path to the configuration file.
	char szCurDir[MAX_PATH];
	GetCurrentDirectory(sizeof(szCurDir), szCurDir);
	string scPluginCfgFile = string(szCurDir) + "\\flhook_plugins\\hookext.ini";

	clients.clear();
	struct PlayerData *pPD = 0;
	while(pPD = Players.traverse_active(pPD))
	{
		uint client = HkGetClientIdFromPD(pPD);
		wstring charname = Players.GetActiveCharacterName(client);
		string filename = GetCharfilename(charname) + ".fl";
		CHARACTER_ID charid;
		strcpy(charid.szCharFilename, filename.c_str());
		CharacterSelect(charid,client);
	}
}
Пример #6
0
/// Print message to all ships within the specific number of meters of the player.
void PrintLocalUserCmdText(uint client, const wstring &wscMsg, float fDistance)
{
	uint iShip;
	pub::Player::GetShip(client, iShip);

	Vector pos;
	Matrix rot;
	pub::SpaceObj::GetLocation(iShip, pos, rot);

	uint iSystem;
	pub::Player::GetSystem(client, iSystem);

	// For all players in system...
	struct PlayerData *pPD = 0;
	while(pPD = Players.traverse_active(pPD))
	{
		// Get the this player's current system and location in the system.
		uint client2 = HkGetClientIdFromPD(pPD);
		uint iSystem2 = 0;
		pub::Player::GetSystem(client2, iSystem2);
		if (iSystem != iSystem2)
			continue;

		uint iShip2;
		pub::Player::GetShip(client2, iShip2);

		Vector pos2;
		Matrix rot2;
		pub::SpaceObj::GetLocation(iShip2, pos2, rot2);

		// Is player within the specified range of the sending char.
		if (HkDistance3D(pos, pos2) > fDistance)
			continue;

		PrintUserCmdText(client2, L"%s", wscMsg.c_str());
	}
}