Beispiel #1
0
        public GameClient GetClientByAccount(GameClient Me,int AccountId)
        {
            lock(Clients)
                for(int i=0;i<Clients.Length;++i)
                    if (Clients[i] != null && Clients[i] != Me)
                    {
                        GameClient Client = Clients[i] as GameClient;
                        if (Client.HasAccount() && Client._Account.AccountId == AccountId)
                            return Client;
                    }

            return null;
        }
Beispiel #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);
        }
Beispiel #3
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;
            Realm = (GameData.Realms)Info.Realm;
            SetPvpFlag(false);

            EvtInterface = EventInterface.GetEventInterface((uint)_Info.CharacterId);
            SocInterface = new SocialInterface(this);
            TokInterface = new TokInterface(this);
            MlInterface = new MailInterface(this);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        public static Player CreatePlayer(GameClient Client, Character Char)
        {
            Log.Success("Player", "CreatePlayer");

            GameClient Other = (Client.Server as TCPServer).GetClientByAccount(Client,Char.AccountId);
            if (Other != null)
                Other.Disconnect();

            Player Plr = new Player(Client, Char);

            return Plr;
        }
Beispiel #6
0
        protected override BaseClient GetNewClient()
        {
            GameClient client = new GameClient(this);

            return client;
        }
Beispiel #7
0
        static public void F_PLAYER_STATE2(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
                return;

            Player Plr = cclient.Plr;

            try
            {
                long Pos = packet.Position;

                PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATE2);
                Out.Write(packet.ToArray(), (int)packet.Position, (int)packet.Size);
                Out.WriteByte(0);
                Plr.DispatchPacket(Out, false);

                packet.Position = Pos;
            }
            catch (Exception e)
            {
                Log.Error("F_PLAYER_STATE2", e.ToString());
            }

            if (packet.Size < 17)
            {
                Plr.IsMoving = false;
                return;
            }

            UInt16 Key = packet.GetUint16();

            byte MoveByte = packet.GetUint8();
            byte UnkByte = packet.GetUint8();
            byte CombatByte = packet.GetUint8();
            byte RotateByte = packet.GetUint8();

            UInt16 Heading = packet.GetUint16R();
            UInt16 X = packet.GetUint16R();
            UInt16 Y = packet.GetUint16R();
            byte Unk1 = packet.GetUint8();
            UInt16 Z = packet.GetUint16R();
            //byte Unk2 = packet.GetUint8();

            Heading /= 8;
            X /= 2;
            Y /= 2;
            Z /= 2;

            if (CombatByte >= 50 && CombatByte < 0x92 || CombatByte == 0xDF)
            {
                if (Plr.LastCX != 0 && Plr.LastCY != 0)
                {
                    if (Plr.LastCX > 12288 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (X > 12288 && Plr.LastCX < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastCY > 24576 && Y < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Y > 24576 && Plr.LastCY < 8192)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));
                }

                Plr.LastCX = X;
                Plr.LastCY = Y;

                X = Plr.Zone.CalculCombat(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculCombat(Y, Plr.YOffset, false);
                Heading /= 2;
                Z += 32768;
                Z /= 4;
            }
            else
            {
                if (Plr.LastX != 0 && Plr.LastY != 0)
                {
                    if (Plr.LastX > 24576 && X < 4096)
                        Plr.SetOffset((ushort)(Plr.XOffset + 1), Plr.YOffset);
                    else if (Plr.LastX < 4096 && X > 24576)
                        Plr.SetOffset((ushort)(Plr.XOffset - 1), Plr.YOffset);

                    if (Plr.LastY > 24576 && Y < 4096)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset + 1));
                    else if (Plr.LastY < 4096 && Y > 24576)
                        Plr.SetOffset(Plr.XOffset, (ushort)(Plr.YOffset - 1));

                }

                Plr.LastX = X;
                Plr.LastY = Y;

                X = Plr.Zone.CalculPin(X, Plr.XOffset, true);
                Y = Plr.Zone.CalculPin(Y, Plr.YOffset, false);
            }

            Plr.SetPosition(X, Y, Z, Heading);
        }
Beispiel #8
0
 static public void F_REQUEST_INIT_OBJECT(BaseClient client, PacketIn packet)
 {
     GameClient cclient = client as GameClient;
 }