Exemplo n.º 1
0
 /// <summary>
 /// 更新坐骑
 /// </summary>
 /// <param name="update">更新内容</param>
 public void MountsUpdate(Mounts m, List<string> update)
 {
     m_mounts = m;
     MountsUpdate(update);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 坐骑列表
 /// </summary>
 /// <param name="mounts"></param>
 public MountsSimple(Mounts mounts)
 {
     m_mounts = mounts;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 换宠
        /// </summary>
        /// <param name="petid"></param>
        /// <returns></returns>
        public bool ChangePet(string petid,Mounts mounts)
        {
            Pet p = PetAccess.Instance.GetPetByID(petid, this.ID);
            if (p == null)
            {
                Call(PetsCommand.GuidePetsInfoR, false, TipManager.GetMessage(PetsReturn.ParaNameError));
                return false;
            }
            int petslevel = p.Value.GetIntOrDefault("PetsLevel");
            if (m_pet == null || p.ID != m_pet.ID)
            {
                if ((petslevel - m_level) > 5)
                {
                    Call(PetsCommand.GuidePetsInfoR, false, TipManager.GetMessage(PetsReturn.NoLevel));
                    return false;
                }
            }
            IList c = m_b3.Value.GetValue<IList>("C");
            Variant v0 = null;//是否存在出征宠
            Variant v1 = null;//要求出征的宠

            foreach (Variant v in c)
            {
                if (v.GetStringOrEmpty("E") == string.Empty)
                    continue;

                if (m_pet != null && v.GetStringOrDefault("E") == m_pet.ID)
                    v0 = v;
                if (v.GetStringOrDefault("E") == p.ID)
                    v1 = v;
                //如果两者不为空的时候退出
                if (v0 != null && v1 != null)
                    break;
            }
            if (v1 == null)
            {
                return false;
            }
            if (v0 != null && v0.GetStringOrDefault("E") == v1.GetStringOrDefault("E"))
            {
                v0["I"] = v0.GetIntOrDefault("I") == 1 ? 0 : 1;
                if (v0.GetIntOrDefault("I") == 0)
                {
                    PetAccess.PetReset(m_pet, null, false, null);
                    m_pet.Save();
                    Call(PetsCommand.UpdatePetR, true, m_pet);
                    Call(PetsCommand.GuidePetsInfoR, true, m_pet, 0);
                    ResetPet(null);
                }
            }
            else
            {
                if (v0 != null)
                {
                    PetAccess.PetReset(m_pet, null, false, null);
                    m_pet.Save();
                    Call(PetsCommand.UpdatePetR, true, m_pet);
                    v0["I"] = 0;
                }

                //坐骑加成
                PetAccess.PetReset(p, m_skill, false, mounts);
                v1["I"] = 1;
                ResetPet(p);
                Call(PetsCommand.GuidePetsInfoR, true, p, 1);
            }
            m_b3.Save();
            Call(ClientCommand.UpdateActorR, new PlayerExDetail(m_b3));
            List<Variant> ps = PlayerExAccess.Instance.SlipPets(m_b3);

            if ((v0 != null && v0.GetIntOrDefault("P") > 3) || (v1 != null && v1.GetIntOrDefault("P") > 3))
            {
                GetSlipPets(ps);
            }
            return true;
        }
Exemplo n.º 4
0
 /// <summary>
 /// 陪伴兽
 /// </summary>
 /// <param name="pb"></param>
 private static void Mountegg(PlayerBusiness pb, GameConfig gc)
 {
     if (pb.Mounts != null)
     {
         pb.Call(GoodsCommand.UseGoodsR, false, TipManager.GetMessage(GoodsReturn.IsMounst));
         return;
     }
     Mounts m = new Mounts();
     m.ID = ObjectId.GenerateNewId().ToString();
     m.PlayerID = pb.ID;
     m.MountsID = gc.Value.GetStringOrDefault("MountsID");
     m.Level = 1;
     m.Rank = 1;
     m.Experience = 0;
     DateTime dt = DateTime.UtcNow;
     m.Update = dt;
     m.Created = dt;
     m.Name = gc.Name;
     m.Status = 1;
     m.ZhuFu = 0;
     m.FailCount = 0;
     m.FailTime = dt;
     if (m.Save())
     {
         pb.MountsUpdate(m, null);
         pb.MountsInfo();
     }
 }