Exemple #1
0
        private static void ModifyStat(string tableName, int statLineId, string statName, object newValue)
        {
            StatTable selectedTable = Tables.SingleOrDefault(table => table.Name.Equals(tableName));

            if (selectedTable == null)
            {
                return;
            }

            StatLine selectedLine = selectedTable.StatisticLines.OrderBy(line => line.Creation).ToList()[statLineId];

            if (selectedLine == null)
            {
                return;
            }

            Stat selectedStat = selectedLine.Statistics.SingleOrDefault(stat => stat.Name.Equals(statName));

            if (selectedStat == null)
            {
                return;
            }

            if (selectedStat.Value.Equals(newValue))
            {
                return;
            }

            selectedStat.Value   = newValue;
            selectedLine.Updated = DateTime.Now;

            Console.WriteLine($"Value of {selectedTable.Name}:{selectedLine.Creation}:{selectedStat.Name} changed to {newValue}");
        }
Exemple #2
0
 private static void ViewTable(StatTable table)
 {
     foreach (StatLine lines in table.StatisticLines)
     {
         Console.WriteLine(string.Join(" ", lines.Statistics.OrderBy(stat => stat.Ordering)));
     }
 }
Exemple #3
0
 public GenericSlimeEnemyEntity()
 {
     Name = "Generic Slime Enemy";
     StatTable.Add(HP, 20);
     StatTable.Add(Attack, 10);
     StatTable.Add(Defense, 0);
     isDead = false;
 }
Exemple #4
0
 public WeebBaitEntity()
 {
     Name = "Weeb Bait";
     StatTable.Add(HP, 25);
     StatTable.Add(Attack, 20);
     StatTable.Add(Defense, 5);
     isDead = false;
 }
Exemple #5
0
 public TheTankEntity()
 {
     Name = "The Tank";
     StatTable.Add(HP, 25);
     StatTable.Add(Attack, 30);
     StatTable.Add(Defense, 42);
     isDead = false;
 }
Exemple #6
0
    private boolean goesFirst = false;      //in every battle the enemy will go first unless the player has a Potion of Getting Schwifty

    public PlayerEntity()
    {
        Name = "Player";
        StatTable.Add(HP, 10);
        StatTable.Add(Attack, 0);
        StatTable.Add(Defense, 0);
        isDead = false;
    }
Exemple #7
0
        private static void DeleteTable(StatTable table)
        {
            if (GetTable(table.Name) == null)
            {
                return;
            }

            Tables.Remove(table);
        }
    void initStats(StatTable table)
    {
        HP          = new CharacterStat(table.HP);
        mind        = new CharacterStat(table.mind);
        melee       = new CharacterStat(table.melee);
        ATK         = new CharacterStat(table.ATK);
        armor       = new CharacterStat(table.armor);
        magicResist = new CharacterStat(table.magicResist);
        evasion     = new CharacterStat(table.evasion);
        wind        = new CharacterStat(table.wind);
        forest      = new CharacterStat(table.forest);
        fire        = new CharacterStat(table.fire);
        mountain    = new CharacterStat(table.mountain);
        endurance   = new CharacterStat(table.endurance);
        movement    = new CharacterStat(table.movement);

        freeMove = table.freeMove;
        cost     = table.cost;

        abilities = table.abilities;
        for (int i = 0; i <= 6; i++)
        {
            if (table.abilities[i] != null)
            {
                abilities[i] = (Ability)Object.Instantiate(table.abilities[i]); //ScriptableObject.CreateInstance(table.abilities[i].GetType());
                abilities[i].Initialize();
                abilities[i].owner = this;
            }
        }

        feats = table.feats;
        for (int i = 0; i <= 6; i++)
        {
            if (table.feats[i] != null)
            {
                feats[i]       = (Feat)Object.Instantiate(table.feats[i]);
                feats[i].owner = this;
                feats[i].Initialize();
            }
        }

        burningResist    = new CharacterStat(table.burningResist);
        coldResist       = new CharacterStat(table.coldResist);
        corrosionResist  = new CharacterStat(table.corrosionResist);
        infestionResist  = new CharacterStat(table.infestionResist);
        poisonResist     = new CharacterStat(table.poisonResist);
        stopResist       = new CharacterStat(table.stopResist);
        crippleResist    = new CharacterStat(table.crippleResist);
        stunResist       = new CharacterStat(table.stunResist);
        silenceResist    = new CharacterStat(table.silenceResist);
        breakResist      = new CharacterStat(table.breakResist);
        thornResist      = new CharacterStat(table.thornResist);
        blindsightResist = new CharacterStat(table.blindsightResist);
        rageResist       = new CharacterStat(table.rageResist);
        dazzleResist     = new CharacterStat(table.dazzleResist);
    }
Exemple #9
0
        private static void CreateTableFromValues(string[] parsedInputValues)
        {
            if (!parsedInputValues[0].ToLower().Equals("create"))
            {
                return;
            }

            StatTable table = new StatTable(string.Empty);

            table.Name = parsedInputValues[1].Contains(":") ? string.Empty : parsedInputValues[1];
        }
Exemple #10
0
        void AppendBuildTaskStats(List <BuildStat> stats, StatTable table)
        {
            table.FillNewRow("---");
            var tasks = CollectTaskStatsByName(stats);

            foreach (var taskList in tasks)
            {
                var taskName = taskList.First().Name;
                AppendCommonInfo(taskList, taskName, table);
            }
        }
Exemple #11
0
        void AppendHistoryStats(List <BuildStat> stats, string buildName, StatTable table)
        {
            var actualStats = string.IsNullOrEmpty(buildName) ? stats : stats.FindAll(s => IsSameName(s, buildName));

            foreach (var stat in actualStats)
            {
                var name     = stat.Name;
                var args     = stat.Args;
                var date     = stat.Start;
                var duration = stat.Duration;
                table.AddNewRow(name, FormatArgs(args), date.ToShortDateString(), Utils.FormatTimeSpan(duration));
            }
        }
Exemple #12
0
    public MyForm(Game model)
    {
        var mainTable = CreateMainTable();

        var table     = BoardPanel.CreateGameBoardPanel(model);
        var statTable = StatTable.CreateStatPanel(model);

        mainTable.Controls.Add(table, 0, 0);
        mainTable.Controls.Add(statTable, 1, 0);

        Controls.Add(mainTable);

        model.GameEnded += GameEndMessage;
    }
Exemple #13
0
        void OnHistoryRequested(RequestContext context, RequestArgs args)
        {
            _logger.LogDebug($"OnHistoryRequested: ({args.Count})");
            var    sb        = new StringBuilder();
            string buildName = args.Count > 0 ? args[0] : null;

            sb.Append(buildName == null ? "History:\n" : $"History ({buildName}):\n");
            var table = new StatTable();

            FormatHistoryHeader(table);
            AppendHistoryStats(_container.Builds, buildName, table);
            table.Append(sb);
            _server.RaiseCommonMessage(context, sb.ToString());
        }
Exemple #14
0
    void WriteFile()
    {
        StatTable testOne = new StatTable()
        {
            ElementID  = 01,
            name       = "puck",
            maxHP      = 10,
            damage     = 1,
            buff       = 10,
            initiative = 14
        };

        wrapper.CharData.Add(testOne);

        jsonString = JsonUtility.ToJson(wrapper, true);
        File.WriteAllText(path, jsonString);
    }
Exemple #15
0
        void AppendCommonInfo <T>(List <T> stats, string name, StatTable table) where T : ICommonStat
        {
            table.AddNewRow(name);
            table.AddToRow(stats.Count.ToString());
            if (stats.Count > 1)
            {
                var history = new List <T>(stats);
                history.Reverse();
                history = history.Skip(1).ToList();
                var min = history.Min(s => s.Duration.TotalSeconds);
                var max = history.Max(s => s.Duration.TotalSeconds);
                var avg = history.Average(s => s.Duration.TotalSeconds);
                table.AddToRow(Utils.FormatSeconds(min), Utils.FormatSeconds(max), Utils.FormatSeconds(avg));
            }
            else
            {
                table.AddToRow("", "", "");
            }
            var last = stats.Last().Duration.TotalSeconds;

            table.AddToRow(Utils.FormatSeconds(last));
        }
Exemple #16
0
        public Stats(int level, Stats baseStats, Stats natMods = null)
        {
            StatsList = new int[NUMBER_OF_STATS];
            if (baseStats == null)
            {
                return;
            }
            Stats natStats = natMods == null ? new Stats() : natMods;

            StatsList[0]  = StatTable.SetMHPNorms(level, baseStats.MaxHP, natStats.MaxHP);
            StatsList[1]  = StatTable.SetStatNorms(level, baseStats.Atk, natStats.Atk);
            StatsList[2]  = StatTable.SetStatNorms(level, baseStats.Def, natStats.Def);
            StatsList[3]  = StatTable.SetStatNorms(level, baseStats.Map, natStats.Map);
            StatsList[4]  = StatTable.SetStatNorms(level, baseStats.Mar, natStats.Mar);
            StatsList[5]  = StatTable.SetStatNorms(level, baseStats.Spd, natStats.Spd);
            StatsList[6]  = StatTable.SetStatNorms(level, baseStats.Tec, natStats.Tec);
            StatsList[7]  = StatTable.SetStatNorms(level, baseStats.Luk, natStats.Luk);
            StatsList[8]  = StatTable.SetOtherStatNorms(baseStats.Acc, natStats.Acc);
            StatsList[9]  = StatTable.SetOtherStatNorms(baseStats.Eva, natStats.Eva);
            StatsList[10] = StatTable.SetOtherStatNorms(baseStats.Crt, natStats.Crt);
            StatsList[11] = StatTable.SetOtherStatNorms(baseStats.Cev, natStats.Cev);
        }
Exemple #17
0
 void AppendBuildStats(List <BuildStat> stats, string name, StatTable table, bool withTaskDetails)
 {
     if (string.IsNullOrEmpty(name))
     {
         var builds = _server.FindBuilds();
         foreach (var buildName in builds.Keys)
         {
             var statsByName = stats.FindAll(s => IsSameName(s, buildName));
             _logger.LogDebug($"Stats for {buildName}: {statsByName.Count}");
             AppendBuildStats(statsByName, buildName, table, withTaskDetails);
         }
         return;
     }
     if (stats.Count > 0)
     {
         var statsByName = stats.FindAll(s => IsSameName(s, name));
         AppendCommonBuildStats(statsByName, name, table);
         if (withTaskDetails)
         {
             AppendBuildTaskStats(statsByName, table);
         }
     }
 }
Exemple #18
0
 void FormatStatHeader(StatTable table)
 {
     table.AddNewRow("BUILD", "COUNT", "MIN", "MAX", "AVG", "LAST");
 }
Exemple #19
0
 void FormatHistoryHeader(StatTable table)
 {
     table.AddNewRow("BUILD", "ARGS", "DATE", "DURATION");
 }
Exemple #20
0
 public TableDeletedEventArgs(StatTable table)
 {
     Table = table;
 }
Exemple #21
0
        /// <summary>
        /// Writes a save to a folder. The save name is generated based on the save number stored by
        /// this save.
        /// </summary>
        /// <param name="saveDirectory"></param>
        public void Write(string saveDirectory)
        {
            // The output file is indicated by the save number.
            var writer = new BinaryWriter(File.Create(Path.Combine(saveDirectory, SaveFileName)));

            //BinaryWriter writer = new BinaryWriter(stream);

            // Firstly, write the header.
            writer.Write(Header);

            Details.Write(writer);

            // Now the skills.
            writer.Write(Proficiencies.ActiveCount + Skills.ActiveCount);
            Proficiencies.WriteAllProficiencies(writer);
            Skills.WriteAllSkills(writer);

            // Some unknown stuff.
            writer.Write(Vehicle1Color);
            writer.Write(Vehicle2Color);
            writer.Write(UnknownVariable4);
            writer.Write(UnknownVariable5);

            // Ammo.
            writer.Write(Ammo.Count);
            foreach (var ammo in Ammo)
            {
                ammo.Value.Write(writer);
            }

            // Items.
            writer.Write(Items.Count);
            foreach (var item in Items)
            {
                item.Write(writer);
            }

            writer.Write(BackpackSlots);
            writer.Write(WeaponSlots);

            // Weapons.
            writer.Write(Weapons.Count);
            foreach (var weapon in Weapons)
            {
                weapon.Write(writer);
            }

            // Stats.
            StatTable.Write(writer);

            // Visited locations.
            writer.Write(LocationsVisited.Count);
            foreach (var location in LocationsVisited)
            {
                writer.BL_WriteString(location.InternalName());
            }

            writer.BL_WriteString(CurrentLocation.InternalName());

            writer.Write(UnknownVariable6);
            writer.Write(UnknownVariable7);
            writer.BL_WriteString(UnknownVariable8);
            writer.Write(UnknownVariable9);
            writer.Write(UnknownVariable10);
            writer.Write(SaveNumber);
            writer.Write(UnknownVariable12);
            writer.Write(0u);

            // Playthroughs.
            writer.Write(Playthroughs.Count);
            foreach (var playthrough in Playthroughs)
            {
                writer.Write(playthrough.Number);
                writer.BL_WriteString(playthrough.ActiveMissionName);
                writer.Write(playthrough.FoundMissionsCount);
                foreach (var mission in playthrough.Missions)
                {
                    if (mission.Value.Status != Mission.MissionStatus.Unknown)
                    {
                        writer.BL_WriteString(mission.Value.InternalName);
                        writer.Write(mission.Value.MissionStatusFlag);
                        writer.Write(mission.Value.UnknownVariable2);
                        writer.Write(mission.Value.UnknownVariable3);
                        writer.Write(mission.Value.Details.Count);
                        foreach (var detail in mission.Value.Details)
                        {
                            writer.BL_WriteString(detail.UnknownString);
                            writer.Write(detail.UnknownVariable);
                        }
                    }
                }
            }

            writer.Write(PlayTimeSeconds);
            writer.BL_WriteString(SaveTimeString);
            writer.BL_WriteString(Name);
            writer.Write(Color1ARGB);
            writer.Write(Color2ARGB);
            writer.Write(Color3ARGB);

            writer.Write(UnknownVariable14);
            writer.Write(UnknownVariable15.Count);
            foreach (Int32 x in UnknownVariable15)
            {
                writer.Write(x);
            }
            writer.Write(UnknownVariable16.Count);
            foreach (Int32 x in UnknownVariable16)
            {
                writer.Write(x);
            }

            // Echo
            writer.Write(EchoPlaythroughs.Count);
            foreach (var echoPlaythrough in EchoPlaythroughs)
            {
                writer.Write(echoPlaythrough.Playthrough);
                writer.Write(echoPlaythrough.Echoes.Count);
                foreach (var echo in echoPlaythrough.Echoes)
                {
                    writer.BL_WriteString(echo.InternalName);
                    writer.Write(echo.UnknownVariable1);
                    writer.Write(echo.UnknownVariable2);
                }
            }

            writer.Write(UnknownVariable17.Length);
            writer.Write(UnknownVariable17);

            writer.Close();
        }
Exemple #22
0
 void AppendCommonBuildStats(List <BuildStat> stats, string name, StatTable table)
 {
     AppendCommonInfo(stats, name, table);
 }
Exemple #23
0
 public static StatData GetStatData(this int a_nStatID)
 {
     return(StatTable.GetData(a_nStatID));
 }
Exemple #24
0
    //#if !get2byte
    //# define get2byte(x)   ((x)[0]<<8 | (x)[1])
    //#endif

    /*
    ** Connect to or create a statvfs virtual table.
    */
    static int statConnect(
      sqlite3 db,
      object pAux,
      int argc,
      string[] argv,
      out sqlite3_vtab ppVtab,
      out string pzErr
    )
    {
      StatTable pTab;

      pTab = new StatTable();//(StatTable )sqlite3_malloc(sizeof(StatTable));
      //memset(pTab, 0, sizeof(StatTable));
      pTab.db = db;

      sqlite3_declare_vtab( db, VTAB_SCHEMA );
      ppVtab = pTab;
      pzErr = "";
      return SQLITE_OK;
    }