コード例 #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));
        }
コード例 #2
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;
        }
コード例 #3
0
        static void CreateCharacter(CharacterCreationRequestMessage message, WorldClient client, bool succes, long id)
        {
            if (!succes)
            {
                client.Send(new CharacterCreationResultMessage((sbyte)CharacterCreationResultEnum.ERR_NO_REASON));
                return;
            }
            ContextActorLook look   = BreedRecord.GetBreedLook(message.breed, message.sex, message.cosmeticId, message.colors);
            CharacterRecord  record = CharacterRecord.New(id, message.name, client.Account.Id, look, message.breed, message.cosmeticId, message.sex);

            record.AddInstantElement();
            client.Character = new Character(client, record, true);
            logger.White("Character " + record.Name + " created");
            ProcessSelection(client);
        }
コード例 #4
0
        public static void HandleCharacterCreationRequest(CharacterCreationRequestMessage message, WorldClient client)
        {
            if (client.Characters.Count() == client.Account.MaxCharactersCount)
            {
                client.Send(new CharacterCreationResultMessage((sbyte)CharacterCreationResultEnum.ERR_TOO_MANY_CHARACTERS));
                return;
            }
            if (CharacterRecord.CheckCharacterNameExist(message.name))
            {
                client.Send(new CharacterCreationResultMessage((sbyte)CharacterCreationResultEnum.ERR_NAME_ALREADY_EXISTS));
                return;
            }
            if (client.Account.Role <= ServerRoleEnum.MODERATOR)
            {
                foreach (var value in message.name)
                {
                    if (UnauthorizedNameContent.Contains(value))
                    {
                        client.Send(new CharacterCreationResultMessage((sbyte)CharacterCreationResultEnum.ERR_INVALID_NAME));
                        return;
                    }
                }
            }
            string look = BreedRecord.GetBreedEntityLook((int)message.breed, message.sex, (int)message.cosmeticId, message.colors).ConvertToString();

            CharacterRecord newCharacter = CharacterRecord.Default(message.name, client.Account.Id, look, message.breed, message.sex);

            client.Character       = new Character(newCharacter, client);
            client.Character.IsNew = true;
            StatsRecord.Create(client.Character);
            client.Character.SetLevel(ConfigurationManager.Instance.StartLevel);
            client.Character.Record.AddElement();
            client.Character.UpdateBreedSpells();
            client.Character.LearnAllJobs();
            Logger.Log("Character " + newCharacter.Name + " created!");
            ProcessSelection(client);
        }
コード例 #5
0
        public ErrorEnum CreateCharacter(SimpleClient client, CreateCharacterMessage message)
        {
            if (!m_nameCheckerRegex.IsMatch(message.name))
            {
                return(ErrorEnum.ERR_NOCREATE);
            }
            if (IsCharacterNameExist(message.name))
            {
                return(ErrorEnum.ERR_PLAYER_EXIST);
            }
            BreedRecord breed = BreedManager.Instance.GetBreedByJobId(message.job);

            if (breed == null)
            {
                return(ErrorEnum.ERR_NOCREATE);
            }
            CharacterRecord record = new CharacterRecord()
            {
                AccountId     = client.Account.Id,
                Name          = message.name,
                HD_MD5        = message.hd_md5,
                SceneId       = breed.StartMap,
                Sex           = message.sex == 1,
                X             = breed.StartX,
                Y             = breed.StartY,
                Z             = breed.StartZ,
                Level         = 1,
                Experience    = 60,
                Job           = breed.Job,
                Money         = (uint)breed.StartMoney,
                HP            = breed.StartHP,
                DamageTaken   = 0,
                Strenght      = breed.StartStrenght,
                Stamina       = breed.StartStamina,
                Dexterity     = breed.StartDexterity,
                Intelligence  = breed.StartIntelligence,
                SPI           = breed.StartSPI,
                HairMesh      = message.hair_mesh,
                HairColor     = (uint)message.hair_color,
                HeadMesh      = message.head_mesh,
                City_Code     = message.city_code,
                Constellation = message.constellation,
                Country       = message.country,
                SN_Card       = message.sn_card,
                Card_Type     = message.card_type,
                HD_SN         = message.hd_sn,
                Bin_Account   = message.bin_account,
                BlockTime     = DateTime.MinValue,
                DeletedDate   = null
            };
            var closets = message.closets.Select(x => new ClosetItemRecord()
            {
                ClosetItemId = x.id,
                Equipped     = true,
                OwnerId      = record.Id
            });

            try
            {
                Database.Insert(record);
                foreach (var closet in closets)
                {
                    Database.Insert(closet);
                }
            }
            catch
            {
                return(ErrorEnum.ERR_NOCREATE);
            }

            client.Character        = new Character(record);
            client.Character.Client = client;

            client.Account.LoadRecord();

            return(ErrorEnum.ERR_SUCCESS);
        }
コード例 #6
0
ファイル: Stats.cs プロジェクト: Zaetic/Symbioz-2.38-RED
        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);
        }
コード例 #7
0
        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();
                }
            }
        }