示例#1
0
        private string TextToShow(object o)
        {
            if (o is int)
            {
                var c = (int)o;
                switch (c)
                {
                case 0:
                case 1:
                    return("");

                case 2:
                    RPG.Notify(Notification.Kill("double kill + 2"));
                    RPG.PlayerData.AddExp(2);
                    RPG.Audio.PlayKillStreak("doublekill");
                    return("double kill");

                case 3:
                    RPG.Notify(Notification.Kill("multi kill + 4"));
                    RPG.PlayerData.AddExp(4);
                    RPG.Audio.PlayKillStreak("multikill");
                    return("multi kill");

                case 4:
                    RPG.Notify(Notification.Kill("mega kill + 8"));
                    RPG.PlayerData.AddExp(8);
                    RPG.Audio.PlayKillStreak("megakill");
                    return("mega kill");

                case 5:
                    RPG.Notify(Notification.Kill("ultra kill + 12"));
                    RPG.PlayerData.AddExp(12);
                    RPG.Audio.PlayKillStreak("ultrakill");
                    return("ultra kill");

                case 6:
                    RPG.Notify(Notification.Kill("monster kill + 24"));
                    RPG.PlayerData.AddExp(24);
                    RPG.Audio.PlayKillStreak("monsterkill");
                    return("m m m monster kill");

                case 7:
                    RPG.Notify(Notification.Kill("ludicrous kill + 48"));
                    RPG.PlayerData.AddExp(48);
                    RPG.Audio.PlayKillStreak("ludicrouskill");
                    return("ludicrous kill");

                case 8:
                    RPG.Notify(Notification.Kill("rampage kill + 60"));
                    RPG.PlayerData.AddExp(60);
                    RPG.Audio.PlayKillStreak("rampage");
                    return("rampage kill");

                case 9:
                    RPG.Notify(Notification.Kill("wicked sick + 80"));
                    RPG.PlayerData.AddExp(80);
                    RPG.Audio.PlayKillStreak("wickedsick");
                    return("wicked sick");

                case 10:
                    RPG.Notify(Notification.Kill("unstoppable + 100"));
                    RPG.PlayerData.AddExp(100);
                    RPG.Audio.PlayKillStreak("unstoppable");
                    return("unstoppable");
                }

                if (c > 10)
                {
                    RPG.Notify(Notification.Kill("holy shit + 100"));
                    RPG.PlayerData.AddExp(100);
                    RPG.Audio.PlayKillStreak("holyshit");
                    return("h o l y  s h i t");
                }
            }

            return((string)o);
        }
示例#2
0
        public override void Update()
        {
            WorldData = RPG.WorldData;

            Ped player = Game.Player.Character;


            if (RPG.ExplosiveHits)
            {
                Function.Call(Hash.SET_EXPLOSIVE_AMMO_THIS_FRAME, Game.Player.Handle);
                Function.Call(Hash.SET_EXPLOSIVE_MELEE_THIS_FRAME, Game.Player.Handle);
            }

            if (RPG.SuperJump)
            {
                Function.Call(Hash.SET_SUPER_JUMP_THIS_FRAME, Game.Player.Handle);
            }

            if (!InitiateNpcs)
            {
                NpcDatas.AddRange(NpcRepository.Npcs);

                foreach (var npc in NpcDatas)
                {
                    npc.Spawned = false;

                    var blip = World.CreateBlip(npc.Position);
                    blip.Sprite = npc.BlipSprite;
                    WorldData.Blips.Add(new BlipObject("Blip_" + npc.Name, blip));
                }
                InitiateNpcs = true;
            }

            if (!PlayerData.Tutorial.BoughtAmmoFromShop && PlayerData.Tutorial.PressJToOpenMenu)
            {
                var tut  = RPG.GetPopup <TutorialBox>();
                var ammo = PlayerData.Inventory.FirstOrDefault(i => i.Name.Contains("Ammo"));
                if (ammo != null)
                {
                    PlayerData.Tutorial.BoughtAmmoFromShop = true;
                    EventHandler.Do(o =>
                    {
                        tut.Hide();
                        Wait(300);
                        if (!RPG.PlayerData.Tutorial.GetAKill)
                        {
                            tut.Pop("Getting kills, completing missions are just two ways to earn XP and Skill Points", "Get a kill.");
                        }
                    });
                }
            }
            if (!PlayerData.Tutorial.LearntAboutCrafting && PlayerData.Tutorial.LearntAboutIcons)
            {
                var tut       = RPG.GetPopup <TutorialBox>();
                var repairKit = PlayerData.Inventory.FirstOrDefault(i => i.Name.Contains("Vehicle Repair Kit"));
                if (repairKit != null)
                {
                    PlayerData.Tutorial.LearntAboutCrafting = true;
                    EventHandler.Do(o =>
                    {
                        PlayerData.AddItem("Health Kit", 5);
                        tut.Hide();
                        Wait(300);
                        tut.Pop("You can use items directly from the inventory or bind them to your skillbar.", "Access the menu > Character Menu > Set SkillBar and bind 'Health Kit' to T");
                    });
                }
            }
            if (!PlayerData.Tutorial.LearntAboutSkillbar && PlayerData.Tutorial.LearntAboutCrafting)
            {
                var tut          = RPG.GetPopup <TutorialBox>();
                var healthKitInT = !PlayerData.SkillSlots[0].IsEmpty && PlayerData.SkillSlots[0].IsItem && PlayerData.SkillSlots[0].ItemName == "Health Kit";
                if (healthKitInT)
                {
                    PlayerData.Tutorial.LearntAboutSkillbar = true;
                    EventHandler.Do(o =>
                    {
                        tut.Hide();
                    });
                }
            }

            CheckNpcs();

            foreach (var l in RPG.WorldData.Loot)
            {
                if (l.Prop != null && l.Prop.Exists() && l.Item != null)
                {
                    if (RPGSettings.ShowUI)
                    {
                        var dist = l.Prop.Position.DistanceTo(Game.Player.Character.Position);
                        if (dist < 60)
                        {
                            OutputArgument xArg       = new OutputArgument();
                            OutputArgument yArg       = new OutputArgument();
                            var            pos        = l.Prop.Position;
                            var            dimensions = l.Prop.Model.GetDimensions();
                            pos.Y -= dimensions.Y / 2;
                            pos.Z += 0.4f;
                            Function.Call(Hash._WORLD3D_TO_SCREEN2D, pos.X, pos.Y, pos.Z, xArg, yArg);
                            var x = xArg.GetResult <float>();
                            var y = yArg.GetResult <float>();

                            var itemName = l.Item.Type == ItemType.Money
                                ? "gta$" + l.Item.MoneyValue
                                : l.Item.Quantity + "x " + l.Item.Name;

                            new UIRectangle(new Point((int)(UI.WIDTH * x) - 50, (int)(UI.HEIGHT * y) + 12), new Size(100, 2), l.Item.GetRarityColor()).Draw();
                            new UIText(itemName, new Point((int)(UI.WIDTH * x), (int)(UI.HEIGHT * y)), 0.21f, Color.White, 0, true).Draw();
                        }
                    }

                    l.Prop.ApplyForce(new Vector3(0, 0, -0.1f));
                }
            }

            var nearbyForVecs = RPGInfo.NearbyVehicles;

            foreach (var vec in nearbyForVecs.Where(v => v.EngineHealth <= 0))
            {
                if (RPG.PlayerData.CurrentVehicle != null && vec.Handle == RPG.PlayerData.CurrentVehicle.Handle)
                {
                    continue;
                }

                if (!KilledVecs.Contains(vec.Handle))
                {
                    KilledVecs.Add(vec.Handle);


                    var rng = Random.Range(0, 100 + 1);
                    if (rng < 70)
                    {
                        var m = new Model(GM.GetHashKey("prop_box_guncase_03a"));
                        m.Request(1000);
                        var p = World.CreateProp(m, vec.Position + new Vector3(0, 0, 1.0f) + Vector3.RandomXY(), vec.Rotation, true, false);
                        p.ApplyForce(new Vector3(0, 0, -0.05f));
                        RPG.WorldData.AddLoot(new LootItem(ItemRepository.Get("Vehicle Parts"), p));
                    }
                    else if (rng < 80)
                    {
                        var m = new Model(GM.GetHashKey("prop_box_guncase_03a"));
                        m.Request(1000);
                        var p = World.CreateProp(m, vec.Position + new Vector3(0, 0, 1.0f) + Vector3.RandomXY(), vec.Rotation, true, false);
                        p.ApplyForce(new Vector3(0, 0, -0.05f));
                        RPG.WorldData.AddLoot(new LootItem(ItemRepository.Get("Vehicle Repair Kit"), p));
                    }


                    if (!vec.HasBeenDamagedBy(Game.Player.Character))
                    {
                        continue;
                    }

                    if (vec.Model.IsHelicopter)
                    {
                        RPG.Notify(Notification.Kill("destroyed helicopter: +100 Exp"));
                        PlayerData.AddExp(100);
                    }
                    else if (vec.Model.IsPlane)
                    {
                        RPG.Notify(Notification.Kill("destroyed aircraft: +150 Exp"));
                        PlayerData.AddExp(150);
                    }
                    else if (vec.Model.IsBoat)
                    {
                        RPG.Notify(Notification.Kill("Destroyed Boat: +200 Exp"));
                        PlayerData.AddExp(200);
                    }
                    else if (vec.Model.IsBike)
                    {
                        RPG.Notify(Notification.Kill("Destroyed Bike: +20 Exp"));
                        PlayerData.AddExp(20);
                    }
                    else if (vec.Model.IsTrain)
                    {
                        RPG.Notify(Notification.Kill("Destroyed Train: +500 Exp"));
                        PlayerData.AddExp(500);
                    }
                    else
                    {
                        RPG.Notify(Notification.Kill("Destroyed Vehicle: +15 Exp"));
                        PlayerData.AddExp(15);
                    }

                    CheckIfForQuest(vec, vec.Model.Hash, false);
                }
            }

            var nearbyForKills = RPGInfo.NearbyPeds;

            //var nearbyForKills = World.GetAllPeds();
            foreach (var ped in nearbyForKills.Where(p => !p.IsAlive))
            {
                if (ped.CurrentBlip != null)
                {
                    ped.CurrentBlip.Remove();
                }

                var n = RPG.WorldData.Npcs.FirstOrDefault(x => x.Ped != null && x.Ped.Handle == ped.Handle);
                if (n != null)
                {
                    RPG.WorldData.Npcs.Remove(n);
                }

                if (!KilledPeds.Contains(ped.Handle))
                {
                    KilledPeds.Add(ped.Handle);
                    //Check if kill needed for quest
                    var pedData = NpcDatas.FirstOrDefault(npc => npc.Ped != null && npc.Ped.Handle == ped.Handle);
                    if (pedData != null)
                    {
                        pedData.Destroy();
                    }
                    CheckIfForQuest(ped, ped.Model.Hash, true);
                    //If player didn't damage, continue
                    if (!ped.HasBeenDamagedBy(Game.Player.Character))
                    {
                        continue;
                    }


                    if (!PlayerData.Tutorial.GetAKill && PlayerData.Tutorial.PressJToOpenMenu && PlayerData.Tutorial.BoughtAmmoFromShop)
                    {
                        var tut = RPG.GetPopup <TutorialBox>();
                        PlayerData.Tutorial.GetAKill = true;
                        PlayerData.SkillExp         += 100;
                        EventHandler.Do(o =>
                        {
                            tut.Hide();
                            Wait(300);
                            if (!RPG.PlayerData.Tutorial.UnlockSkillWithSp)
                            {
                                tut.Pop("Hope you haven't attracted the cops. If so lose them. Time to unlock some skills.", "Access the menu > Character Menu > Skills. Unlock your first skill.");
                            }
                        });
                    }

                    RPG.Notify(Notification.Kill("target eliminated: +5 Exp"));

                    //Basic loot rng
                    var rng = Random.Range(0, 100 + 1);

                    if (rng < 70)
                    {
                        var m = new Model(GM.GetHashKey("prop_cash_pile_01"));
                        m.Request(1000);
                        var p = World.CreateProp(m, ped.Position + new Vector3(0, 0, 2.2F) + Vector3.RandomXYZ(), ped.Rotation, true, false);
                        p.ApplyForce(new Vector3(0, 0, 0.05f));
                        RPG.WorldData.AddLoot(new LootItem(ItemRepository.Cash(Random.Range(20, 80)), p));
                    }

                    if (rng < 30)
                    {
                        var items2 = new[] { "Bandages", "Basic Scraps", "Simple Protective Gear", "Ammo Pack I" };

                        var m2 = new Model(GM.GetHashKey("prop_money_bag_01"));
                        m2.Request(1000);
                        var p2 = World.CreateProp(m2, ped.Position + new Vector3(0, 0.5f, 2.2F) + Vector3.RandomXY(), ped.Rotation, true, false);
                        p2.ApplyForce(new Vector3(0, 0, 0.05f));
                        RPG.WorldData.AddLoot(new LootItem(ItemRepository.Get(items2[Random.Range(0, items2.Length)]), p2));
                    }
                    else if (rng < 40)
                    {
                        var items2 = new[] { "Health Kit", "Refurbished Kevlar", "Ammo Pack II" };

                        var m2 = new Model(GM.GetHashKey("prop_money_bag_01"));
                        m2.Request(1000);
                        var p2 = World.CreateProp(m2, ped.Position + new Vector3(0.5f, 0, 2.2F) + Vector3.RandomXY(), ped.Rotation, true, false);
                        p2.ApplyForce(new Vector3(0, 0, 0.05f));
                        RPG.WorldData.AddLoot(new LootItem(ItemRepository.Get(items2[Random.Range(0, items2.Length)]), p2));
                    }

                    PlayerData.AddExp(5);
                }
            }

            var activeQuests = PlayerData.Quests.Where(q => q.InProgress).ToList();

            for (int i = 0; i < activeQuests.Count; i++)
            {
                activeQuests[i].CheckState();
            }


            QuestUpdates();
        }