Ejemplo n.º 1
0
    public bool MoveNext()
    {
        int rgelt;
        int pceltFetched;

        if (this.m_IEnumItem.Next(1, out rgelt, out pceltFetched) != 0)
        {
            return(false);
        }
        if (rgelt != 0)
        {
            this.m_Current = new CItem();
            CItem   citem  = this.m_Current;
            IPStore PStore = this.m_IPStore;
            int     num    = (int)this.m_KeyType;
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            Guid& guidType = @this.m_TypeGuid;
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            Guid&  guidSubType = @this.m_SubTypeGuid;
            IntPtr ptr         = new IntPtr(rgelt);
            string szItemName  = this.CopyString(ptr);
            citem.Init(PStore, (PST_KEY)num, guidType, guidSubType, szItemName);
            ptr = new IntPtr(rgelt);
            Marshal.FreeCoTaskMem(ptr);
        }
        return(true);
    }
Ejemplo n.º 2
0
        public CItem GetItem(SQLiteCommand ZQuery)    // Liefert ein Item anhand eines aktuellen Datensatzes
        {
            CItem item = new CItem();

            item.Init();

            item.Name         = ZQuery.FieldByName("name").AsString;
            item.NameOriginal = ZQuery.FieldByName("nameoriginal").AsString;
            item.Origin       = ZQuery.FieldByName("origin").AsString;
            item.Description  = ZQuery.FieldByName("description").AsString;
            item.OnlineURL    = ZQuery.FieldByName("onlineurl").AsString;
            item.Extension    = ZQuery.FieldByName("extension").AsString;
            item.Provider     = ZQuery.FieldByName("provider").AsString;
            item.SetClassRestrictionStr(ZQuery.FieldByName("classrestrictions").AsString);
            item.SetEffectStr(ZQuery.FieldByName("effects").AsString);
            item.Realm      = ZQuery.FieldByName("realm").AsInteger;
            item.Position   = ZQuery.FieldByName("position").AsInteger;
            item.Type       = (EItemType)ZQuery.FieldByName("type").AsInteger;
            item.Level      = ZQuery.FieldByName("level").AsInteger;
            item.Quality    = ZQuery.FieldByName("quality").AsInteger;
            item.Bonus      = ZQuery.FieldByName("bonus").AsInteger;
            item.Class      = ZQuery.FieldByName("class").AsInteger;
            item.SubClass   = ZQuery.FieldByName("subclass").AsInteger;
            item.Material   = ZQuery.FieldByName("material").AsInteger;
            item.AF         = ZQuery.FieldByName("af").AsInteger;
            item.DPS        = ZQuery.FieldByName("dps").AsInteger;
            item.Speed      = ZQuery.FieldByName("speed").AsInteger;
            item.DamageType = ZQuery.FieldByName("damagetype").AsInteger;
            item.MaxLevel   = ZQuery.FieldByName("maxlevel").AsInteger;
            if (item.MaxLevel > 0)
            {
                item.CurLevel = item.MaxLevel;
            }
            item.LastUpdate = Utils.UnixToDateTime(ZQuery.FieldByName("lastupdate").AsInteger);

            return(item);
        }
Ejemplo n.º 3
0
        //TODO: fix false indexes from delphi conversion
        // Diese Funktion macht die eigentliche Lesearbeit
        // Input ist dabei der Index des zu beschaffenden Items und einen Zeiger
        // auf eine CItem-Klasse, welche ausgefüllt werden soll
        // Rückgabe ist true für keinen Fehler
        public bool GetItem(int index, CItem Item)      // Liest das spezifizierte Item
        {
            int           i;
            string        Line;                                    // Hier eine maximale Länge eines Textes heruasfinden
            StringBuilder sArg            = new StringBuilder(64); // Längere Bonusbezeichnungen gibts glaub nicht
            int           NextBonus       = 0;                     // Welche Position soll der nächste Bonus eingetragen werden
            int           NextRestriction = 0;                     // Nächster Index einer Klassenbeschränkung
            bool          bRestriction    = false;

            if ((index < 0) && (index >= nItems))
            {
                return(false);                                  // Itemindex nicht im gültigen Bereich
            }
            Item.Init();
            Item.Name    = arItemNames.Strings[index];
            Item.Realm   = Unit.player.Realm;   // Immer Realm des Spielers annehmen
            Item.Quality = 0;
            // Versuche Aufgrund des Namen auf den Itemslot zu schliessen
            string strTemp = Item.Name.ToLower();

            for (i = 0; i < 18; i++)
            {
                for (int j = 0; j < Unit.xml_config.arItemSlots[i].arIds.Length; j++)
                {
                    if (strTemp.IndexOf(Unit.xml_config.arItemSlots[i].arIds[j]) > -1)
                    {
                        Item.Position = i;
                    }
                }
            }
            // Lesezeiger auf Beginn der entsprechenden Info-Sektion stellen
            fChatLog.BaseStream.Flush(); // Ist nötig, da wir eventuell noch im eof-state sind
            fChatLog.BaseStream.Seek(arOffsets[index], SeekOrigin.Begin);
            Line = fChatLog.ReadLine();  // Erste Zeile Lesen (kann ignoriert werden)
            Line = fChatLog.ReadLine();  // Erste Zeile mit Infos
            while (!fChatLog.EndOfStream)
            {
                Debug.Assert(Line.Length < 1024);
                int Value = 0;
                // Ist Info-Sektion zu Ende?
                int pStart = Line.IndexOf(strInfoStop);
                if (pStart != -1)
                {
                    break;
                }
                if (Line.Length > 11 && Line[11] == '-')
                {       // Alles danach ist ein Wert, der mich interessiert
                    // Suche erstmal nach einem Zahlenwert. Sollte immer nur einer sein
                    // Bonus-Argument ist immer der String vor einem Doppelpunkt,
                    // oder der String hinter einer Zahl
                    bool bValue   = false; // Gibts eine Zahl?
                    bool bDoppel  = false; // gibt es einen Doppelpunkt im String
                    bool bPercent = false; // Es ist ein Prozent-Wert
                    sArg.Length = 0;       // Aktuelle Position im Argument-String
                    for (i = 13; i < Line.Length; i++)
                    {
                        if ((Line[i] >= '0') && (Line[i] <= '9'))
                        {
                            bValue = true;
                            Value  = Value * 10 + Line[i] - '0';
                        }
                        else if (Line[i] == ':')
                        {
                            bDoppel = true;
                        }
                        else if (Line[i] == ' ')
                        {
                            if (bValue && (bDoppel || (sArg.Length > 0)))
                            {
                                break;
                            }
                            sArg.Length = 0;
                        }
                        else if (Line[i] == '%')
                        {
                            bPercent = true;
                        }
                        else if ((Line[i] == '\r') || (Line[i] == '.'))
                        {
                        }                                                       // Diese Zeichen ignorieren
                        else
                        {
                            sArg.Append(Line[i]);
                        }
                    }
                    if (bValue)
                    {   // In xml_config nach einem entsprechendem Boni suchen
                        int bid = Unit.xml_config.GetBonusId(sArg.ToString(), bPercent);
                        if (bid < 0)
                        {       // testen, ob der gesamte Text nicht vielleicht doch ein Bonus ist
                            bid = Unit.xml_config.GetBonusId(Line.Substring(14, i - 16), bPercent);
                        }
                        if (bid >= 0)
                        {       // Es ist ein regulärer Bonus
                            Item.Effect[NextBonus]      = bid;
                            Item.EffectValue[NextBonus] = Value;
                            NextBonus++;
                        }
                        else
                        {       // Hier ein paar zusätzliche Werte nehmen, die keine Boni sind
                            if (string.Compare(sArg.ToString(), strAF) == 0)
                            {
                                Item.AF = Value;
                            }
                            if (string.Compare(sArg.ToString(), strQuality) == 0)
                            {
                                Item.Quality = Value;
                            }
                            if (string.Compare(sArg.ToString(), strSpeed) == 0)
                            {
                                Item.Speed = Value;
                            }
                            if (string.Compare(sArg.ToString(), strAbsorb) == 0)
                            {   // Value in Rüstungsklasse umwandeln
                                switch (Value)
                                {
                                case 0: Item.Class = 0; Item.Level = Item.AF; break;

                                case 10: Item.Class = 1; Item.Level = Item.AF / 2; break;

                                case 19: Item.Class = 2; Item.Level = Item.AF / 2; break;

                                case 27: Item.Class = 3; Item.Level = Item.AF / 2; break;

                                case 34: Item.Class = 4; Item.Level = Item.AF / 2; break;
                                }
                                //if (Item.Position < 0)
                                //	Item.Position = 0;	// Alle Rüstungen als Handschuhe annehmen
                                // Es gibt leider keine Info darüber im Log
                                // Wenn wir die Position auf -1 lassen, dann kommt automatisch eine Auswahlbox
                            }
                            if (string.Compare(sArg.ToString(), "DPS") == 0)
                            {   // Nur ersten DPS-Wert speichern
                                if (Item.DPS == 0)
                                {
                                    Item.DPS = Value;
                                    // Berechne den Itemlevel
                                    int level = (Value - 11) / 3;
                                    if (level > 51)
                                    {
                                        level = 51;
                                    }
                                    Item.Level = level;
                                }
                            }
                        }
                    }
                }
                //		else
                {       // noch ein paar besondere Strings auswerten
                    if (string.Compare(Line, 11, strUnique, 0, strUnique.Length) == 0)
                    {   // Unique Gegenstände nicht importieren
                        return(false);
                    }
                    if (string.Compare(Line, 11, strCrafted, 0, strCrafted.Length) == 0)
                    {   // Craftet Gegenstände nicht importieren
                        return(false);
                    }
                    if (string.Compare(Line, 11, strArtifact, 0, strArtifact.Length) == 0)
                    {
                        Item.MaxLevel = 10;
                        Item.Realm    = 7;
                    }
                    if ((string.Compare(Line, 11, strBonus, 0, strBonus.Length) == 0) ||
                        (string.Compare(Line, 11, strBonus2, 0, strBonus2.Length) == 0))
                    {   // Spezielle Werte (meist Bonuserhöhungen)
                        // Bonus auf BONUS: VALUE
                        for (i = 21; i < Line.Length; i++)
                        {       // Alles bis zum Doppelpunkt in sArg kopieren
                            if (Line[i] == ':')
                            {
                                break;
                            }
                            sArg[i - 21] = Line[i];
                        }
                        sArg.Length = i - 21;
                        for (; i < Line.Length; i++)
                        {
                            if ((Line[i] >= '0') && (Line[i] <= '9'))
                            {
                                Value = Value * 10 + Line[i] - '0';
                            }
                        }
                        // In xml_config nach einem entsprechendem Boni suchen
                        int bid = Unit.xml_config.GetBonusId(sArg.ToString());
                        if (bid >= 0)
                        {       // Es ist ein regulärer Bonus
                            Item.Effect[NextBonus]      = bid;
                            Item.EffectValue[NextBonus] = Value;
                            NextBonus++;
                        }
                        else
                        {       // Fehlermeldung
                            MessageBox.Show("Ein Bonus '" + sArg.ToString() + "' ist unbekannt!\nDie Datei 'config.xml' bzw. die entsprechende Sprachdatei anpassen!", "Fehler");
                        }
                    }
                    if (string.Compare(Line, 11, strActivLevel, 0, strActivLevel.Length) == 0)
                    {   // Danach kommt ne Zahl, welche den Level angibt
                        int level = Utils.Str2Int(Line, 11 + strActivLevel.Length);
                        Item.EffectLevel[NextBonus - 1] = level;
                    }
                    int cp = 12;
                    if ((string.Compare(Line, 11, strRestriction, 0, strRestriction.Length) == 0) ||
                        (string.Compare(Line, 12, strRestriction, 0, strRestriction.Length) == 0))
                    {   // Solange nachfolgende Strings eine Klasse darstellen, solange
                        // diese bei den Beschränkungen eintragen
                        bRestriction = true;
                        cp           = 12 + strRestriction.Length;
                    }
                    while (bRestriction && (cp < Line.Length))
                    {
                        int pArg = 0;
                        for (; cp < Line.Length; cp++)
                        {
                            if ((Line[cp] == ' ') || (Line[cp] == ',') || (Line[cp] == '-') || (Line[cp] == '\r'))
                            {
                                sArg.Length = pArg;
                                if (pArg > 0)
                                {       // Es gibt einen String. Schauen obs ne Klasse ist
                                    int cid = Unit.xml_config.GetClassId(sArg.ToString());
                                    if (cid >= 0)
                                    {
                                        Item.ClassRestriction[NextRestriction++] = cid;
                                    }
                                    else
                                    {   // Keine Klasse mehr, Modus aufheben
                                        bRestriction = false;
                                    }
                                }
                                pArg = 0;
                            }
                            else
                            {
                                sArg[pArg++] = Line[cp];
                            }
                        }
                    }
                }
                Line = fChatLog.ReadLine();
            }
            return(true);
        }