Beispiel #1
0
 public void OnTick(object sender, EventArgs e)
 {
     if (Main.ModActive)
     {
         Ped closest = World.GetClosest <Ped>(Game.Player.Character.Position, World.GetNearbyPeds(Game.Player.Character, 1.5f));
         if (((closest != null) && (!closest.IsDead && closest.IsHuman)) && (closest.RelationshipGroup == Relationships.FriendlyGroup))
         {
             Extensions.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to recruit");
             Game.DisableControlThisFrame(2, Control.Context);
             if (Game.IsDisabledControlJustPressed(2, Control.Context))
             {
                 try
                 {
                     closest.Recruit(Game.Player.Character);
                 }
                 catch (Exception exception1)
                 {
                     Debug.Log(exception1.ToString());
                 }
             }
         }
         else if (((closest != null) && (!closest.IsDead && closest.IsHuman)) && (closest.RelationshipGroup == Game.Player.Character.RelationshipGroup))
         {
             Extensions.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to manage Group");
             Game.DisableControlThisFrame(2, Control.Context);
             if (Game.IsDisabledControlJustPressed(2, Control.Context) && !Main.MasterMenuPool.IsAnyMenuOpen())
             {
                 this.currentGroupPed  = closest;
                 this.mainMenu.Visible = !this.mainMenu.Visible;
             }
         }
     }
 }
Beispiel #2
0
 public void OnTick(object sender, EventArgs e)
 {
     if (Game.Player.Character.IsDead)
     {
         inventoryMenu.Visible     = false;
         craftCampfireMenu.Visible = false;
     }
     if (Main.ModActive)
     {
         Game.DisableControlThisFrame(2, GTA.Control.Phone);
         if (Game.IsDisabledControlJustPressed(2, GTA.Control.Phone) && !Main.MasterMenuPool.IsAnyMenuOpen())
         {
             inventoryMenu.Visible = !inventoryMenu.Visible;
         }
     }
     if (Main.ModActive && !Game.Player.Character.IsInVehicle())
     {
         try
         {
             Prop closest = World.GetClosest <Prop>(Game.Player.Character.Position, World.GetNearbyProps(Game.Player.Character.Position, 2.5f));
             if (closest == Character.tent)
             {
                 Extensions.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to sleep in Tent");
                 Game.DisableControlThisFrame(2, GTA.Control.Context);
                 if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context))
                 {
                     Population.Sleep(Game.Player.Character.Position);
                 }
             }
             else if (closest == Character.campFire)
             {
                 Extensions.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to craft using Campfire");
                 Game.DisableControlThisFrame(2, GTA.Control.Context);
                 if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context))
                 {
                     craftCampfireMenu.Visible = !craftCampfireMenu.Visible;
                 }
             }
             Game.Player.CanControlCharacter = !craftCampfireMenu.Visible;
             Ped ped = World.GetClosest <Ped>(Game.Player.Character.Position, World.GetNearbyPeds(Game.Player.Character, 1.5f));
             if (((ped == null) || (!ped.IsDead || !ped.IsHuman)) || this.lootedPeds.Contains(ped))
             {
                 if (((ped != null) && (ped.IsDead && !ped.IsHuman)) && !this.lootedPeds.Contains(ped))
                 {
                     Extensions.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to harvest meat from animal corpse");
                     Game.DisableControlThisFrame(2, GTA.Control.Context);
                     if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context))
                     {
                         if (!Game.Player.Character.Weapons.HasWeapon((WeaponHash)(-1716189206)))
                         {
                             UI.Notify("You need a knife to harvest ~b~Raw Meat~w~ from dead animals!", true);
                         }
                         else if (Inventory.playerMaterialInventory.Find(material => material.Name == "Raw Meat").Amount == Inventory.playerMaterialInventory.Find(material => material.Name == "Raw Meat").MaxAmount)
                         {
                             UI.Notify("You cannot carry any more ~b~Raw Meat~w~!", true);
                         }
                         else
                         {
                             Game.Player.Character.Weapons.Select((WeaponHash)(-1716189206), true);
                             Game.Player.Character.Task.PlayAnimation("pickup_object", "pickup_low", 8f, 0xbb8, AnimationFlags.None);
                             InventoryMaterial local7 = Inventory.playerMaterialInventory.Find(material => material.Name == "Raw Meat");
                             local7.Amount++;
                             object[] objArray5 = new object[5];
                             objArray5[0] = "(";
                             objArray5[1] = Inventory.playerMaterialInventory.Find(item => item.Name == "Raw Meat").Amount;
                             object[] local10 = objArray5;
                             local10[2] = "/";
                             local10[3] = Inventory.playerMaterialInventory.Find(item => item.Name == "Raw Meat").MaxAmount;
                             object[] local12 = local10;
                             local12[4] = ")";
                             materialsSubMenu.MenuItems.Find(item => item.Text == "Raw Meat").SetRightLabel(string.Concat(local12));
                             craftCampfireMenu.MenuItems[0].SetRightLabel("(" + Inventory.playerMaterialInventory.Find(material => material.Name == "Raw Meat").Amount + ")");
                             object[] objArray6 = new object[5];
                             objArray6[0] = "You have harvested ~b~Raw Meat ~g~(";
                             objArray6[1] = Inventory.playerMaterialInventory.Find(material => material.Name == "Raw Meat").Amount;
                             object[] local15 = objArray6;
                             local15[2] = "/";
                             local15[3] = Inventory.playerMaterialInventory.Find(material => material.Name == "Raw Meat").MaxAmount;
                             object[] local17 = local15;
                             local17[4] = ")";
                             UI.Notify(string.Concat(local17), true);
                             this.lootedPeds.Add(ped);
                         }
                     }
                 }
             }
             else
             {
                 Extensions.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to search corpse");
                 Game.DisableControlThisFrame(2, GTA.Control.Context);
                 if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context))
                 {
                     Game.Player.Character.Task.PlayAnimation("pickup_object", "pickup_low");
                     int num = RandoMath.CachedRandom.Next(0, 10);
                     if (num < 3)
                     {
                         List <InventoryItem> playerItemInventory = Inventory.playerItemInventory;
                         int num4 = 0;
                         while (true)
                         {
                             if (num4 >= playerItemInventory.Count)
                             {
                                 InventoryItem itemFound = RandoMath.GetRandomElementFromList <InventoryItem>(playerItemInventory);
                                 if (Inventory.playerItemInventory.Find(item => item.Name == itemFound.Name).Amount == Inventory.playerItemInventory.Find(item => item.Name == itemFound.Name).MaxAmount)
                                 {
                                     UI.Notify("Found ~b~" + itemFound.Name + "~w~ but inventory is full!", true);
                                 }
                                 else
                                 {
                                     InventoryItem local1 = Inventory.playerItemInventory.Find(item => item.Name == itemFound.Name);
                                     local1.Amount++;
                                     object[] objArray1 = new object[] { "Found ~b~", itemFound.Name, "~g~ (", Inventory.playerItemInventory.Find(item => item.Name == itemFound.Name).Amount, "/", Inventory.playerItemInventory.Find(item => item.Name == itemFound.Name).MaxAmount, ")" };
                                     UI.Notify(string.Concat(objArray1), true);
                                     this.lootedPeds.Add(ped);
                                     object[] objArray2 = new object[] { "(", Inventory.playerItemInventory.Find(item => item.Name == itemFound.Name).Amount, "/", Inventory.playerItemInventory.Find(item => item.Name == itemFound.Name).MaxAmount, ")" };
                                     itemsSubMenu.MenuItems.Find(item => item.Text == itemFound.Name).SetRightLabel(string.Concat(objArray2));
                                 }
                                 break;
                             }
                             if (playerItemInventory[num4].GetType() == typeof(InventoryCraftableFoodItem))
                             {
                                 playerItemInventory.Remove(playerItemInventory[num4]);
                             }
                             num4++;
                         }
                     }
                     else if (num <= 5)
                     {
                         UI.Notify("Found nothing", true);
                         this.lootedPeds.Add(ped);
                     }
                     else
                     {
                         List <InventoryMaterial> playerMaterialInventory = Inventory.playerMaterialInventory;
                         int num8 = 0;
                         while (true)
                         {
                             if (num8 >= playerMaterialInventory.Count)
                             {
                                 InventoryItem materialFound = RandoMath.GetRandomElementFromList <InventoryMaterial>(playerMaterialInventory);
                                 if (Inventory.playerMaterialInventory.Find(material => material.Name == materialFound.Name).Amount == Inventory.playerMaterialInventory.Find(material => material.Name == materialFound.Name).MaxAmount)
                                 {
                                     UI.Notify("Found ~b~" + materialFound.Name + "~w~ but inventory is full!", true);
                                 }
                                 else
                                 {
                                     InventoryMaterial local2 = Inventory.playerMaterialInventory.Find(material => material.Name == materialFound.Name);
                                     local2.Amount++;
                                     object[] objArray3 = new object[] { "Found ~b~", materialFound.Name, "~g~ (", Inventory.playerMaterialInventory.Find(material => material.Name == materialFound.Name).Amount, "/", Inventory.playerMaterialInventory.Find(material => material.Name == materialFound.Name).MaxAmount, ")" };
                                     UI.Notify(string.Concat(objArray3), true);
                                     this.lootedPeds.Add(ped);
                                     object[] objArray4 = new object[] { "(", Inventory.playerMaterialInventory.Find(item => item.Name == materialFound.Name).Amount, "/", Inventory.playerMaterialInventory.Find(item => item.Name == materialFound.Name).MaxAmount, ")" };
                                     materialsSubMenu.MenuItems.Find(item => item.Text == materialFound.Name).SetRightLabel(string.Concat(objArray4));
                                     craftCampfireMenu.MenuItems.Find(item => item.Text == materialFound.Name).SetRightLabel("(" + Inventory.playerMaterialInventory.Find(material => material.Name == "Raw Meat").Amount + ")");
                                 }
                                 break;
                             }
                             if ((playerMaterialInventory[num8].GetType() == typeof(InventoryCraftableMaterial)) || (playerMaterialInventory[num8].Name == "Raw Meat"))
                             {
                                 playerMaterialInventory.Remove(playerMaterialInventory[num8]);
                             }
                             num8++;
                         }
                     }
                 }
             }
         }
         catch (Exception exception1)
         {
             Debug.Log(exception1.ToString());
         }
     }
 }