Example #1
0
 private static void Postfix(Fatigue __instance, ref UnitModel ___data)
 {
     if (_settings.MaxCondition && ___data.side == RuntimeVars.playerSide)
     {
         ___data.condition = 1f;
     }
 }
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = Flags.ToString();

            ele.TryPathTo("Fatigue", true, out subEle);
            subEle.Value = Fatigue.ToString();

            ele.TryPathTo("BarterGold", true, out subEle);
            subEle.Value = BarterGold.ToString();

            ele.TryPathTo("Level", true, out subEle);
            subEle.Value = Level.ToString();

            ele.TryPathTo("CalcMin", true, out subEle);
            subEle.Value = CalcMin.ToString();

            ele.TryPathTo("CalcMax", true, out subEle);
            subEle.Value = CalcMax.ToString();

            ele.TryPathTo("SpeedMultiplier", true, out subEle);
            subEle.Value = SpeedMultiplier.ToString();

            ele.TryPathTo("Karma", true, out subEle);
            subEle.Value = Karma.ToString("G15");

            ele.TryPathTo("DispositionBase", true, out subEle);
            subEle.Value = DispositionBase.ToString();

            ele.TryPathTo("TemplateFlags", true, out subEle);
            subEle.Value = TemplateFlags.ToString();
        }
Example #3
0
 private static void Prefix(Fatigue __instance, ref UnitModel ___data, ref float dt)
 {
     if (_settings.MaxCondition && ___data.side == RuntimeVars.playerSide)
     {
         dt = 10000f;
     }
 }
 /// <summary>
 /// Handle pre-game fatigue values.
 /// </summary>
 /// <param name="teams">The teams.</param>
 public void PreGame(Team[] teams)
 {
     foreach (var team in teams)
     {
         for (Int32 loopCount = 0; loopCount < team.Players.Count; loopCount++)
         {
             Fatigue fatigue = null;
             if (this.players.TryGetValue(team.Players[loopCount].Identifier, out fatigue) == true)
             {
                 team.Players[loopCount].Fatigue.DaysOff = fatigue.DaysOff;
                 team.Players[loopCount].Fatigue.Streak  = fatigue.Streak;
             }
         }
     }
 }
        /// <summary>
        /// Gets the player fatigue.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>The fatigue instance.</returns>
        private Fatigue GetPlayerFatigue(String id)
        {
            Fatigue fatigue = null;

            if (this.players.TryGetValue(id, out fatigue) == false)
            {
                fatigue = new Fatigue();
                this.players.Add(id, fatigue);
            }
            else
            {
            }

            return(fatigue);
        }
Example #6
0
        public override Dictionary <string, object> SaveToDict()
        {
            var dict = new Dictionary <string, object>();

            dict.Add(GDMConstants.SchemaKey, "Hero");

            dict.Merge(true, locked.ToGDEDict(lockedKey));
            dict.Merge(true, lv.ToGDEDict(lvKey));
            dict.Merge(true, status.ToGDEDict(statusKey));
            dict.Merge(true, hashCode.ToGDEDict(hashCodeKey));
            dict.Merge(true, battleForce.ToGDEDict(battleForceKey));
            dict.Merge(true, hpPropAdd.ToGDEDict(hpPropAddKey));
            dict.Merge(true, exp.ToGDEDict(expKey));
            dict.Merge(true, mpPropAdd.ToGDEDict(mpPropAddKey));
            dict.Merge(true, tpPropAdd.ToGDEDict(tpPropAddKey));
            dict.Merge(true, starNumUpgradeTimes.ToGDEDict(starNumUpgradeTimesKey));
            dict.Merge(true, index.ToGDEDict(indexKey));
            dict.Merge(true, wakeNum.ToGDEDict(wakeNumKey));
            dict.Merge(true, nameBeforeId.ToGDEDict(nameBeforeIdKey));
            dict.Merge(true, Likability.ToGDEDict(LikabilityKey));
            dict.Merge(true, teamPos.ToGDEDict(teamPosKey));
            dict.Merge(true, likability.ToGDEDict(likabilityKey));
            dict.Merge(true, Fatigue.ToGDEDict(FatigueKey));
            dict.Merge(true, TeamOrder.ToGDEDict(TeamOrderKey));
            dict.Merge(true, sex.ToGDEDict(sexKey));
            dict.Merge(true, skillLevel.ToGDEDict(skillLevelKey));
            dict.Merge(true, teamIdBelongTo.ToGDEDict(teamIdBelongToKey));
            dict.Merge(true, id.ToGDEDict(idKey));

            dict.Merge(true, equipHelmet.ToGDEDict(equipHelmetKey));
            dict.Merge(true, equipBreastplate.ToGDEDict(equipBreastplateKey));
            dict.Merge(true, equipGardebras.ToGDEDict(equipGardebrasKey));
            dict.Merge(true, equipLegging.ToGDEDict(equipLeggingKey));
            dict.Merge(true, jewelry0.ToGDEDict(jewelry0Key));
            dict.Merge(true, jewelry1.ToGDEDict(jewelry1Key));
            dict.Merge(true, RoleAttritubeList.ToGDEDict(RoleAttritubeListKey));
            dict.Merge(true, equipWeapon.ToGDEDict(equipWeaponKey));
            dict.Merge(true, a_skillOmega.ToGDEDict(a_skillOmegaKey));
            dict.Merge(true, a_skill0.ToGDEDict(a_skill0Key));
            dict.Merge(true, a_skill1.ToGDEDict(a_skill1Key));
            dict.Merge(true, ItemInfo.ToGDEDict(ItemInfoKey));
            dict.Merge(true, AnimData.ToGDEDict(AnimDataKey));
            return(dict);
        }
Example #7
0
        public static float GetFatiguePower(Fatigue f)
        {
            switch (f)
            {
            case Fatigue.None:
                return(0);

            case Fatigue.Little:
                return(0.05f);

            case Fatigue.Moderate:
                return(0.10f);

            case Fatigue.Lot:
                return(0.15f);

            case Fatigue.Limit:
                return(0.20f);
            }
            return(0);
        }
Example #8
0
    public LocalObject(LocalShape localShape, string _uniqueName = "", Inventory _inventory = null)
    {
        uniqueName = _uniqueName;
        shape = new ShapeComponent(localShape, this);

        if (localShape.type == LocalType.Get("Destructible") || localShape.type == LocalType.Get("Container"))
        {
            hp = new HPComponent(this);
        }
        else if (localShape.type == LocalType.Get("Creature"))
        {
            hp = new HPComponent(this);
            movement = new Movement(this);
            defence = new Defence(this);
            attack = new Attack(this);
            abilities = new Abilities(this);
            fatigue = new Fatigue(this);
            eating = new Eating(this);
        }

        if (_inventory != null)
        {
            inventory = new Inventory(6, 1, "", false, null, this);
            _inventory.CopyTo(inventory);
        }
    }
Example #9
0
    public LocalObject(string _uniqueName, Race _race, CharacterClass _cclass, Background _background, Origin _origin, int experience)
    {
        uniqueName = _uniqueName;
        race = _race;
        cclass = _cclass;
        background = _background;
        origin = _origin;

        xp = new Experience(experience, this);

        skills = new Skills(this);
        inventory = new Inventory(6, 1, "", true, null, this);

        hp = new HPComponent(this);
        movement = new Movement(this);
        defence = new Defence(this);
        attack = new Attack(this);
        abilities = new Abilities(this);
        fatigue = new Fatigue(this);
        eating = new Eating(this);
    }
        /// <summary>
        /// Handles post game fatigue values.
        /// </summary>
        /// <param name="teams">The teams.</param>
        /// <param name="results">The results.</param>
        public void PostGame(Team[] teams, GameResults results)
        {
            for (Int32 loopCount = 0; loopCount < 2; loopCount++)
            {
                var     pitchers = results.Pitchers[loopCount];
                Boolean starter  = true;

                foreach (var pitcher in pitchers)
                {
                    // Get the pitcher's fatigue
                    Fatigue fatigue = this.GetPlayerFatigue(pitcher.Identifier);

                    // Increment streak
                    fatigue.Streak++;

                    // Find pitcher's gane stats
                    var stats = results.GetPitchersStats(pitcher.Identifier);
                    if (stats != null)
                    {
                        Double daysOff        = 0;
                        Double inningsPitched = stats.TotalOuts / 3.0;
                        if (starter)
                        {
                            daysOff = Math.Sqrt((inningsPitched * 3) / 4) + 1;
                        }
                        else
                        {
                            daysOff = Math.Sqrt(inningsPitched * 4) - 1.4;
                        }

                        daysOff = Math.Floor(daysOff);

                        fatigue.DaysOff = (Int32)daysOff;
                    }

                    if (fatigue.Streak >= 3)
                    {
                        fatigue.DaysOff++;
                    }

                    starter = false;
                }

                teams[loopCount].Players.SortByStat(StatToSort.Innings);
                foreach (var player in teams[loopCount].Players)
                {
                    if (player.PitchingStats.Innings > 0)
                    {
                        if (pitchers.Contains(player) == false)
                        {
                            // Get the pitcher's fatigue
                            Fatigue fatigue = this.GetPlayerFatigue(player.Identifier);
                            fatigue.Streak = 0;
                            if (fatigue.DaysOff > 0)
                            {
                                fatigue.DaysOff--;
                            }
                        }
                    }
                }
            }
        }
Example #11
0
 public CharState()
 {
     Boredom = new Boredom();
     Fatigue = new Fatigue();
 }
Example #12
0
        public async Task <IActionResult> Index(int id)
        {
            AuthDTO auth = GetAuth(_ESIClient);

            _Log.LogDebug(String.Format("Logged in to retrieve Character Info for Character Id: {0}", auth.CharacterId));

            Fatigue jumpFatigue = null;

            EVEStandard.Models.System locationSystem = null;
            CharacterAttributes       attributes     = null;

            if (id <= 0)          // Use own Character info
            {
                id = CharacterId; // Set id and use that

                var characterJumpFatigue = await _ESIClient.Character.GetJumpFatigueV1Async(auth);

                jumpFatigue = characterJumpFatigue.Model;

                var characterLocationApi = await _ESIClient.Location.GetCharacterLocationV1Async(auth);

                CharacterLocation characterLocation = characterLocationApi.Model;
                var locationSystemApi = await _ESIClient.Universe.GetSolarSystemInfoV4Async(characterLocation.SolarSystemId);

                locationSystem = locationSystemApi.Model;

                var attributesApi = await _ESIClient.Skills.GetCharacterAttributesV1Async(auth);

                attributes = attributesApi.Model;
            }

            Character_Row character = _DBService.GetCharacterPublicInfo(id);
            var           portrait  = await _ESIClient.Character.GetCharacterPortraitsV2Async(id);

            var corporation = await _ESIClient.Corporation.GetCorporationInfoV4Async((int)character.CorporationId);

            List <SkillQueueDataModel> skillsQueue = await GetSkillQueue(auth, id);

            List <CharacterBookmarkDataModel> bookmarksViewModel = await GetBookmarks(auth);

            bookmarksViewModel = bookmarksViewModel.OrderBy(x => x.Folder.Name).ToList();

            var walletApi = await _ESIClient.Wallet.GetCharacterWalletBalanceV1Async(auth);

            double walletBalance = walletApi.Model;

            var model = new CharacterPageViewModel
            {
                Id                   = id,
                Character            = character,
                Attributes           = attributes,
                Portrait             = portrait.Model,
                Corporation          = corporation.Model,
                LocationSystem       = locationSystem,
                CharacterJumpFatigue = jumpFatigue,
                SkillsQueue          = skillsQueue,
                Bookmarks            = bookmarksViewModel,
                WalletBalance        = walletBalance
            };

            return(View(model));
        }
Example #13
0
 static public string EnumToString(Fatigue a)
 {
     return(FatigueLbl[(int)a]);
 }