/// <summary> /// 宠物升级 /// </summary> /// <param name="pet"></param> /// <param name="newExp"></param> /// <param name="max"></param> /// <param name="petLev"></param> /// <returns></returns> private int UpPetLev(Pet pet, int newExp, int max, int petLev) { if (pet == null) return petLev; Variant mv = pet.Value; if (mv == null) return petLev; string petsType = mv.GetStringOrDefault("PetsType"); bool isPet = false; while (true) { petLev += 1; //得到可以领捂的技能 pet.Value["PetsLevel"] = petLev; PetProperty life = PetAccess.GetSkillPro(pet, petLev); Variant ccd = mv.GetVariantOrDefault("ChengChangDu"); life.ChengChangDu = ccd.GetIntOrDefault("V"); int curExp = newExp - max; //表示出战宠升级 if (Pet != null && Pet.ID == pet.ID) { isPet = true; } PetAccess.RefreshPetProperty(pet.Value, life, curExp, true); LevelLogAccess.Instance.Insert(pet.ID, petLev, UserID); if (petLev < maxLevel) { Variant exp = mv.GetVariantOrDefault("Experience"); max = exp.GetIntOrDefault("M"); if (curExp < max) { exp["V"] = curExp; break; } } else { break; } } FinishNote(FinishCommand.PetUpLev, petLev); pet.Init(); if (isPet) { //表示出战宠 PetAccess.PetReset(pet, m_skill, false, m_mounts); Call(PetsCommand.UpdatePetR, true, pet); } else { pet.Save(); } return petLev; }
public void ResetPet(Pet value, bool iscall = true) { m_pet = value; if (m_pet != null) { m_pet.Init(); } if (iscall) { Variant v = new Variant(2); v["ID"] = this.ID; v["Pet"] = value; this.CallAll(ClientCommand.UpdateActorR, v); } }