Exemple #1
0
        public static int CreateBuff(int tmplBuffId, string modDesc)            //A*(x+B)+C
        {
            // TODO : code to catch exception while tmplBuff == null
            SkBuff tmplBuff = s_SkBuffTbl[tmplBuffId];
            SkBuff buff     = new SkBuff();

            buff._id         = ++s_maxId;
            buff._icon       = tmplBuff._icon;
            buff._desc       = tmplBuff._desc;
            buff._name       = tmplBuff._name;
            buff._type       = tmplBuff._type;
            buff._priority   = tmplBuff._priority;
            buff._stackLimit = tmplBuff._stackLimit;
            buff._lifeTime   = tmplBuff._lifeTime;
            buff._interval   = tmplBuff._interval;
            buff._mods       = SkAttribsModifier.Create(modDesc);
            buff._eff        = tmplBuff._eff;
            buff._effBeg     = tmplBuff._effBeg;
            buff._effEnd     = tmplBuff._effEnd;
            s_SkBuffTbl.Add(buff._id, buff);
            if (s_maxId < buff._id)
            {
                s_maxId = buff._id;
            }
            return(s_maxId);
        }
Exemple #2
0
        public static void LoadData()
        {
            if (s_SkBuffTbl != null)
            {
                return;
            }

            SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("skBuff");

            //reader.Read(); // skip title if needed
            s_SkBuffTbl = new Dictionary <int, SkBuff>();
            while (reader.Read())
            {
                SkBuff buff = new SkBuff();
                buff._id         = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_id")));
                buff._desc       = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_desc")));
                buff._icon       = reader.GetString(reader.GetOrdinal("_icon"));
                buff._name       = reader.GetString(reader.GetOrdinal("_name"));
                buff._type       = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_type")));
                buff._priority   = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_priority")));
                buff._stackLimit = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_stackLimit")));
                buff._lifeTime   = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_timeActive")));
                buff._interval   = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_timeInterval")));
                buff._mods       = SkAttribsModifier.Create(reader.GetString(reader.GetOrdinal("_mods")));
                SkEffect.s_SkEffectTbl.TryGetValue(Convert.ToInt32(reader.GetString(reader.GetOrdinal("_eff"))), out buff._eff);
                SkEffect.s_SkEffectTbl.TryGetValue(Convert.ToInt32(reader.GetString(reader.GetOrdinal("_effBeg"))), out buff._effBeg);
                SkEffect.s_SkEffectTbl.TryGetValue(Convert.ToInt32(reader.GetString(reader.GetOrdinal("_effEnd"))), out buff._effEnd);

                try{
                    s_SkBuffTbl.Add(buff._id, buff);
                }catch (Exception e)     {
                    Debug.LogError("Exception on skBuff " + buff._id + " " + e);
                }
                if (s_maxId < buff._id)
                {
                    s_maxId = buff._id;
                }
            }
        }
Exemple #3
0
        public static void LoadData()
        {
            if (s_SkillTbl != null)
            {
                return;
            }
#if DBG_COL_ATK
            SkDebug.LoadIds();
#endif
            SkEffect.LoadData();
            SkBuff.LoadData();
            SkTriggerEvent.LoadData();

            SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("skMain");
            //reader.Read(); // skip title if needed
            s_SkillTbl = new Dictionary <int, SkData>();
            while (reader.Read())
            {
                SkData skill = new SkData();
                skill._id                = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_id")));
                skill._desc              = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_desc")));
                skill._icon              = reader.GetString(reader.GetOrdinal("_icon"));
                skill._name              = reader.GetString(reader.GetOrdinal("_name"));
                skill._interruptable     = reader.GetString(reader.GetOrdinal("_interruptable")).Equals("1");
                skill._coolingTime       = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_coolingTime")));
                skill._coolingTimeType   = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_coolingTimeType")));
                skill._coolingTimeShared = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_coolingTimeShared")));

                skill._pretimeOfPrepare = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_pretimeOfPrepare")));
                skill._postimeOfPrepare = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_postimeOfPrepare")));
                SkEffect.s_SkEffectTbl.TryGetValue(Convert.ToInt32(reader.GetString(reader.GetOrdinal("_effPrepare"))), out skill._effPrepare);

                skill._condToLoop      = SkCond.Create(reader.GetString(reader.GetOrdinal("_cond")));
                skill._pretimeOfMain   = ToSingleArray(reader.GetString(reader.GetOrdinal("_pretimeOfMain")));
                skill._timeOfMain      = ToSingleArray(reader.GetString(reader.GetOrdinal("_timeOfMain")));
                skill._postimeOfMain   = ToSingleArray(reader.GetString(reader.GetOrdinal("_postimeOfMain")));
                skill._effMainEachTime = ToSkEffectArray(reader.GetString(reader.GetOrdinal("_effMainEachTime")));
                SkEffect.s_SkEffectTbl.TryGetValue(Convert.ToInt32(reader.GetString(reader.GetOrdinal("_effMainOneTime"))), out skill._effMainOneTime);

                string[] strEventsList = reader.GetString(reader.GetOrdinal("_triggerEvents")).Split(';');
                foreach (string strEvents in strEventsList)
                {
                    List <SkTriggerEvent> curEvents = new List <SkTriggerEvent>();
                    string[] strCurEvents           = strEvents.Split(',');
                    foreach (string strEvent in strCurEvents)
                    {
                        int            eventId = Convert.ToInt32(strEvent);
                        SkTriggerEvent curEvent;
                        SkTriggerEvent.s_SkTriggerEventTbl.TryGetValue(eventId, out curEvent);
                        if (curEvent != null)
                        {
                            curEvents.Add(curEvent);
                        }
                    }
                    skill._events.Add(curEvents);
                }

                skill._pretimeOfEnding = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_pretimeOfEnding")));
                skill._postimeOfEnding = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_postimeOfEnding")));
                SkEffect.s_SkEffectTbl.TryGetValue(Convert.ToInt32(reader.GetString(reader.GetOrdinal("_effEnding"))), out skill._effEnding);

                try{
                    s_SkillTbl.Add(skill._id, skill);
                }catch (Exception e)     {
                    Debug.LogError("Exception on skMain " + skill._id + " " + e);
                }
            }

            new Thread(new ThreadStart(SkInst.s_ExpCompiler.Compile)).Start();
            //SkInst.s_ExpCompiler.Compile();
        }