//--------------------------------------------------------------------------- private void TfrmDBStatus_FormCreate(object sender, EventArgs e) { TGnuGettextInstance.TranslateComponent(this); string sql = "select alb.cnt as alb, hib.cnt as hib, mid.cnt as mid, arte.cnt as arte, alle.cnt as alle"; sql = sql + " from (select count(*) as cnt from items where realm = 1) as alb,"; sql = sql + " (select count(*) as cnt from items where realm = 2) as hib,"; sql = sql + " (select count(*) as cnt from items where realm = 4) as mid,"; sql = sql + " (select count(*) as cnt from items where maxlevel > 0) as arte,"; sql = sql + " (select count(*) as cnt from items) as alle"; ZQuery.CommandText = sql; ZQuery.Open(); lbAlbion.Text = ZQuery.FieldByName("alb").AsString; lbHibernia.Text = ZQuery.FieldByName("hib").AsString; lbMidgard.Text = ZQuery.FieldByName("mid").AsString; lbArtifacts.Text = ZQuery.FieldByName("arte").AsString; lbSum.Text = ZQuery.FieldByName("alle").AsString; ZQuery.Close(); lbDBVersion.Text = SQLiteUtils.SQLiteDBVersion(ZQuery).ToString(); lbDBVersion.SetHint(ZQuery.Connection.GetDataSource()); int size = (int)(new FileInfo(ZQuery.Connection.GetDataSource()).Length / 1024.0); lbDBSize.Text = string.Format("{0:N0} KByte", size); lbSysLang.Text = Unit.xml_config.sysLanguage; }
//--------------------------------------------------------------------------- private void FillOnlineDB() { string sql = "select provider from items group by provider"; ZQuery.CommandText = sql; ZQuery.Open(); cbOnlineDB.Items.Clear(); cbOnlineDB.Items.Add(_("<Alle>")); string provider = ""; while (!ZQuery.GetEof()) { provider = ZQuery.FieldByName("provider").AsString; cbOnlineDB.Items.Add(provider); ZQuery.Next(); } ZQuery.Close(); cbOnlineDB.SelectedIndex = 0; }
//--------------------------------------------------------------------------- private void SearchForItems() { int i; Cursor cCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { stStatus.Text = _("Suche Gegenstände..."); Application.DoEvents(); vtItems.ClearObjects(); FreeSearchedItems(); string sql = ""; string fsql = ""; sql = "select *"; sql = sql + " from items i"; fsql = FilterSQL(fsql, "i.level >= " + (iMinLevel).ToString()); fsql = FilterSQL(fsql, "i.level <= " + (iMaxLevel).ToString()); if (sExtensions != "") { fsql = FilterSQL(fsql, "i.extension not in (" + sExtensions + ")"); } if (iRealm != 7) { fsql = FilterSQL(fsql, "i.realm in (7," + (iRealm).ToString()) + ")"; } if (iPosition >= 0) { fsql = FilterSQL(fsql, "i.position = " + (iPosition).ToString()); } if (iType >= 0) { fsql = FilterSQL(fsql, "i.class = " + (iType).ToString()); } if (sName != "") { fsql = FilterSQL(fsql, "i.name like '%" + sName + "%'"); } if (cbBonus.CurrentData >= 0 && iBonusValue > 0) { fsql = FilterSQL(fsql, "i.effects like '%" + Unit.xml_config.arBonuses[cbBonus.CurrentData].id + "%'"); } if (iOnlineDB > 0) { fsql = FilterSQL(fsql, "i.provider = " + Utils.QuotedStr((string)cbOnlineDB.Items[iOnlineDB], '\'')); } if (fsql != "") { sql = sql + " where " + fsql; } if (Unit.xml_config.bDebugSQL) { Utils.DebugPrint(sql); } ZQuery.CommandText = sql; ZQuery.Open(); bool bFound; int index; CItem Item; CPlayerAttributes xTempAttributes = new CPlayerAttributes(); // Kopie der aktuellen Attribute if (bCalcTotalUtility && bSearchMode) { xTempAttributes = Unit.player.Attributes; if (Unit.player.Item[iBasePos].bEquipped) { xTempAttributes -= Unit.player.Item[iBasePos]; } } while (!ZQuery.GetEof()) { Item = Unit.ItemDB.GetItem(ZQuery); Item.sNutzen = Item.CalcNutzen(); bFound = true; // Kann Item von der Klasse benutzt werden? if (!Item.isUseable(iClass)) { bFound = false; } else if (iMinUtility > -1 && Item.sNutzen < iMinUtility) { bFound = false; } else if (iMaxUtility < 1000 && Item.sNutzen > iMaxUtility) { bFound = false; } else if (cbBonus.CurrentData >= 0 && Item.GetBonusEffect(cbBonus.CurrentData) < iBonusValue) { bFound = false; } // Wenn bFound hier noch true, dann Item in Liste übernehmen if (bFound) { if (bCalcTotalUtility) { if (bSearchMode) { xTempAttributes += Item; Item.sGesamt = xTempAttributes.CalcGesamtNutzen(Unit.player.Weights); xTempAttributes -= Item; } else { Item.sGesamt = Item.sNutzen; } } arSearchItems.Length++; arSearchItems[arSearchItems.Length - 1] = Item; } else { //delete Item; Item = null; } ZQuery.Next(); } ZQuery.Close(); stStatus.Text = (arSearchItems.Length).ToString() + _(" Gegenstände gefunden."); Application.DoEvents(); vtItems.ObjectsCount = arSearchItems.Length; //vtItems.Sort(vtItems.PrimarySortColumn, vtItems.PrimarySortOrder); } finally { Cursor.Current = cCursor; } }