예제 #1
0
파일: Party.cs 프로젝트: Emudofus/Aldos
 public Party(Character leader, IEnumerable<Character> members, bool available)
 {
     _leaderId = leader.Id;
     _members.Add(leader);
     if (members != null) _members.AddRange(members);
     _available = available;
 }
예제 #2
0
파일: Party.cs 프로젝트: Emudofus/Aldos
        public bool AddMember(Character member)
        {
            if (_available)
            {
                if (!_members.Contains(member)) _members.Add(member);

                if (Updated != null)
                    Updated(member, new PartyUpdated(member, true));

                return true;
            }

            return false;
        }
예제 #3
0
파일: Parser.cs 프로젝트: Emudofus/Aldos
        private void Parse_CharacterSelectionMessage(CharacterSelectionMessage message)
        {
            Character chosen = _account.Characters.Where(chr => chr.Id == message.Chosen).First();

            if (chosen == null)
            {
                _client.Send(new Utils.Objects.Packet(PacketID.CharacterSelectedErrorMessage));
                return;
            }

            _character = chosen;
            _character.PrivateMessageReceived = ParseEvent;
            _character.Client = _client;
            _account.CurrentCharacter = _character;
            Environment.Instance.ActorSpeaked += ParseEvent;

            _client.Send(new Utils.Objects.Packet(PacketID.BasicNoOperationMessage));
            _client.Send(new CharacterSelectedSuccessMessage(_character));
            _client.Send(new InventoryContentMessage(_character));
            _client.Send(new InventoryWeightMessage());
            _client.Send(new FriendsListMessage(_account.Friends));
            _client.Send(new IgnoredListMessage());
            _client.Send(new EnabledChannelsMessage(GlobalConfig.Network.Game.DefaultEnabledChannels,
                                                    GlobalConfig.Network.Game.DefaultDisabledChannels));
            _client.Send(new SpellListMessage());
            _client.Send(new SetCharacterRestrictionsMessage());

            _client.Send(new TextInformationMessage(Network.Enums.TextInformationType.INFORMATION_MESSAGE,
                                                    GlobalConfig.Network.Game.HomeMessage));
            if (_account.LastIp != _client.IP)
                _client.Send(new SystemChatMessage("Dernière adresse IP utilisée : " + _account.LastIp + "."));
            _client.Send(new SystemChatMessage("Votre adresse IP actuelle : " + _client.IP + "."));
            _client.Send(new SystemChatMessage("Dernière connexion : " + Utils.Other.GetDate(_character.LastUse).ToString() + "."));
        }
예제 #4
0
파일: Parser.cs 프로젝트: Emudofus/Aldos
        private void Parse_CharacterCreationRequestMessage(CharacterCreationRequestMessage message)
        {
            if (_account.Characters.Count >= 6)
            {
                _client.Send(new CharacterCreationResultMessage(Network.Enums.CharacterCreationResult.TOO_MANY_CHARACTERS));
                return;
            }

            if (Character.FindOne(chr => chr.Name == (string)message.CharacterInfos[0]) != null)
            {
                _client.Send(new CharacterCreationResultMessage(Network.Enums.CharacterCreationResult.NAME_ALREADY_EXISTS));
                return;
            }

            _character = Character.New
                (
                    _account,
                    (string)message.CharacterInfos[0],
                    (Gender)message.CharacterInfos[2],
                    (Breed)message.CharacterInfos[1],
                    (List<int>)message.CharacterInfos[3]
                );

            _client.Send(new Utils.Objects.Packet(PacketID.BasicNoOperationMessage));
            _client.Send(new CharacterCreationResultMessage(Network.Enums.CharacterCreationResult.OK));
            _client.Send(new CharactersListMessage(_account.Characters.ToList()));
        }
예제 #5
0
파일: Map.cs 프로젝트: Emudofus/Aldos
 public void OnActorSpeaked(Character sender, string message)
 {
     if (_actors.Contains(sender) && Updated != null)
         Updated(sender, new ActorSpeakedArgs(sender, Channel.GLOBAL, message));
 }
예제 #6
0
파일: Map.cs 프로젝트: Emudofus/Aldos
 public void OnActorMoved(Character sender, List<int> path)
 {
     if (_actors.Contains(sender) && Updated != null)
         Updated(sender, new MapActorMovedArgs(path));
 }
예제 #7
0
파일: EventArgs.cs 프로젝트: Emudofus/Aldos
 public PartyUpdated(Character updated, bool type)
     : base(GameEventArgsType.PartyUpdated)
 {
     Updated = updated;
     Type = type;
 }
예제 #8
0
파일: EventArgs.cs 프로젝트: Emudofus/Aldos
 public PartyLeaderUpdated(Character newLeader)
     : base(GameEventArgsType.PartyLeaderUpdated)
 {
     NewLeader = newLeader;
 }
예제 #9
0
파일: Party.cs 프로젝트: Emudofus/Aldos
 public Party(Character leader)
     : this(leader, null, false)
 {
 }
예제 #10
0
파일: Party.cs 프로젝트: Emudofus/Aldos
        public bool RemoveMember(Character member)
        {
            if (_available)
            {
                if (_members.Remove(member) && Updated != null)
                {
                    Updated(member, new PartyUpdated(member, false));

                    if (_members.Count == 1)
                    {
                        Updated(_members.Last(), new PartyUpdated(_members.Last(), false));
                        _members.Clear();

                        return true;
                    }
                    else if (_leaderId == member.Id)
                        Leader = _members[new Random().Next(0, _members.Count)];

                    return true;
                }
            }

            return false;
        }
예제 #11
0
파일: Character.cs 프로젝트: Emudofus/Aldos
        private static void Insert(Character chr)
        {
            Utils.DatabaseManager.Instance.Execute
                (
                    "INSERT INTO `character` " +

                    "(`Id`, `Account_Id`, `Name`, `Gender`, `Breed`, `Level`, `Colors`, `LastUse`, `CurrentMap_Id`, `CurrentCell_Id`, " +
                    "`StatsPoints`, `SpellsPoints`, `Kamas`, `Energy`, `Vitality`, `Wisdom`, `Strength`, `Intelligence`, `Chance`, `Agility`)" +

                    "VALUES (" +
                    chr.Id + ", '" + chr.Owner.Id + "', '" + chr.Name + "', '" + chr.Gender + "', '" + chr.Breed + "', '" + chr.Level + "', " +
                    "'" + string.Join<int>(";", chr.Look.Colors) + "', '" + chr.LastUse + "', '" + chr.Disposition.Map.Id + "', " +
                    "'" + chr.Disposition.Cell + "', '" + chr.Characteristics.statsPoints + "', '" + chr.Characteristics.spellsPoints + "', " +
                    "'" + chr.Characteristics.kamas + "', '" + chr.Characteristics.energyPoints + "', '" + chr.Characteristics.vitality + "', " +
                    "'" + chr.Characteristics.wisdom + "', '" + chr.Characteristics.strength + "', '" + chr.Characteristics.intelligence + "', " +
                    "'" + chr.Characteristics.chance + "', '" + chr.Characteristics.agility + "'" +
                           ");"
                );
        }
예제 #12
0
파일: Character.cs 프로젝트: Emudofus/Aldos
 public bool SendPrivateMessage(Character sender, string message)
 {
     if (PrivateMessageReceived != null)
     {
         PrivateMessageReceived(sender, new ActorSpeakedArgs(sender, Channel.PSEUDO_PRIVATE, message));
         return true;
     }
     else
         return false;
 }
예제 #13
0
파일: Character.cs 프로젝트: Emudofus/Aldos
        /// <summary>
        /// Initialize and insert the character in the database.
        /// </summary>
        /// <param name="owner">Owner of character</param>
        /// <param name="name">Character's name</param>
        /// <param name="gender">Character's gender</param>
        /// <param name="breed">Character's breed</param>
        /// <param name="colors">Character's colors</param>
        /// <returns>Character created</returns>
        public static Character New(Account owner, string name, Gender gender, Breed breed, List<int> colors)
        {
            Character ret = new Character
                (
                    ++s_lastId, owner, name, gender, breed, GlobalConfig.Network.Game.StartLevel,
                    colors, Environment.Instance.Now,
                    new Network.Types.context.EntityDispositionInformations
                        (
                            GlobalConfig.Network.Game.StartMap,
                            GlobalConfig.Network.Game.StartCell,
                            Directions.SOUTH_WEST
                        ),
                    new Network.Types.character.CharacterCharacteristicsInformations
                        (
                            GlobalConfig.Network.Game.StartLevel, breed,
                            (5*GlobalConfig.Network.Game.StartLevel-5), (GlobalConfig.Network.Game.StartLevel - 1),
                            0, 0, 0, 0, 0, 0, 0, 0
                        )
                );

            Insert(ret);

            return ret;
        }