Пример #1
0
 public WorldCharacter(Character ch, byte eqpslot, ushort eqpid)
 {
     Character = ch;
     ID = Character.ID;
     Equips = new Dictionary<byte, ushort>();
     Equips.Add(eqpslot, eqpid);
 }
Пример #2
0
 public WorldCharacter(Character ch)
 {
     Character = ch;
     ID = Character.ID;
     Equips = new Dictionary<byte, ushort>();
     foreach (var eqp in ch.Equips.Where(eq => eq.Slot < 0))
     {
         byte realslot = (byte)(eqp.Slot * -1);
         if (Equips.ContainsKey(realslot))
         {
             Log.WriteLine(LogLevel.Warn, "{0} has duplicate equip in slot {1}", ch.Name, realslot);
             Equips.Remove(realslot);
         }
         Equips.Add(realslot, (ushort)eqp.EquipID);
     }
     Detach();
 }
Пример #3
0
        public WorldCharacter CreateCharacter(string name, byte slot, byte hair, byte color, byte face, Job job, bool ismale)
        {
            if (Characters.ContainsKey(slot) || slot > 5)
                return null;
            //TODO: check if hair etc are actual beginner ones! (premium hack)

            BaseStatsEntry stats = DataProvider.Instance.JobBasestats[job];
            if (stats == null)
            {
                Log.WriteLine(LogLevel.Warn, "Houston, we have a problem! Jobstats not found for job {0}", job.ToString());
                return null;
            }

            Character newchar = new Character();
            newchar.AccountID = this.AccountID;
            newchar.CharLevel = 1;
            newchar.Name = name;
            newchar.Face = face;
            newchar.Hair = hair;
            newchar.HairColor = color;
            newchar.Job = (byte)job;
            newchar.Male = ismale;
            newchar.Slot = slot;
            newchar.XPos = 7636;
            newchar.YPos = 4610;
            newchar.HP = (short)stats.MaxHP;
            newchar.SP = (short)stats.MaxSP;
            newchar.HPStones = (short)stats.MaxHPStones;
            newchar.SPStones = (short)stats.MaxSPStones;
            Program.Entity.AddToCharacters(newchar);
            int charID = newchar.ID;
            ushort begineqp = GetBeginnerEquip(job);
            if (begineqp > 0)
            {
                DatabaseEquip eqp = new DatabaseEquip();
                eqp.EquipID = begineqp;
                eqp.Slot = (short)((job == Job.Archer) ? -10 : -12);
                newchar.Equips.Add(eqp);
            }
            Program.Entity.SaveChanges();
            WorldCharacter tadaa = new WorldCharacter(newchar, (job == Job.Archer) ? (byte)12 : (byte)10, begineqp);
            Characters.Add(slot, tadaa);
            return tadaa;
        }
Пример #4
0
 /// <summary>
 /// Create a new Character object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="accountID">Initial value of the AccountID property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="slot">Initial value of the Slot property.</param>
 /// <param name="map">Initial value of the Map property.</param>
 /// <param name="charLevel">Initial value of the CharLevel property.</param>
 /// <param name="job">Initial value of the Job property.</param>
 /// <param name="male">Initial value of the Male property.</param>
 /// <param name="hP">Initial value of the HP property.</param>
 /// <param name="sP">Initial value of the SP property.</param>
 /// <param name="hPStones">Initial value of the HPStones property.</param>
 /// <param name="sPStones">Initial value of the SPStones property.</param>
 /// <param name="exp">Initial value of the Exp property.</param>
 /// <param name="fame">Initial value of the Fame property.</param>
 /// <param name="money">Initial value of the Money property.</param>
 /// <param name="hair">Initial value of the Hair property.</param>
 /// <param name="hairColor">Initial value of the HairColor property.</param>
 /// <param name="face">Initial value of the Face property.</param>
 /// <param name="xPos">Initial value of the XPos property.</param>
 /// <param name="yPos">Initial value of the YPos property.</param>
 /// <param name="statPoints">Initial value of the StatPoints property.</param>
 /// <param name="strStats">Initial value of the StrStats property.</param>
 /// <param name="endStats">Initial value of the EndStats property.</param>
 /// <param name="dexStats">Initial value of the DexStats property.</param>
 /// <param name="intStats">Initial value of the IntStats property.</param>
 /// <param name="sprStats">Initial value of the SprStats property.</param>
 /// <param name="usablePoints">Initial value of the UsablePoints property.</param>
 public static Character CreateCharacter(global::System.Int32 id, global::System.Int32 accountID, global::System.String name, global::System.Byte slot, global::System.Byte map, global::System.Byte charLevel, global::System.Byte job, global::System.Boolean male, global::System.Int32 hP, global::System.Int32 sP, global::System.Int16 hPStones, global::System.Int16 sPStones, global::System.Int64 exp, global::System.Int32 fame, global::System.Int64 money, global::System.Byte hair, global::System.Byte hairColor, global::System.Byte face, global::System.Int32 xPos, global::System.Int32 yPos, global::System.Byte statPoints, global::System.Byte strStats, global::System.Byte endStats, global::System.Byte dexStats, global::System.Byte intStats, global::System.Byte sprStats, global::System.Byte usablePoints)
 {
     Character character = new Character();
     character.ID = id;
     character.AccountID = accountID;
     character.Name = name;
     character.Slot = slot;
     character.Map = map;
     character.CharLevel = charLevel;
     character.Job = job;
     character.Male = male;
     character.HP = hP;
     character.SP = sP;
     character.HPStones = hPStones;
     character.SPStones = sPStones;
     character.Exp = exp;
     character.Fame = fame;
     character.Money = money;
     character.Hair = hair;
     character.HairColor = hairColor;
     character.Face = face;
     character.XPos = xPos;
     character.YPos = yPos;
     character.StatPoints = statPoints;
     character.StrStats = strStats;
     character.EndStats = endStats;
     character.DexStats = dexStats;
     character.IntStats = intStats;
     character.SprStats = sprStats;
     character.UsablePoints = usablePoints;
     return character;
 }
Пример #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Characters EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCharacters(Character character)
 {
     base.AddObject("Characters", character);
 }
Пример #6
0
 public void SetShortcutsData(byte[] pData)
 {
     _character = LazyLoadMe();
     _character.Shortcuts = pData;
     Program.Entity.SaveChanges();
     Detach();
 }
Пример #7
0
 public void SetQuickBarStateData(byte[] pData)
 {
     _character = LazyLoadMe();
     _character.QuickBarState = pData;
     Program.Entity.SaveChanges();
     Detach();
 }
Пример #8
0
 public void SetGameSettingsData(byte[] pData)
 {
     _character = LazyLoadMe();
     _character.GameSettings = pData;
     Program.Entity.SaveChanges();
     Detach();
 }