2022-08-14 23:35:36 +02:00
|
|
|
|
using GTA;
|
2022-08-14 19:06:51 +08:00
|
|
|
|
using GTA.Native;
|
|
|
|
|
|
|
|
|
|
namespace RageCoop.Client
|
|
|
|
|
{
|
|
|
|
|
public partial class SyncedPed
|
|
|
|
|
{
|
2022-08-14 23:35:36 +02:00
|
|
|
|
private void DisplaySpeaking(bool speaking)
|
|
|
|
|
{
|
2022-08-15 00:19:00 +02:00
|
|
|
|
if (!MainPed.IsHuman)
|
2022-08-14 23:35:36 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (speaking)
|
|
|
|
|
{
|
|
|
|
|
Function.Call(Hash.PLAY_FACIAL_ANIM, MainPed.Handle, "mic_chatter", "mp_facial");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (MainPed.Gender)
|
|
|
|
|
{
|
|
|
|
|
case Gender.Male:
|
2022-10-23 19:02:39 +08:00
|
|
|
|
Function.Call(Hash.PLAY_FACIAL_ANIM, MainPed.Handle, "mood_normal_1",
|
|
|
|
|
"facials@gen_male@variations@normal");
|
2022-08-14 23:35:36 +02:00
|
|
|
|
break;
|
|
|
|
|
case Gender.Female:
|
2022-10-23 19:02:39 +08:00
|
|
|
|
Function.Call(Hash.PLAY_FACIAL_ANIM, MainPed.Handle, "mood_normal_1",
|
|
|
|
|
"facials@gen_female@variations@normal");
|
2022-08-14 23:35:36 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2022-10-23 19:02:39 +08:00
|
|
|
|
Function.Call(Hash.PLAY_FACIAL_ANIM, MainPed.Handle, "mood_normal_1",
|
|
|
|
|
"facials@mime@variations@normal");
|
2022-08-14 23:35:36 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-14 19:06:51 +08:00
|
|
|
|
|
|
|
|
|
private void DisplayInCover()
|
|
|
|
|
{
|
|
|
|
|
var ourAnim = GetCoverAnim();
|
|
|
|
|
var animDict = GetCoverIdleAnimDict();
|
|
|
|
|
|
|
|
|
|
if (ourAnim != null && animDict != null)
|
|
|
|
|
{
|
|
|
|
|
var flag = AnimationFlags.Loop;
|
|
|
|
|
if (!Function.Call<bool>(Hash.IS_ENTITY_PLAYING_ANIM, MainPed, animDict, ourAnim, 3))
|
|
|
|
|
{
|
2022-10-23 19:02:39 +08:00
|
|
|
|
if (LoadAnim(animDict) == null) return;
|
2022-10-08 12:43:24 +08:00
|
|
|
|
|
2022-08-14 19:06:51 +08:00
|
|
|
|
MainPed.Task.ClearAll();
|
2022-10-08 12:43:24 +08:00
|
|
|
|
Function.Call(Hash.TASK_PLAY_ANIM, MainPed, animDict, ourAnim, 8f, 10f, -1, flag, -8f, 1, 1, 1);
|
2022-08-14 19:06:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal string GetCoverAnim()
|
|
|
|
|
{
|
|
|
|
|
if (IsInCover)
|
|
|
|
|
{
|
|
|
|
|
if (IsBlindFiring)
|
|
|
|
|
{
|
|
|
|
|
if (IsInCover)
|
|
|
|
|
return IsInCoverFacingLeft ? "blindfire_low_l_aim_med" : "blindfire_low_r_aim_med";
|
|
|
|
|
return IsInCoverFacingLeft ? "blindfire_hi_l_aim_med" : "blindfire_hi_r_aim_med";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return IsInCoverFacingLeft ? "idle_l_corner" : "idle_r_corner";
|
|
|
|
|
}
|
2022-10-23 19:02:39 +08:00
|
|
|
|
|
2022-08-14 19:06:51 +08:00
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal string GetCoverIdleAnimDict()
|
|
|
|
|
{
|
|
|
|
|
if (!IsInCover) return "";
|
|
|
|
|
var altitude = IsInLowCover ? "low" : "high";
|
|
|
|
|
|
2022-12-04 19:34:54 +08:00
|
|
|
|
var hands = GetWeaponHandsHeld((uint)CurrentWeapon);
|
2022-08-14 19:06:51 +08:00
|
|
|
|
if (IsBlindFiring)
|
|
|
|
|
{
|
|
|
|
|
if (hands == 1) return "cover@weapon@1h";
|
|
|
|
|
if (hands == 2 || hands == 5) return "cover@weapon@2h";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hands == 1) return "cover@idles@1h@" + altitude + "@_a";
|
|
|
|
|
if (hands == 2 || hands == 5) return "cover@idles@2h@" + altitude + "@_a";
|
|
|
|
|
if (hands == 3 || hands == 4 || hands == 0) return "cover@idles@unarmed@" + altitude + "@_a";
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal int GetWeaponHandsHeld(uint weapon)
|
|
|
|
|
{
|
|
|
|
|
switch (weapon)
|
|
|
|
|
{
|
2022-10-23 19:02:39 +08:00
|
|
|
|
case (uint)WeaponHash.Unarmed:
|
2022-08-14 19:06:51 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
2022-10-23 19:02:39 +08:00
|
|
|
|
case (uint)WeaponHash.RPG:
|
|
|
|
|
case (uint)WeaponHash.HomingLauncher:
|
|
|
|
|
case (uint)WeaponHash.Firework:
|
2022-08-14 19:06:51 +08:00
|
|
|
|
return 5;
|
|
|
|
|
|
2022-10-23 19:02:39 +08:00
|
|
|
|
case (uint)WeaponHash.Minigun:
|
2022-08-14 19:06:51 +08:00
|
|
|
|
return 5;
|
|
|
|
|
|
2022-10-23 19:02:39 +08:00
|
|
|
|
case (uint)WeaponHash.GolfClub:
|
|
|
|
|
case (uint)WeaponHash.PoolCue:
|
|
|
|
|
case (uint)WeaponHash.Bat:
|
2022-08-14 19:06:51 +08:00
|
|
|
|
return 4;
|
|
|
|
|
|
2022-10-23 19:02:39 +08:00
|
|
|
|
case (uint)WeaponHash.Knife:
|
|
|
|
|
case (uint)WeaponHash.Nightstick:
|
|
|
|
|
case (uint)WeaponHash.Hammer:
|
|
|
|
|
case (uint)WeaponHash.Crowbar:
|
|
|
|
|
case (uint)WeaponHash.Wrench:
|
|
|
|
|
case (uint)WeaponHash.BattleAxe:
|
|
|
|
|
case (uint)WeaponHash.Dagger:
|
|
|
|
|
case (uint)WeaponHash.Hatchet:
|
|
|
|
|
case (uint)WeaponHash.KnuckleDuster:
|
2022-08-14 19:06:51 +08:00
|
|
|
|
case unchecked((uint)-581044007):
|
|
|
|
|
case unchecked((uint)-102323637):
|
|
|
|
|
case unchecked((uint)-538741184):
|
|
|
|
|
return 3;
|
|
|
|
|
|
|
|
|
|
case unchecked((uint)-1357824103):
|
|
|
|
|
case unchecked((uint)-1074790547):
|
2022-10-23 19:02:39 +08:00
|
|
|
|
case 2132975508:
|
2022-08-14 19:06:51 +08:00
|
|
|
|
case unchecked((uint)-2084633992):
|
|
|
|
|
case unchecked((uint)-952879014):
|
2022-10-23 19:02:39 +08:00
|
|
|
|
case 100416529:
|
|
|
|
|
case (uint)WeaponHash.Gusenberg:
|
|
|
|
|
case (uint)WeaponHash.MG:
|
|
|
|
|
case (uint)WeaponHash.CombatMG:
|
|
|
|
|
case (uint)WeaponHash.CombatPDW:
|
|
|
|
|
case (uint)WeaponHash.AssaultSMG:
|
|
|
|
|
case (uint)WeaponHash.SMG:
|
|
|
|
|
case (uint)WeaponHash.HeavySniper:
|
|
|
|
|
case (uint)WeaponHash.PumpShotgun:
|
|
|
|
|
case (uint)WeaponHash.HeavyShotgun:
|
|
|
|
|
case (uint)WeaponHash.Musket:
|
|
|
|
|
case (uint)WeaponHash.AssaultShotgun:
|
|
|
|
|
case (uint)WeaponHash.BullpupShotgun:
|
|
|
|
|
case (uint)WeaponHash.SawnOffShotgun:
|
|
|
|
|
case (uint)WeaponHash.SweeperShotgun:
|
|
|
|
|
case (uint)WeaponHash.CompactRifle:
|
2022-08-14 19:06:51 +08:00
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string LoadAnim(string anim)
|
|
|
|
|
{
|
2022-10-08 23:49:48 +08:00
|
|
|
|
if (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, anim))
|
2022-08-14 19:06:51 +08:00
|
|
|
|
{
|
|
|
|
|
Function.Call(Hash.REQUEST_ANIM_DICT, anim);
|
2022-10-08 12:43:24 +08:00
|
|
|
|
return null;
|
2022-08-14 19:06:51 +08:00
|
|
|
|
}
|
2022-10-23 19:02:39 +08:00
|
|
|
|
|
2022-08-14 19:06:51 +08:00
|
|
|
|
return anim;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-23 19:02:39 +08:00
|
|
|
|
}
|