Example #1
0
        private static bool GetArtifacts(out Hashtable lst, out Dictionary<Heros.ArtifactLevelEnum, Hashtable> artifactKLevelKIds)
        {
            lst = new Hashtable();
            artifactKLevelKIds = new Dictionary<Heroes.Core.Heros.ArtifactLevelEnum, Hashtable>();

            using (StreamReader sr = new StreamReader(string.Format(@"{0}\Data\Artifact.txt", _appStartupPath)))
            {
                string strLine = "";
                strLine = sr.ReadLine();    // 1st line is column header

                while (!sr.EndOfStream)
                {
                    strLine = sr.ReadLine();

                    // id,name,part,rank,a,d,p,k,skillId,effect,dur,speed,morale,luck,life,w,m,o,s,c,g,gold,img,desc
                    string[] datas = strLine.Split(new char[] { ',' }, 24);

                    Heros.Artifact dr = new Heros.Artifact();
                    dr._id = System.Convert.ToInt32(datas[0]);
                    dr._name = datas[1];
                    dr._equipPart = (Heroes.Core.Heros.EquipPartEnum)System.Convert.ToInt32(datas[2]);
                    dr._level = (Heroes.Core.Heros.ArtifactLevelEnum)System.Convert.ToInt32(datas[3]);

                    dr._attack = System.Convert.ToInt32(datas[4]);
                    dr._defense = System.Convert.ToInt32(datas[5]);
                    dr._power = System.Convert.ToInt32(datas[6]);
                    dr._knowledge = System.Convert.ToInt32(datas[7]);

                    dr._skillId = System.Convert.ToInt32(datas[8]);
                    dr._effect = System.Convert.ToInt32(datas[9]);
                    dr._duration = System.Convert.ToInt32(datas[10]);
                    dr._speed = System.Convert.ToInt32(datas[11]);
                    dr._morale = System.Convert.ToInt32(datas[12]);
                    dr._luck = System.Convert.ToInt32(datas[13]);
                    dr._life = System.Convert.ToInt32(datas[14]);

                    dr._wood = System.Convert.ToInt32(datas[15]);
                    dr._mercury = System.Convert.ToInt32(datas[16]);
                    dr._ore = System.Convert.ToInt32(datas[17]);
                    dr._sulfur = System.Convert.ToInt32(datas[18]);
                    dr._crystal = System.Convert.ToInt32(datas[19]);
                    dr._gem = System.Convert.ToInt32(datas[20]);
                    dr._gold = System.Convert.ToInt32(datas[21]);

                    //if (datas[22] == "0")
                    //{
                    //    System.Diagnostics.Debug.WriteLine("");
                    //}

                    dr._infoImgFileName = string.Format(@"{0}\Images\Core\Artifacts\Info\{1}", _appStartupPath, datas[22]);

                    dr._description = datas[23];

                    lst.Add(dr._id, dr);

                    // group by level
                    Hashtable artifactKIds = null;
                    if (artifactKLevelKIds.ContainsKey(dr._level))
                        artifactKIds = artifactKLevelKIds[dr._level];
                    else
                    {
                        artifactKIds = new Hashtable();
                        artifactKLevelKIds.Add(dr._level, artifactKIds);
                    }

                    artifactKIds.Add(dr._id, dr);
                }
            }

            return true;
        }
Example #2
0
        public void CopyFrom(Artifact a)
        {
            this._id = a._id;
            this._name = a._name;
            this._description = a._description;
            this._infoImgFileName = a._infoImgFileName;

            this._equipPart = a._equipPart;
            this._level = a._level;

            this._attack = a._attack;
            this._defense = a._defense;
            this._power = a._power;
            this._knowledge = a._knowledge;

            this._isEquiped = a._isEquiped;
        }