Esempio n. 1
0
        public CharacterState(Character character)
        {
            Character = character;
            created = false;

            Party = null;
            Followers = new List<Character>();
        }
Esempio n. 2
0
        public CharacterParty(Character leader)
        {
            Members = new Dictionary<Character, int>();

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

            _ownerID = leader.ID;
            _ownerName = leader.Name;
        }
Esempio n. 3
0
        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]);
            }
        }
Esempio n. 4
0
        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.World.Realm.Characters.Character>();
            Commander = new RealmCommand(this);
            _parser = new RealmParser(this);

            Player = null;
            isAuth = false;

            Send("HG");
        }
Esempio n. 5
0
        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()));
            }
        }
Esempio n. 6
0
        private void CreateCharacter(string datas)
        {
            try
            {
                var characterDatas = datas.Split('|');

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

                    character.ID = Entities.Cache.CharactersCache.GetNewID();
                    character.Name = characterDatas[0];
                    character.Level = Utilities.Config.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.GetIntElement("StartMap_Feca");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Feca");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Feca");
                            return;
                        case 2:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Osa");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Osa");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Osa");
                            return;
                        case 3:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Enu");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Enu");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Enu");
                            return;
                        case 4:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Sram");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Sram");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Sram");
                            return;
                        case 5:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Xel");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Xel");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Xel");
                            return;
                        case 6:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Eca");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Eca");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Eca");
                            return;
                        case 7:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Eni");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Eni");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Eni");
                            return;
                        case 8:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Iop");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Iop");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Iop");
                            return;
                        case 9:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Cra");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Cra");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Cra");
                            return;
                        case 10:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Sadi");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Sadi");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Sadi");
                            return;
                        case 11:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Sacri");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Sacri");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Sacri");
                            return;
                        case 12:
                            character.MapID = Utilities.Config.GetIntElement("StartMap_Panda");
                            character.MapCell = Utilities.Config.GetIntElement("StartCell_Panda");
                            character.Dir = Utilities.Config.GetIntElement("StartDir_Panda");
                            return;
                    }

                    character.CharactPoint = (character.Level - 1) * 5;
                    character.SpellPoint = (character.Level - 1);
                    character.Exp = Entities.Cache.LevelsCache.ReturnLevel(character.Level).Character;
                    character.Kamas = (long)Utilities.Config.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();

                    Entities.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());
            }
        }