Esempio n. 1
0
        private void listView_skills_SelectedIndexChanged(object sender, EventArgs e)
        {
            string text = "";

            if (listView_skills.SelectedIndices.Count > 0)
            {
                uint      id = Util.GetUInt32(listView_skills.Items[listView_skills.SelectedIndices[0]].SubItems[2].Text);
                UserSkill us = null;

                if (Globals.SkillListLock.TryEnterReadLock(Globals.THREAD_WAIT_GUI))
                {
                    try
                    {
                        us = Util.GetSkill(id);
                    }
                    finally
                    {
                        Globals.SkillListLock.ExitReadLock();
                    }
                }

                if (us != null)
                {
                    text = Util.GetSkillName(us.ID, us.Level) + Environment.NewLine +
                           "Level: " + us.Level.ToString() + Environment.NewLine +
                           (us.Passive == 0x01 ? "Passive" : "Active") + Environment.NewLine +
                           Util.GetSkillDesc(us.ID, us.Level, 1) + Environment.NewLine +
                           Util.GetSkillDesc(us.ID, us.Level, 2) + Environment.NewLine +
                           Util.GetSkillDesc(us.ID, us.Level, 3) + Environment.NewLine +
                           "Type ID: " + us.ID;
                }
            }

            toolTip1.SetToolTip(listView_skills, text);
        }
Esempio n. 2
0
        static public int GetSkillReuse(uint id)
        {
            long      getskill_reuse = 0;
            UserSkill us             = Util.GetSkill(id);

            if (us.IsReady())
            {
                getskill_reuse = 0;
            }
            else
            {
                getskill_reuse = (us.NextTime.Ticks - System.DateTime.Now.Ticks) / System.TimeSpan.TicksPerMillisecond;
            }
            return((int)getskill_reuse);
        }
Esempio n. 3
0
        public bool IsReady()
        {
            Globals.SkillListLock.EnterReadLock();
            try
            {
                if (Globals.gamedata.skills.ContainsKey(SkillID))
                {
                    UserSkill us = Util.GetSkill(SkillID);

                    if (us.IsReady())
                    {
                        return(true);
                    }
                }
            }
            finally
            {
                Globals.SkillListLock.ExitReadLock();
            }
            return(false);
        }
Esempio n. 4
0
        public static void SkillList(ByteBuffer buffe)
        {
            uint cnt = 0;
            if (Globals.gamedata.Chron < Chronicle.CT3_0)
            {
                 cnt = buffe.ReadUInt32();
            }
            else
            {
                cnt = buffe.ReadUInt16();
            }

            Globals.SkillListLock.EnterWriteLock();
            try
            {
                //flag all our skills as possibly old
                foreach (UserSkill old_us in Globals.gamedata.skills.Values)
                {
                    old_us.OldSkill = true;
                }

                //load all of our new skill
                for (uint i = 0; i < cnt; i++)
                {
                    UserSkill us = new UserSkill();
                    if (Globals.gamedata.Chron >= Chronicle.CT3_0)
                    {
                        buffe.ReadUInt16(); //dunno
                    }
                    us.Passive = buffe.ReadUInt32();
                    us.Level = buffe.ReadUInt32();
                    us.ID = buffe.ReadUInt32();
                    buffe.ReadByte();//dunno what the new 1 byte is

                    if (Globals.gamedata.Chron >= Chronicle.CT2_4)
                    {
                        buffe.ReadByte();//dunno what the new 1 byte is
                    }

                    if (Globals.gamedata.Chron >= Chronicle.CT3_0)
                    {
                        buffe.ReadByte(); //FF
                        buffe.ReadByte(); //FF
                    }

                    //us.NextTime = new System.DateTime(0L); //System.DateTime.Now.AddMilliseconds(Globals.SKILL_INIT_REUSE);
                    //us.LastTime = new System.DateTime(0L);//start at the begining of time

                    if (Globals.gamedata.skills.ContainsKey(us.ID))
                    {
                        ((UserSkill)Globals.gamedata.skills[us.ID]).Level = us.Level;
                        ((UserSkill)Globals.gamedata.skills[us.ID]).OldSkill = false;
                    }
                    else
                    {
                        Globals.gamedata.skills.Add(us.ID, us);
                    }
                }

                //remove all of our old skills
                System.Collections.ArrayList dirty_items = new System.Collections.ArrayList();

                foreach (UserSkill old_us in Globals.gamedata.skills.Values)
                {
                    if (old_us.OldSkill)
                    {
                        dirty_items.Add(old_us.ID);
                    }
                }

                for (int i = 0; i < dirty_items.Count; i++)
                {
                    Globals.gamedata.skills.Remove((uint)dirty_items[i]);
                }
                dirty_items.Clear();
            }
            finally
            {
                Globals.SkillListLock.ExitWriteLock();
                if (Globals.show_active_skills)
                {
                    AddInfo.Set_SkillList(1);
                }
                else
                {
                    AddInfo.Set_SkillList(0);
                }
            }
        }