コード例 #1
0
ファイル: CharacterState.cs プロジェクト: T4NK/SunDofus
        public CharacterState(Character character)
        {
            Character = character;
            created = false;

            Party = null;
            Followers = new List<Character>();
        }
コード例 #2
0
ファイル: CharacterParty.cs プロジェクト: T4NK/SunDofus
        public CharacterParty(Character leader)
        {
            Members = new Dictionary<Character, int>();

            lock (Members)
                Members.Add(leader, 1);

            _ownerID = leader.ID;
            _ownerName = leader.Name;
        }
コード例 #3
0
ファイル: ItemUsableModel.cs プロジェクト: T4NK/SunDofus
        public void ParseEffect(Character client)
        {
            var datas = Args.Split('|');

            foreach (var effect in datas)
            {
                var infos = effect.Split(';');
                Realm.Effects.EffectAction.ParseEffect(client, int.Parse(infos[0]), infos[1]);
            }
        }
コード例 #4
0
ファイル: RealmClient.cs プロジェクト: T4NK/SunDofus
        public RealmClient(SilverSocket socket)
            : base(socket)
        {
            _packetLocker = new object();

            this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected);
            this.ReceivedDatas += new ReceiveDatasHandler(this.ReceivedPackets);

            Characters = new List<SunDofus.Realm.Characters.Character>();
            Commander = new RealmCommand(this);
            _parser = new RealmParser(this);

            Player = null;
            isAuth = false;

            Send("HG");
        }
コード例 #5
0
ファイル: CharacterParty.cs プロジェクト: T4NK/SunDofus
        public void AddMember(Character member)
        {
            lock(Members)
                Members.Add(member, 0);

            member.State.Party = this;

            if (Members.Count == 2)
            {
                Send(string.Format("PCK{0}", _ownerName));
                Send(string.Format("PL{0}", _ownerID));
                Send(string.Format("PM{0}", PartyPattern()));
            }
            else
            {
                member.NetworkClient.Send(string.Format("PCK{0}", _ownerName));
                member.NetworkClient.Send(string.Format("PL{0}", _ownerID));
                member.NetworkClient.Send(string.Format("PM{0}", PartyPattern()));

                foreach (var character in Members.Keys.ToList().Where(x => x != member).OrderByDescending(x => x.Stats.initiative.Total()))
                    character.NetworkClient.Send(string.Format("PM{0}", character.PatternOnParty()));
            }
        }
コード例 #6
0
ファイル: RealmParser.cs プロジェクト: T4NK/SunDofus
        private void CreateCharacter(string datas)
        {
            try
            {
                var characterDatas = datas.Split('|');

                if (characterDatas[0] != "" | CharactersManager.ExistsName(characterDatas[0]) == false)
                {
                    var character = new Character();

                    character.ID = Database.Cache.CharactersCache.GetNewID();
                    character.Name = characterDatas[0];
                    character.Level = Utilities.Config.GetConfig.GetIntElement("StartLevel");
                    character.Class = int.Parse(characterDatas[1]);
                    character.Sex = int.Parse(characterDatas[2]);
                    character.Skin = int.Parse(character.Class + "" + character.Sex);
                    character.Size = 100;
                    character.Color = int.Parse(characterDatas[3]);
                    character.Color2 = int.Parse(characterDatas[4]);
                    character.Color3 = int.Parse(characterDatas[5]);

                    switch (character.Class)
                    {
                        case 1:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Feca");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Feca");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Feca");
                            return;
                        case 2:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Osa");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Osa");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Osa");
                            return;
                        case 3:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Enu");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Enu");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Enu");
                            return;
                        case 4:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Sram");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Sram");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Sram");
                            return;
                        case 5:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Xel");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Xel");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Xel");
                            return;
                        case 6:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Eca");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Eca");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Eca");
                            return;
                        case 7:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Eni");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Eni");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Eni");
                            return;
                        case 8:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Iop");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Iop");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Iop");
                            return;
                        case 9:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Cra");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Cra");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Cra");
                            return;
                        case 10:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Sadi");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Sadi");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Sadi");
                            return;
                        case 11:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Sacri");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Sacri");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Sacri");
                            return;
                        case 12:
                            character.MapID = Utilities.Config.GetConfig.GetIntElement("StartMap_Panda");
                            character.MapCell = Utilities.Config.GetConfig.GetIntElement("StartCell_Panda");
                            character.Dir = Utilities.Config.GetConfig.GetIntElement("StartDir_Panda");
                            return;
                    }

                    character.CharactPoint = (character.Level - 1) * 5;
                    character.SpellPoint = (character.Level - 1);
                    character.Exp = Database.Cache.LevelsCache.ReturnLevel(character.Level).Character;
                    character.Kamas = (long)Utilities.Config.GetConfig.GetIntElement("StartKamas");

                    character.isNewCharacter = true;

                    if (character.Class < 1 | character.Class > 12 | character.Sex < 0 | character.Sex > 1)
                    {
                        Client.Send("AAE");
                        return;
                    }

                    character.SpellsInventary.LearnSpells();

                    Database.Cache.CharactersCache.CreateCharacter(character);

                    lock(CharactersManager.CharactersList)
                        CharactersManager.CharactersList.Add(character);

                    lock(Client.Characters)
                        Client.Characters.Add(character);

                    Network.ServersHandler.AuthLinks.Send(string.Format("SNAC|{0}|{1}", Client.Infos.ID, character.Name));

                    Client.Send("TB");
                    Client.Send("AAK");
                    SendCharacterList("");
                }
                else
                {
                    Client.Send("AAE");
                }
            }
            catch (Exception e)
            {
                Utilities.Loggers.ErrorsLogger.Write(e.ToString());
            }
        }