Пример #1
0
 public static Char CreateCharacter(short type, int chrId)
 {
     XElement cls = XmlDatas.TypeToElement[type];
     if (cls == null) return null;
     var ret = new Char
     {
         ObjectType = type,
         CharacterId = chrId,
         Level = 1,
         Exp = 0,
         CurrentFame = 0,
         Backpack = 1,
         _Equipment = cls.Element("Equipment").Value,
         MaxHitPoints = int.Parse(cls.Element("MaxHitPoints").Value),
         HitPoints = int.Parse(cls.Element("MaxHitPoints").Value),
         MaxMagicPoints = int.Parse(cls.Element("MaxMagicPoints").Value),
         MagicPoints = int.Parse(cls.Element("MaxMagicPoints").Value),
         Attack = int.Parse(cls.Element("Attack").Value),
         Defense = int.Parse(cls.Element("Defense").Value),
         Speed = int.Parse(cls.Element("Speed").Value),
         Dexterity = int.Parse(cls.Element("Dexterity").Value),
         HpRegen = int.Parse(cls.Element("HpRegen").Value),
         MpRegen = int.Parse(cls.Element("MpRegen").Value),
         Tex1 = 0,
         Tex2 = 0,
         Dead = false,
         PCStats = "",
         FameStats = new FameStats(),
         Pet = -1
     };
     ret.Backpacks = new Dictionary<int, short[]> { { 1, ret.PackFromEquips() } };
     return ret;
 }