예제 #1
0
 void Init(PC pc)
 {
     ID   = pc.ID;
     NAME = pc.PCNAME;
     if (!string.IsNullOrEmpty(pc.CURRENT))
     {
         STATUS = pc.CURRENT.Split(new string[] { "   :" }, StringSplitOptions.RemoveEmptyEntries).Last().Trim();
     }
     VERSION  = pc.TESTREQUEST != null ? pc.TESTREQUEST.FIPVERSION.VERSION : "";
     STARTED  = pc.STARTED == null ? "" : pc.STARTED.GetValueOrDefault().ToString(IdBasedObject.defDateTimeFormat, CultureInfo.InvariantCulture);
     PCPING   = pc.PCPING == null ? "" : pc.PCPING.GetValueOrDefault().ToString(IdBasedObject.defDateTimeFormat, CultureInfo.InvariantCulture);
     PAUSEDBY = pc.PERSON == null ? "" : pc.PERSON.PHONE;
     string[] parts = NAME.ToUpper().Split('X');
     if (parts.Length > 1)
     {
         IP = "192.168.0.1" + parts[1];
     }
     ACTIONFLAG = pc.ACTIONFLAG.GetValueOrDefault(0);
     SCHEDULES  = pc.SCHEDULES.GetValueOrDefault(0);
     HOSTID     = pc.HOST_ID.GetValueOrDefault(-1);
 }
예제 #2
0
        }                                               //manually

        ///<summary>Int value doesnt matter, ex `.ToString(1);`</summary>
        public override string ToString()
        {
            return(string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " +
                                 "{10} {11} {12} {13} {14} {15} {16} {17} {18} {19} " +
                                 "{20} {21} {22} {23} {24} {25} {26} {27} {28} {29} " +
                                 "{30} {31}),",
                                 NAME == null ? ""                   : "\nId: Pokemons." + System.Text.RegularExpressions.Regex.Replace(NAME.ToUpper().Replace('-', '_'), @"[\.']", ""),
                                 RegionalDex == null ? ""            : ",\n//regionalDex: new int[]{" + RegionalDex + "}",
                                 Type1 == null || Type1 == "NONE" ? "" : ",\ntype1: Types." + Type1,
                                 Type2 == null || Type2 == "NONE" ? "" : ",\ntype2: Types." + Type2,
                                 Ability1 == null || Ability1 == "NONE" ? "" : ",\nability1: Abilities." + Ability1,
                                 Ability2 == null || Ability2 == "NONE" ? "" : ",\nability2: Abilities." + Ability2,
                                 HiddenAbility == null || HiddenAbility == "NONE" ? "" : ",\nhiddenAbility: Abilities." + HiddenAbility,
                                 MaleRatio == null ? ""              : ",\nmaleRatio: " + MaleRatio,
                                 CatchRate == null ? ""              : ",\ncatchRate: " + CatchRate,
                                 EggGroup1 == null || EggGroup1 == "NONE" ? "" : ",\neggGroup1: EggGroups." + EggGroup1,
                                 EggGroup2 == null || EggGroup2 == "NONE" ? "" : ",\neggGroup2: EggGroups." + EggGroup2,
                                 HatchTime == null ? ""              : ",\nhatchTime: " + HatchTime,
                                 Height == null ? ""                 : ",\nheight: " + Height,
                                 Weight == null ? ""                 : ",\nweight: " + Weight,
                                 LevelingRate == null ? ""           : ",\nlevelingRate: LevelingRate." + LevelingRate,//\n" +
                                 PokedexColor == null ? ""           : ",\npokedexColor: Color." + PokedexColor,
                                 BaseFriendship == null ? ""         : ",\nbaseFriendship: " + BaseFriendship,
                                 EXPYield == null ? ""               : ",\nbaseExpYield: " + EXPYield,
                                 BSHP == null ? ""                   : ",\nbaseStatsHP: " + BSHP,
                                 BSATK == null ? ""                  : ",baseStatsATK: " + BSATK,
                                 BSDEF == null ? ""                  : ",baseStatsDEF: " + BSDEF,
                                 BSSPA == null ? ""                  : ",baseStatsSPA: " + BSSPA,
                                 BSSPD == null ? ""                  : ",baseStatsSPD: " + BSSPD,
                                 BSSPE == null ? ""                  : ",baseStatsSPE: " + BSSPE,//\n" +
                                 EYHP == null || EYHP == "0" ? ""    : ",\nevHP: " + EYHP,
                                 EYATK == null || EYATK == "0" ? ""  : ",\nevATK: " + EYATK,
                                 EYDEF == null || EYDEF == "0" ? ""  : ",\nevDEF: " + EYDEF,
                                 EYSPA == null || EYSPA == "0" ? ""  : ",\nevSPA: " + EYSPA,
                                 EYSPD == null || EYSPD == "0" ? ""  : ",\nevSPD: " + EYSPD,
                                 EYSPE == null || EYSPE == "0" ? ""  : ",\nevSPE: " + EYSPE, //\n" +
                                                                                             //NAME == null? "" : "$"luminance: "+Luminance,\n" +
                                 ",\nmovesetmoves: new PokemonMoveset[] " +
                                                                                             //$"\n" +
                                 "{\n" +
                                                                                             //trimend goes on last value, but there's also a comma before every value so it's fine
                                                                                             //it balances out the extra, and also if the value is null, you're not left with additional
                                                                                             //or dangling commas to trigger any errors.
                                 Moves.Replace("'", "").TrimEnd(',') + "\n" +
                                 "}",
                                 //$"\n" +
                                 PokemonEvolution == null ? "" : ",\nevolution: new IPokemonEvolution[] {" + PokemonEvolution.TrimEnd(',') + "\n}"
                                 //,HeldItem == null? "" : "heldItem: "+HeldItem +","
                                 ));
        }