Exemplo n.º 1
0
        public void RemodelColors(CharacterRecord record, int[] colors)
        {
            var dic = ContextActorLook.GetConvertedColorsWithIndex(colors);
            var col = ContextActorLook.GetConvertedColorSortedByIndex(dic);

            col = BreedRecord.VerifiyColors(col, record.Sex, BreedRecord.GetBreed(record.BreedId)).ToList();
            record.Look.SetColors(ContextActorLook.GetConvertedColors(col));
        }
        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;
        }
Exemplo n.º 3
0
        public static Stats New(ushort level, sbyte breedId)
        {
            BreedRecord breed = BreedRecord.GetBreed(breedId);

            var stats = new Stats()
            {
                ActionPoints        = ApCharacteristic.New(StartActionPoints),
                MovementPoints      = MpCharacteristic.New((short)StartMovementPoints),
                Agility             = Characteristic.Zero(),
                AirDamageBonus      = Characteristic.Zero(),
                AirReduction        = Characteristic.Zero(),
                AirResistPercent    = ResistanceCharacteristic.Zero(),
                AllDamagesBonus     = Characteristic.Zero(),
                DamagesBonusPercent = Characteristic.Zero(),
                Chance = Characteristic.Zero(),
                CriticalDamageBonus     = Characteristic.Zero(),
                CriticalDamageReduction = Characteristic.Zero(),
                CriticalHit             = Characteristic.Zero(),
                Initiative             = Characteristic.Zero(),
                CriticalHitWeapon      = 0,
                DodgePAProbability     = Characteristic.Zero(),
                DodgePMProbability     = Characteristic.Zero(),
                EarthDamageBonus       = Characteristic.Zero(),
                EarthReduction         = Characteristic.Zero(),
                EarthResistPercent     = ResistanceCharacteristic.Zero(),
                FireDamageBonus        = Characteristic.Zero(),
                FireReduction          = Characteristic.Zero(),
                FireResistPercent      = ResistanceCharacteristic.Zero(),
                GlobalDamageReduction  = 0,
                GlyphBonusPercent      = Characteristic.Zero(),
                RuneBonusPercent       = Characteristic.Zero(),
                PermanentDamagePercent = Characteristic.Zero(),
                HealBonus               = Characteristic.Zero(),
                Intelligence            = Characteristic.Zero(),
                LifePoints              = breed.StartLifePoints,
                MaxEnergyPoints         = (ushort)(level * 100),
                NeutralDamageBonus      = Characteristic.Zero(),
                NeutralReduction        = Characteristic.Zero(),
                NeutralResistPercent    = ResistanceCharacteristic.Zero(),
                Prospecting             = Characteristic.New(breed.StartProspecting),
                PushDamageBonus         = Characteristic.Zero(),
                PushDamageReduction     = Characteristic.Zero(),
                PvPAirReduction         = Characteristic.Zero(),
                PvPAirResistPercent     = ResistanceCharacteristic.Zero(),
                PvPEarthReduction       = Characteristic.Zero(),
                PvPEarthResistPercent   = ResistanceCharacteristic.Zero(),
                PvPFireReduction        = Characteristic.Zero(),
                PvPFireResistPercent    = ResistanceCharacteristic.Zero(),
                PvPNeutralReduction     = Characteristic.Zero(),
                PvPNeutralResistPercent = ResistanceCharacteristic.Zero(),
                PvPWaterReduction       = Characteristic.Zero(),
                PvPWaterResistPercent   = ResistanceCharacteristic.Zero(),
                Range    = RangeCharacteristic.Zero(),
                Reflect  = Characteristic.Zero(),
                Strength = Characteristic.Zero(),
                SummonableCreaturesBoost = Characteristic.New(1),
                TrapBonus                 = Characteristic.Zero(),
                TrapBonusPercent          = Characteristic.Zero(),
                Vitality                  = Characteristic.Zero(),
                WaterDamageBonus          = Characteristic.Zero(),
                WaterReduction            = Characteristic.Zero(),
                WaterResistPercent        = ResistanceCharacteristic.Zero(),
                WeaponDamagesBonusPercent = Characteristic.Zero(),
                Wisdom        = Characteristic.Zero(),
                TackleBlock   = Characteristic.Zero(),
                TackleEvade   = Characteristic.Zero(),
                PAAttack      = Characteristic.Zero(),
                PMAttack      = Characteristic.Zero(),
                Energy        = (ushort)(level * 100),
                MaxLifePoints = breed.StartLifePoints,
                WeightBonus   = 0,
            };

            return(stats);
        }
        public static void HandleStatsUpgrade(StatsUpgradeRequestMessage message, WorldClient client)
        {
            if (client.Character.IsFighting)
            {
                client.Send(new StatsUpgradeResultMessage((sbyte)StatsUpgradeResultEnum.IN_FIGHT, 0));
                return;
            }
            StatsBoostTypeEnum statId = (StatsBoostTypeEnum)message.statId;

            if (statId < StatsBoostTypeEnum.Strength || statId > StatsBoostTypeEnum.Intelligence)
            {
                Logger.Error("Wrong statsid");
            }
            if (message.boostPoint > 0)
            {
                UInt16ReflectedStat linkedStat = GetReflectedStat(client.Character.StatsRecord, statId);

                BreedRecord breed = BreedRecord.GetBreed(client.Character.Record.Breed);
                int         num   = linkedStat.GetValue();
                ushort      num2  = message.boostPoint;
                if (num2 >= 1 && message.boostPoint <= (short)client.Character.Record.StatsPoints)
                {
                    uint[][] thresholds     = breed.GetThresholds(statId);
                    int      thresholdIndex = breed.GetThresholdIndex(num, thresholds);
                    while ((long)num2 >= (long)((ulong)thresholds[thresholdIndex][1]))
                    {
                        short num3;
                        short num4;
                        if (thresholdIndex < thresholds.Length - 1 && (double)num2 / thresholds[thresholdIndex][1] > (double)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num)))
                        {
                            num3 = (short)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num));
                            num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1]));
                            if (thresholds[thresholdIndex].Length > 2)
                            {
                                num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2]));
                            }
                        }
                        else
                        {
                            num3 = (short)System.Math.Floor((double)num2 / thresholds[thresholdIndex][1]);
                            num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1]));
                            if (thresholds[thresholdIndex].Length > 2)
                            {
                                num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2]));
                            }
                        }
                        num           += (int)num3;
                        num2          -= (ushort)num4;
                        thresholdIndex = breed.GetThresholdIndex(num, thresholds);
                    }


                    if (statId == StatsBoostTypeEnum.Vitality)
                    {
                        var previousVitality = linkedStat.GetValue();
                        linkedStat.SetValue((short)num);
                        client.Character.StatsRecord.LifePoints  += (short)(client.Character.StatsRecord.BaseVitality - previousVitality);
                        client.Character.CurrentStats.LifePoints += (uint)(client.Character.StatsRecord.BaseVitality - previousVitality);
                    }
                    else
                    {
                        linkedStat.SetValue((short)num);
                    }
                    client.Character.Record.StatsPoints -= (ushort)(message.boostPoint - num2);
                    client.Send(new StatsUpgradeResultMessage((sbyte)StatsUpgradeResultEnum.SUCCESS, message.boostPoint));
                    client.Character.RefreshStats();
                }
            }
        }