Beispiel #1
0
 public Criminal(EventManager.EventType type) : base()
 {
     this.dispatchCooldown = 7;
     this.dispatchTry      = 0;
     this.blockCooldown    = 0;
     this.blockTry         = 0;
     this.type             = type;
     this.relationship     = Util.NewRelationshipOf(type);
 }
Beispiel #2
0
 public Nitroable(EventManager.EventType type) : base(type)
 {
     this.exhausts      = new List <string>();
     this.nitroAmount   = 600;
     this.nitroCooldown = false;
 }
Beispiel #3
0
 internal protected static void RegisterTriggeredEvent(string eventName, GameObject source, GameObject destination, EventManager.EventType eventType)
 {
     EventManager.RegisterTriggeredEvent(eventName, source, destination, eventType);
 }
Beispiel #4
0
 public Event(EventManager.EventType e_type)
 {
     event_type = e_type;
 }
Beispiel #5
0
 protected virtual void OnEventSent(string eventName, GameObject source, GameObject destination, EventManager.EventType eventType)
 {
     //WeaverLog.Log($"Event Received = [{eventName}] [{source?.name}] [{destination?.name}] [{eventType}]");
 }
Beispiel #6
0
 void OnEventSendInternal(string eventName, GameObject source, GameObject destination, EventManager.EventType eventType)
 {
     OnEventSent(eventName, source, destination, eventType);
     foreach (var listener in listeners)
     {
         try
         {
             listener.Value(eventName, source, destination);
         }
         catch (Exception e)
         {
             WeaverLog.LogError("Event Listener Error: " + e);
         }
     }
 }
Beispiel #7
0
        public static bool AnyEmergencyIsNear(Vector3 position, DispatchManager.DispatchType dispatchType, EventManager.EventType eventType)
        {
            if (position.Equals(Vector3.Zero))
            {
                return(false);
            }

            List <Ped> nearbyPeds = new List <Ped>(World.GetNearbyPeds(position, 100.0f));

            if (nearbyPeds.Count < 1)
            {
                return(false);
            }

            int max = 0;

            switch (eventType)
            {
            case EventManager.EventType.AggressiveDriver:
            case EventManager.EventType.GangTeam:
                max = 2;

                break;

            case EventManager.EventType.Carjacker:
                max = 0;

                break;

            case EventManager.EventType.Massacre:
            case EventManager.EventType.Driveby:
            case EventManager.EventType.Racer:
                max = 4;

                break;

            case EventManager.EventType.Terrorist:
                max = 6;

                break;
            }

            return((nearbyPeds.FindAll(p => WeCanGiveTaskTo(p) && dispatchType.Equals(DispatchManager.DispatchType.ArmyGround) ? armyRelationships.Contains(p.RelationshipGroup) : copRelationships.Contains(p.RelationshipGroup))).Count > max);
        }
Beispiel #8
0
        public static int NewRelationshipOf(EventManager.EventType type)
        {
            int newRel = World.AddRelationshipGroup((count++).ToString());

            if (newRel != 0)
            {
                switch (type)
                {
                case EventManager.EventType.AggressiveDriver:
                case EventManager.EventType.Carjacker:
                case EventManager.EventType.Racer:
                {
                    foreach (int i in criminalRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }
                    foreach (int i in copRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }

                    criminalRelationships.Add(newRel);

                    break;
                }

                case EventManager.EventType.Driveby:
                case EventManager.EventType.Massacre:
                {
                    foreach (int i in oldRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }
                    foreach (int i in criminalRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }
                    foreach (int i in copRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }

                    if (!Main.CriminalsCanFightWithPlayer)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, playerID);
                    }

                    World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, newRel);
                    criminalRelationships.Add(newRel);

                    break;
                }

                case EventManager.EventType.GangTeam:
                {
                    foreach (int i in criminalRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }
                    foreach (int i in copRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }

                    if (!Main.CriminalsCanFightWithPlayer)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, playerID);
                    }

                    World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, newRel);
                    criminalRelationships.Add(newRel);

                    break;
                }

                case EventManager.EventType.Terrorist:
                {
                    foreach (int i in oldRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }
                    foreach (int i in criminalRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }
                    foreach (int i in armyRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }
                    foreach (int i in copRelationships)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i);
                    }

                    if (!Main.CriminalsCanFightWithPlayer)
                    {
                        World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, playerID);
                    }

                    World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, newRel);
                    criminalRelationships.Add(newRel);

                    break;
                }
                }
            }

            return(newRel);
        }