Exemplo n.º 1
0
 /// <summary>
 /// Set relationship between a specified <c>RelationshipGroup</c> and an array of
 /// of <c>RelationshipGroup</c>s to Hate. Relationship is one-way, only
 /// </summary>
 /// <param name="rg"><c>RelationshipGroup</c> to modify</param>
 /// <param name="hateGroupHashes">Array of <c>RelationshipGroup</c> hashes to apply relationship with</param>
 public static void makeRelationshipGroupHate(RelationshipGroup rg, uint[] hateGroupHashes)
 {
     foreach (uint group in hateGroupHashes)
     {
         rg.SetRelationshipBetweenGroups((RelationshipGroup)group, Relationship.Hate, false);
     }
 }
Exemplo n.º 2
0
        public void MakeZombie(Ped ped, RelationshipGroup relationshipGroup)
        {
            GiveZombieLook(ped);
            ped.RelationshipGroup = relationshipGroup;
            if (!Function.Call <bool>(Hash.HAS_CLIP_SET_LOADED, new InputArgument[]
                                      { "move_m@drunk@verydrunk" }))
            {
                Function.Call(Hash.REQUEST_CLIP_SET, new InputArgument[]
                {
                    "move_m@drunk@verydrunk"
                });
            }
            if (Function.Call <bool>(Hash.HAS_CLIP_SET_LOADED, new InputArgument[]
            {
                "move_m@drunk@verydrunk"
            }))
            {
                Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, new InputArgument[]
                {
                    ped.Handle, "move_m@drunk@verydrunk", 1048576000
                });
            }
            Function.Call(Hash.STOP_PED_SPEAKING, new InputArgument[]
            {
                ped.Handle, true
            });

            ped.AlwaysKeepTask = true;
            ped.IsEnemy        = true;
            Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, ped, 1);
            Function.Call(Hash.SET_PED_FLEE_ATTRIBUTES, ped, 0, 0);
            Function.Call(Hash.SET_PED_COMBAT_ATTRIBUTES, ped, 46, 1);
        }
Exemplo n.º 3
0
 public static void SetPedRelaionshipGroup(Ped ped, RelationshipGroup relationshipGroup)
 {
     if (ped.RelationshipGroup != relationshipGroup)
     {
         ped.RelationshipGroup = relationshipGroup;
     }
 }
Exemplo n.º 4
0
        private async Task <Ped[]> SpawnBodyguards(Ped targetPed, int amount)
        {
            PedGroup group = new PedGroup();

            group.Add(targetPed, true);
            group.FormationType   = FormationType.Default;
            group.SeparationRange = 1f;

            RelationshipGroup relationship = World.AddRelationshipGroup("_ASSASSIN_TARGETS");

            relationship.SetRelationshipBetweenGroups(new RelationshipGroup(Util.GetHashKey("COP")), Relationship.Respect, true);
            relationship.SetRelationshipBetweenGroups(new RelationshipGroup(Util.GetHashKey("SECURITY_GUARD")), Relationship.Respect, true);
            targetPed.RelationshipGroup = relationship;

            Random random = new Random();

            Ped[] bodyguards = new Ped[amount];
            for (int i = 0; i < amount; i++)
            {
                float   x         = Util.GetRandomFloat(random, -2, 2);
                float   y         = Util.GetRandomFloat(random, -2, 2);
                Vector3 spawnPos  = targetPed.GetOffsetPosition(new Vector3(x, y, 0f));
                Ped     bodyguard = await Util.CreatePed(PedHash.FibOffice01SMM, spawnPos);

                bodyguard.Armor = 300;
                bodyguard.Weapons.Give(WeaponHash.CarbineRifle, int.MaxValue, true, true);

                bodyguard.RelationshipGroup = new RelationshipGroup(Util.GetHashKey("SECURITY_GUARD"));
                group.Add(bodyguard, false);

                bodyguards[i] = bodyguard;
            }

            return(bodyguards);
        }
Exemplo n.º 5
0
        public BackupHandler()
        {
            bodyguardGroup = World.AddRelationshipGroup("bodyguards");
            bodyguardGroup.SetRelationshipBetweenGroups(Game.PlayerPed.RelationshipGroup, Relationship.Companion, true);

            EventHandlers["bc:buzzardbackup"]   += new Action(SpawnBuzzardBackup);
            EventHandlers["bc:technicalbackup"] += new Action(SpawnTechnicalBackup);
        }
Exemplo n.º 6
0
        public ZombieSpawner()
        {
            zombies     = new List <Ped>();
            ZombieGroup = World.AddRelationshipGroup("zombies");

            EntityDecoration.RegisterProperty(ZOMBIE_DECOR, DecorationType.Bool);
            Tick += OnTick;
        }
Exemplo n.º 7
0
        public GameRules()
        {
            Tick += OnTick;

            relationCriminal = World.AddRelationshipGroup("criminal");
            relationPolice   = World.AddRelationshipGroup("cop");
            relationTraitor  = World.AddRelationshipGroup("traitor");
        }
Exemplo n.º 8
0
        public Mission()
        {
            relationship = new RelationshipGroup("MISSION_ENEMY".GetHashCode());
            relationship.SetRelationshipBetweenGroups(relationship, Relationship.Respect);

            Ped playerPed = Game.PlayerPed;

            relationship.SetRelationshipBetweenGroups(playerPed.RelationshipGroup, Relationship.Hate);
            playerPed.RelationshipGroup.SetRelationshipBetweenGroups(relationship, Relationship.Hate);
        }
Exemplo n.º 9
0
        public bool CanRobRelationship(RelationshipGroup group)
        {
            Relationship relation = group.GetRelationshipBetweenGroups(Game.Player.Character.RelationshipGroup.Hash);

            if (relation == Relationship.Companion)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 10
0
        public override bool OnBeforeCalloutDisplayed()
        {
            spawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.AroundPosition(215.0f));
            while (spawnPoint.DistanceTo(Game.LocalPlayer.Character.Position) < 30.0f)
            {
                spawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.AroundPosition(210.0f)).GetSafeCoordinatesForPed();
                GameFiber.Yield();
            }
            if (spawnPoint == Vector3.Zero)
            {
                spawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.AroundPosition(195.0f));
            }

            suspect = new Ped(spawnPoint);
            if (!suspect.Exists())
            {
                return(false);
            }
            hostage = new Ped(spawnPoint + suspect.ForwardVector * 0.9f);
            if (!hostage.Exists())
            {
                return(false);
            }

            suspect.BlockPermanentEvents = true;
            hostage.BlockPermanentEvents = true;

            hostage.Heading = suspect.Heading = MathHelper.GetRandomSingle(1f, 359f);

            RelationshipGroup hostageRelation = new RelationshipGroup("HOSTAGE");

            hostage.RelationshipGroup = hostageRelation;
            Game.SetRelationshipBetweenRelationshipGroups(hostageRelation, "COP", Relationship.Companion);
            Game.SetRelationshipBetweenRelationshipGroups(hostageRelation, "PLAYER", Relationship.Companion);
            Game.SetRelationshipBetweenRelationshipGroups("COP", hostageRelation, Relationship.Companion);

            RelationshipGroup suspectRelation = new RelationshipGroup("SUSPECT");

            suspect.RelationshipGroup = suspectRelation;
            Game.SetRelationshipBetweenRelationshipGroups(suspectRelation, "COP", Relationship.Dislike);
            Game.SetRelationshipBetweenRelationshipGroups(suspectRelation, "PLAYER", Relationship.Dislike);
            Game.SetRelationshipBetweenRelationshipGroups("COP", suspectRelation, Relationship.Dislike);

            this.ShowCalloutAreaBlipBeforeAccepting(spawnPoint, 17.5f);
            this.AddMinimumDistanceCheck(15.0f, suspect.Position);

            // Set up our callout message and location
            this.CalloutMessage  = "Hostage situation";
            this.CalloutPosition = spawnPoint;

            //Play the police scanner audio for this callout (available as of the 0.2a API)
            Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT CRIME_ASSAULT_CIVILIAN IN_OR_ON_POSITION UNITS_RESPOND_CODE_03", spawnPoint);

            return(base.OnBeforeCalloutDisplayed());
        }
Exemplo n.º 11
0
        public static void Init()
        {
            Groups = new Dictionary<int, RelationshipGroup>();


            {
                var group = new RelationshipGroup("MissionCreator_RESPECT");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Respect);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Respect);
                Groups.Add(1, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_LIKE");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Like);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Like);
                Groups.Add(2, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_NEUTRAL");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Neutral);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Neutral);
                Groups.Add(3, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_DISLIKE");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Dislike);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Dislike);
                Groups.Add(4, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_HATE");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Hate);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Hate);
                Groups.Add(5, group);
            }


            {
                RelationshipGroup group1;
                RelationshipGroup group2;
                group1 = new RelationshipGroup("MissionCreator_GROUP1");
                group2 = new RelationshipGroup("MissionCreator_GROUP2");
                Game.SetRelationshipBetweenRelationshipGroups(group2, group1, Relationship.Hate);
                Game.SetRelationshipBetweenRelationshipGroups(group1, group2, Relationship.Hate);
                Groups.Add(6, group1);
                Groups.Add(7, group2);
            }
        }
Exemplo n.º 12
0
        public static void Init()
        {
            Groups = new Dictionary <int, RelationshipGroup>();


            {
                var group = new RelationshipGroup("MissionCreator_RESPECT");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Respect);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Respect);
                Groups.Add(1, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_LIKE");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Like);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Like);
                Groups.Add(2, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_NEUTRAL");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Neutral);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Neutral);
                Groups.Add(3, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_DISLIKE");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Dislike);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Dislike);
                Groups.Add(4, group);
            }

            {
                var group = new RelationshipGroup("MissionCreator_HATE");
                Game.SetRelationshipBetweenRelationshipGroups(Game.LocalPlayer.Character.RelationshipGroup, group, Relationship.Hate);
                Game.SetRelationshipBetweenRelationshipGroups(group, Game.LocalPlayer.Character.RelationshipGroup, Relationship.Hate);
                Groups.Add(5, group);
            }


            {
                RelationshipGroup group1;
                RelationshipGroup group2;
                group1 = new RelationshipGroup("MissionCreator_GROUP1");
                group2 = new RelationshipGroup("MissionCreator_GROUP2");
                Game.SetRelationshipBetweenRelationshipGroups(group2, group1, Relationship.Hate);
                Game.SetRelationshipBetweenRelationshipGroups(group1, group2, Relationship.Hate);
                Groups.Add(6, group1);
                Groups.Add(7, group2);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Instantiate Heli with parameters.
        /// </summary>
        /// <param name="model">Model name of the helicopter to use</param>
        /// <param name="height">hover _height of the helicopter</param>
        /// <param name="radius">hover _radius of the helicopter</param>
        /// <param name="bulletproof">Whether the helicopter is _isBulletproof</param>
        public Heli(string model, float height, float radius, bool bulletproof, bool spawnFarAway)
        {
            // settings
            _model         = (Model)Game.GenerateHash(model);
            _height        = height;
            _radius        = radius;
            _isBulletproof = bulletproof;
            _spawnFarAway  = spawnFarAway;

            // instantiate a relationship group
            _leader = Game.Player.Character;
            _rg     = _leader.RelationshipGroup;
        }
Exemplo n.º 14
0
 void SetRelationShips()
 {
     ZombieGroup   = World.AddRelationshipGroup("ZombieGroup");
     FriendlyGroup = World.AddRelationshipGroup("FriendlyGroup");
     PlayerGroup   = World.AddRelationshipGroup("PlayerGroup");
     RunnerGroup   = World.AddRelationshipGroup("RunnerGroup");
     BomberGroup   = World.AddRelationshipGroup("BomberGroup");
     PlayerGroup.SetRelationshipBetweenGroups(ZombieGroup, Relationship.Hate, true);
     PlayerGroup.SetRelationshipBetweenGroups(FriendlyGroup, Relationship.Companion, true);
     FriendlyGroup.SetRelationshipBetweenGroups(ZombieGroup, Relationship.Hate, true);
     RunnerGroup.SetRelationshipBetweenGroups(ZombieGroup, Relationship.Companion, true);
     FriendlyGroup.SetRelationshipBetweenGroups(RunnerGroup, Relationship.Hate, true);
     FriendlyGroup.SetRelationshipBetweenGroups(BomberGroup, Relationship.Hate, true);
 }
Exemplo n.º 15
0
        public void MakeFriendly(Ped ped, RelationshipGroup relationshipGroup)
        {
            ped.RelationshipGroup = relationshipGroup;
            ped.Health            = 100;
            Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, ped, Game.Player.Character.PedGroup);
            ped.Weapons.Give(WeaponHash.CarbineRifle, 100, true, true);
            ped.Task.FightAgainstHatedTargets(30f);
            ped.AlwaysKeepTask = true;
            Function.Call(Hash.SET_PED_COMBAT_ATTRIBUTES, ped, 46, true);
            Blip blip = ped.AddBlip();

            blip.Sprite = BlipSprite.Friend;
            blip.Color  = BlipColor.Blue;
        }
Exemplo n.º 16
0
        /// <summary>
        /// Instantiate a StrafeRun controller
        /// </summary>
        /// <param name="radius">XY-plane Distance from the target position of each strafe run to spawn</param>
        /// <param name="height">Z-axis, or height, above the target position of each strafe run to spawn</param>
        /// <param name="targetRadius">Distance around the target position to detect targets each strafe run</param>
        /// <param name="cinematic">if <c>true</c>, activate cinematic camera on each strafe run</param>
        public StrafeRun(float radius, float height, float targetRadius, int bombsPerPlane, bool cinematic = true)
        {
            // settings
            _height          = height;
            _radius          = radius;
            _cinematic       = cinematic;
            _searchRadius    = targetRadius;
            _jdamsPerVehicle = bombsPerPlane;

            // other preparations
            relGroup = Game.Player.Character.RelationshipGroup;
            targetMarkerPtfxAsset.Request();
            cineCamCtrler = new StrafeRunCinematicCamController();
        }
Exemplo n.º 17
0
        /// <summary>
        /// Read settings from INI file and instantiate necessary data structures with the settings.
        /// </summary>
        private void readSettings(bool verbose = false)
        {
            // init ScriptSettings
            ScriptSettings ss = base.Settings;

            // read in general settings
            string sec = "General";

            activateKey = ss.GetValue <Keys>(sec, "activate", activateKey);

            // read in settings for Attack Heli
            sec        = "AttackHeli";
            attackHeli = new Attackheli(
                ss.GetValue <string>(sec, "HeliModel", "Akula"),
                ss.GetValue <float>(sec, "height", 20f),
                ss.GetValue <float>(sec, "radius", 20f),
                ss.GetValue <bool>(sec, "bulletproof", true),
                ss.GetValue <bool>(sec, "spawnFarAway", false)
                );
            RelationshipGroup heliRg = attackHeli._rg;

            // read in settings for Support Heli
            sec         = "SupportHeli";
            supportHeli = new SupportHeli(
                ss.GetValue <string>(sec, "HeliModel", "Polmav"),
                ss.GetValue <float>(sec, "height", 20f),
                ss.GetValue <float>(sec, "radius", 20f),
                ss.GetValue <bool>(sec, "bulletproof", true),
                ss.GetValue <bool>(sec, "spawnFarAway", false)
                );
            supportHeli._rg = heliRg;

            // read in settings for Strafe Run
            sec = "JetStrafeRun";
            strafeRunActivateKey = ss.GetValue <Keys>(sec, "activateKey", strafeRunActivateKey);
            strafeRun            = new StrafeRun(
                ss.GetValue <float>(sec, "spawnRadius", 375f),
                ss.GetValue <float>(sec, "spawnHeight", 275f),
                ss.GetValue <float>(sec, "targetRadius", 50f),
                ss.GetValue <int>(sec, "bombsPerPlane", 2),
                ss.GetValue <bool>(sec, "cinematic", true)
                );

            // read in settings for ground crew
            crewSettings = new GroundCrewSettings(ss);

            // manipulate heliRg
            Helper.makeRelationshipGroupHate(heliRg, Helper.defaultHateGroups);
        }
Exemplo n.º 18
0
 public RelationshipGroup UpdateGroup(RelationshipGroup rGroup)
 {
     return(ExecuteFaultHandledOperation(() =>
     {
         RelationshipGroup updateRelationshipGroup = null;
         if (rGroup.RelationshipGroupId == 0)
         {
             updateRelationshipGroup = _relationshipGroupRepository.Add(rGroup);
         }
         else
         {
             updateRelationshipGroup = _relationshipGroupRepository.Update(rGroup);
         }
         return updateRelationshipGroup;
     }));
 }
Exemplo n.º 19
0
        public void Test_UpdateGroup_add_new_group()
        {
            RelationshipGroup newRGroup   = new RelationshipGroup();
            RelationshipGroup addedRGroup = new RelationshipGroup()
            {
                RelationshipGroupId = 10
            };

            Mock <IRelationshipGroupsRepository> mockRelationshipGroupsRepo = new Mock <IRelationshipGroupsRepository>();

            mockRelationshipGroupsRepo.Setup(obj => obj.Add(newRGroup)).Returns(addedRGroup);

            RelationshipGroupManager manager = new RelationshipGroupManager(mockRelationshipGroupsRepo.Object);

            RelationshipGroup results = manager.UpdateGroup(newRGroup);

            Assert.IsTrue(results == addedRGroup);
        }
Exemplo n.º 20
0
        public PresidentEscort()
        {
            presidentGroup = World.AddRelationshipGroup("president");
            terroristGroup = World.AddRelationshipGroup("terrorist");
            bodyguardGroup = World.AddRelationshipGroup("bodyguard");

            presidentGroup.SetRelationshipBetweenGroups(terroristGroup, Relationship.Hate);
            presidentGroup.SetRelationshipBetweenGroups(bodyguardGroup, Relationship.Companion);
            terroristGroup.SetRelationshipBetweenGroups(presidentGroup, Relationship.Hate);
            terroristGroup.SetRelationshipBetweenGroups(bodyguardGroup, Relationship.Hate);
            bodyguardGroup.SetRelationshipBetweenGroups(presidentGroup, Relationship.Companion);
            bodyguardGroup.SetRelationshipBetweenGroups(terroristGroup, Relationship.Hate);

            EventHandlers["playerSpawned"] += new Action <dynamic>(respawn);
            EventHandlers["pe:host"]       += new Action(startHost);
            EventHandlers["pe:start"]      += new Action <string>(startPlayer);
            EventHandlers["pe:stopGame"]   += new Action(cleanupGame);
        }
Exemplo n.º 21
0
        public MoneyTruckEvent()
        {
            EventHandlers["playerSpawned"] += new Action <dynamic>(spawn => {
                if (!alreadySpawned)
                {
                    onTickTask = new Func <Task>(OnTick);

                    moneyTruckerGroup = World.AddRelationshipGroup("moneyTrucker");
                    moneyTruckerGroup.SetRelationshipBetweenGroups(Game.PlayerPed.RelationshipGroup, Relationship.Dislike, true);
                    moneyTruckerGroup.SetRelationshipBetweenGroups(new RelationshipGroup("COP".GetHashCode()), Relationship.Companion, true);

                    alreadySpawned = true;
                }
            });

            EventHandlers["re:preparemoneytruckevent"] += new Action(PrepareMoneyTruckEvent);

            EventHandlers["re:startmoneytruckevent"] += new Action <dynamic, dynamic, dynamic>(StartMoneyTruckEvent);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 预设任务组关系, should be called only once in init.
        /// </summary>
        public static void Init()
        {
            MissionEnemyGroup   = World.AddRelationshipGroup("MissionEnemyGroup");
            MissionAlianceGroup = World.AddRelationshipGroup("MissionAlianceGroup");
            MissionFighterGroup = World.AddRelationshipGroup("MissionFighterGroup");

            // 默认玩家与任务玩家为同盟
            new RelationshipGroup((int)RelationshipBaseGroup.PLAYER).SetRelationshipBetweenGroups(MissionFighterGroup, Relationship.Companion, true);
            // 默认玩家与任务敌人为敌对
            new RelationshipGroup((int)RelationshipBaseGroup.PLAYER).SetRelationshipBetweenGroups(MissionEnemyGroup, Relationship.Hate, true);
            // 任务玩家与任务敌人为敌对
            MissionFighterGroup.SetRelationshipBetweenGroups(MissionEnemyGroup, Relationship.Hate, true);
            // 任务玩家与任务同盟为同盟
            MissionFighterGroup.SetRelationshipBetweenGroups(MissionAlianceGroup, Relationship.Companion, true);
            // 任务同盟与任务敌人为敌对
            MissionAlianceGroup.SetRelationshipBetweenGroups(MissionEnemyGroup, Relationship.Hate, true);
            // 任务敌人与行人为敌对
            MissionEnemyGroup.SetRelationshipBetweenGroups(new RelationshipGroup((int)RelationshipBaseGroup.COP), Relationship.Hate, true);
            MissionEnemyGroup.SetRelationshipBetweenGroups(new RelationshipGroup((int)RelationshipBaseGroup.CIVFEMALE), Relationship.Hate, true);
        }
Exemplo n.º 23
0
        public void Test_UpdateGroup_update_existing_group()
        {
            RelationshipGroup existingRGroup = new RelationshipGroup()
            {
                RelationshipGroupId = 10
            };

            RelationshipGroup updatedRGroup = new RelationshipGroup()
            {
                RelationshipGroupId = 10
            };

            Mock <IRelationshipGroupsRepository> mockRelationshipGroupsRepo = new Mock <IRelationshipGroupsRepository>();

            mockRelationshipGroupsRepo.Setup(obj => obj.Update(existingRGroup)).Returns(updatedRGroup);


            RelationshipGroupManager manager = new RelationshipGroupManager(mockRelationshipGroupsRepo.Object);

            RelationshipGroup results = manager.UpdateGroup(existingRGroup);

            Assert.IsTrue(results == updatedRGroup);
        }
Exemplo n.º 24
0
        public const NetDeliveryMethod SYNC_MESSAGE_TYPE = NetDeliveryMethod.UnreliableSequenced; // unreliable_sequenced

        #endregion


        public Main()
        {
            res    = UIMenu.GetScreenResolutionMantainRatio();
            screen = GTA.UI.Screen.Resolution;

            LogManager.RuntimeLog("\r\n>> [" + DateTime.Now + "] GTA Network Initialization.");

            World.DestroyAllCameras();

            CrossReference.EntryPoint = this;

            GameSettings   = Misc.GameSettings.LoadGameSettings();
            PlayerSettings = Util.Util.ReadSettings(GTANInstallDir + "\\settings.xml");

            CefUtil.DISABLE_CEF = PlayerSettings.DisableCEF;
            DebugInfo.ShowFps   = PlayerSettings.ShowFPS;
            EnableMediaStream   = PlayerSettings.MediaStream;
            EnableDevTool       = PlayerSettings.CEFDevtool;

            _threadJumping = new Queue <Action>();

            NetEntityHandler = new Streamer.Streamer();
            CameraManager    = new CameraManager();

            Watcher                = new SyncEventWatcher(this);
            VehicleSyncManager     = new UnoccupiedVehicleSync();
            WeaponInventoryManager = new WeaponManager();

            Npcs         = new Dictionary <string, SyncPed>();
            _tickNatives = new Dictionary <string, NativeData>();
            _dcNatives   = new Dictionary <string, NativeData>();

            EntityCleanup = new List <int>();
            BlipCleanup   = new List <int>();

            _emptyVehicleMods = new Dictionary <int, int>();
            for (var i = 0; i < 50; i++)
            {
                _emptyVehicleMods.Add(i, 0);
            }

            Chat             = new ClassicChat();
            Chat.OnComplete += ChatOnComplete;

            _backupChat = (ClassicChat)Chat;

            LogManager.RuntimeLog("Attaching OnTick loop.");

            Tick += OnTick;

            KeyDown += OnKeyDown;

            KeyUp += (sender, args) =>
            {
                if (args.KeyCode == Keys.Escape && _wasTyping)
                {
                    _wasTyping = false;
                }
            };

            _config = new NetPeerConfiguration("GTANETWORK")
            {
                Port = 8888, ConnectionTimeout = 30f
            };
            _config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated);

            LogManager.RuntimeLog("Building menu.");
            _menuPool = new MenuPool();
            BuildMainMenu();

            //Function.Call(Hash._ENABLE_MP_DLC_MAPS, true); // _ENABLE_MP_DLC_MAPS
            Function.Call(Hash._USE_FREEMODE_MAP_BEHAVIOR, true); // _ENABLE_MP_DLC_MAPS
            Function.Call(Hash._LOAD_MP_DLC_MAPS);                // _LOAD_MP_DLC_MAPS / _USE_FREEMODE_MAP_BEHAVIOR

            MainMenuCamera = World.CreateCamera(new Vector3(743.76f, 1070.7f, 350.24f), new Vector3(), GameplayCamera.FieldOfView);
            MainMenuCamera.PointAt(new Vector3(707.86f, 1228.09f, 333.66f));

            RelGroup       = World.AddRelationshipGroup("SYNCPED");
            FriendRelGroup = World.AddRelationshipGroup("SYNCPED_TEAMMATES");

            RelGroup.SetRelationshipBetweenGroups(Game.Player.Character.RelationshipGroup, Relationship.Pedestrians, true);
            FriendRelGroup.SetRelationshipBetweenGroups(Game.Player.Character.RelationshipGroup, Relationship.Companion, true);

            SocialClubName = Game.Player.Name;

            LogManager.RuntimeLog("Getting welcome message.");
            GetWelcomeMessage();

            var t = new Thread(UpdateSocialClubAvatar)
            {
                IsBackground = true
            };

            t.Start();

            //Function.Call(Hash.SHUTDOWN_LOADING_SCREEN);

            Audio.SetAudioFlag(AudioFlags.LoadMPData, true);
            Audio.SetAudioFlag(AudioFlags.DisableBarks, true);
            Audio.SetAudioFlag(AudioFlags.DisableFlightMusic, true);
            Audio.SetAudioFlag(AudioFlags.PoliceScannerDisabled, true);
            Audio.SetAudioFlag(AudioFlags.OnlyAllowScriptTriggerPoliceScanner, true);
            Function.Call(Hash._FORCE_AMBIENT_SIREN, false); //_FORCE_AMBIENT_SIREN

            // disable fire dep dispatch service
            Function.Call(Hash.ENABLE_DISPATCH_SERVICE, 4, false); // ENABLE_DISPATCH_SERVICE

            GlobalVariable.Get(2576573).Write(1);                  //Enable MP cars?

            LogManager.RuntimeLog("Reading whitelists.");
            ThreadPool.QueueUserWorkItem(delegate
            {
                NativeWhitelist.Init();
                SoundWhitelist.Init();
            });

            //var fetchThread = new Thread((ThreadStart) delegate
            //{
            //    var list = Process.GetProcessesByName("GameOverlayUI");
            //    if (!list.Any()) return;
            //    for (var index = list.Length - 1; index >= 0; index--) list[index].Kill();
            //});

            //fetchThread.Start();

            if (!PlayerSettings.DisableCEF)
            {
                LogManager.RuntimeLog("Initializing CEF.");
                CEFManager.InitializeCef();
            }

            LogManager.RuntimeLog("Rebuilding Server Browser.");
            RebuildServerBrowser();

            LogManager.RuntimeLog("Checking game files integrity.");
            IntegrityCheck();
        }
Exemplo n.º 25
0
 /// <summary>
 /// 设置<seealso cref="Ped"/>组别为<seealso cref="RelationshipGroup"/>
 /// </summary>
 /// <param name="ped"></param>
 /// <param name="relationshipGroup"></param>
 public static void SetRelationshipGroup(this Ped ped, RelationshipGroup relationshipGroup)
 {
     MissionRelationship.SetPedRelaionshipGroup(ped, relationshipGroup);
 }
Exemplo n.º 26
0
 private Relationships(RelationshipGroup id)
 {
     _pedType = id;
 }
Exemplo n.º 27
0
 public void SetRelationTo(RelationshipGroup target, RelationshipType relation)
 {
     Internal.Function.Call(0x0746, (int)relation, (int)_pedType, (int)target);
 }
Exemplo n.º 28
0
        public static Relationships FromID(RelationshipGroup id)
        {
            Relationships retval = null;

            if (_instanceCache == null)
            {
                _instanceCache = new Dictionary<RelationshipGroup, Relationships>();
            }
            else if (_instanceCache.TryGetValue(id, out retval))
            {
                return retval;
            }

            retval = new Relationships(id);
            _instanceCache.Add(id, retval);

            return retval;
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            string path = Directory.GetCurrentDirectory().Split("DungeonTool")[0] + "DungeonTool/";

            StoredData.PlayerCount = 5;
            StoredData.PlayerLevel = 2;

            #region Personalities
            string personalityJson  = File.ReadAllText(path + @"Data/personalities.json");
            JArray personalityArray = JArray.Parse(personalityJson);
            foreach (JToken personalityToken in personalityArray.Children())
            {
                Personality personality = JsonConvert.DeserializeObject <Personality>(personalityToken.ToString(), new PersonalityConverter());
                StoredData.Personalities.Add(personality);
            }
            #endregion

            #region Personality groups
            string personalityGroupJson  = File.ReadAllText(path + @"Data/personality_groups.json");
            JArray personalityGroupArray = JArray.Parse(personalityGroupJson);
            foreach (JToken personalityGroupToken in personalityGroupArray.Children())
            {
                PersonalityGroup personalityGroup = JsonConvert.DeserializeObject <PersonalityGroup>(personalityGroupToken.ToString(), new PersonalityGroupConverter());
                StoredData.PersonalityGroups.Add(personalityGroup);
            }
            #endregion

            #region Relationships
            string relationshipJson  = File.ReadAllText(path + @"Data/relationships.json");
            JArray relationshipArray = JArray.Parse(relationshipJson);
            foreach (JToken relationshipToken in relationshipArray.Children())
            {
                Relationship relationship = JsonConvert.DeserializeObject <Relationship>(relationshipToken.ToString(), new RelationshipConverter());
                StoredData.Relationships.Add(relationship);
            }
            #endregion

            #region Relationship groups
            string relationshipGroupJson  = File.ReadAllText(path + @"Data/relationship_groups.json");
            JArray relationshipGroupArray = JArray.Parse(relationshipGroupJson);
            foreach (JToken relationshipGroupToken in relationshipGroupArray.Children())
            {
                RelationshipGroup relationshipGroup = JsonConvert.DeserializeObject <RelationshipGroup>(relationshipGroupToken.ToString(), new RelationshipGroupConverter());
                StoredData.RelationshipGroups.Add(relationshipGroup);
            }
            #endregion

            #region Infernal cults
            string cultJson  = File.ReadAllText(path + @"Data/infernal_cults.json");
            JArray cultArray = JArray.Parse(cultJson);
            foreach (JToken cultToken in cultArray.Children())
            {
                InfernalCult cult = JsonConvert.DeserializeObject <InfernalCult>(cultToken.ToString(), new InfernalCultConverter());
                StoredData.InfernalCults.Add(cult);
            }
            #endregion

            #region Infernal cult groups
            string cultGroupJson  = File.ReadAllText(path + @"Data/infernal_cult_groups.json");
            JArray cultGroupArray = JArray.Parse(cultGroupJson);
            foreach (JToken cultGroupToken in cultGroupArray.Children())
            {
                InfernalCultGroup cultGroup = JsonConvert.DeserializeObject <InfernalCultGroup>(cultGroupToken.ToString(), new InfernalCultGroupConverter());
                StoredData.InfernalCultGroups.Add(cultGroup);
            }
            #endregion

            #region Appropriate monsters
            string monsterJson  = File.ReadAllText(path + @"Data/monsters.json");
            JArray monsterArray = JArray.Parse(monsterJson);
            foreach (JToken monsterToken in monsterArray.Children())
            {
                Monster monster = JsonConvert.DeserializeObject <Monster>(monsterToken.ToString(), new MonsterConverter());
                StoredData.Monsters.Add(monster);
            }
            #endregion

            Encounter encounter = Encounter.CreateEncounter(EncounterDifficulty.Deadly);
            Console.WriteLine(encounter.ToString());
        }
 public TargetingSystem(Ped player)
 {
     _player   = player;
     _playerRg = player.RelationshipGroup;
 }
Exemplo n.º 31
0
 public HateGroup()
 {
     GroupId = World.AddRelationshipGroup("hates-player");
     GroupId.SetRelationshipBetweenGroups(Game.GenerateHash("PLAYER"), Relationship.Hate);
 }
        public ArmyHeliSquadSpawner()
        {
            ArmyHeliSquadGroup = World.AddRelationshipGroup("armyHeliSquad");

            Tick += OnTick;
        }
Exemplo n.º 33
0
        public RebelSquadSpawner()
        {
            RebelSquadGroup = World.AddRelationshipGroup("rebelSquad");

            Tick += OnTick;
        }