Exemplo n.º 1
0
        public void AddJobXp(sbyte jobid, ulong amount)
        {
            var job = CharacterJobRecord.GetJob(Id, jobid);

            if (job.JobLevel == 200)
            {
                return;
            }
            var exp = ExperienceRecord.GetExperienceForLevel((uint)(job.JobLevel + 1));

            if (job.JobExp + amount >= exp)
            {
                job.JobLevel++;
                Client.Send(new JobLevelUpMessage(job.JobLevel, job.GetJobDescription()));
                if (job.JobLevel == 200)
                {
                    job.JobExp = exp;
                    RefreshJobs();
                    return;
                }
                AddJobXp(jobid, amount);
            }
            else
            {
                job.JobExp += amount;
            }
            SaveTask.UpdateElement(job);
            RefreshJobs();
        }
        public void GenerateArenaLoot()
        {
            if ((Fighter as CharacterFighter).HasLeft)
            {
                return;
            }
            WorldClient client = (Fighter as CharacterFighter).Client;
            AsyncRandom random = new AsyncRandom();

            FightLoot.kamas += (uint)(random.Next(50 * client.Character.Record.Level, 250 * client.Character.Record.Level));
            client.Character.AddKamas((int)FightLoot.kamas);

            uint itemQt = (uint)random.Next(1, client.Character.Record.Level);

            FightLoot.objects.Add(FightArena.ARENA_ITEM_ID);
            FightLoot.objects.Add((ushort)itemQt);
            client.Character.Inventory.Add(FightArena.ARENA_ITEM_ID, itemQt);



            if (client.Character.Record.Level != 200)
            {
                var experienceForNextLevel = ExperienceRecord.GetExperienceForLevel((uint)client.Character.Record.Level + 1);
                var experienceForLevel     = ExperienceRecord.GetExperienceForLevel(client.Character.Record.Level);
                int earnedXp = (int)((double)(experienceForNextLevel - (double)experienceForLevel) / (double)15);

                var expdatas = new FightResultExperienceData(true, true, true, true, false, false, false, client.Character.Record.Exp, experienceForLevel, experienceForNextLevel, earnedXp, 0, 0, 0);
                AdditionalDatas.Add(expdatas);
                client.Character.AddXp((ulong)earnedXp);
            }
        }
Exemplo n.º 3
0
 public void SetLevel(uint level)
 {
     if (level <= Record.Level)
     {
         Client.Character.NotificationError("Level must be higher then " + Record.Level);
         return;
     }
     AddXp(ExperienceRecord.GetExperienceForLevel(level) - Record.Exp, false);
     RefreshEmotes();
     RefreshStats();
     RefreshSpells();
     RefreshShortcuts();
     Client.Send(new CharacterLevelUpMessage(Record.Level));
     if (this.PartyMember != null)
     {
         foreach (WorldClient c in this.PartyMember.Party.Members)
         {
             c.Send(new PartyUpdateMessage((uint)this.PartyMember.Party.Id,
                                           this.PartyMember.GetPartyMemberInformations()));
         }
     }
     if (level >= 100 && !this.Record.KnownOrnaments.Contains(13))
     {
         this.AddOrnament(13);
     }
     if (level >= 160 && !this.Record.KnownOrnaments.Contains(14))
     {
         this.AddOrnament(14);
     }
     if (level >= 200 && !this.Record.KnownOrnaments.Contains(15))
     {
         this.AddOrnament(15);
     }
 }
        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;
            }
        }
Exemplo n.º 5
0
        public static void TestCommand(string value, WorldClient client)
        {
            client.Character.Reply("Votre XP: " + client.Character.Record.Exp);
            var forNext = ExperienceRecord.GetExperienceForLevel((uint)(client.Character.Record.Level + 1)) - client.Character.Record.Exp;

            client.Character.Reply("Xp prochain Niveau: " + forNext);
            client.Character.Reply("Xp Totale Prochain Niveau: " + (forNext + client.Character.Record.Exp));
        }
Exemplo n.º 6
0
        public void AddXp(ulong amount, bool sendpackets = true)
        {
            if (Record.Level == 200)
            {
                return;
            }
            var exp = ExperienceRecord.GetExperienceForLevel((uint)Record.Level + 1);

            if (Record.Exp + amount >= exp)
            {
                Record.Level++;
                if (Record.Level == 100)
                {
                    StatsRecord.ActionPoints++;
                    LearnEmote(22, sendpackets);
                }
                StatsRecord.LifePoints  += 5;
                CurrentStats.LifePoints += 5;
                Record.SpellPoints      += 1;
                Record.StatsPoints      += 5;
                UpdateBreedSpells(sendpackets);
                if (sendpackets)
                {
                    Client.Character.SendMap(new CharacterLevelUpInformationMessage(Record.Level, Record.Name, (uint)Id));
                    Client.Send(new CharacterLevelUpMessage(Record.Level));
                }
                if (Record.Level == 200)
                {
                    Record.Exp = exp;
                    if (sendpackets)
                    {
                        RefreshStats();
                    }
                    return;
                }
                AddXp(amount, sendpackets);
            }
            else
            {
                Record.Exp += amount;
            }
            if (sendpackets)
            {
                RefreshStats();
            }
        }
Exemplo n.º 7
0
        public static CharacterRecord New(long id, string name, int accountId, ContextActorLook look, sbyte breedId, ushort cosmeticId,
                                          bool sex)
        {
            ushort level  = WorldConfiguration.Instance.StartLevel;
            var    record = new CharacterRecord(id, name, accountId, look, breedId, cosmeticId, sex
                                                , WorldConfiguration.Instance.StartMapId,
                                                WorldConfiguration.Instance.StartCellId, 1, WorldConfiguration.Instance.StartKamas,
                                                ExperienceRecord.GetExperienceForLevel(level).Player, -1
                                                , new List <byte>()
            {
                1
            }, Stats.New(level, breedId), 0, 0
                                                , CharacterAlignment.New(), new List <ushort>(), new List <ushort>(), CharacterJob.New().ToList(),
                                                new List <short>(), new List <CharacterSpell>(), new List <CharacterHumanOption>(), ArenaRank.New(), new List <CharacterShortcut>(), 0, 0, 0, 0);

            return(record);
        }
Exemplo n.º 8
0
 public JobExperience GetJobExperience()
 {
     return(new JobExperience(JobId, (byte)Level, Experience, ExperienceRecord.GetExperienceForLevel(Level).Job, ExperienceRecord.GetExperienceForNextLevel(Level).Job));
 }
Exemplo n.º 9
0
        public CharacterCharacteristicsInformations GetCharacterCharacteristics(Character character)
        {
            ulong expFloor     = ExperienceRecord.GetExperienceForLevel(character.Level).Player;
            ulong expNextFloor = ExperienceRecord.GetExperienceForNextLevel(character.Level).Player;

            CharacterCharacteristicsInformations informations = new CharacterCharacteristicsInformations()
            {
                actionPoints            = ActionPoints.GetBaseCharacteristic(),
                actionPointsCurrent     = ActionPoints.TotalInContext(),
                additionnalPoints       = 0,
                agility                 = Agility.GetBaseCharacteristic(),
                airDamageBonus          = AirDamageBonus.GetBaseCharacteristic(),
                airElementReduction     = AirReduction.GetBaseCharacteristic(),
                airElementResistPercent = AirResistPercent.GetBaseCharacteristic(),
                alignmentInfos          = character.Record.Alignment.GetActorExtendedAlignement(),
                allDamagesBonus         = AllDamagesBonus.GetBaseCharacteristic(),
                chance = Chance.GetBaseCharacteristic(),
                criticalDamageBonus          = CriticalDamageBonus.GetBaseCharacteristic(),
                criticalDamageReduction      = CriticalDamageReduction.GetBaseCharacteristic(),
                criticalHit                  = CriticalHit.GetBaseCharacteristic(),
                criticalHitWeapon            = CriticalHitWeapon,
                criticalMiss                 = Characteristic.Zero().GetBaseCharacteristic(),
                damagesBonusPercent          = DamagesBonusPercent.GetBaseCharacteristic(),
                dodgePALostProbability       = DodgePAProbability.GetBaseCharacteristic(),
                dodgePMLostProbability       = DodgePMProbability.GetBaseCharacteristic(),
                earthDamageBonus             = EarthDamageBonus.GetBaseCharacteristic(),
                earthElementReduction        = EarthReduction.GetBaseCharacteristic(),
                earthElementResistPercent    = EarthResistPercent.GetBaseCharacteristic(),
                pvpEarthElementReduction     = PvPEarthReduction.GetBaseCharacteristic(),
                pvpEarthElementResistPercent = PvPEarthResistPercent.GetBaseCharacteristic(),
                fireDamageBonus              = FireDamageBonus.GetBaseCharacteristic(),
                fireElementReduction         = FireReduction.GetBaseCharacteristic(),
                fireElementResistPercent     = FireResistPercent.GetBaseCharacteristic(),
                pvpFireElementReduction      = PvPFireReduction.GetBaseCharacteristic(),
                pvpFireElementResistPercent  = PvPFireResistPercent.GetBaseCharacteristic(),
                glyphBonusPercent            = GlyphBonusPercent.GetBaseCharacteristic(),
                healBonus                      = HealBonus.GetBaseCharacteristic(),
                initiative                     = new CharacterBaseCharacteristic((short)FormulasProvider.Instance.BaseInitiative(this), 0, Initiative.Total(), 0, 0),
                intelligence                   = Intelligence.GetBaseCharacteristic(),
                kamas                          = character.Record.Kamas,
                lifePoints                     = (uint)LifePoints,
                maxEnergyPoints                = MaxEnergyPoints,
                maxLifePoints                  = (uint)MaxLifePoints,
                movementPoints                 = MovementPoints.GetBaseCharacteristic(),
                movementPointsCurrent          = MovementPoints.TotalInContext(),
                PMAttack                       = PMAttack.GetBaseCharacteristic(),
                PAAttack                       = PAAttack.GetBaseCharacteristic(),
                pvpAirElementReduction         = PvPAirReduction.GetBaseCharacteristic(),
                pvpAirElementResistPercent     = PvPAirResistPercent.GetBaseCharacteristic(),
                pvpNeutralElementReduction     = PvPNeutralReduction.GetBaseCharacteristic(),
                pvpNeutralElementResistPercent = PvPNeutralResistPercent.GetBaseCharacteristic(),
                pvpWaterElementReduction       = PvPWaterReduction.GetBaseCharacteristic(),
                pvpWaterElementResistPercent   = PvPWaterResistPercent.GetBaseCharacteristic(),
                energyPoints                   = Energy,
                experience                     = character.Experience,
                experienceLevelFloor           = expFloor,
                experienceNextLevelFloor       = expNextFloor,
                neutralDamageBonus             = NeutralDamageBonus.GetBaseCharacteristic(),
                neutralElementReduction        = NeutralReduction.GetBaseCharacteristic(),
                neutralElementResistPercent    = NeutralResistPercent.GetBaseCharacteristic(),
                tackleEvade                    = TackleEvade.GetBaseCharacteristic(),
                tackleBlock                    = TackleBlock.GetBaseCharacteristic(),
                range                          = Range.GetBaseCharacteristic(),
                waterElementReduction          = WaterReduction.GetBaseCharacteristic(),
                waterDamageBonus               = WaterDamageBonus.GetBaseCharacteristic(),
                waterElementResistPercent      = WaterResistPercent.GetBaseCharacteristic(),
                reflect                        = Reflect.GetBaseCharacteristic(),
                permanentDamagePercent         = PermanentDamagePercent.GetBaseCharacteristic(),
                prospecting                    = Prospecting.GetBaseCharacteristic(),
                pushDamageBonus                = PushDamageBonus.GetBaseCharacteristic(),
                pushDamageReduction            = PushDamageReduction.GetBaseCharacteristic(),
                runeBonusPercent               = RuneBonusPercent.GetBaseCharacteristic(),
                spellModifications             = new CharacterSpellModification[0],
                spellsPoints                   = character.Record.SpellPoints,
                statsPoints                    = character.Record.StatsPoints,
                vitality                       = Vitality.GetBaseCharacteristic(),
                strength                       = Strength.GetBaseCharacteristic(),
                summonableCreaturesBoost       = SummonableCreaturesBoost.GetBaseCharacteristic(),
                trapBonus                      = TrapBonus.GetBaseCharacteristic(),
                trapBonusPercent               = TrapBonusPercent.GetBaseCharacteristic(),
                weaponDamagesBonusPercent      = WeaponDamagesBonusPercent.GetBaseCharacteristic(),
                wisdom                         = Wisdom.GetBaseCharacteristic(),
                probationTime                  = 0,
            };

            return(informations);
        }
        public void GeneratePVMLoot()
        {
            if ((Fighter as CharacterFighter).HasLeft)
            {
                return;
            }
            #region VariableDefinitions
            WorldClient client   = (Fighter as CharacterFighter).Client;
            AsyncRandom random   = new AsyncRandom();
            FightPvM    pvmfight = Fighter.Fight as FightPvM;
            #endregion

            #region Kamas & Items Generation
            List <DroppedItem> m_drops = new List <DroppedItem>();
            foreach (var monster in pvmfight.MonsterGroup.Monsters)
            {
                var template = MonsterRecord.GetMonster(monster.MonsterId);
                var grade    = template.GetGrade(monster.ActualGrade);

                #region kamas
                int droppedKamas = random.Next(template.MinKamas, template.MaxKamas + 1);
                FightLoot.kamas += (uint)(droppedKamas * ConfigurationManager.Instance.KamasDropRatio);
                #endregion

                #region items
                List <CharacterFighter> charactersFighters = Fighter.Team.GetFighters().FindAll(x => x is CharacterFighter).ConvertAll <CharacterFighter>(x => (CharacterFighter)x);
                int prospectingSum = charactersFighters.Sum((CharacterFighter entry) => entry.Client.Character.StatsRecord.Prospecting);

                foreach (var item in template.Drops.FindAll(x => x.ProspectingLock <= prospectingSum))
                {
                    int    D = random.Next(0, 201);
                    double dropchancePercent = item.GetDropRate(monster.ActualGrade) + pvmfight.MonsterGroup.AgeBonus / 5 + client.Character.StatsRecord.Prospecting / 100;


                    if (D <= dropchancePercent)
                    {
                        var alreadyDropped = m_drops.FirstOrDefault(x => x.GID == item.ObjectId);
                        if (alreadyDropped == null)
                        {
                            uint dropMax = GetQuantityDropMax();

                            uint Q = (uint)random.Next(1, (int)(dropMax + 1));
                            if (Q > item.Count)
                            {
                                Q = 1;
                            }
                            m_drops.Add(new DroppedItem(item.ObjectId, Q));
                        }
                        else
                        {
                            alreadyDropped.Quantity++;
                        }
                    }
                }


                #endregion
            }

            #endregion

            client.Character.AddKamas((int)FightLoot.kamas);

            foreach (var item in m_drops)
            {
                FightLoot.objects.Add(item.GID);
                FightLoot.objects.Add((ushort)item.Quantity);
                client.Character.Inventory.Add(item.GID, item.Quantity, false, false);
            }

            #region Experience Provider
            List <MonsterData> monsters = new List <MonsterData>();
            foreach (var monster in pvmfight.MonsterGroup.Monsters)
            {
                var grade = MonsterRecord.GetMonster(monster.MonsterId).GetGrade(monster.ActualGrade);
                monsters.Add(new MonsterData(grade.Level, (int)grade.GradeXp));
            }
            var team = Fighter.Team.GetFighters().FindAll(x => x is CharacterFighter).ConvertAll <CharacterFighter>(x => (CharacterFighter)x);;
            ExperienceFormulas formulas = new ExperienceFormulas();
            formulas.InitXpFormula(new PlayerData(client.Character.Record.Level, client.Character.StatsRecord.Wisdom), monsters, team.ConvertAll <GroupMemberData>(x => new GroupMemberData(x.Client.Character.Record.Level, false)), pvmfight.MonsterGroup.AgeBonus);
            if (client.Character.Record.Level >= 200)
            {
                formulas._xpSolo = 0;
            }
            client.Character.AddXp((ulong)formulas._xpSolo);
            PlayerLevel = client.Character.Record.Level;
            var expdatas = new FightResultExperienceData(true, true, true, true, false, false, false, client.Character.Record.Exp, ExperienceRecord.GetExperienceForLevel(client.Character.Record.Level), ExperienceRecord.GetExperienceForLevel((uint)client.Character.Record.Level + 1), (int)formulas._xpSolo, 0, 0, 0);
            AdditionalDatas.Add(expdatas);
            #endregion
            client.Character.Inventory.Refresh();
            client.Character.RefreshShortcuts();
        }