Пример #1
0
        public void Death(EmbeddedData dat, DbAccount acc, DbChar character, FameStats stats, string killer)
        {
            character.Dead = true;
            SaveCharacter(acc, character, acc.LockToken != null);
            var finalFame = stats.CalculateTotal(dat, character, new DbClassStats(acc), out bool firstBorn);
            var death     = new DbDeath(acc, character.CharId)
            {
                ObjectType = character.ObjectType,
                Level      = character.Level,
                TotalFame  = finalFame,
                Killer     = killer,
                FirstBorn  = firstBorn,
                DeathTime  = DateTime.Now
            };

            death.Flush();

            var idBuff = BitConverter.GetBytes(character.CharId);

            Sets.Remove(0, $"alive.{acc.AccountId}", idBuff);
            Lists.AddFirst(0, $"dead.{acc.AccountId}", idBuff);

            UpdateFame(acc, finalFame);

            var entry = new DbLegendEntry()
            {
                AccId     = int.Parse(acc.AccountId),
                ChrId     = character.CharId,
                TotalFame = finalFame
            };

            DbLegend.Insert(this, death.DeathTime, entry);
        }
Пример #2
0
        public void Death(XmlData dat, DbAccount acc, DbChar character, FameStats stats, string killer)
        {
            character.Dead = true;
            SaveCharacter(acc, character, acc.LockToken != null);
            bool firstBorn;
            var  finalFame = stats.CalculateTotal(dat, character,
                                                  new DbClassStats(acc), out firstBorn);

            DbDeath death = new DbDeath(acc, character.CharId);

            death.ObjectType = character.ObjectType;
            death.Level      = character.Level;
            death.TotalFame  = finalFame;
            death.Killer     = killer;
            death.FirstBorn  = firstBorn;
            death.DeathTime  = DateTime.Now;
            death.Flush();

            byte[] idBuff = BitConverter.GetBytes(character.CharId);
            Sets.Remove(0, "alive." + acc.AccountId, idBuff);
            Lists.AddFirst(0, "dead." + acc.AccountId, idBuff);

            UpdateFame(acc, finalFame);

            DbLegendEntry entry = new DbLegendEntry()
            {
                AccId     = acc.AccountId,
                ChrId     = character.CharId,
                TotalFame = finalFame
            };

            DbLegend.Insert(this, death.DeathTime, entry);
        }
Пример #3
0
        public virtual void InsertCq(Record cq, Key key)
        {
            string strSp = cq.SampleKey;

            //是否需要添加 Sample 到集合中
            if (!Samples.Contains(strSp))
            {
                InsertSample(strSp);
            }

            LLNCC node = Buoy[key];
            //根据 Key 找出 Cq 集合
            CqCollection cqs = null;

            //判断 Buoy 是否有指向
            if (node == null)//Buoy 没指向
            {
                //实例新的集合
                cqs = new CqCollection()
                {
                    Key = key
                };

                cqs.Samples = Samples;
                cqs[strSp]  = cq;
                if (key.Previous != null)
                {
                    node = Lists.AddAfter(Buoy[key.Previous], cqs);
                }
                else
                {
                    node = Lists.AddFirst(cqs);
                }
                Buoy[key] = node;
            }
            else//Buoy 有指向
            {
                LLNCC preNode = null;
                if (key.Previous != null)
                {
                    preNode = Buoy[key.Previous].Next;
                }
                else
                {
                    preNode = Lists.First;
                }


                while (preNode != null && preNode != node.Next)
                {
                    cqs = preNode.Value;
                    if (cqs[strSp] == null)
                    {
                        cqs[strSp] = cq;
                        break;
                    }

                    preNode = preNode.Next;
                }

                if (node.Next == preNode)
                {
                    cqs = new CqCollection()
                    {
                        Key = key
                    };
                    cqs.Samples = Samples;
                    cqs[strSp]  = cq;
                    node        = Lists.AddAfter(node, cqs);
                    Buoy[key]   = node;
                }
            }
        }