Ejemplo n.º 1
0
        public void AddFriend(string Name)
        {
            Player Plr = GetPlayer();

            if (Plr == null)
            {
                return;
            }

            Name = Name.ToLower();

            if (Name.Length <= 0 || Name.ToLower() == Plr.Name.ToLower())
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_SN_FRIENDSLIST_ERR_ADD_SELF);
                return;
            }

            Character_social Social = GetSocial(Name);

            if (Social != null && Social.Friend > 0)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_SN_FRIENDSLIST_ERR_EXISTS);
                return;
            }

            Character Char = CharMgr.GetCharacter(Name);

            if (Char == null)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_SN_LISTS_ERR_PLAYER_NOT_FOUND);
                return;
            }

            EventInterface Event = null;

            if (Social != null)
            {
                Social.Friend = 1;
                CharMgr.Database.SaveObject(Social);

                Event = EventInterface.GetEventInterface((uint)Social.DistCharacterId);
            }
            else
            {
                Social                 = new Character_social();
                Social.CharacterId     = Plr._Info.CharacterId;
                Social.DistName        = Char.Name;
                Social.DistCharacterId = Char.CharacterId;
                Social.Friend          = 1;
                Social.Ignore          = 0;
                CharMgr.Database.AddObject(Social);

                Event = Load(Social);
            }

            SendFriends(Social);
            Plr.SendLocalizeString(Char.Name, GameData.Localized_text.TEXT_SN_FRIENDSLIST_ADD_SUCCESS);
        }
Ejemplo n.º 2
0
        public Player(GameClient Client, Character Info) : base()
        {
            Log.Success("Player", "Construction de " + Info.Name);

            _Client = Client;
            _Info   = Info;
            _Value  = Info.Value[0];

            Name = Info.Name;
            SetFaction((byte)(8 * (8 * Info.Realm) + 6));

            EvtInterface = EventInterface.GetEventInterface((uint)_Info.CharacterId);
            SocInterface = new SocialInterface(this);
            TokInterface = new TokInterface(this);
        }
Ejemplo n.º 3
0
        public EventInterface Load(Character_social Social)
        {
            if (Social == null || Social.DistCharacterId == 0)
            {
                return(null);
            }

            EventInterface Interface = EventInterface.GetEventInterface((uint)Social.DistCharacterId);

            Interface.AddEventNotify(EventName.PLAYING, OnPlayerConnect, true);
            Interface.AddEventNotify(EventName.LEAVE, OnPlayerLeave, true);
            Social.Event = Interface;
            _Socials.Add(Social);

            return(Interface);
        }
Ejemplo n.º 4
0
Archivo: Player.cs Proyecto: uvbs/DoR
        public Player(GameClient Client, Character Info) : base()
        {
            _Client = Client;
            _Info   = Info;
            _Value  = Info.Value;

            Name  = Info.Name;
            Realm = (GameData.Realms)Info.Realm;
            SetPVPFlag(false);

            EvtInterface = AddInterface(EventInterface.GetEventInterface((uint)_Info.CharacterId)) as EventInterface;
            SocInterface = AddInterface <SocialInterface>();
            TokInterface = AddInterface <TokInterface>();
            MlInterface  = AddInterface <MailInterface>();

            EvtInterface.AddEventNotify(EventName.ON_MOVE, CancelQuit);
            EvtInterface.AddEventNotify(EventName.ON_RECEIVE_DAMAGE, CancelQuit);
            EvtInterface.AddEventNotify(EventName.ON_DEAL_DAMAGE, CancelQuit);
            EvtInterface.AddEventNotify(EventName.ON_START_CASTING, CancelQuit);
        }