Esempio n. 1
0
        public void SaveCharacter()
        {
            using (SqlConnection connection = new SqlConnection(Program.DBConnectionString))
            {
                List <int> itemlist = new List <int>();
                foreach (IItem item in Backpack)
                {
                    if (item == null)
                    {
                        itemlist.Add(0);
                    }
                    else
                    {
                        itemlist.Add(item.Id);
                    }
                }
                string backpackDB = string.Join(",", itemlist);

                List <int> skilllist = new List <int>();
                foreach (ISkill skill in LearnedSkills)
                {
                    if (skill == null)
                    {
                        skilllist.Add(0);
                    }
                    else
                    {
                        skilllist.Add(skill.Id);
                    }
                }
                string learnedskillsDB = string.Join(",", skilllist);

                string solvedtasksDB = string.Join(",", SolvedTasks);

                SqlCommand command = new SqlCommand();
                command.CommandText = "UPDATE GameCharacters SET " +
                                      "Name='" + Name.ToString() + "', " +
                                      "Lvl=" + Level.ToString() + ", " +
                                      "CoordX=" + X.ToString() + ", " +
                                      "CoordY=" + Y.ToString() + ", " +
                                      "SkillPoints=" + SkillPoints.ToString() + ", " +
                                      "HeadId=" + (Head == null ? "0" : Head.Id.ToString()) + ", " +
                                      "BodyId=" + (Body == null ? "0" : Body.Id.ToString()) + ", " +
                                      "LHandId=" + (LHand == null ? "0" : LHand.Id.ToString()) + ", " +
                                      "RHandId=" + (RHand == null ? "0" : RHand.Id.ToString()) + ", " +
                                      "Boots=" + (Boots == null ? "0" : Boots.Id.ToString()) + ", " +
                                      "JeweleryOne=" + (JeweleryOne == null ? "0" : JeweleryOne.Id.ToString()) + ", " +
                                      "JeweleryTwo=" + (JeweleryTwo == null ? "0" : JeweleryTwo.Id.ToString()) + ", " +
                                      "Gold=" + Gold.ToString() + ", " +
                                      "Health=" + Health.ToString() + ", " +
                                      "BackPack='" + backpackDB.ToString() + "', " +
                                      "LearnedSkills='" + learnedskillsDB.ToString() + "', " +
                                      "SolvedTasks='" + solvedtasksDB.ToString() + "'" +
                                      " WHERE id=" + ID.ToString();

                command.Connection = connection;
                connection.Open();
                command.ExecuteNonQuery();
            }
        }
        public void AddSkillPointRegistration(int skillID, int weaponLevel, int skillRank)
        {
            if (skillRank > HighestRank)
            {
                HighestRank = skillRank;
            }
            PlayerSkillPointTracker tracker;

            if (!SkillPoints.ContainsKey(skillID))
            {
                tracker = new PlayerSkillPointTracker(skillID);
            }
            else
            {
                tracker = SkillPoints[skillID];
            }

            tracker.Points++;

            // Always take the lowest weapon level.
            if (tracker.RegisteredLevel == -1 || weaponLevel < tracker.RegisteredLevel)
            {
                tracker.RegisteredLevel = weaponLevel;
            }

            SkillPoints[skillID] = tracker;
        }
Esempio n. 3
0
    void Awake()
    {
        currentStats = new Stats();
        currentStats.Init();

        skillPoints = new SkillPoints();

        OnPlayerDeath = new V3Event();
        OnPlayerDeath.AddListener(OnDeath);
        OnPlayerSpawn = new UnityEvent();
        OnPlayerSpawn.AddListener(OnSpawn);

        if (playerState == null)
        {
            playerState = this.gameObject.AddComponent <StateManager>();
        }

        if (FindObjectOfType <MainMenuController>() != null)
        {
            SetState <PlayerMenuState>();
        }

        gameManager = GameManager.Instance;

        if (gameManager.sessionData.isGameLoaded)
        {
            this.OnGameLoaded();
        }
        else
        {
            gameManager.OnGameLoaded.AddListener(OnGameLoaded);
        }
    }
Esempio n. 4
0
        public void Level2HumanWizardIntMod4Returns35()
        {
            SkillPoints skillpoints = new SkillPoints();
            int         expected    = 35;
            int         actual      = skillpoints.SkillPointTotal(2, 4, "Wizard", "Human");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        public void HumanReturns4()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 4;
            int         actual      = skillPoints.SkillPointRace("Human");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        public void OtherIntMod3Returns20()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 20;
            int         actual      = skillPoints.SkillPointTotalLevelOne(3, "");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 7
0
        public void BarbarianLevel2IntMod2Returns6()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 6;
            int         actual      = skillPoints.SkillPointTotalHighLevel(2, 2, "Barbarian");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 8
0
        public void BardIntMod2Returns32()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 32;
            int         actual      = skillPoints.SkillPointTotalLevelOne(2, "Bard");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 9
0
        public void RogueIntMod4Returns48()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 48;
            int         actual      = skillPoints.SkillPointTotalLevelOne(4, "Rogue");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 10
0
        public void Level1HumanRangerIntMod4Returns24()
        {
            SkillPoints skillpoints = new SkillPoints();
            int         expected    = 44;
            int         actual      = skillpoints.SkillPointTotal(1, 4, "Ranger", "Human");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 11
0
        public void BarbarianIntModNegative1Returns12()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 12;
            int         actual      = skillPoints.SkillPointTotalLevelOne(-1, "Barbarian");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 12
0
        public void Level2ElfClericIntMod4Returns38()
        {
            SkillPoints skillpoints = new SkillPoints();
            int         expected    = 30;
            int         actual      = skillpoints.SkillPointTotal(2, 4, "Cleric", "Elf");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 13
0
        public void Level1ElfWizardIntMod4Returns24()
        {
            SkillPoints skillpoints = new SkillPoints();
            int         expected    = 24;
            int         actual      = skillpoints.SkillPointTotal(1, 4, "Wizard", "Elf");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 14
0
        public void OtherLevel2IntMod4Returns6()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 6;
            int         actual      = skillPoints.SkillPointTotalHighLevel(2, 4, "");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 15
0
        public void ClericLevel1IntMod4Returns0()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 0;
            int         actual      = skillPoints.SkillPointTotalHighLevel(1, 4, "Cleric");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 16
0
        public void RogueLevel10IntMod4Returns108()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 108;
            int         actual      = skillPoints.SkillPointTotalHighLevel(10, 4, "Rogue");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 17
0
        public void RangerLevel20IntMod0Returns114()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 114;
            int         actual      = skillPoints.SkillPointTotalHighLevel(20, 0, "Bard");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 18
0
        public void ElfLevel5Returns0()
        {
            SkillPoints skillPoints = new SkillPoints();
            int         expected    = 0;
            int         actual      = skillPoints.SkillPointRaceHighlevel(5, "Elf");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 19
0
        public IList <Information> ValidateStartingCharacter()
        {
            IList <Information> problems = new List <Information>();

            if (Name == "")
            {
                problems.Add(new Information("Jméno", "Postava potřebuje jméno k tomu aby byla validní.\n\nNezapomeň, že jméno je jen označení postavy. Pokud tvoje postava nezná svoje jméno, má asi nějaký způsob jak se označuje, buď ona sama, nebo ostatními kolem ní. Ale každá postava by měla mít své označení, byť by to bylo \"Bezejmený\""));
            }

            int currentMoney = Money + StartMoneyValue;

            if (currentMoney < 0)
            {
                problems.Add(new Information("Peníze", "Byli přesaženy peníze o " + RuleTables.GetPresentableMoney(-currentMoney) + ".\n\nAby mohla být postava uzavřena je potřeba nepřesáhnout peníze získané ze zázemí postavy. Buď odeberte některé předměty nebo zvyšte počáteční peníze postavy."));
            }

            int backgroundPoints = BackroundPoints - OriginGrade - StartMoneyGrade - StartSkillGrade;

            if (backgroundPoints < 0)
            {
                problems.Add(new Information("Zázemí", "Byl přesažen počet využitých bodů zázemí. Bylo použito o " + (-backgroundPoints) + " bodů více.\n\nSniž počet využitých bodů, nebo zvyš počet dostupných bodů skrze vyjímečnost, pokud je to možné."));
            }
            else if (backgroundPoints > 0)
            {
                problems.Add(new Information("Zázemí", "Máš " + backgroundPoints + " nevyužitých bodů zázemí.\n\nZvyš jednu z kategorií zázemí, nebo sniž počet dostupných bodů skrze vyjímečnost, pokud je to možné."));
            }

            int freeMainAtt = FreeMainAttributePoints;

            if (freeMainAtt != 0)
            {
                string mainAttMsg = "";
                if (freeMainAtt < 0)
                {
                    mainAttMsg = "Přesáhl jsi o " + (-freeMainAtt) + " body hlavních vlastností. Aby postava byla validní je potřeba aby využila přesně její body hlavních vlastností.";
                }
                else if (freeMainAtt > 0)
                {
                    mainAttMsg = "Máš " + freeMainAtt + " nevyužitých bodů hlavních vlastností. Aby postava byla validní je potřeba aby využila všechny její body hlavních vlastností.";
                }

                problems.Add(new Information("Hlavní vlastnosti", mainAttMsg));
            }

            int freeMinorAtt = FreeMinorAttributePoints;

            if (freeMinorAtt != 0)
            {
                string minorAttMsg = "";
                if (freeMinorAtt < 0)
                {
                    minorAttMsg = "Přesáhl jsi o " + (-freeMinorAtt) + " body vedlejších vlastností. Aby postava byla validní je potřeba aby využila přesně její body vedlejších vlastností.";
                }
                else if (freeMinorAtt > 0)
                {
                    minorAttMsg = "Máš " + freeMinorAtt + " nevyužitých bodů vedlejších vlastností. Aby postava byla validní je potřeba aby využila všechny její body vedlejších vlastností.";
                }

                problems.Add(new Information("Vedlejší vlastnosti", minorAttMsg));
            }


            //dovednosti
            if (Level == 1)
            {
                int phy, men, com;
                phy = FreeStartingSkillPoints(SkillType.Fyzicka);
                men = FreeStartingSkillPoints(SkillType.Psychicka);
                com = FreeStartingSkillPoints(SkillType.Kombinovana);

                string skillPointList = "";

                if (phy < 0)
                {
                    skillPointList += "\nFyzické dovednosti přesáhnuty o " + (-phy) + " bodů.";
                }
                else if (phy > 0)
                {
                    skillPointList += "\nFyzické dovednosti mají " + phy + " nevyužitých bodů.";
                }
                if (men < 0)
                {
                    skillPointList += "\nPsychické dovednosti přesáhnuty o " + (-men) + " bodů.";
                }
                else if (men > 0)
                {
                    skillPointList += "\nPsychické dovednosti mají " + men + " nevyužitých bodů.";
                }
                if (com < 0)
                {
                    skillPointList += "\nKombinované dovednosti přesáhnuty o " + (-com) + " bodů.";
                }
                else if (com > 0)
                {
                    skillPointList += "\nKombinované dovednosti mají " + com + " nevyužitých bodů.";
                }

                string joke = "";
                if (men < 0 && GetSkillRating("Čtení / psaní") > 0)
                {
                    joke = "\nTřeba se můžeš zbavit dovednosti Čtení/psaní. Kdo by to potřeboval? A navíc knihy jsou děsně drahý, ty si jako chudý dobrodruch stejně nebudeš moct dovolit. To se radši nauč ohánět s pořádným kyjem. Ten je levnej, neničíš si oči když ho používáš ve tmě či za šera a navíc tím můžeš uspat toho otravného kněze co se ti neustále snaží prokecat díru do hlavy.";
                }

                if (skillPointList != "")
                {
                    problems.Add(new Information("Dovednosti", "Špatně využity body dovedností. Pro validitu postavy je potřeba využít všechny počáteční body dovedností.\n"
                                                 + skillPointList + "\n\nUprav naučené dovednosti, nebo změň míru počátečních dovedností ze zázemí." + joke));
                }
            }
            else
            {
                int    max     = GetMaxSkillPoints();
                int    current = SkillPoints.Aggregate(0, (result, x) => result + x.Value);
                string msg     = "";

                int phy, men, com;
                phy = SkillPoints[SkillType.Fyzicka];
                men = SkillPoints[SkillType.Psychicka];
                com = SkillPoints[SkillType.Kombinovana];

                GetSkillPointLimits(SkillType.Fyzicka, out int surePointsPhy, out int variablePointsPhy);
                GetSkillPointLimits(SkillType.Psychicka, out int surePointsMen, out int variablePointsMen);
                GetSkillPointLimits(SkillType.Kombinovana, out int surePointsCom, out int variablePointsCom);

                if (max + current > 0)
                {
                    msg += "\nSoučet všech využitých bodů dovedností byl přesažen o " + (-(max + current)) + " bodů.";
                }
                else if (max + current < 0)
                {
                    msg += "\nSoučet všech využitých bodů dovedností není dostatečný a zbývají " + (max + current) + " bodů dovedností.";
                }

                if (phy + surePointsPhy > 0)
                {
                    msg += "\nZbývá " + (phy + surePointsPhy) + " jistých fyzických dovednostních bodů.";
                }
                else if (phy + variablePointsPhy < 0)
                {
                    msg += "\nNejisté fyzické dovednostní body byli přesaženy o " + (-(phy + variablePointsPhy)) + " bodů.";
                }
                if (men + surePointsMen > 0)
                {
                    msg += "\nZbývá " + (men + surePointsMen) + " jistých psychických dovednostních bodů.";
                }
                else if (men + variablePointsPhy < 0)
                {
                    msg += "\nNejisté psychických dovednostní body byli přesaženy o " + (-(men + variablePointsMen)) + " bodů.";
                }
                if (com + surePointsCom > 0)
                {
                    msg += "\nZbývá " + (com + surePointsCom) + " jistých kombinovaných dovednostních bodů.";
                }
                else if (com + variablePointsCom < 0)
                {
                    msg += "\nNejisté kombinovaných dovednostní body byli přesaženy o " + (-(com + variablePointsCom)) + " bodů.";
                }


                if (msg != "")
                {
                    problems.Add(new Information("Dovednosti", "Špatně využity body dovedností. Pro validitu postavy je potřeba využít všechny jisté body dovedností, nesmí se přesáhnout omezení z nejistých bodů dovedností a musí být plně využit součet všech bodů dovedností.\n"
                                                 + msg + "\n\nUprav naučené dovednosti, rozdělení vlastností, úroveň postavy nebo změň míru počátečních dovedností ze zázemí."));
                }
            }

            Profession.IsValid(this, ref problems);


            return(problems);
        }
Esempio n. 20
0
        // Non-Patch
        private static IEnumerator AddPointsLate_Enumerator(string pointsType, int extraNum, SkillPoints __instance,
                                                            Agent ___agent)
        {
            logger.LogDebug("SkillPoints_AddPointsLate_IEnumerator:");
            logger.LogDebug("\tpointsType = " + pointsType);
            logger.LogDebug("\textraNum = " + extraNum);

            if (pointsType == "DestructionPoints" || pointsType == "DestructionPoints2" || pointsType == "FireExtinguishPoints")
            {
                yield return(null);
            }
            else
            {
                yield return(new WaitForSeconds(0.3f));
            }

            if (Time.timeScale == 0f && !GC.multiplayerMode)
            {
                while (Time.timeScale == 0f)
                {
                    yield return(null);
                }

                yield return(new WaitForSeconds(0.2f));
            }

            int    xpReward          = 0;
            bool   suppressAnimation = false;
            string text = pointsType;

            switch (text)
            {
            case "ArrestedPoints":
                xpReward = 100;
                break;

            case "ArrestedPointsInnocent":
                if (___agent.statusEffects.hasTrait(vTrait.TheLaw) && !___agent.oma.superSpecialAbility ||
                    ___agent.HasTrait <VeryHardOnYourself>())                                    // TODO is new
                {
                    if (___agent.statusEffects.hasTrait(vTrait.Crooked))
                    {
                        xpReward = 0;
                    }
                    else if (___agent.statusEffects.hasTrait(vTrait.Crooked2))
                    {
                        xpReward = -40;
                    }
                    else
                    {
                        xpReward = -80;
                    }
                }
                else
                {
                    xpReward = 10;
                }
                break;

            case "BigQuestBonusDowntown":
                xpReward = 500;
                break;

            case "BigQuestBonusFloor":
                xpReward = 300;
                break;

            case "BigQuestBonusGame":
                xpReward = 1000;
                break;

            case "BigQuestBonusIndustrial":
                xpReward = 500;
                break;

            case "BigQuestBonusPark":
                xpReward = 500;
                break;

            case "BigQuestBonusSlums":
                xpReward = 500;
                break;

            case "BigQuestBonusUptown":
                xpReward = 500;
                break;

            case cSkillPoints.BQMalusDowntown:                     // TODO is new
                xpReward = -500;
                break;

            case cSkillPoints.BQMalusFloor:                     // TODO is new
                xpReward = 300;
                break;

            case cSkillPoints.BQMalusGame:                     // TODO is new
                xpReward = -1000;
                break;

            case cSkillPoints.BQMalusIndustrial:                     // TODO is new
                xpReward = -500;
                break;

            case cSkillPoints.BQMalusPark:                     // TODO is new
                xpReward = -500;
                break;

            case cSkillPoints.BQMalusSlums:                     // TODO is new
                xpReward = -500;
                break;

            case cSkillPoints.BQMalusUptown:                     // TODO is new
                xpReward = -500;
                break;

            case "CompleteMission":
                xpReward = 300;

                if (GC.challenges.Contains(cChallenge.UnpaidInternship))                         // TODO is new
                {
                    xpReward *= 2;
                }

                break;

            case "CompleteMissionFindBombs":
                xpReward = 700;
                break;

            case "CompleteMissionReduced":
                xpReward = 150;

                if (GC.challenges.Contains(cChallenge.UnpaidInternship))                         // TODO is new
                {
                    xpReward *= 2;
                }

                break;

            case "Destruction":
                xpReward = 200;
                break;

            case "DestructionPoints":
                xpReward          = 1;
                suppressAnimation = true;
                break;

            case "DestructionPoints2":
                xpReward          = 2;
                suppressAnimation = true;
                break;

            case "DisarmDetonatorPoints":
                xpReward = 20;
                break;

            case "ElectabilityBonus":
                xpReward = 100;
                break;

            case cSkillPoints.ElectabilityMalus:                     // TODO is new
                xpReward = -100;
                break;

            case "Enslaved":
                xpReward = 30;
                break;

            case "FindTreasure":
                xpReward = 100;
                GC.stats.AddToStat(___agent, "TreasuresFound", 1);
                break;

            case "FireExtinguishPoints":
                xpReward          = 5;
                suppressAnimation = true;
                break;

            case "FreedPrisoner":
                xpReward = 20 * extraNum;

                if (extraNum > 1)
                {
                    pointsType = "FreedPrisoners";
                }

                break;

            case "FreedSlave":
                xpReward = 50 * extraNum;

                if (extraNum > 1)
                {
                    pointsType = "FreedSlaves";
                }

                break;

            case cSkillPoints.FreePrisonerFailure:                     // TODO is new
                xpReward = -50 * extraNum;
                break;

            case "HackPoints":
                xpReward = 20;
                break;

            case "IndirectlyKill":
                xpReward = 30;
                break;

            case "IndirectlyKillInnocent":
                if ((___agent.statusEffects.hasTrait(vTrait.TheLaw) && !___agent.oma.superSpecialAbility) ||
                    ___agent.HasTrait <VeryHardOnYourself>())                                    // TODO is new
                {
                    if (___agent.statusEffects.hasTrait(vTrait.Crooked))
                    {
                        xpReward = 0;
                    }
                    else if (___agent.statusEffects.hasTrait(vTrait.Crooked2))
                    {
                        xpReward = -15;
                    }
                    else
                    {
                        xpReward = -30;
                    }
                }
                else
                {
                    xpReward = 10;
                }
                break;

            case "IndirectlyKillRival":
                xpReward = 90;
                break;

            case "Joke":
                xpReward = 30 * extraNum;
                break;

            case "KilledRobot":
                xpReward = 1000;
                break;

            case "KillPoints":
                xpReward = 50;
                break;

            case "KillPointsInnocent":
                if ((___agent.statusEffects.hasTrait(vTrait.TheLaw) && !___agent.oma.superSpecialAbility) ||
                    ___agent.HasTrait <VeryHardOnYourself>())                                    // TODO is new
                {
                    if (___agent.statusEffects.hasTrait(vTrait.Crooked2))
                    {
                        xpReward = 0;
                    }
                    else if (___agent.statusEffects.hasTrait(vTrait.Crooked))
                    {
                        xpReward = -20;
                    }
                    else if (!___agent.oma.superSpecialAbility)
                    {
                        xpReward = -40;
                    }
                }
                else
                {
                    xpReward = 10;
                }

                break;

            case "KillPointsRival":
                xpReward = 150;
                break;

            case "KnockOutPoints":
                xpReward = 75;
                break;

            case "KnockOutPointsInnocent":
                if ((___agent.statusEffects.hasTrait(vTrait.TheLaw) && !___agent.oma.superSpecialAbility) ||
                    ___agent.HasTrait <VeryHardOnYourself>())                                    // TODO is new
                {
                    if (___agent.statusEffects.hasTrait(vTrait.Crooked))
                    {
                        xpReward = 0;
                    }
                    else if (___agent.statusEffects.hasTrait(vTrait.Crooked2))
                    {
                        xpReward = -20;
                    }
                    else
                    {
                        xpReward = -40;
                    }
                }
                else
                {
                    xpReward = 10;
                }

                break;

            case "KnockOutPointsRival":
                xpReward = 150;
                break;

            case "LockpickPoints":
                xpReward = 20;
                break;

            case "ManySleeping":
                xpReward = 100;
                break;

            case "Massacre":
                xpReward = 100;
                break;

            case "NoAngerLevel":
                xpReward = 100;
                break;

            case cSkillPoints.AngeredMany:                // TODO is new
                xpReward *= -100;                         // TODO '*' by mistake?
                break;

            case "NoDamageTaken":
                xpReward = 100;
                break;

            case cSkillPoints.TookLotsOfDamage:                     // TODO is new
                xpReward = 100;
                break;

            case "NoDestruction":
                xpReward = 200;
                break;

            case "NoGuns":
                xpReward = 200;
                break;

            case "NoKillBonus":
                xpReward = 100;
                break;

            case "NoKillLevel":
                xpReward = 100;
                break;

            case "NotAlertedBonus":
                xpReward = 100;
                break;

            case "OnlyFists":
                xpReward = 200;
                break;

            case "PickpocketPoints":
                if ((___agent.statusEffects.hasTrait(vTrait.TheLaw) && !___agent.oma.superSpecialAbility &&
                     !___agent.statusEffects.hasTrait(vTrait.PromiseIllReturnIt)) ||
                    ___agent.HasTrait <VeryHardOnYourself>())                                    // TODO is new
                {
                    if (___agent.statusEffects.hasTrait(vTrait.Crooked))
                    {
                        xpReward = 0;
                    }
                    else if (___agent.statusEffects.hasTrait(vTrait.Crooked2))
                    {
                        xpReward = -10;
                    }
                    else
                    {
                        xpReward = -15;
                    }
                }
                else
                {
                    xpReward = 15;
                }

                break;

            case "PoisonAirPoints":
                xpReward = 20;
                break;

            case "RemoveSlaveHelmetPoints":
                xpReward = 20;
                break;

            case "RemoveWindowPoints":
                xpReward = 20;
                break;

            case "ShakedownFailPoints":
                xpReward = -100;
                break;

            case "ShakedownPoints":
                xpReward = 100;
                break;

            case "StealPoints":
                xpReward = extraNum * 10;
                break;

            case "StealPointsNegative":
                xpReward = extraNum * 10;

                if ((___agent.statusEffects.hasTrait(vTrait.TheLaw) && !___agent.oma.superSpecialAbility &&
                     !___agent.statusEffects.hasTrait(vTrait.PromiseIllReturnIt)) ||
                    ___agent.HasTrait <VeryHardOnYourself>())                                    // TODO is new
                {
                    xpReward *= -1;

                    if (___agent.statusEffects.hasTrait(vTrait.Crooked))
                    {
                        xpReward /= 2;
                    }
                    else if (___agent.statusEffects.hasTrait(vTrait.Crooked2))
                    {
                        xpReward = 0;
                    }
                }
                break;

            case "StoleLots":
                xpReward = 200;
                break;

            case "TamperGeneratorPoints":
                xpReward = 20;
                break;

            case "TamperLaserEmitterPoints":
                xpReward = 20;
                break;

            case "TamperPoliceBoxPoints":
                xpReward = 20;
                break;

            case "TamperSatelliteDishPoints":
                xpReward = 20;
                break;

            case "TimeBonus":
                xpReward = 100;
                break;

            case "TwoPlayerWinner1":
                xpReward = 200;
                break;

            case "TwoPlayerWinner2":
                xpReward = 200;
                break;

            case "UnlockSafePoints":
                xpReward = 20;
                break;

            case "WonElectionPoints":
                xpReward = 100;                         // TODO missing a '0' here?
                break;
            }

            if (xpReward != 0)
            {
                float xpModifier = 1.00f;

                if (___agent.HasTrait <SmoothBrained>())                // TODO is new
                {
                    xpModifier = 0.00f;
                }
                else if (xpReward > 0)
                {
                    if (___agent.statusEffects.hasTrait(vTrait.Studious))
                    {
                        xpModifier = 1.30f;
                    }
                    else if (___agent.statusEffects.hasTrait(vTrait.SuperStudious))
                    {
                        xpModifier = 1.50f;
                    }
                    else if (___agent.HasTrait <DimBulb>())                    // TODO is new
                    {
                        xpModifier = 0.75f;
                    }
                    else if (___agent.HasTrait <MoronTheMerrier>())                    // TODO is new
                    {
                        xpModifier = 0.50f;
                    }
                    else if (___agent.HasTrait <Brainiac>())                    // TODO is new
                    {
                        xpModifier = 4.00f;
                    }
                }
                else if (___agent.HasTrait <VeryHardOnYourself>())                // TODO is new
                {
                    xpModifier = 2.00f;
                }

                xpReward = (int)(xpReward * xpModifier);

                float floorXpAcceleration = 0.075f;
                int   cityFloor           = Mathf.Clamp(GC.sessionDataBig.curLevelEndless, 1, 16);

                if (GC.sessionDataBig.challenges.Contains("QuickGame"))
                {
                    floorXpAcceleration = 0.1125f;
                    cityFloor           = Mathf.Clamp(GC.sessionDataBig.curLevelEndless, 1, 11);
                }

                xpReward = (int)(xpReward * (1f + (cityFloor - 1) * floorXpAcceleration));
                GC.sessionData.skillPoints[___agent.isPlayer] += xpReward;
                Color32 myColor;

                if (xpReward < 0)
                {
                    myColor = new Color32(byte.MaxValue, 0, 0, byte.MaxValue);

                    if (GC.sessionData.skillPoints[___agent.isPlayer] < __instance.findLevelThreshold(GC.sessionData.skillLevel[___agent.isPlayer] - 1))
                    {
                        GC.sessionData.skillPoints[___agent.isPlayer] = __instance.findLevelThreshold(GC.sessionData.skillLevel[___agent.isPlayer] - 1);
                    }
                }
                else
                {
                    myColor = new Color32(byte.MaxValue, 216, 0, byte.MaxValue);
                }

                if (GC.sessionData.skillPoints[___agent.isPlayer] >= __instance.findLevelThreshold(GC.sessionData.skillLevel[___agent.isPlayer]))
                {
                    GC.audioHandler.Play(___agent, "LevelUp");

                    if (___agent.isPlayer == 1)
                    {
                        GC.alienFX.GainLevel();
                    }

                    GC.sessionData.skillLevel[___agent.isPlayer]++;
                    __instance.levelsGained++;
                    GC.sessionData.levelsGained[___agent.isPlayer]++;
                    __instance.justGainedLevel = true;

                    //__instance.StartCoroutine(__instance.CancelJustGainedLevel()); // Original Private Method Inaccessible

                    // TODO this is a Coroutine, you'll have to StartCoroutine it. - although that doesn't really matter since this will be replaced with a transpiler
                    MethodInfo CancelJustGainedLevel = AccessTools.DeclaredMethod(typeof(SkillPoints), "CancelJustGainedLevel");
                    CancelJustGainedLevel.GetMethodWithoutOverrides <Action>(__instance).Invoke();

                    if (GC.unlocks.CanDoUnlocks())
                    {
                        if (___agent.statusEffects.hasTrait(vTrait.SuperStudious))
                        {
                            GC.unlocks.AddNuggets(2);
                            GC.spawnerMain.SpawnStatusText(___agent, "ItemPickupSlower", "Nuggets", "Item", "Add2Nuggets", "");
                        }
                        else
                        {
                            GC.unlocks.AddNuggets(3);
                            GC.spawnerMain.SpawnStatusText(___agent, "ItemPickupSlower", "Nuggets", "Item", "Add3Nuggets", "");
                        }
                    }

                    ___agent.objectMult.SendChatAnnouncement("LevelUp", GC.sessionData.skillLevel[___agent.isPlayer].ToString(), "");

                    if (___agent.localPlayer)
                    {
                        ___agent.skillBar.dTr.localScale = new Vector3(0f, ___agent.skillBar.dTr.localScale.y, ___agent.skillBar.dTr.localScale.z);
                    }

                    if (!___agent.finishedLevel)
                    {
                        GC.spawnerMain.SpawnStatusText(___agent, "LevelUp", "LevelUp", "Interface");
                    }

                    if (___agent.statusEffects.hasTrait(vTrait.PotentialtoNotSuck))
                    {
                        Agent agent = ___agent;

                        if (___agent.possessing || ___agent.transforming)
                        {
                            if (!GC.multiplayerMode)
                            {
                                if (___agent.isPlayer == 1)
                                {
                                    agent = GC.backupAgent1;
                                }

                                if (___agent.isPlayer == 2)
                                {
                                    agent = GC.backupAgent2;
                                }

                                if (___agent.isPlayer == 3)
                                {
                                    agent = GC.backupAgent3;
                                }

                                if (___agent.isPlayer == 4)
                                {
                                    agent = GC.backupAgent4;
                                }
                            }
                            else
                            {
                                if (___agent.playerColor == 1)
                                {
                                    agent = GC.backupAgent1;
                                }

                                if (___agent.playerColor == 2)
                                {
                                    agent = GC.backupAgent2;
                                }

                                if (___agent.playerColor == 3)
                                {
                                    agent = GC.backupAgent3;
                                }

                                if (___agent.playerColor == 4)
                                {
                                    agent = GC.backupAgent4;
                                }
                            }
                        }

                        if (GC.sessionData.skillLevel[___agent.isPlayer] % 2 == 0 && (agent.strengthStatMod != 3 || agent.enduranceStatMod != 3 ||
                                                                                      agent.accuracyStatMod != 3 || agent.speedStatMod != 3))
                        {
                            string randStatMod;
                            bool   bonusStat;

                            do
                            {
                                randStatMod = GC.Choose("Strength", "Endurance", "Accuracy", "Speed");
                                bonusStat   = true;

                                if (randStatMod == "Strength" && agent.strengthStatMod == 3)
                                {
                                    bonusStat = false;
                                }
                                else if (randStatMod == "Endurance" && agent.enduranceStatMod == 3)
                                {
                                    bonusStat = false;
                                }
                                else if (randStatMod == "Accuracy" && agent.accuracyStatMod == 3)
                                {
                                    bonusStat = false;
                                }
                                else if (randStatMod == "Speed" && agent.speedStatMod == 3)
                                {
                                    bonusStat = false;
                                }
                            } while (!bonusStat);

                            switch (randStatMod)
                            {
                            case "Accuracy":
                                agent.SetAccuracy(agent.accuracyStatMod + 1, true);
                                GC.spawnerMain.SpawnStatusText(___agent, "BuffSpecial", "Accuracy", "BuffSpecial", "");

                                break;

                            case "Endurance":
                                agent.SetEndurance(agent.enduranceStatMod + 1, true);
                                GC.spawnerMain.SpawnStatusText(___agent, "BuffSpecial", "Endurance", "BuffSpecial", "");

                                break;

                            case "Speed":
                                agent.SetSpeed(agent.speedStatMod + 1, true);
                                GC.spawnerMain.SpawnStatusText(___agent, "BuffSpecial", "Speed", "BuffSpecial", "");

                                break;

                            case "Strength":
                                agent.SetStrength(agent.strengthStatMod + 1, true);
                                GC.spawnerMain.SpawnStatusText(___agent, "BuffSpecial", "Strength", "BuffSpecial", "");

                                break;
                            }
                        }
                    }

                    if (___agent.health > 0f && !GC.menuGUI.demoOver)
                    {
                        if (___agent.possessing)
                        {
                            if (!GC.multiplayerMode)
                            {
                                if (___agent.isPlayer == 1)
                                {
                                    GC.backupAgent1.health = GC.backupAgent1.healthMax;
                                }

                                if (___agent.isPlayer == 2)
                                {
                                    GC.backupAgent2.health = GC.backupAgent2.healthMax;
                                }

                                if (___agent.isPlayer == 3)
                                {
                                    GC.backupAgent3.health = GC.backupAgent3.healthMax;
                                }

                                if (___agent.isPlayer == 4)
                                {
                                    GC.backupAgent4.health = GC.backupAgent4.healthMax;
                                }
                            }
                            else
                            {
                                if (___agent.playerColor == 1)
                                {
                                    GC.backupAgent1.health = GC.backupAgent1.healthMax;
                                }

                                if (___agent.playerColor == 2)
                                {
                                    GC.backupAgent2.health = GC.backupAgent2.healthMax;
                                }

                                if (___agent.playerColor == 3)
                                {
                                    GC.backupAgent3.health = GC.backupAgent3.healthMax;
                                }

                                if (___agent.playerColor == 4)
                                {
                                    GC.backupAgent4.health = GC.backupAgent4.healthMax;
                                }
                            }

                            GC.spawnerMain.SpawnStatusText(___agent, "HealthUpSlower", "FullHealth", "StatusEffect");
                        }
                        else
                        {
                            ___agent.statusEffects.ChangeHealth(___agent.healthMax);
                        }
                    }
                    else
                    {
                        ___agent.fullHealthAfterResurrect = true;
                    }

                    if (___agent.localPlayer && !suppressAnimation)
                    {
                        if (GC.fourPlayerMode)
                        {
                            __instance.SpawnSkillPointsStatusText(pointsType, xpReward);
                        }
                        else
                        {
                            ___agent.skillBar.StartChange(true);
                            ___agent.skillBar.StartAnim(xpReward, pointsType, myColor);
                        }
                    }

                    if (___agent.completingBigQuestLevel)
                    {
                        GC.quests.SpawnBigQuestCompletedText2(___agent, true);
                    }
                    else if (___agent.failingBigQuestLevel)
                    {
                        GC.quests.SpawnBigQuestFailedText2(___agent, true);
                    }
                }
                else if (___agent.localPlayer && !suppressAnimation)
                {
                    if (GC.fourPlayerMode)
                    {
                        __instance.SpawnSkillPointsStatusText(pointsType, xpReward);

                        if (___agent.completingBigQuestLevel)
                        {
                            GC.quests.SpawnBigQuestCompletedText2(___agent, false);
                        }
                        else if (___agent.failingBigQuestLevel)
                        {
                            GC.quests.SpawnBigQuestFailedText2(___agent, false);
                        }
                    }
                    else
                    {
                        ___agent.skillBar.StartChange(false);
                        ___agent.skillBar.StartAnim(xpReward, pointsType, myColor);
                    }
                }

                if (___agent.localPlayer)
                {
                    ___agent.skillBar.UpdateSkillText();
                }
            }

            logger.LogDebug("\txpReward = " + xpReward);
        }
Esempio n. 21
0
        public static bool AddPointsLate_Prefix(string pointsType, int extraNum, ref IEnumerator __result, SkillPoints __instance,
                                                ref Agent ___agent)
        {
            logger.LogDebug("SkillPoints_AddPointsLate");

            __result = AddPointsLate_Enumerator(pointsType, extraNum, __instance, ___agent);

            return(false);
        }
Esempio n. 22
0
        public virtual void CalculateSkillPoints()
        {
            SkillPoints skill = new SkillPoints();

            TotalSkillPoints = skill.SkillPointTotal(PlayerClass.PlayerLevel, PlayerClass.StatMods.IntAbilityMod, PlayerClass.ChosenClass, Race.RaceName);
        }