Exemple #1
0
        private static void SpawnGangMonsters()
        {
            if (gangSpawned)
            {
                Dbgl("spawning gang members");
                int gangNo = new IntR(settings.MinGang, settings.MaxGang).GetValue(rand);
                for (int i = 0; i < gangNo; i++)
                {
                    int     l337 = new IntR(1, Get1337Level() - 1).GetValue(rand);
                    Monster mLow = GetRandomMonster(rand, l337);

                    Vector3 pos = GetValidPos(GetGroupPos(bossMonster.pos.Value, i, 8f, 4f));
                    if (pos == Vector3.zero)
                    {
                        Dbgl("gang member invalid position");
                        if (gangNo < settings.MaxGang * 2)
                        {
                            gangNo++;
                        }
                        continue;
                    }
                    Dbgl("gang member valid position");
                    ActorAgent agentLow = new ActorAgent(pos, bossMonster.rot, mLow.id, new Action <ActorAgent>(MonsterGangDeath));
                    Module <SpawnMgr> .Self.AddActorAgent(agentLow);

                    agentLow.Spawn();
                }
            }
        }
Exemple #2
0
 static void Prefix(ref int count, ref IntR ___OrgBigOrderCount, ref IntR ___NpcSpecialOrderCount)
 {
     if (enabled)
     {
         ___OrgBigOrderCount     = new IntR(1, settings.NumberBigOrders);
         ___NpcSpecialOrderCount = new IntR(0, settings.NumberSpecialOrders);
         count = settings.NumberCommerceOrders;
     }
 }
Exemple #3
0
        private static Monster GetRandomMonster(System.Random rand, int l337)
        {
            Monster[] Monsters = MonstersWeenie;
            switch (l337)
            {
            case 5:
                Monsters = MonstersElite;
                Dbgl("u r 1337");
                break;

            case 4:
                Monsters = MonstersHigh;
                break;

            case 3:
                Monsters = MonstersMid;
                break;

            case 2:
                Monsters = MonstersLow;
                break;
            }

            int i = new IntR(1, Monsters.Length).GetValue(rand) - 1;

            while (!settings.AllowRats && Monsters[i].id > 20020000)
            {
                i = new IntR(1, Monsters.Length).GetValue(rand) - 1;
            }

            Monster m = Monsters[i];

            int highestPos = Positions.Length;

            // cut out places you can't access

            string amber = Module <GlobleBlackBoard> .Self.GetInfo("amber");

            string bridge = Module <GlobleBlackBoard> .Self.GetInfo("Portiabridge");

            string southblock = Module <GlobleBlackBoard> .Self.GetInfo("southblock");

            if (amber != "1")
            {
                highestPos -= 3;
            }
            else if (southblock != "2")
            {
                highestPos -= 2;
            }

            int p = new IntR(1, highestPos).GetValue(rand) - 1;

            m.pos = Positions[p];
            return(m);
        }
Exemple #4
0
 static void Prefix(ref int count, ref int centerLevel, ref IntR ___OrgBigOrderCount, ref IntR ___NpcSpecialOrderCount)
 {
     if (enabled)
     {
         ___OrgBigOrderCount     = new IntR(1, settings.NumberBigOrders);
         ___NpcSpecialOrderCount = new IntR(0, settings.NumberSpecialOrders);
         count = settings.NumberCommerceOrders;
         if (settings.RandomOrderLevel)
         {
             centerLevel = new IntR(1, centerLevel).GetValue();
         }
     }
 }
Exemple #5
0
        private static void OnWakeUp(object[] obj)
        {
            if (!enabled)
            {
                return;
            }

            SceneManager.activeSceneChanged -= ChangeScene;
            SceneManager.activeSceneChanged += ChangeScene;

            if (agent != null)
            {
                Module <SpawnMgr> .Self.RemoveActorAgent(agent);

                agent.Destroy();
            }
            Module <AreaTriggerManager> .Self.DestroyTrigger(triggerID);

            monsterAlive = false;

            //TestSpawnAllMonsters();
            //SpawnAllPoints();
            //return;


            int chance = new IntR(0, 100).GetValue(rand);

            Dbgl("Chance: " + chance);

            if (chance >= settings.ChanceInvade)
            {
                return;
            }

            bossMonster = GetRandomMonster(rand, Get1337Level());

            gangSpawned = false;
            int chanceGang = new IntR(0, 100).GetValue(rand);

            if (Get1337Level() > 1 && chanceGang < settings.ChanceGang)
            {
                gangSpawned = true;
            }
            areaTrigger = Module <AreaTriggerManager> .Self.CreateAreaTrigger(triggerID, bossMonster.pos.Value, "Main", 40, true);

            monsterAlive = true;
            monsterName  = bossMonster.name;
            char[] vowels = { 'A', 'E', 'I', 'O', 'U' };
            Singleton <TipsMgr> .Instance.SendSystemTip((vowels.Contains(monsterName[0]) ? "An " : "A ") + monsterName + " is attacking " + bossMonster.pos.Key + (gangSpawned?" and they brought a gang":"") + "!", SystemTipType.danger);
        }
Exemple #6
0
        private static void OnWakeUp(object[] obj)
        {
            if (agent != null)
            {
                Module <SpawnMgr> .Self.RemoveActorAgent(agent);

                agent.Destroy();
            }
            Module <AreaTriggerManager> .Self.DestroyTrigger(triggerID);

            monsterAlive = false;

            //TestSpawnAllMonsters();
            //SpawnAllPoints();
            //return;

            int randSeed = (int)DateTime.UtcNow.Ticks + UnityEngine.Random.Range(0, 9999);

            System.Random rand = new System.Random(randSeed);

            int chance = new IntR(1, 100).GetValue(rand);

            Dbgl("Chance: " + chance);

            if (chance > settings.ChanceInvade)
            {
                return;
            }

            Monster m = GetRandomMonster(rand);

            agent = new ActorAgent(m.pos.Value, m.rot, m.id, new Action <ActorAgent>(MonsterDeath));
            Module <SpawnMgr> .Self.AddActorAgent(agent);

            agent.Spawn();
            areaTrigger = Module <AreaTriggerManager> .Self.CreateAreaTrigger(triggerID, m.pos.Value, "Main", 40, true);

            monsterAlive = true;
            monsterName  = m.name;
            char[] vowels = { 'A', 'E', 'I', 'O', 'U' };
            Singleton <TipsMgr> .Instance.SendSystemTip((vowels.Contains(monsterName[0]) ? "An " : "A ") + monsterName + " is attacking " + m.pos.Key + "!", SystemTipType.danger);
        }
Exemple #7
0
        private static void GetRewardsList()
        {
            basicRewardList = DbReader.Read <BoxInfo>(LocalDb.cur.ReadFullTable("The_Chest"), 20);

            medRewardList = DbReader.Read <DungeonChestConfInfo>(LocalDb.cur.ReadFullTable("Dungeon_Chest"), 20);

            eliteRewardList = new List <Reward>();

            SqliteDataReader sqliteDataReader = LocalDb.cur.ReadFullTable("Unlimited_DungeonN");

            while (sqliteDataReader.Read())
            {
                IntR     range      = new IntR(sqliteDataReader.GetString(sqliteDataReader.GetOrdinal("levelRange")), '~');
                string   rawString  = sqliteDataReader.GetString(sqliteDataReader.GetOrdinal("reward"));
                string[] rawRewards = rawString.Split(new char[]
                {
                    '|'
                });
                if (rawRewards.Length < 4)
                {
                    Debug.LogError("rewards length error! " + rawString);
                }
                else
                {
                    DoubleValue <int, FloatR>[] rewardsArray = new DoubleValue <int, FloatR> [4];
                    for (int j = 0; j < 4; j++)
                    {
                        string[] array5 = rawRewards[j].Split(new char[]
                        {
                            '_'
                        });
                        rewardsArray[j] = new DoubleValue <int, FloatR>(int.Parse(array5[0]), new FloatR(array5[1], '~'));
                    }
                    eliteRewardList.Add(new Reward(rewardsArray, range));
                }
            }
        }
Exemple #8
0
        private static void TimerCallback(object state)
        {
            double currentTime = Module <TimeManager> .Self.TotalSecond / Module <TimeManager> .Self.TimeScale;

            foreach (KeyValuePair <int, double> k in kissingSpouses)
            {
                if (k.Value + 6 < currentTime)
                {
                    Actor a = ActorMgr.Self.Get(k.Key);
                    if (a != null)
                    {
                        ResetOneSpouseAnimation(a);
                    }
                }
            }

            if (!enabled || !settings.SpousesKiss || Module <ScenarioModule> .Self.CurrentScenarioName == "Main" || Module <ScenarioModule> .Self.CurrentScenarioName == "food")
            {
                return;
            }

            double nextKissTime = lastKiss + settings.MinKissingInterval;

            if (currentTime < nextKissTime)
            {
                return;
            }

            List <FavorObject> spouseList  = GetSpouses();
            List <Actor>       aSpouseList = new List <Actor>();

            aSpouseList.Add(Module <Player> .Self.actor);

            foreach (FavorObject f in spouseList)
            {
                Actor a = ActorMgr.Self.Get(f.ID);
                if (a == null)
                {
                    continue;
                }

                if (a.InActiveScene)
                {
                    aSpouseList.Add(a);
                }
            }

            int n = aSpouseList.Count;

            while (n > 1)
            {
                n--;
                int   k     = rand.Next(n + 1);
                Actor value = aSpouseList[k];
                aSpouseList[k] = aSpouseList[n];
                aSpouseList[n] = value;
            }

            foreach (Actor a in aSpouseList)
            {
                if (currentTime < nextKissTime)
                {
                    break;
                }

                if (!a.CanInteract || a.InBattle || !a.Visible || a.IsActionRunning(ACType.Sleep) || a.IsActionRunning(ACType.Sit) || a.IsActionRunning(ACType.Conversation) || a.IsActionRunning(ACType.Interact) || kissingSpouses.ContainsKey(a.InstanceId) || Module <EGMgr> .Self.IsEngagementEvent(a.InstanceId) || a.OnBus || a.IsInteractive())
                {
                    continue;
                }
                Vector3 pos1 = a.gamePos;
                foreach (Actor ao in aSpouseList)
                {
                    if (ao.InstanceId == a.InstanceId || !ao.CanInteract || ao.InBattle || !ao.Visible || ao.IsActionRunning(ACType.Sleep) || ao.IsActionRunning(ACType.Sit) || ao.IsActionRunning(ACType.Conversation) || ao.IsActionRunning(ACType.Interact) || kissingSpouses.ContainsKey(ao.InstanceId) || Module <EGMgr> .Self.IsEngagementEvent(ao.InstanceId) || ao.OnBus || ao.IsInteractive())
                    {
                        continue;
                    }
                    Vector3 pos2 = ao.gamePos;
                    float   dist = Vector3.Distance(pos1, pos2);

                    if (dist < settings.MaxKissingDistance)
                    {
                        int maxR   = Math.Max(50 - Math.Max(((int)Math.Round(currentTime - nextKissTime) - settings.MinKissingInterval), 0), 2);
                        int chance = new IntR(1, maxR).GetValue(rand);

                        if (chance != 1)
                        {
                            continue;
                        }

                        float _radiusSelf = a.GetActorRadius();
                        float _radiusTar  = ao.GetActorRadius();
                        float num         = (Module <NpcRepository> .Self.GetNpcGender(a.InstanceId) != Gender.Male) ? .17f : .19f;
                        if (a.InstanceId == Module <Player> .Self.actor.InstanceId || ao.InstanceId == Module <Player> .Self.actor.InstanceId)
                        {
                            num = (Module <Player> .Self.GetGender() != Gender.Male) ? -0.05f : -0.03f;
                        }
                        float _dis = _radiusSelf + _radiusTar + num;

                        Vector3 _tarDir = ao.gamePos - a.gamePos;
                        _tarDir.y = 0f;
                        Vector3 tarPos;
                        if (Module <ScenarioModule> .Self.CurrentScenarioName == "Main")
                        {
                            Util.TryGetGroundPosition(out tarPos, a.gamePos, _tarDir, _dis, 3f, 3f, true, 0.1f, _radiusTar, 36);
                        }
                        else
                        {
                            Util.TryGetGroundPosition(out tarPos, a.gamePos, _tarDir, _dis, 2f, 2f, true, 0.1f, _radiusTar, 36);
                        }

                        float y = Mathf.Max(a.gamePos.y, tarPos.y);

                        Vector3 apos = a.gamePos;
                        Vector3 arot = a.gameRot.eulerAngles;

                        Vector3 _sefPos = a.gamePos;
                        _sefPos.y = y;
                        Vector3 _tarPos = tarPos;
                        _tarPos.y = y;
                        Vector3 _sefRot = Quaternion.LookRotation(_tarPos - _sefPos, Vector3.up).eulerAngles;
                        Vector3 _tarRot = Quaternion.LookRotation(_sefPos - _tarPos, Vector3.up).eulerAngles;
                        Vector3 vector  = (_sefPos + _tarPos) * 0.5f;
                        if (a.TryDoAction(ACType.Transfer, ACTransferPara.Construct(string.Empty, _sefPos, _sefRot)))
                        {
                            if (ao.TryDoAction(ACType.Transfer, ACTransferPara.Construct(string.Empty, _tarPos, _tarRot)))
                            {
                                a.StopAction(ACType.Animation, false);
                                if (a.TryDoAction(ACType.Animation, ACTAnimationPara.Construct(animName, null, null, true)))
                                {
                                    ao.StopAction(ACType.Animation, false);
                                    if (ao.TryDoAction(ACType.Animation, ACTAnimationPara.Construct(animName, null, null, true)))
                                    {
                                        kissLocations.Add(ao.gamePos - a.gamePos);     // add location for audio

                                        kissingSpouses.Add(a.InstanceId, currentTime); // for resetting animations
                                        kissingSpouses.Add(ao.InstanceId, currentTime);

                                        lastKiss = currentTime; // reset timer for kissing

                                        // start animating
                                        a.AddGravityEffector(turnOffGravity);
                                        a.StartInteraction(FullBodyBipedEffector.LeftHand, ao.GetInteractionObject(iKName), true);
                                        a.StartInteraction(FullBodyBipedEffector.RightHand, ao.GetInteractionObject(iKName), true);

                                        ao.AddGravityEffector(turnOffGravity);
                                        ao.StartInteraction(FullBodyBipedEffector.LeftHand, a.GetInteractionObject(iKName), true);
                                        ao.StartInteraction(FullBodyBipedEffector.RightHand, a.GetInteractionObject(iKName), true);

                                        break;
                                    }
                                    else
                                    {
                                        ResetOneSpouseAnimation(a);
                                        a.TryDoAction(ACType.Transfer, ACTransferPara.Construct(string.Empty, apos, arot));
                                    }
                                }
                            }
                            else
                            {
                                a.TryDoAction(ACType.Transfer, ACTransferPara.Construct(string.Empty, apos, arot));
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
 public Reward(DoubleValue <int, FloatR>[] rewards, IntR range)
 {
     rewardsArray = rewards;
     levelRange   = range;
 }