Esempio n. 1
0
 //---------------------------------------------------------------------------
 public CPlayerAttributes(CPlayerAttributes rhs)
 { // Copy-Konstruktor
     iClass = rhs.iClass;
     iLevel = rhs.iLevel;
     arAttributeStates.Length = rhs.arAttributeStates.Length;
     for (int i = 0; i < arAttributeStates.Length; i++)
     {
         arAttributeStates[i] = rhs.arAttributeStates[i];
     }
     arOthers.Length = rhs.arOthers.Length;
     for (int i = 0; i < arOthers.Length; i++)
     {
         arOthers[i] = rhs.arOthers[i];
     }
 }
Esempio n. 2
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;
            }
        }