コード例 #1
0
ファイル: CMDataBase.cs プロジェクト: DiablosOffens/Moras.Net
        public void UpdateItem(int index, CItem Item)
        {
            int TempPos = Unit.xml_config.GetSlotPosition(Unit.xml_config.arItemSlots[Item.Position].strPosClass);

            string sql = "update items set";

            sql = sql + " name = " + Utils.QuotedStr(Item.Name, '\'');
            sql = sql + ", nameoriginal = " + Utils.QuotedStr(Item.NameOriginal, '\'');
            sql = sql + ", origin = " + Utils.QuotedStr(Item.Origin, '\'');
            sql = sql + ", description = " + Utils.QuotedStr(Item.Description, '\'');
            sql = sql + ", onlineurl = " + Utils.QuotedStr(Item.OnlineURL, '\'');
            sql = sql + ", extension = " + Utils.QuotedStr(Item.Extension, '\'');
            sql = sql + ", provider = " + Utils.QuotedStr(Item.Provider, '\'');
            sql = sql + ", classrestrictions = " + Utils.QuotedStr(Item.GetClassRestrictionStr(), '\'');
            sql = sql + ", effects = " + Utils.QuotedStr(Item.GetEffectStr(), '\'');
            sql = sql + ", realm = " + (Item.Realm).ToString();
            sql = sql + ", position = " + (TempPos).ToString();
            sql = sql + ", type = " + ((int)Item.Type).ToString();
            sql = sql + ", level = " + (Item.Level).ToString();
            sql = sql + ", quality = " + (Item.Quality).ToString();
            sql = sql + ", bonus = " + (Item.Bonus).ToString();
            sql = sql + ", class = " + (Item.Class).ToString();
            sql = sql + ", subclass = " + (Item.SubClass).ToString();
            sql = sql + ", material = " + (Item.Material).ToString();
            sql = sql + ", af = " + (Item.AF).ToString();
            sql = sql + ", dps = " + (Item.DPS).ToString();
            sql = sql + ", speed = " + (Item.Speed).ToString();
            sql = sql + ", damagetype = " + (Item.DamageType).ToString();
            sql = sql + ", maxlevel = " + (Item.MaxLevel).ToString();
            sql = sql + ", lastupdate = " + (Utils.DateTimeToUnix(Item.LastUpdate)).ToString();
            sql = sql + " where id = " + (index).ToString();
            Unit.frmMain.ZQuery.CommandText = sql;
            Unit.frmMain.ZQuery.ExecuteNonQuery();
        }
コード例 #2
0
ファイル: CMDataBase.cs プロジェクト: DiablosOffens/Moras.Net
        // Das übergebene Item wird zur Database hinzugefügt
        // Achtung, es wird nicht geprüft, ob das Item schon einmal in der Datenbank ist
        // Dafür vorher testen
        // gibt die Id in der DB zurück
        public int AddItem(CItem Item)
        {
            if (Item.Position < 0)
            {
                Utils.AskForPosition(Item);
            }

            int TempPos = Unit.xml_config.GetSlotPosition(Unit.xml_config.arItemSlots[Item.Position].strPosClass);

            string sql = "insert into items ";

            sql = sql + "(name, nameoriginal, origin, description, onlineurl, extension, provider, classrestrictions, effects, realm, position, type, level, quality, bonus, class, subclass, material, af, dps, speed, damagetype, maxlevel, lastupdate)";
            sql = sql + " values (" + Utils.QuotedStr(Item.Name, '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.NameOriginal, '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.Origin, '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.Description, '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.OnlineURL, '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.Extension, '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.Provider, '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.GetClassRestrictionStr(), '\'');
            sql = sql + ", " + Utils.QuotedStr(Item.GetEffectStr(), '\'');
            sql = sql + ", " + (Item.Realm).ToString();
            sql = sql + ", " + (TempPos).ToString();
            sql = sql + ", " + ((int)Item.Type).ToString();
            sql = sql + ", " + (Item.Level).ToString();
            sql = sql + ", " + (Item.Quality).ToString();
            sql = sql + ", " + (Item.Bonus).ToString();
            sql = sql + ", " + (Item.Class).ToString();
            sql = sql + ", " + (Item.SubClass).ToString();
            sql = sql + ", " + (Item.Material).ToString();
            sql = sql + ", " + (Item.AF).ToString();
            sql = sql + ", " + (Item.DPS).ToString();
            sql = sql + ", " + (Item.Speed).ToString();
            sql = sql + ", " + (Item.DamageType).ToString();
            sql = sql + ", " + (Item.MaxLevel).ToString();
            sql = sql + ", " + (Utils.DateTimeToUnix(Item.LastUpdate)).ToString() + ")";
            Unit.frmMain.ZQuery.CommandText = sql;
            Unit.frmMain.ZQuery.ExecuteNonQuery();

            return(0);
        }