예제 #1
0
        public void addXp(long xp)
        {
            this.Experience += xp;

            while (Experience >= ExpFloorTable.getGuildXpMax(this.Level) && this.Level < Settings.AppSettings.GetIntElement("World.GuildMaxLevel"))
            {
                levelUp();
            }
        }
예제 #2
0
        public void addXp(long amount)
        {
            Exp += amount;

            while (Exp >= ExpFloorTable.GetFloorByLevel(Level + 1).Mount&& Level < 100)
            {
                levelUp();
            }
        }
예제 #3
0
        public static void Initialize()
        {
            nextPlayerGuid = CharacterTable.getNextGuid();
            nextPlayerGuid++;
            nextItemGuid = InventoryItemTable.getNextGuid();
            nextItemGuid++;
            nextGuildId = GuildTable.getNextGuid();
            nextGuildId++;
            nextMountId = MountTable.getNextGuid();
            nextMountId++;
            nextSpeakingId = SpeakingTable.getNextGuid();
            nextSpeakingId++;
            SpellTable.Load();
            ExpFloorTable.Load();
            MonsterTable.Load();
            ItemTemplateTable.Load();
            ItemTemplateTable.LoadItemActions();
            ItemSetTable.Load();
            DropTable.Load();
            TitleTable.Load();
            IObjectTemplateTable.Load();
            AreaTable.Load();
            AreaSubTable.Load();
            MapTable.Load();
            MapTable.LoadActions();
            CellActionTable.Load();
            MobGroupFixTable.Load();
            BreedTable.Load();
            NpcTemplateTable.Load();
            NpcTemplateTable.LoadPlaces();
            NpcQuestionTable.Load();
            NpcReplyTable.Load();
            ShopNpcTable.Initialize();
            GuildTable.Load();
            CharactersGuildTable.Load();
            TaxCollectorTable.Load();
            PrismeTable.Load();
            BidHouseTable.Load();
            BidHouseTable.LoadItems();
            MountParkTable.Load();
            StaticMountTable.Load();
            MountTable.Load();//TODO Dynamic load of Character mount
            ZaapTable.Load();
            ZaapiTable.Load();

            var Timer = new System.Timers.Timer(1000 * 60 * 25);

            Timer.Elapsed += delegate(object sender, ElapsedEventArgs e)
            {
                Save();
            };
            Timer.Start();
        }
예제 #4
0
        public override string Compile()
        {
            long xpMin = ExpFloorTable.GetFloorByLevel(player.GetGuild().Level).Guild;
            long xpMax;

            if (ExpFloorTable.GetFloorByLevel(player.GetGuild().Level + 1) == null)
            {
                xpMax = -1L;
            }
            else
            {
                xpMax = ExpFloorTable.GetFloorByLevel(player.GetGuild().Level + 1).Guild;
            }
            return("gIG" + (guild.CharactersGuildCache.Count <= 9 ? 0 : 1) + "|" + guild.Level + "|" + xpMin + "|" + xpMax + "|" + guild.Experience + "|" + xpMax);
        }
예제 #5
0
        public void AddExperience(long Value)
        {
            if (!this.myInitialized)
            {
                this.Initialize();
            }

            this.Experience += Value;

            if (this.Level != ExpFloorTable.Cache.Count)
            {
                ExpFloorModel Floor;

                var LastLevel = this.Level;

                do
                {
                    Floor = ExpFloorTable.GetFloorByLevel(this.Level + 1);

                    if (Floor.Character < this.Experience)
                    {
                        this.Level++;
                        this.CaractPoint += 5;
                        this.SpellPoint++;

                        if (this.Level == 100)
                        {
                            this.AP++;
                            this.myStats.AddBase(EffectEnum.AddPA, 1);
                        }

                        // Apprend des nouveaux sorts
                        this.mySpells.GenerateLevelUpSpell((ClassEnum)this.Classe, this.Level);
                    }
                }while (Floor.Character < this.Experience && this.Level != 200);

                if (this.Level != LastLevel)
                {
                    this.Life = this.MaxLife;
                    this.Send(new CharacterNewLevelMessage(this.Level));
                }

                if (this.Client != null)
                {
                    this.Client.Send(new AccountStatsMessage(this));
                }
            }
        }
예제 #6
0
        public int getGrade()
        {
            int mRank = 1;

            for (int i = 1; (i <= ExpFloorTable.MaxLevel); i++)
            {
                if ((ExpFloorTable.GetFloorByLevel(i).PvP == -1))
                {
                    break;
                }
                if ((Honor >= ExpFloorTable.GetFloorByLevel(i).PvP))
                {
                    mRank = i;
                }
            }
            return(mRank);
        }
예제 #7
0
 public void AddHonor(int honor)
 {
     Honor += honor;
     if (Honor >= 25000)
     {
         Level = 10;
         Honor = 25000;
     }
     for (int n = 1; n <= 10; n++)
     {
         if (Honor < ExpFloorTable.GetFloorByLevel(n).PvP)
         {
             Level = (byte)(n - 1);
             break;
         }
     }
 }
예제 #8
0
        public void LevelUP()
        {
            if (this.Level == ExpFloorTable.Cache.Count)
            {
                return;
            }
            this.Level++;
            this.CaractPoint += 5;
            this.SpellPoint++;
            this.Life = this.MaxLife;
            if (this.Level == 100)
            {
                this.AP++;
                this.myStats.AddBase(EffectEnum.AddPA, 1);
            }
            this.mySpells.GenerateLevelUpSpell((ClassEnum)this.Classe, this.Level);
            this.Experience = ExpFloorTable.GetFloorByLevel(this.Level).Character;

            if (this.HasGuild())
            {
                this.getCharacterGuild().Level = this.Level;
                CharactersGuildTable.Add(this.getCharacterGuild());
            }
        }
예제 #9
0
 private String parseXpString()
 {
     return(Exp + "," + ExpFloorTable.GetFloorByLevel(Level).Mount + "," + ExpFloorTable.GetFloorByLevel(Level + 1).Mount);
 }
예제 #10
0
        public override string Compile()
        {
            var Packet = new StringBuilder("GE");

            Packet.Append((Program.currentTimeMillis() - this.GameEndResult.Fight.startTime)).Append('|');                                                       // FightTime;
            Packet.Append(this.GameEndResult.Fight.FightId).Append('|');
            Packet.Append(this.GameEndResult.Fight.FightType == FightType.TYPE_AGGRESSION || this.GameEndResult.Fight.FightType == FightType.TYPE_PVMA ? 1 : 0); // Can WinHonor ?

            foreach (var Result in this.GameEndResult.FightResults.Values)
            {
                Packet.Append('|').Append(Result.Win ? '2' : '0').Append(';');
                Packet.Append(Result.Fighter.ActorId).Append(';');
                Packet.Append(Result.Fighter.Name).Append(';');
                Packet.Append(Result.Fighter.Level).Append(';');
                Packet.Append(Result.Fighter.Dead ? '1' : '0').Append(';');

                if (this.GameEndResult.Fight.FightType == FightType.TYPE_AGGRESSION || this.GameEndResult.Fight.FightType == FightType.TYPE_PVMA)
                {
                    if (Result.Fighter.ActorType == GameActorTypeEnum.TYPE_CHARACTER)
                    {
                        var CharacterFighter = Result.Fighter as CharacterFighter;

                        Packet.Append(CharacterFighter.Character.AlignmentType != Libs.Enumerations.AlignmentTypeEnum.ALIGNMENT_NEUTRAL ? ExpFloorTable.GetFloorByLevel(CharacterFighter.Character.getGrade()).PvP : 0).Append(';');
                        Packet.Append(CharacterFighter.Character.Honor).Append(';');
                        Packet.Append(CharacterFighter.Character.AlignmentType != Libs.Enumerations.AlignmentTypeEnum.ALIGNMENT_NEUTRAL ? ExpFloorTable.GetFloorByLevel(CharacterFighter.Character.getGrade() + 1).PvP != -1 ? ExpFloorTable.GetFloorByLevel(CharacterFighter.Character.getGrade() + 1).PvP : ExpFloorTable.GetFloorByLevel(CharacterFighter.Character.getGrade()).PvP : 0).Append(';');
                        Packet.Append(Result.WinHonor).Append(';');
                        Packet.Append(CharacterFighter.Character.getGrade()).Append(';');
                        Packet.Append(CharacterFighter.Character.Deshonor).Append(';');
                        Packet.Append(Result.WinDisHonor).Append(';');
                        if (Result.WinItems != null)
                        {
                            Packet.Append(string.Join(",", Result.WinItems.Select(x => x.Key + "~" + x.Value))).Append(';');
                        }
                        else
                        {
                            Packet.Append("").Append(';');
                        }

                        Packet.Append(Result.WinKamas.ToString()).Append(';');
                        Packet.Append(ExpFloorTable.GetFloorByLevel(Result.Fighter.Level).Character).Append(';');
                        Packet.Append((Result.Fighter as CharacterFighter).Character.Experience).Append(';');
                        Packet.Append(ExpFloorTable.GetFloorByLevel(Result.Fighter.Level + 1).Character).Append(';');
                        Packet.Append(Result.WinExp);
                    }
                    else if (Result.Fighter.ActorType == GameActorTypeEnum.TYPE_PRISM)
                    {
                        var CharacterFighter = Result.Fighter as PrismFighter;

                        Packet.Append(CharacterFighter.Prisme.AlignmentType != Libs.Enumerations.AlignmentTypeEnum.ALIGNMENT_NEUTRAL ? ExpFloorTable.GetFloorByLevel(CharacterFighter.Prisme.Level).PvP : 0).Append(';');
                        Packet.Append(CharacterFighter.Prisme.Honor).Append(';');
                        Packet.Append(CharacterFighter.Prisme.AlignmentType != Libs.Enumerations.AlignmentTypeEnum.ALIGNMENT_NEUTRAL ? ExpFloorTable.GetFloorByLevel(CharacterFighter.Prisme.Level + 1).PvP != -1 ? ExpFloorTable.GetFloorByLevel(CharacterFighter.Prisme.Level + 1).PvP : ExpFloorTable.GetFloorByLevel(CharacterFighter.Prisme.Level).PvP : 0).Append(';');
                        Packet.Append(Result.WinHonor).Append(';');
                        Packet.Append(CharacterFighter.Prisme.Level).Append(';');
                        Packet.Append(0).Append(';');
                        Packet.Append(Result.WinDisHonor).Append(';');
                        if (Result.WinItems != null)
                        {
                            Packet.Append(string.Join(",", Result.WinItems.Select(x => x.Key + "~" + x.Value))).Append(';');
                        }
                        else
                        {
                            Packet.Append("").Append(';');
                        }

                        Packet.Append(Result.WinKamas.ToString()).Append(';');
                        Packet.Append(0).Append(';');
                        Packet.Append(0).Append(';');
                        Packet.Append(0).Append(';');
                        Packet.Append(Result.WinExp);
                    }
                }
                else
                {
                    if (Result.Fighter.ActorType == GameActorTypeEnum.TYPE_CHARACTER)
                    {
                        Packet.Append(ExpFloorTable.GetFloorByLevel(Result.Fighter.Level).Character).Append(';');
                        Packet.Append(this.GameEndResult.Fight.FightType == FightType.TYPE_KOLIZEUM ? (Result.Fighter as CharacterFighter).Character.Cote : (Result.Fighter as CharacterFighter).Character.Experience).Append(';');
                        Packet.Append(this.GameEndResult.Fight.FightType == FightType.TYPE_KOLIZEUM ? 10000 : ExpFloorTable.GetFloorByLevel(Result.Fighter.Level + 1).Character).Append(';');
                        Packet.Append(Result.WinExp).Append(';');
                        Packet.Append(Result.WinGuildXp).Append(';');
                        Packet.Append(Result.WinMountXp).Append(';');
                    }
                    else
                    {
                        Packet.Append(";;;;;;");
                    }

                    if (Result.WinItems != null)
                    {
                        Packet.Append(string.Join(",", Result.WinItems.Select(x => x.Key + "~" + x.Value))).Append(';');
                    }
                    else
                    {
                        Packet.Append("").Append(';');
                    }

                    Packet.Append(Result.WinKamas > 0 ? Result.WinKamas.ToString() : "");
                }
            }



            if (GameEndResult.TCollectorResult != null)
            {
                Packet.Append("|5;").Append(GameEndResult.TCollectorResult.TaxCollector.ActorId).Append(";").Append(GameEndResult.TCollectorResult.TaxCollector.N1).Append(",").Append(GameEndResult.TCollectorResult.TaxCollector.N2).Append(";").Append(GameEndResult.TCollectorResult.TaxCollector.Guild.Level).Append(";0;");
                Packet.Append(GameEndResult.TCollectorResult.TaxCollector.Guild.Level).Append(";");
                Packet.Append(GameEndResult.TCollectorResult.TaxCollector.Guild.Experience).Append(";");
                Packet.Append(ExpFloorTable.getGuildXpMax(GameEndResult.TCollectorResult.TaxCollector.Guild.Level)).Append(";;");
                Packet.Append(GameEndResult.TCollectorResult.WinExp).Append(";;");
                if (GameEndResult.TCollectorResult.WinItems != null)
                {
                    Packet.Append(string.Join(",", GameEndResult.TCollectorResult.WinItems.Select(x => x.Key + "~" + x.Value))).Append(';');
                }
                else
                {
                    Packet.Append("").Append(';');
                }
                Packet.Append(GameEndResult.TCollectorResult.WinKamas).Append("|");
            }

            return(Packet.ToString());
        }
예제 #11
0
        public override string Compile()
        {
            var Packet = new StringBuilder("As");

            try
            {
                var Stats = Character.myStats;

                Packet.Append(Character.Experience).Append(',')
                .Append(ExpFloorTable.GetFloorByLevel(Character.Level).Character).Append(',')
                .Append(ExpFloorTable.GetFloorByLevel(Character.Level + 1).Character).Append('|');
                Packet.Append(Character.Kamas).Append('|');
                Packet.Append(Character.CaractPoint).Append('|');
                Packet.Append(Character.SpellPoint).Append('|');
                Packet.Append(Character.Alignement).Append("~").Append(Character.Alignement).Append(",").Append(Character.AlignementLevel).Append(",")
                .Append(Character.getGrade()).Append(",").Append(Character.Honor).Append(",").Append(Character.Deshonor + ",")
                .Append((Character.showWings ? "1" : "0")).Append("|");
                Packet.Append(Character.Life).Append(',').Append(Character.MaxLife).Append('|');
                Packet.Append(Character.Energy).Append(',')
                .Append(10000).Append('|');
                Packet.Append(Character.Initiative).Append('|');
                Packet.Append(Character.Prospection).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddPA).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddPM).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddForce).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddVitalite).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddSagesse).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddChance).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddAgilite).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddIntelligence).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddPO).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddInvocationMax).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddDamage).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddDamagePhysic).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddDamageMagic).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddDamagePercent).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddSoins).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddDamagePiege).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddDamagePiege).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddRenvoiDamageItem).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddDamageCritic).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddEchecCritic).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddEsquivePA).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddEsquivePM).ToString()).Append('|');

                /* resistances */
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamageNeutre).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentNeutre).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePvPNeutre).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentPvPNeutre).ToString()).Append('|');

                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamageTerre).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentTerre).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePvPTerre).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentPvPTerre).ToString()).Append('|');

                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamageEau).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentEau).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePvPEau).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentPvPEau).ToString()).Append('|');

                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamageAir).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentAir).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePvPAir).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentPvPAir).ToString()).Append('|');

                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamageFeu).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentFeu).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePvPFeu).ToString()).Append('|');
                Packet.Append(Stats.GetEffect(EffectEnum.AddReduceDamagePourcentPvPFeu).ToString()).Append('|');

                Packet.Append('1');
            }
            catch (Exception e) { Logger.Error(e); return("BN"); }
            return(Packet.ToString());
        }
예제 #12
0
        private static void ProcessCharacterCreationRequest(WorldClient Client, string Packet)
        {
            var characterInfos = Packet.Substring(2);

            // fake Packet
            if (!characterInfos.Contains('|'))
            {
                Client.Disconnect();
                return;
            }

            var infos = characterInfos.Split('|');

            // fake Packet
            if (infos.Length != 6)
            {
                Client.Disconnect();
                return;
            }

            String first = (infos[0][0].ToString()).ToUpper();
            var    Name  = first + infos[0].Substring(1).ToLower();

            var Class  = int.Parse(infos[1]);
            var Sex    = int.Parse(infos[2]);
            var Color1 = int.Parse(infos[3]);
            var Color2 = int.Parse(infos[4]);
            var Color3 = int.Parse(infos[5]);

            // trop de personnage
            if (Client.Account.Characters.Count > (Settings.AppSettings.GetIntElement("Account.MaxPlayer") - 1))
            {
                Client.Send(new CharacterSlotFullMessage());
                return;
            }

            // fake class
            if (!StringHelper.isValidName(Name) || Class < (int)ClassEnum.CLASS_FECA || Class > (int)ClassEnum.CLASS_PANDAWA)
            {
                Client.Send(new CharacterCreationFailMessage());
                return;
            }

            // fake sex
            if (Sex > 1 || Sex < 0)
            {
                Client.Send(new CharacterCreationFailMessage());
                return;
            }

            // fake color
            if (Color1 < -1 || Color2 < -1 || Color3 < -1)
            {
                Client.Send(new CharacterCreationFailMessage());
                return;
            }

            // pseudo deja pris ?
            if (CharacterTable.Contains(Name) || 4 > Name.Length)
            {
                Client.Send(new CharacterNameAlreadyExistMessage());
                return;
            }

            var character = new Database.Models.Player()
            {
                ID              = DatabaseCache.nextPlayerGuid++,
                Owner           = Client.Account.ID,
                Name            = Name,
                Level           = Settings.AppSettings.GetIntElement("World.StartLevel"),
                Color1          = Color1,
                Color2          = Color2,
                Color3          = Color3,
                Look            = Class * 10,
                Sexe            = Sex,
                Classe          = Class,
                EnabledChannels = "i*#$p%!?:@",
                Map             = Settings.AppSettings.GetShortElement("World.StartMap"),
                CellId          = Settings.AppSettings.GetIntElement("World.StartCell"),
                Restriction     = 0,
                Experience      = ExpFloorTable.GetFloorByLevel(Settings.AppSettings.GetIntElement("World.StartLevel")).Character,
                Kamas           = Settings.AppSettings.GetIntElement("World.KamasStart"),
                CaractPoint     = (Settings.AppSettings.GetIntElement("World.StartLevel") - 1) * 5,
                SpellPoint      = Settings.AppSettings.GetIntElement("World.StartLevel") - 1,
                LifePer         = 100,
                Energy          = 10000,
                AP              = (Settings.AppSettings.GetIntElement("World.StartLevel") >= 100 ? 7 : 6),
                MP              = 3,
                Vitality        = 0,
                Wisdom          = 0,
                Strength        = 0,
                Intell          = 0,
                Agility         = 0,
                Chance          = 0,
                Alignement      = 0,
                Honor           = 0,
                Deshonor        = 0,
                Stuff           = "",
                MountID         = -1,
                MountXPGive     = 0,
                Title           = 0,
                SavePos         = Settings.AppSettings.GetShortElement("World.StartMap") + "," + Settings.AppSettings.GetIntElement("World.StartCell"),
                Account         = Client.Account,
            };

            if (!CharacterTable.Add(character))
            {
                Client.Send(new CharacterCreationFailMessage());
                return;
            }

            Client.Account.Characters.Add(character.ID, character);

            using (CachedBuffer Buffer = new CachedBuffer(Client))
            {
                Buffer.Append(new CharacterCreationSuccessMessage());
                Buffer.Append(new CharactersListMessage(Client.Account.Characters));
            }
        }