Exemplo n.º 1
0
        public static Equip LoadEquip(DataRow row)
        {
            ulong  uniqueID = GetDataTypes.GetUlong(row["ID"]);
            uint   owner    = GetDataTypes.GetUint(row["Owner"]);
            ushort equipID  = GetDataTypes.GetUshort(row["EquipID"]);
            sbyte  slot     = GetDataTypes.GetSByte(row["Slot"]);
            byte   upgrade  = GetDataTypes.GetByte(row["Upgrades"]);

            ushort strByte = GetDataTypes.GetUshort(row["iSTR"]);
            ushort endByte = GetDataTypes.GetUshort(row["iEND"]);
            ushort dexByte = GetDataTypes.GetUshort(row["iDEX"]);
            ushort sprByte = GetDataTypes.GetUshort(row["iSPR"]);
            ushort intByte = GetDataTypes.GetUshort(row["iINT"]);
            Equip  equip   = new Equip(owner, equipID, slot)
            {
                UniqueID = uniqueID,
                Upgrades = upgrade,
                Str      = strByte,
                End      = endByte,
                Dex      = dexByte,
                Spr      = sprByte,
                Int      = intByte
            };

            return(equip);
        }
Exemplo n.º 2
0
        public void LoadBasic(WorldCharacter pChar)
        {
            try
            {
                locker.WaitOne();
                DataTable equips = null;
                using (var dbClient = Program.DatabaseManager.GetClient())
                {
                    equips = dbClient.ReadDataTable("SELECT * FROM equips WHERE Owner=" + pChar.ID + " AND Slot < 0");
                }

                if (equips != null)
                {
                    foreach (DataRow row in equips.Rows)
                    {
                        var loaded = Equip.LoadEquip(row);
                        EquippedItems.Add(loaded);
                    }
                }
            }
            finally
            {
                locker.ReleaseMutex();
            }
        }
Exemplo n.º 3
0
 public void AddToEquipped(Equip pEquip)
 {
     try
     {
         locker.WaitOne();
         EquippedItems.Add(pEquip);
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
Exemplo n.º 4
0
 public void AddToEquipped(Equip pEquip)
 {
     try
     {
         locker.WaitOne();
         EquippedItems.Add(pEquip);
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Create a new Equip object.
        /// </summary>
        /// <param name="id">Initial value of the ID property.</param>
        /// <param name="owner">Initial value of the Owner property.</param>
        /// <param name="slot">Initial value of the Slot property.</param>
        /// <param name="equipID">Initial value of the EquipID property.</param>
        /// <param name="upgrades">Initial value of the Upgrades property.</param>
        /// <param name="incStr">Initial value of the IncStr property.</param>
        /// <param name="incEnd">Initial value of the IncEnd property.</param>
        /// <param name="incDex">Initial value of the IncDex property.</param>
        /// <param name="incInt">Initial value of the IncInt property.</param>
        /// <param name="incSpr">Initial value of the IncSpr property.</param>
        public static Equip CreateEquip(global::System.Int32 id, global::System.Int32 owner, global::System.Int16 slot, global::System.Int32 equipID, global::System.Byte upgrades, global::System.Byte incStr, global::System.Byte incEnd, global::System.Byte incDex, global::System.Byte incInt, global::System.Byte incSpr)
        {
            Equip equip = new Equip();

            equip.ID       = id;
            equip.Owner    = owner;
            equip.Slot     = slot;
            equip.EquipID  = equipID;
            equip.Upgrades = upgrades;
            equip.IncStr   = incStr;
            equip.IncEnd   = incEnd;
            equip.IncDex   = incDex;
            equip.IncInt   = incInt;
            equip.IncSpr   = incSpr;
            return(equip);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Create a new Equip object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="owner">Initial value of the Owner property.</param>
 /// <param name="slot">Initial value of the Slot property.</param>
 /// <param name="equipID">Initial value of the EquipID property.</param>
 /// <param name="upgrades">Initial value of the Upgrades property.</param>
 /// <param name="incStr">Initial value of the IncStr property.</param>
 /// <param name="incEnd">Initial value of the IncEnd property.</param>
 /// <param name="incDex">Initial value of the IncDex property.</param>
 /// <param name="incInt">Initial value of the IncInt property.</param>
 /// <param name="incSpr">Initial value of the IncSpr property.</param>
 public static Equip CreateEquip(global::System.Int32 id, global::System.Int32 owner, global::System.Int16 slot, global::System.Int32 equipID, global::System.Byte upgrades, global::System.Byte incStr, global::System.Byte incEnd, global::System.Byte incDex, global::System.Byte incInt, global::System.Byte incSpr)
 {
     Equip equip = new Equip();
     equip.ID = id;
     equip.Owner = owner;
     equip.Slot = slot;
     equip.EquipID = equipID;
     equip.Upgrades = upgrades;
     equip.IncStr = incStr;
     equip.IncEnd = incEnd;
     equip.IncDex = incDex;
     equip.IncInt = incInt;
     equip.IncSpr = incSpr;
     return equip;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Equips EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEquips(Equip equip)
 {
     base.AddObject("Equips", equip);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Equips EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEquips(Equip equip)
 {
     base.AddObject("Equips", equip);
 }
Exemplo n.º 9
0
        public static Equip LoadEquip(DataRow row)
        {
            ulong uniqueID = GetDataTypes.GetUlong(row["ID"]);
            uint owner = GetDataTypes.GetUint(row["Owner"]);
            ushort equipID = GetDataTypes.GetUshort(row["EquipID"]);
            sbyte slot = GetDataTypes.GetSByte(row["Slot"]);
            byte upgrade = GetDataTypes.GetByte(row["Upgrades"]);

            ushort strByte = GetDataTypes.GetUshort(row["iSTR"]);
            ushort endByte = GetDataTypes.GetUshort(row["iEND"]);
            ushort dexByte = GetDataTypes.GetUshort(row["iDEX"]);
            ushort sprByte = GetDataTypes.GetUshort(row["iSPR"]);
            ushort intByte = GetDataTypes.GetUshort(row["iINT"]);
            Equip equip = new Equip(owner, equipID, slot)
            {
                UniqueID = uniqueID,
                Upgrades = upgrade,
                Str = strByte,
                End = endByte,
                Dex = dexByte,
                Spr = sprByte,
                Int = intByte
            };
            return equip;
        }
Exemplo n.º 10
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)
            //NOTE: Check the SHN's for this -> Moved to database
            BaseStatsEntry stats = DataProvider.Instance.JobBasestats[job];
            if (stats == null)
            {
                //NOTE be serious.. please
                // Log.WriteLine(LogLevel.Warn, "Houston, we have a problem! Jobstats not found for job {0}", job.ToString());
                Log.WriteLine(LogLevel.Error, "Jobstats not found for job {0}", job.ToString());
                return null;
            }
            Database.Storage.LookInfo newLook = new Database.Storage.LookInfo();
            Database.Storage.PositionInfo newPos = new Database.Storage.PositionInfo();
            Database.Storage.Character newchar = new Database.Storage.Character();
            newchar.AccountID = this.AccountID;
            newchar.CharLevel = 1;
            newchar.Name = name;
            newLook.Face = face;
            newLook.Hair = hair;
            newLook.HairColor = color;
            newchar.Job = (byte)job;
            newLook.Male = ismale;
            newchar.Slot = slot;
            newPos.XPos = 7636;
            newPos.YPos = 4610;
            newchar.HP = (short)stats.MaxHP;
            newchar.SP = (short)stats.MaxSP;
            newchar.HPStones = (short)stats.MaxHPStones;
            newchar.SPStones = (short)stats.MaxSPStones;
            newchar.LookInfo = newLook;
            newchar.PositionInfo = newPos;
            int charID = newchar.ID;
             DatabaseClient client = Program.DatabaseManager.GetClient();

             string query =
                 "INSERT INTO `characters` " +
                 "(`AccountID`,`Name`,`MasterJoin`,`Slot`,`Job`,`Male`,`Hair`,`HairColor`,`Face`," +
                 " `QuickBar`, `QuickBarState`, `ShortCuts`, `GameSettings`, `ClientSettings`) " +
                 "VALUES " +
                     "('" + newchar.AccountID +
                     "', '" + newchar.Name +
                     "', '" + DateTime.Now.ToDBString() +
                        "', " +		newchar.Slot +
                        ", " +		newchar.Job  +
                        ", " +		Convert.ToByte(newchar.LookInfo.Male) +
                        ", " +		newchar.LookInfo.Hair +
                        ", " +		newchar.LookInfo.HairColor +
                        ", " +		newchar.LookInfo.Face +
                        ", " +      "0" +
                        ", " +      "0" +
                        ", " +      "0" +
                        ", " +      "0" +
                        ", " +      "0" +
                        ")";
                client.ExecuteQuery(query);

            WorldCharacter tadaa = new WorldCharacter(newchar,this);
            ushort begineqp = GetBeginnerEquip(job);

            if (begineqp > 0)
            {
                sbyte eqp_slot = (sbyte)((job == Job.Archer) ? -10 : -12); //, (job == Job.Archer) ? (byte)12 : (byte)10, begineqp)
                Equip eqp = new Equip((uint)newchar.ID, begineqp, eqp_slot);
                tadaa.Inventory.AddToEquipped(eqp);
                client.ExecuteQuery("INSERT INTO equips (owner,slot,EquipID) VALUES ('"+tadaa.ID+"','"+eqp_slot+"','"+eqp.EquipID+"')");
            }
            Characters.Add(slot, tadaa);
            return tadaa;
        }