public void AddExperience(ulong value) { if (this.Level >= ExperienceRecord.MaxMinationLevel) { return; } this.Exp += value; if (this.Exp >= this.UpperBoundExperience || this.Exp < this.LowerBoundExperience) { this.Level = ExperienceRecord.GetCharacterLevel(this.Exp); } long neededToUp = (long)(this.UpperBoundExperience - this.LowerBoundExperience); long current = (neededToUp) - ((long)this.UpperBoundExperience - (long)this.Exp); this.Percentage = (ushort)Extensions.Percentage(current, neededToUp); if (this.Level >= ExperienceRecord.MaxMinationLevel) { this.Level = ExperienceRecord.MaxMinationLevel; this.Exp = ExperienceRecord.GetExperienceForLevel(ExperienceRecord.MaxMinationLevel).Player; this.Percentage = 0; } }
/// <summary> /// Todo use informations of local character /// </summary> /// <returns></returns> public GuildMember ToGuildMember() { return(new GuildMember((ulong)Record.CharacterId, CharacterRecord.Name, (byte)ExperienceRecord.GetCharacterLevel(CharacterRecord.Exp), CharacterRecord.BreedId, CharacterRecord.Sex, Record.Rank, Record.GivenExperience, Record.experienceGivenPercent, Record.Rights, (sbyte)(Connected == true ? 1 : 0), (sbyte)CharacterRecord.Alignment.Side, 0, Record.MoodSmileyId, 0, 0, new PlayerStatus(0))); }
public void RemodelBreed(CharacterRecord record, sbyte breedId, ushort cosmecticId) { var currentBreed = BreedRecord.GetBreed(record.BreedId); var newBreed = BreedRecord.GetBreed(breedId); var level = ExperienceRecord.GetCharacterLevel(record.Exp); var shortcuts = record.Shortcuts.OfType <CharacterSpellShortcut>(); List <ushort> spells = currentBreed.GetSpellsForLevel(200, new List <CharacterSpell>()).ToList(); spells.AddRange(this.BreedSpecialSpells); foreach (var spell in spells) { record.Spells.RemoveAll(x => x.SpellId == spell); var shortcut = shortcuts.FirstOrDefault(x => x.SpellId == spell); record.Shortcuts.Remove(shortcut); } foreach (var spell in newBreed.GetSpellsForLevel(level, new List <CharacterSpell>())) { record.Spells.Add(new CharacterSpell(spell, 1)); } var look = record.Sex ? ContextActorLook.Parse(currentBreed.FemaleLook) : ContextActorLook.Parse(currentBreed.MaleLook); var newLook = record.Sex ? ContextActorLook.Parse(newBreed.FemaleLook) : ContextActorLook.Parse(newBreed.MaleLook); record.SpellPoints += (ushort)(level - 1); foreach (var skin in look.Skins) { record.Look.RemoveSkin(skin); } foreach (var skin in newLook.Skins) { record.Look.AddSkin(skin); } record.Look.SetScale(newLook.Scale); ushort headSkin = HeadRecord.GetSkin(record.CosmeticId); record.Look.RemoveSkin(headSkin); record.Look.AddSkin(HeadRecord.GetSkin(cosmecticId)); record.BreedId = breedId; }
public void Restat(bool addStatPoints) { int vitality = this.Stats.Vitality.Base; this.Stats.LifePoints -= vitality; this.Stats.MaxLifePoints -= vitality; this.Stats.Vitality.Base = 0; this.Stats.Agility.Base = 0; this.Stats.Intelligence.Base = 0; this.Stats.Chance.Base = 0; this.Stats.Strength.Base = 0; this.Stats.Wisdom.Base = 0; if (addStatPoints) { this.StatsPoints = (ushort)(5 * ExperienceRecord.GetCharacterLevel(this.Exp) - 5); } }
public CharacterBaseInformations GetCharacterBaseInformations() { return(new CharacterBaseInformations((ulong)Id, Name, (byte)ExperienceRecord.GetCharacterLevel(Exp), Look.ToEntityLook(), BreedId, Sex)); }