Beispiel #1
0
        private void SetTimerState(bool active)
        {
            PacketOut Out;

            EvtInterface.RemoveEvent(TimerUp);

            if (!active)
            {
                Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE);
                Out.WriteUInt32(0x1BA0);
                Out.WriteHexStringBytes("0300000016560100000000");
            }

            else
            {
                Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO);
                Out.WriteUInt32(0x1BA0);
                Out.WriteHexStringBytes("000001000000020000167C00");

                Out.WriteByte((byte)_capturePoints.Count);

                foreach (CapturePoint c in _capturePoints)
                {
                    Out.WriteHexStringBytes("000001000000");
                    Out.WritePascalString(c.ObjectiveName);
                }

                Out.WriteHexStringBytes("FF00");
                Out.WritePascalString("Pacify all of the Trolls!");

                Out.WriteByte(0);
                Out.WritePascalString("These are the areas that Destruction controls. They can only be claimed while holding the Troll Pacifier located at the top of Stone Troll Hill.");

                // Timer
                Out.WriteUInt32(60);
                // Timer
                Out.WriteUInt32(60);
                Out.WriteUInt32(0);
                Out.WriteByte(0);
                Out.WriteUInt32(0);

                EvtInterface.AddEvent(TimerUp, 60000, 1);
            }

            for (int i = 0; i < 2; ++i)
            {
                foreach (Player plr in Players[i])
                {
                    plr.SendPacket(Out);
                }
            }
        }
Beispiel #2
0
        public void SendAbilityDone(ushort TargetOID)
        {
            Log.Success("Ability", "Send Done :" + Info.Entry);

            Player    player = this.Caster.GetPlayer();
            PacketOut Out1   = new PacketOut((byte)Opcodes.F_USE_ABILITY);

            Out1.WriteUInt16(0);
            Out1.WriteUInt16(Info.Entry);
            Out1.WriteUInt16(Caster.Oid);
            Out1.WriteHexStringBytes("061022730601000001E601000000");
            player.DispatchPacket(Out1, true);

            PacketOut Out2 = new PacketOut((byte)Opcodes.F_USE_ABILITY);

            Out2.WriteUInt16(0);
            Out2.WriteUInt16(Info.Entry);
            Out2.WriteUInt16(Caster.Oid);
            Out2.WriteHexStringBytes("0610227302010000000001000000");
            player.DispatchPacket(Out2, true);

            PacketOut Out3 = new PacketOut((byte)Opcodes.F_SWITCH_ATTACK_MODE);

            Out3.WriteByte(1);
            Out3.Fill(0, 3);
            player.SendPacket(Out3);

            PacketOut Out4 = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER);

            Out4.WriteUInt16(Info.Entry);
            Out4.Fill(0, 10);
            player.SendPacket(Out4);
        }
        private void StartChannel()
        {
            if (_channelInfo.CastTime == 0)
            {
                throw new InvalidOperationException("A channel's cast time must never be zero.");
            }
            _channelStartTime = TCPManager.GetTimeStampMS();
            _nextTickTime     = _channelStartTime + 1000;
            InvokeChannelBuff();
            _host.AbtInterface.SetCooldown(_baseEntry, _channelInfo.Cooldown * 1000);
            if (_playerHost != null && _channelInfo.SpecialCost > 5)
            {
                _playerHost.CrrInterface.ConsumeResource((byte)_channelInfo.SpecialCost, false);
            }
            else if (_channelInfo.SpecialCost < 0)
            {
                Player playerCaster = _host as Player;

                if (playerCaster != null)
                {
                    playerCaster.ResetMorale();

                    PacketOut Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER, 12);
                    Out.WriteHexStringBytes("000002000000EA6000000000");
                    playerCaster.SendPacket(Out);
                }
            }
        }
Beispiel #4
0
        public static void UpdateSpeed(Connection conn)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_MAX_VELOCITY);

            Out.WriteHexStringBytes("00C80100");// speed 200
            conn.SendTCP(Out);
        }
Beispiel #5
0
        public static void SummonMount1(Connection conn)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_MOUNT_UPDATE);

            Out.WriteHexStringBytes("29D806BE1DF20000000000000000000000000000");
            conn.SendTCP(Out);
        }
Beispiel #6
0
        public void TimerUp()
        {
            for (int i = 0; i < 2; ++i)
            {
                foreach (Player plr in Players[i])
                {
                    plr.SendClientMessage("LastUpdatedTime up! All Control Points reset.", ChatLogFilters.CHATLOGFILTERS_C_WHITE);
                    if (_flag.Holder?.Realm == plr.Realm)
                    {
                        plr.SendLocalizeString(ChatLogFilters.CHATLOGFILTERS_C_RED_LARGE, Localized_text.TEXT_PQ_FAILED);
                    }
                }
            }

            _flag.ResetTo(EHeldState.Home);

            foreach (CapturePoint c in _capturePoints)
            {
                c.Reset();
            }

            // Disable the timer on UI
            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE);

            Out.WriteUInt32(0x1BA0);
            Out.WriteHexStringBytes("0300000016560100000000");

            for (int i = 0; i < 2; ++i)
            {
                foreach (Player plr in Players[i])
                {
                    plr.SendPacket(Out);
                }
            }
        }
Beispiel #7
0
        public override void Notify_PlayerLoaded()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_EFFECTS, 48);

            Out.WriteByte(1);
            Out.WriteByte(1);
            Out.WriteUInt16(0);
            Out.WriteUInt16(myPlayer.Oid);
            Out.WriteByte(254);
            Out.WriteByte(0);
            if (myPlayer.Info.CareerLine == 20)
            {
                Out.WriteUInt16R(332);
            }
            else
            {
                Out.WriteUInt16R(267);  // 263 for shammy
            }
            Out.WriteHexStringBytes("E4EECC02");
            Out.WriteUInt16R(myPlayer.Oid);

            // Buff Lines
            Out.WriteByte(10);

            for (int i = 0; i < 5; ++i)
            {
                Out.WriteByte((byte)i);
                if (ExperimentalMode)
                {
                    Out.WriteZigZag(-40);
                }
                else
                {
                    Out.WriteZigZag(-20 * (i + 1));
                }
            }

            for (int i = 0; i < 5; ++i)
            {
                Out.WriteByte((byte)(i + 5));
                if (ExperimentalMode)
                {
                    Out.WriteZigZag(-40);
                }
                else
                {
                    Out.WriteZigZag(-20 * (i + 1));
                }
            }

            Out.WriteByte(0);

            myPlayer.SendPacket(Out);
        }
        public override void Notify_PlayerLoaded()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_EFFECTS, 48);

            Out.WriteByte(1);
            Out.WriteByte(1);
            Out.WriteUInt16(0);
            Out.WriteUInt16(myPlayer.Oid);
            Out.WriteByte(253);
            Out.WriteByte(0);
            Out.WriteUInt16R(myPlayer.Info.CareerLine == 9 ? (ushort)269 : (ushort)273);
            Out.WriteHexStringBytes("E2B88202");
            Out.WriteUInt16R(myPlayer.Oid);

            // Buff Lines
            Out.WriteByte(3);

            Out.WriteByte(0);
            Out.WriteZigZag(1);
            Out.WriteByte(2);
            Out.WriteZigZag(1);
            Out.WriteByte(4);
            Out.WriteZigZag(1);

            Out.WriteByte(0);

            myPlayer.SendPacket(Out);

            Out = new PacketOut((byte)Opcodes.F_INIT_EFFECTS, 48);
            Out.WriteByte(1);
            Out.WriteByte(1);
            Out.WriteUInt16(0);
            Out.WriteUInt16(myPlayer.Oid);
            Out.WriteByte(254);
            Out.WriteByte(0);
            Out.WriteUInt16R(myPlayer.Info.CareerLine == 9 ? (ushort)341 : (ushort)342);
            Out.WriteHexStringBytes("E2B88202");
            Out.WriteUInt16R(myPlayer.Oid);

            // Buff Lines
            Out.WriteByte(5);

            for (int i = 0; i < 5; ++i)
            {
                Out.WriteByte((byte)i);
                Out.WriteZigZag(-20 * (i + 1));
            }

            Out.WriteByte(0);

            myPlayer.SendPacket(Out);
        }
Beispiel #9
0
        protected override void SendCreateMonster(Player plr)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);

            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);

            Out.WriteUInt16(Heading);
            Out.WriteUInt16((ushort)WorldPosition.Z);
            Out.WriteUInt32((uint)WorldPosition.X);
            Out.WriteUInt32((uint)WorldPosition.Y);
            Out.WriteUInt16(0);    // Speed Z
            // 18
            Out.WriteUInt16(1578); //1578    1583???

            Out.WriteByte(50);
            Out.WriteByte(Owner.GldInterface.Guild.Info.Level);
            if (RealmStandard == Realms.REALMS_REALM_DESTRUCTION)
            {
                Out.WriteByte(128);
            }
            else
            {
                Out.WriteByte(64);
            }
            Out.Fill(0, 6);
            Out.WriteUInt16(9);
            Out.Fill(0, 13);

            Out.WriteByte(0x02);
            Out.WriteByte(0x17);
            Out.WriteByte(0x19);
            Out.WriteByte(0x01);

            Owner.GldInterface.Guild.BuildHeraldry(Out);
            Log.Info("", "" + Owner.GldInterface.Guild.GetBannerPost(Bannertyp));
            Out.WriteByte(Owner.GldInterface.Guild.GetBannerPost(Bannertyp));
            //Out.WriteByte(0x01);
            Out.WriteByte(0x02);


            Out.WriteStringBytes(Name);

            Out.WriteHexStringBytes("000000100303010A0000001205002905CAA286BB2910640005040000100343002905000000");


            plr.SendPacket(Out);
        }
        public void SendRenownAbility(CharacterInfoRenown ren, byte trained)
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_CAREER_PACKAGE_INFO, 64);

            Out.WriteByte(ren.Tree);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteByte(ren.Position);
            Out.Fill(0, 2);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteByte(trained);                               // skill trained
            Out.WriteByte(2);
            Out.Fill(0, 14);
            Out.WriteByte(ren.Renown_Costs);    // renown costs
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteUInt16(ren.SpellId);    // ability id
            if (ren.Unk.Length > 0)
            {
                Out.WriteHexStringBytes(ren.Unk.Replace(" ", ""));
            }

            else
            {
                Out.WriteByte(3);
                Out.Fill(0, 3);
                Out.WriteUInt16(0x0204);            //???
            }
            Out.WritePascalString("");              // name
            if (ren.Slotreq == 0)
            {
                Out.Fill(0, 5);
            }
            else   // requirement
            {
                Out.WriteByte(1);
                Out.WriteByte(0);
                Out.WriteByte(ren.Slotreq);
                Out.Fill(0, 5);
            }
            _player.SendPacket(Out);
        }
Beispiel #11
0
        public static void F_REQUEST_CHAR(Connection conn, PacketIn packet)
        {
            UInt16 Operation = packet.GetUint16();

            if (Operation == 0x2D58)
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_ERROR);
                Out.WriteByte(2);
                conn.SendTCP(Out);
            }

            else
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_RESPONSE);

                // Out.WriteHexStringBytes("74686562657374370000000000000000000000000000000000FF1400000000004D69726B6661660000000000000000000000000000000000000000000000000000000000000000000000000000000000011A02000E00B400000000000000000000000000C91200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF00000000000000FF00000000000000FF00000000000000FF00000000000000FF0000004604000000000000000000000000000000000000FF0000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
                Out.WriteHexStringBytes("74686562657374370000000000000000000000000000000000FF14000000000054796F6E6574680000000000000000000000000000000000000000000000000000000000000000000000000000000000286B02012A00D100000000000000000000000000EE25000000000000EC25000000000000ED25000000000000EB25000000000000EA2500000000000000000000000000000000000000000000F21B000000000000EF2500000000000000000000000000000000000000000000540F0000000000002A1E000000000000C41F0000000000003F1E000000000000000000000000000000000000FF00000000000000FF00000000000000FF00000000000000FF00000000000000FF0000006122000000000000000000000000000000000000FF0000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
                conn.SendTCP(Out);
            }
            Log.Trace("F_REQUEST_CHAR");
        }
Beispiel #12
0
        /// <summary>
        /// Sends the cooldown after the siege weapon has fired.
        /// </summary>
        private void SendSiegeCooldown()
        {
            PacketOut Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER);

            Out.WriteUInt16(_abilityId);
            Out.WriteUInt16(0x80);                                               // Unk
            Out.WriteUInt32(Type == SiegeType.SNIPER ? (uint)2500 : (uint)4500); // 5s cooldown
            Out.Fill(0, 4);

            foreach (KeyValuePair <Player, byte> plr in Players)
            {
                plr.Key.SendPacket(Out);
            }

            Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER);
            Out.WriteHexStringBytes("000101800000000000000000");

            foreach (KeyValuePair <Player, byte> plr in Players)
            {
                plr.Key.SendPacket(Out);
            }
        }
Beispiel #13
0
        public void SendCustomPacket(string hexStringBytes)
        {
            try
            {
                hexStringBytes = hexStringBytes.Replace(" ", "");

                byte opcode = Convert.ToByte(hexStringBytes.Substring(0, 2), 16);

                PacketOut packet = new PacketOut(opcode);
                packet.WriteHexStringBytes(hexStringBytes.Remove(0, 2));

                packet.WritePacketLength();
                packet = Crypt(packet);
                byte[] buf = packet.ToArray(); //packet.WritePacketLength sets the Capacity

                socket.Send(buf);
            }
            catch
            {
                Log.Error("SendCustomPacket: Failed to send packet");
            }
        }
Beispiel #14
0
        public void SendSniff(string Str)
        {
            string Result = "";

            using (StringReader Reader = new StringReader(Str))
            {
                string Line;
                while ((Line = Reader.ReadLine()) != null)
                {
                    Result += Line.Substring(1, 48).Replace(" ", string.Empty);
                }
            }

            Result = Result.Remove(0, 4);
            byte Opcode = Convert.ToByte(Result.Substring(0, 2), 16);

            Result = Result.Remove(0, 2);

            PacketOut Out = new PacketOut(Opcode);

            Out.WriteHexStringBytes(Result);
            Out.WritePacketLength();
            SendPacket(Out);
        }
Beispiel #15
0
        // Auto Attack Override
        public override void SendAttackMovement(Unit target)
        {
            switch (Spawn.Proto.Model1)
            {
            case 145:
                break;

            case 146:
                break;

            case 147:
                break;

            case 141:     // pink
                break;

            case 142:     // blue
                break;

            case 143:     // flamer
                break;

            default:
                base.SendAttackMovement(target); return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_USE_ABILITY, 20);

            Out.WriteUInt16(0);
            switch (Spawn.Proto.Model1)
            {
            case 145:
                Out.WriteUInt16(23); break;

            case 146:
                Out.WriteUInt16(26); break;

            case 147:
                Out.WriteUInt16(29); break;

            case 141:     // pink
                Out.WriteUInt16(380); break;

            case 142:     // blue
                Out.WriteUInt16(382); break;

            case 143:     // flamer
                Out.WriteUInt16(381); break;

            default:
                Out.WriteUInt16(Oid); break;
            }
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);
            Out.WriteUInt16(Oid);
            Out.WriteByte(1);
            Out.WriteByte(1);
            Out.WriteHexStringBytes("0000000000000000");
            DispatchPacket(Out, true);

            Out = new PacketOut((byte)Opcodes.F_USE_ABILITY, 20);
            Out.WriteUInt16(0);
            switch (Spawn.Proto.Model1)
            {
            case 145:
                Out.WriteUInt16(23); break;

            case 146:
                Out.WriteUInt16(26); break;

            case 147:
                Out.WriteUInt16(29); break;

            case 141:     // pink
                Out.WriteUInt16(380); break;

            case 142:     // blue
                Out.WriteUInt16(382); break;

            case 143:     // flamer
                Out.WriteUInt16(381); break;

            default:
                Out.WriteUInt16(Oid); break;
            }
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);
            Out.WriteUInt16(Oid);
            Out.WriteByte(2);
            Out.WriteByte(1);
            Out.WriteHexStringBytes("0000000000000000");
            DispatchPacket(Out, true);
        }
        public static void SendAuctions(Player plr, string searchTerm, string sellerName, byte minLevel, byte maxLevel, byte rarity, byte career, List <byte> types, List <byte> slots, byte stat)
        {
            List <Auction> matching = new List <Auction>();
            List <Auction> toRemove = new List <Auction>();

            int count = 0;

            lock (Auctions)
            {
                foreach (Auction auct in Auctions)
                {
                    if (count < MAX_AUCTIONS_TO_SEND)
                    {
                        if (auct.Item == null)
                        {
                            auct.Item = ItemService.GetItem_Info(auct.ItemId);
                        }

                        if (auct.Item == null || auct.Seller == null)
                        {
                            toRemove.Add(auct);
                            continue;
                        }

                        // Opposite realm
                        if (auct.Realm != 0 && auct.Realm != plr.Info.Realm)
                        {
                            continue;
                        }

                        // Name mismatch
                        if (searchTerm != string.Empty && auct.Item.Name.IndexOf(searchTerm, 0, StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            continue;
                        }

                        // Not from requested seller
                        if (sellerName != string.Empty && (auct.Seller == null || auct.Seller.Name.IndexOf(sellerName, 0, StringComparison.OrdinalIgnoreCase) == -1))
                        {
                            continue;
                        }

                        // Level mismatch
                        if (minLevel != 0 && auct.Item.MinRank < minLevel)
                        {
                            continue;
                        }
                        if (maxLevel != 0 && auct.Item.MinRank > maxLevel)
                        {
                            continue;
                        }

                        // Attribute mismatch
                        if (rarity != 0 && auct.Item.Rarity != Math.Log(rarity, 2))
                        {
                            continue;
                        }
                        if (career != 0 && !plr.ItmInterface.CanUseItemType(auct.Item, 0, career))
                        {
                            continue;
                        }
                        if (types.Count != 0 && !types.Contains(auct.Item.Type))
                        {
                            continue;
                        }
                        if (slots.Count != 0 && !slots.Contains((byte)auct.Item.SlotId))
                        {
                            continue;
                        }
                        if (stat != 0 && !auct.Item._Stats.Keys.Contains(stat))
                        {
                            continue;
                        }

                        matching.Add(auct);
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }

                if (toRemove.Count > 0)
                {
                    foreach (var auct in toRemove)
                    {
                        Auctions.Remove(auct);
                        CharMgr.Database.DeleteObject(auct);
                    }
                }
            }


            PacketOut Out = new PacketOut((byte)Opcodes.F_AUCTION_SEARCH_RESULT, 7 + matching.Count * 300);

            Out.WriteHexStringBytes("0000753400");
            Out.WriteByte((byte)matching.Count);// count
            Out.WriteByte(0x01);

            foreach (Auction auct in matching)
            {
                Out.WriteUInt64(auct.AuctionId); // id
                Out.WriteUInt16(1);              // part of the id?
                Out.WriteUInt16(0xA752);
                Out.WriteUInt32(0);              // unk
                Out.WriteUInt32(auct.SellPrice); // price
                Out.WriteByte(0x03);             // ??
                Out.FillString(auct.Seller == null ? "" : auct.Seller.Name + (auct.Seller.Sex == 1 ? "^F" : "^M"), 48);
                Out.WriteHexStringBytes("880E39");

                Item.BuildItem(ref Out, null, null, new MailItem(auct.ItemId, auct._Talismans, auct.PrimaryDye, auct.SecondaryDye, auct.Count), 0, auct.Count);

                if (plr != null && plr.ItmInterface != null && auct.Item != null && auct.Item.ItemSet != 0)
                {
                    plr.ItmInterface.SendItemSetInfoToPlayer(plr, auct.Item.ItemSet);
                }
            }

            plr.SendPacket(Out);
        }
Beispiel #17
0
        public static void F_REQUEST_LASTNAME(BaseClient client, PacketIn In)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null)
            {
                return;
            }

            Player Plr = cclient.Plr;

            string lastName = In.GetStringToZero();

            if (lastName == null)
            {
                lastName = "";
            }

            if (Plr.noSurname == 1)
            {
                Plr.SendClientMessage("You have been flagged by a GM to not be able to set a last name", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                // Send success, don't subtract gold
                SendUpdateLastNameSuccess(Plr);
                return;
            }

            // Check to see if the player actually changed their last name
            if (lastName == Plr.Info.Surname)
            {
                Plr.SendClientMessage("The new name is the same as the current name.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                // Send success, don't subtract gold
                SendUpdateLastNameSuccess(Plr);
                return;
            }

            // Check that the name does not exceed the character limit
            if (lastName.Length > GameData.Constants.LastNameCharacterLimit)
            {
                Plr.SendClientMessage("The new name is longer than the character limit.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                SendUpdateLastNameError(Plr);
                return;
            }

            // Check that lastName contains only valid characters
            string invalidCharsFound = FindInvalidCharsInLastName(lastName);

            if (invalidCharsFound.Length > 0)
            {
                string msg = string.Format(
                    "The requested name '{0}' contains the invalid characters [{1}].",
                    lastName, invalidCharsFound);
                Plr.SendClientMessage(msg, ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                SendUpdateLastNameError(Plr);
                return;
            }

            // Check for high enough level
            if (Plr._Value.Level < GameData.Constants.LastNameLevelRequirement)
            {
                Plr.SendClientMessage("You require Rank " + GameData.Constants.LastNameLevelRequirement + " in order to set a last name.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                SendUpdateLastNameError(Plr);
                return;
            }

            // Check that the player has enough gold
            if (Plr._Value.Money < GameData.Constants.LastNameChangeCost)
            {
                Plr.SendClientMessage("You do not have enough money.", ChatLogFilters.CHATLOGFILTERS_USER_ERROR);
                SendUpdateLastNameError(Plr);
                return;
            }

            // Check for abuse
            // Kick straight off for using invalid name.
            if (!CharMgr.AllowName(lastName))
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_QUIT, 4);
                Out.WriteHexStringBytes("01000000");
                Plr.SendPacket(Out);
                return;
            }

            if (lastName.Length > 1)
            {
                lastName = char.ToUpper(lastName[0]) + lastName.Substring(1).ToLower();
            }

            // Update last name field
            Plr.SetLastName(lastName);
            Plr.RemoveMoney(Constants.LastNameChangeCost);

            SendUpdateLastNameSuccess(Plr);
        }
        public void ResetProgressionCommunications(Player plr, Realms realm, VictoryPointProgress vpp, string forceT4)
        {
            _logger.Warn("F_CAMPAIGN_STATUS");
            PacketOut Out = new PacketOut((byte)Opcodes.F_CAMPAIGN_STATUS, 159);

            Out.WriteHexStringBytes("0005006700CB00"); // 7

            // Dwarfs vs Greenskins T1

            Out.WriteByte(0);    // 0 and ignored
            Out.WriteByte(100);  // % Order lock
            Out.WriteByte(0);    // % Dest lock
            // Dwarfs vs Greenskins T2
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(12, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(50);
            Out.WriteByte(50);
            // Dwarfs vs Greenskins T3
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(10, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(100);
            // Dwarfs vs Greenskins T4
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(2, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            // Empire vs Chaos T1
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(8, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(100);
            Out.WriteByte(0);
            // Empire vs Chaos T2
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(14, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(100);
            // Empire vs Chaos T3
            // BuildCaptureStatus(Out, WorldMgr.GetRegion(6, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(100);
            // Empire vs Chaos T4
            // BuildCaptureStatus(Out, WorldMgr.GetRegion(11, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            // High Elves vs Dark Elves T1
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(3, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            // High Elves vs Dark Elves T2
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(15, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            // High Elves vs Dark Elves T3
            // BuildCaptureStatus(Out, WorldMgr.GetRegion(16, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            // High Elves vs Dark Elves T4
            //BuildCaptureStatus(Out, WorldMgr.GetRegion(4, false), realm);
            Out.WriteByte(0);
            Out.WriteByte(100);
            Out.WriteByte(100);

            Out.Fill(0, 83);

            if (string.IsNullOrEmpty(forceT4))
            {
                Out.WriteByte(3);       //dwarf fort
                Out.WriteByte((byte)1); // KV 0 contested, 1 order, 2 dest
                Out.WriteByte((byte)0); // TM
                Out.WriteByte((byte)2); // BC
                Out.WriteByte(3);       //fort

                Out.WriteByte(3);       //emp fort
                Out.WriteByte((byte)1); // reik
                Out.WriteByte((byte)0); // praag
                Out.WriteByte((byte)2); // cw
                Out.WriteByte(3);       //fort

                Out.WriteByte(3);       //elf fort
                Out.WriteByte((byte)1); // Eataine
                Out.WriteByte((byte)0); // DW
                Out.WriteByte((byte)2); // Caledor
                Out.WriteByte(3);       //fort
            }
            else
            {
                Out.WriteByte(3);                                     //dwarf fort
                Out.WriteByte(Convert.ToByte(forceT4[0].ToString())); // KV 0 contested, 1 order, 2 dest
                Out.WriteByte(Convert.ToByte(forceT4[1].ToString())); // TM
                Out.WriteByte(Convert.ToByte(forceT4[2].ToString())); // BC
                Out.WriteByte(3);                                     //fort

                Out.WriteByte(3);                                     //emp fort
                Out.WriteByte(Convert.ToByte(forceT4[3].ToString())); // reik
                Out.WriteByte(Convert.ToByte(forceT4[4].ToString())); // praag
                Out.WriteByte(Convert.ToByte(forceT4[5].ToString())); // cw
                Out.WriteByte(3);                                     //fort

                Out.WriteByte(3);                                     //elf fort
                Out.WriteByte(Convert.ToByte(forceT4[6].ToString())); // Eataine
                Out.WriteByte(Convert.ToByte(forceT4[7].ToString())); // DW
                Out.WriteByte(Convert.ToByte(forceT4[8].ToString())); // Caledor
                Out.WriteByte(3);                                     //fort
            }
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteByte(0);

            Out.WriteByte(00);

            Out.Fill(0, 4);

            _logger.Debug("APOCCOMM:" + Out.ToString());

            plr.SendPacket(Out);
        }
        public void SendCampaignStatus(Player plr, VictoryPointProgress vpp, Realms realm)
        {
            _logger.Trace("Send Campaign Status");
            _logger.Warn("F_CAMPAIGN_STATUS");
            PacketOut Out = new PacketOut((byte)Opcodes.F_CAMPAIGN_STATUS, 159);

            Out.WriteHexStringBytes("0005006700CB00"); // 7

            // Dwarfs vs Greenskins T1
            BuildCaptureStatus(Out, WorldMgr.GetRegion(1, false), realm);

            // Dwarfs vs Greenskins T2
            BuildCaptureStatus(Out, WorldMgr.GetRegion(12, false), realm);

            // Dwarfs vs Greenskins T3
            BuildCaptureStatus(Out, WorldMgr.GetRegion(10, false), realm);

            // Dwarfs vs Greenskins T4
            BuildCaptureStatus(Out, WorldMgr.GetRegion(2, false), realm);

            // Empire vs Chaos T1
            BuildCaptureStatus(Out, WorldMgr.GetRegion(8, false), realm);

            // Empire vs Chaos T2
            BuildCaptureStatus(Out, WorldMgr.GetRegion(14, false), realm);

            // Empire vs Chaos T3
            BuildCaptureStatus(Out, WorldMgr.GetRegion(6, false), realm);

            // Empire vs Chaos T4
            BuildCaptureStatus(Out, WorldMgr.GetRegion(11, false), realm);

            // High Elves vs Dark Elves T1
            BuildCaptureStatus(Out, WorldMgr.GetRegion(3, false), realm);

            // High Elves vs Dark Elves T2
            BuildCaptureStatus(Out, WorldMgr.GetRegion(15, false), realm);

            // High Elves vs Dark Elves T3
            BuildCaptureStatus(Out, WorldMgr.GetRegion(16, false), realm);

            // High Elves vs Dark Elves T4
            BuildCaptureStatus(Out, WorldMgr.GetRegion(4, false), realm);

            Out.Fill(0, 83);

            // RB   4/24/2016   Added logic for T4 campaign progression.
            //gs t4
            // 0 contested 1 order controled 2 destro controled 3 notcontroled locked
            Out.WriteByte(3);                                          //dwarf fort
            BuildBattleFrontStatus(Out, WorldMgr.GetRegion(2, false)); //kadrin valley
            Out.WriteByte(3);                                          //orc fort

            //chaos t4
            Out.WriteByte(3);   //empire fort

            Out.WriteByte((byte)3);
            BuildBattleFrontStatus(Out, WorldMgr.GetRegion(11, false)); //reikland
            Out.WriteByte(3);                                           //chaos fort

            //elf
            Out.WriteByte(3);                                          //elf fort
            BuildBattleFrontStatus(Out, WorldMgr.GetRegion(4, false)); //etaine
            Out.WriteByte(3);                                          //delf fort

            Out.WriteByte(0);                                          // Order underdog rating
            Out.WriteByte(0);                                          // Destruction underdog rating

            if (plr == null)
            {
                byte[] buffer = Out.ToArray();

                if (Player._Players.Count == 0)
                {
                    plr.SendPacket(Out);
                }
                else
                {
                    lock (Player._Players)
                    {
                        foreach (Player player in Player._Players)
                        {
                            if (player == null || player.IsDisposed || !player.IsInWorld())
                            {
                                continue;
                            }

                            PacketOut playerCampaignStatus = new PacketOut(0, 159)
                            {
                                Position = 0
                            };
                            playerCampaignStatus.Write(buffer, 0, buffer.Length);

                            if (player.Region?.Campaign != null)
                            {
                                WriteVictoryPoints(player.Realm, playerCampaignStatus, vpp);
                            }

                            else
                            {
                                playerCampaignStatus.Fill(0, 9);
                            }

                            playerCampaignStatus.Fill(0, 4);

                            player.SendPacket(playerCampaignStatus);
                        }
                    }
                }
            }
            else
            {
                if (plr.Region?.Campaign != null)
                {
                    WriteVictoryPoints(plr.Realm, Out, vpp);
                }

                else
                {
                    Out.Fill(0, 9);
                }

                Out.Fill(0, 4);

                plr.SendPacket(Out);
            }
        }
Beispiel #20
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Log.Success("SendInteract", "" + Name + " -> " + Plr.Name + ",Type=" + InteractType);



            Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_SPEACK_TO, Spawn.Entry, 1);

            if (!IsDead)
            {
                // perhaps do some checks?
                if (Menu.Menu == 7) // Trainer Spells
                {
                    PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    Out.WriteByte(5);
                    Out.WriteByte(0x0F);
                    Out.WriteByte(6);
                    Out.WriteUInt16(0);
                    Plr.SendPacket(Out);
                }
                else if (Menu.Menu == 9) // List items for sale
                {
                    WorldMgr.SendVendor(Plr, Spawn.Entry);
                }
                else if (Menu.Menu == 11) // Buy an item
                {
                    WorldMgr.BuyItemVendor(Plr, Menu, Spawn.Entry);
                }
                else if (Menu.Menu == 14) // Sells an Item
                {
                    Plr.ItmInterface.SellItem(Menu);
                }
                else if (Menu.Menu == 25) // Set rally point
                {
                    RallyPoint Rally = WorldMgr.GetRallyPointFromNPC(Entry);
                    if (Rally != null)
                    {
                        Plr._Value.RallyPoint = Rally.Id;

                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x12);
                        Out.WriteUInt16(Menu.Oid);
                        Out.WriteUInt16(Plr._Value.RallyPoint);
                        Plr.SendPacket(Out);
                    }
                    else
                    {
                        Plr.SendLocalizeString("ERROR: Unknown Rally Point NPC (" + Entry + ").", GameData.Localized_text.CHAT_TAG_DEFAULT);
                    }
                }
                else if (Menu.Menu == 36) // Buy back item
                {
                    Plr.ItmInterface.BuyBackItem(Menu);
                }
                else if (Menu.Menu == 37) // Dye menu
                {
                    byte MAX_DYES = 30;

                    PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    Out.WriteByte(0x1B);

                    List <Dye_Info> Dyes  = WorldMgr.GetDyes();
                    byte            count = (byte)Math.Min(Dyes.Count, MAX_DYES);

                    Out.WriteByte(count);
                    for (byte i = 0; i < count; i++)
                    {
                        Out.WriteByte(i);
                        Out.WriteUInt16(Dyes[i].Entry);
                        Out.WriteUInt32(Dyes[i].Price);
                    }

                    Plr.SendPacket(Out);
                }
                else if (Menu.Menu == 38) // Dye one item
                {
                    Item item = Plr.ItmInterface.GetItemInSlot(Menu.Num);

                    if (item == null)
                    {
                        return;
                    }

                    byte   PrimaryDye     = Menu.Packet.GetUint8();
                    byte   SecondaryDye   = Menu.Packet.GetUint8();
                    ushort PrimaryDyeId   = 0;
                    ushort SecondaryDyeId = 0;

                    uint cost = 0;
                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[PrimaryDye].Price;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[SecondaryDye].Price;
                    }

                    if (!Plr.RemoveMoney(cost))
                    {
                        Plr.SendLocalizeString("", GameData.Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY);
                        return;
                    }

                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        PrimaryDyeId = WorldMgr.GetDyes()[PrimaryDye].Entry;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        SecondaryDyeId = WorldMgr.GetDyes()[SecondaryDye].Entry;
                    }

                    Plr.ItmInterface.DyeItem(item, PrimaryDyeId, SecondaryDyeId);

                    if (Plr._IsActive && Plr.IsInWorld() && Plr._Loaded)
                    {
                        foreach (Player P in _PlayerRanged)
                        {
                            if (P.HasInRange(Plr))
                            {
                                Plr.ItmInterface.SendEquiped(P);
                            }
                        }
                    }
                }
                else if (Menu.Menu == 39) // Dye all items
                {
                    byte Count = 0;
                    for (UInt16 i = 0; i < ItemsInterface.MAX_EQUIPED_SLOT; ++i)
                    {
                        if (Plr.ItmInterface.Items[i] != null) // && is dyable
                        {
                            ++Count;
                        }
                    }

                    byte   PrimaryDye     = Menu.Packet.GetUint8();
                    byte   SecondaryDye   = Menu.Packet.GetUint8();
                    ushort PrimaryDyeId   = 0;
                    ushort SecondaryDyeId = 0;

                    uint cost = 0;
                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[PrimaryDye].Price * Count;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[SecondaryDye].Price * Count;
                    }

                    if (!Plr.RemoveMoney(cost))
                    {
                        Plr.SendLocalizeString("", GameData.Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY);
                        return;
                    }

                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        PrimaryDyeId = WorldMgr.GetDyes()[PrimaryDye].Entry;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        SecondaryDyeId = WorldMgr.GetDyes()[SecondaryDye].Entry;
                    }

                    for (UInt16 i = 0; i < ItemsInterface.MAX_EQUIPED_SLOT; ++i)
                    {
                        if (Plr.ItmInterface.Items[i] != null) // && is dyable
                        {
                            Plr.ItmInterface.DyeItem(Plr.ItmInterface.Items[i], PrimaryDyeId, SecondaryDyeId);
                        }
                    }

                    if (Plr._IsActive && Plr.IsInWorld() && Plr._Loaded)
                    {
                        foreach (Player P in _PlayerRanged)
                        {
                            if (P.HasInRange(Plr))
                            {
                                Plr.ItmInterface.SendEquiped(P);
                            }
                        }
                    }
                }
                else
                {
                    switch (InteractType)
                    {
                    case GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER:
                    {
                        byte[] data = new byte[62]
                        {
                            0x01, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x42, 0x39, 0x00, 0x00, 0x00, 0xC0, 0xE3,
                            0x03, 0x39, 0xA0, 0xD1, 0x6F, 0x00, 0xC8, 0xA8, 0x1D, 0x37, 0x28, 0x94, 0x79, 0x33, 0xB2, 0x24,
                            0x32, 0x44, 0xDB, 0xD7, 0x1C, 0x5D, 0x18, 0x5D, 0xDD, 0x1C, 0xA4, 0x0D, 0x00, 0x00, 0xA8, 0x6B,
                            0x21, 0x36, 0x11, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xAF, 0x3A, 0x78, 0xD1, 0x6F, 0x00
                        };

                        UInt16 Counts = 1;

                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x0A);
                        List <Zone_Taxi> Taxis = WorldMgr.GetTaxis(Plr);
                        Out.WriteByte((byte)Taxis.Count);
                        foreach (Zone_Taxi Taxi in Taxis)
                        {
                            Out.WriteUInt16(Counts);
                            Out.WriteByte((byte)Taxi.Info.Pairing);
                            Out.WriteUInt16(Taxi.Info.Price);
                            Out.WriteUInt16(Taxi.Info.ZoneId);
                            Out.WriteByte(1);
                            ++Counts;
                        }
                        Out.Write(data);
                        Plr.SendPacket(Out);
                    } break;

                    case GameData.InteractType.INTERACTTYPE_BANKER:
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x1D);
                        Out.WriteByte(0);        // need to find bank buy box



                        /*
                         * Out = new PacketOut((byte)Opcodes.F_BAG_INFO);
                         * Out.WriteByte(0x0F);
                         * Out.WriteByte(ItmInterface.GetTotalSlot()); // Number of available slots  // GetTotalSlot
                         * Out.WriteUInt16((UInt16)ItemsInterface.INVENTORY_SLOT_COUNT);
                         * Out.WriteByte(0);
                         * Out.WriteUInt32R(ItmInterface.GetBagPrice());//GetBagPrice
                         *
                         * Out.WriteUInt16(2);// was 2
                         * Out.WriteByte(0x50);// was 0x50
                         * Out.WriteUInt16(0x08);// 0x08
                         * Out.WriteUInt16(0x60);// 0x60
                         * Out.WriteByte(0xEA);// 0xEA
                         * Out.WriteUInt16(0);
                         */



                        Plr.SendPacket(Out);
                    } break;


                    case GameData.InteractType.INTERACTTYPE_SIEGEWEAP:
                    {
                        //     /*
                        PacketOut Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);

                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x1D);
                        Out.WriteByte(1);
                        Out.WriteByte(1);
                        Out.WriteByte(2);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x02);
                        Out.WriteByte(0x4A);
                        Out.WriteUInt16(0);
                        Plr.SendPacket(Out);
                        //21 D9 1D 01 01 02 00 00 02 4A 00 00



                        Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x18);
                        Out.WriteByte(1);
                        Out.WriteUInt16(0x005C);
                        Out.WritePascalString(Name);
                        Out.WriteByte(1);
                        Out.WriteByte(0x3F);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x0E);
                        //Out.WriteByte(0xA6);//(byte)Zone.ZoneId);//zone
                        Out.WriteHexStringBytes("A6103C000400011E0000000002");
                        Out.WriteByte(0);        // reload?
                        Out.WriteUInt16(0x0B);
                        Out.WriteByte(0);


                        //  Out.WriteHexStringBytes("1801005C0D456D706972652043616E6E6F6E013F00000EA6103C000400011E000000000200000B00");

                        Plr.SendPacket(Out);



                        Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x21);
                        Out.WriteByte(0x3C);        // 3c=60 seconds 6000 14=20 seconds=2000
                        Out.Fill(0, 6);
                        Plr.SendPacket(Out);



                        Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x1C);
                        Out.WriteByte(0x3);        //14=20 seconds=2000
                        //Out.Fill(0, 6);
                        Plr.SendPacket(Out);


                        // 1D 01 01 02 00 00 8A DF 00 00

                        Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x1D);
                        Out.WriteByte(1);
                        Out.WriteByte(1);
                        Out.WriteByte(2);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x8A);
                        Out.WriteByte(0xDF);
                        Out.WriteUInt16(0);
                        Plr.SendPacket(Out);


                        //                          */



                        /*
                         *
                         *  // controll timer // size 13
                         *   Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         *   Out.WriteUInt16(Oid);
                         *   Out.WriteByte(0x21);
                         *   Out.WriteByte(0x3C);// 3c=60 seconds 6000 14=20 seconds=2000
                         *   Out.Fill(0, 6);
                         *  Plr.SendPacket(Out);
                         *
                         *  // size 7
                         *  Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         *  Out.WriteUInt16(Oid);
                         *  Out.WriteByte(0x1C);
                         *  Out.WriteByte(0x3);//14=20 seconds=2000
                         *  //Out.Fill(0, 6);
                         *  Plr.SendPacket(Out);
                         *
                         *
                         *
                         */



                        /*
                         * //size 15
                         * Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         * Out.WriteUInt16(Oid);
                         * Out.WriteByte(0x1D);
                         * Out.WriteByte(1);
                         * Out.WriteByte(1);
                         * Out.WriteByte(2);
                         * Out.WriteUInt16(0);
                         * Out.WriteByte(2);
                         * Out.WriteByte(0x4A);
                         * Out.WriteUInt16(0);
                         *
                         * //  Out.WriteByte(0x3);//14=20 seconds=2000
                         * //Out.Fill(0, 6);
                         * Plr.SendPacket(Out);
                         */



                        /*
                         * // target icon
                         * Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         * Out.WriteUInt16(Oid);
                         * Out.WriteByte(0x1C);
                         * Out.WriteByte(0x3);//14=20 seconds=2000
                         * Out.Fill(0, 6);
                         * Plr.SendPacket(Out);
                         * // */
                    } break;



                    case GameData.InteractType.INTERACTTYPE_GUILD_VAULT:
                    {
                        //Size = 43
                        // opens guild vault 5 slots
                        PacketOut Out = new PacketOut((byte)Opcodes.F_GUILD_DATA);
                        Out.WriteByte(0x18);     // ??
                        //Out.WriteByte(0x1);// this shows a buy box
                        Out.WriteByte(5);        // number of vault boxs  0 to 5
                        Out.Fill(0, 8);

                        // VAULT BOX 1
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 2
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 3
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 4
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 5
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        Plr.SendPacket(Out);
                    } break;



                    //Heal Penalties structure i added
                    case GameData.InteractType.INTERACTTYPE_HEALER:
                    {          // packet size 9  -3=6
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x13);
                        Out.WriteByte(1);        // this the penalty points u have
                        Out.WriteUInt16(0);
                        // Out.WriteByte(0);// gold ?
                        //Out.WriteByte(0);// gold
                        Out.WriteByte(1);        //1 silver
                        Out.WriteByte(0);        // 90??// brass
                        Plr.SendPacket(Out);

                        // this packet heals size 6 -3 =3 size
                        Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x14);
                        Out.WriteByte(1);        // this the penalty points u have
                        Out.WriteByte(90);       // 90??// brass
                        Plr.SendPacket(Out);
                    } break;

                    //10 00 03 2E 49 01 00 00 00 00
                    case GameData.InteractType.INTERACTTYPE_BARBERSHOP:
                    {          // packet size 13 -3=10
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x10);
                        Out.WriteByte(0);
                        Out.WriteByte(3);        // 3
                        Out.WriteByte(0x2E);     //2E
                        Out.WriteByte(0x49);     //49
                        Out.WriteByte(1);        // 1 // this is tokens that is required if set to 5 it says=(you dont have enough tokens in your inventory 5 token are required
                        Out.WriteUInt32(0);
                        Plr.SendPacket(Out);
                    } break;

                    //0E 01 01 00
                    case GameData.InteractType.INTERACTTYPE_GUILD_REGISTRAR:
                    {
                        // packet size 13 -3=10
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x0E);
                        Out.WriteByte(1);        //0= sucess full /1=
                        Out.WriteByte(1);        //0= sucess full /1=
                        Out.WriteByte(0);        //
                        Plr.SendPacket(Out);
                    } break;


                    case GameData.InteractType.INTERACTTYPE_AUCTIONEER:    //INTERACTTYPE_AUCTIONEER = 13,
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x1A);
                        Out.WriteByte(0);
                        Plr.SendPacket(Out);


                        Out = new PacketOut((byte)Opcodes.F_AUCTION_SEARCH_RESULT);
                        Out.WritePacketString(@"|00 00 9E 22 00 01 01 00 00 00 00 00 71 |..............q|
|67 F1 00 01 82 52 00 00 00 00 00 00 27 10 03 43 |g....R......'..C|
|68 6F 73 73 65 74 74 65 5E 4D 00 00 00 00 00 00 |hossette^M......|
|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF |................|
|5F 39 00 00 01 4B B6 0F 30 00 00 00 00 00 00 00 |_9...K..0.......|
|00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 |................|
|00 00 00 00 00 00 06 00 14 00 14 00 00 00 00 00 |................|
|00 00 00 00 00 00 00 10 57 69 6C 74 65 64 20 57 |........Wilted W|
|69 6C 64 20 57 65 65 64 00 00 00 06 08 00 05 07 |ild Weed........|
|00 04 01 00 00 02 00 00 04 00 00 0F 00 01 00 00 |................|
|00 00 01 00 00 03 02 00 08 00 00 00 00 00 00 00 |................|
|00 00 00 00 00 00 00 00 00 00 00 00 00          |.............   |");
                        Plr.DispatchPacket(Out, true);


                        //  Out = new PacketOut((byte)Opcodes.F_AUCTION_BID_STATUS);
                    } break;

                    /////////added////////////////////////////////////////////////////////////////////////////////////////
                    // case GameData.InteractType.INTERACTTYPE_SIEGEWEAP:
                    //  {
                    //   PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    //  Out.WriteByte(0x1A);
                    //  Out.WriteByte(0);
                    //  Plr.SendPacket(Out);
                    //  } break;
                    default:
                    {
                        ushort MenuItems = 0;
                        string Text      = WorldMgr.GetCreatureText(Spawn.Entry);

                        if (InteractType == GameData.InteractType.INTERACTTYPE_DYEMERCHANT)
                        {
                            MenuItems += 2;         // Shop // 2
                            MenuItems += 16384;     // Dyes

                            // You need Text to see the 'dyes' option
                            if (Text == String.Empty)
                            {
                                Text = "Selling a bit of everything here, come on have a look see!";
                            }


                            //Text = "Forget about the drut he's selling; take a look at these beauties!"; ORIGNAL IN DB


                            //Text = "Come and see what I have.";
                        }

                        bool HasQuests = QtsInterface.HasQuestInteract(Plr, this);
                        if (HasQuests)
                        {
                            MenuItems += 64;         // Quests
                        }
                        if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_REGISTRAR)
                        {
                            MenuItems += 128;         // Guild Register =128
                            // Guild Regiser needs text
                            if (Text == String.Empty)
                            {
                                Text = "Let's get started. To form a guild, you'll need to have a full group of six adventurers with you. None of you can belong to another guild. For a modest fee of only fifty silver I can create your guild.";
                            }
                        }


                        if (InteractType == GameData.InteractType.INTERACTTYPE_TRAINER)
                        {
                            MenuItems += 1;         // Trainer =1
                            // Theese were previously in there, nice to keep them unless theres info in creature_texts
                            if (Text == String.Empty)
                            {
                                if (Plr.Realm == GameData.Realms.REALMS_REALM_ORDER)
                                {
                                    Text = "Hail defender of the Empire!  Your performance in battle is the only thing that keeps the hordes of Chaos at bay. Let's begin your training at once!";
                                }


                                else
                                {
                                    Text = "Learn these lessons well, for gaining the favor of the Raven god should be of utmost importance to you. Otherwise... There is always room for more Spawn within our ranks.";
                                }
                            }
                        }

                        if (InteractType == GameData.InteractType.INTERACTTYPE_BINDER)
                        {
                            MenuItems += 228;         // Rally Point =256/ 228 is rally quest+influnce
                        }
                        if (Text.Length > 0)
                        {
                            MenuItems += 32;         // Text
                        }
                        // VENDORS INVENTERY BOX PACKET
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);

                        Log.Info("Creature", "npc = " + Name + "  Oid = " + Oid + " MenuItems = " + MenuItems + "  X= " + Spawn.WorldX + "  Y= " + Spawn.WorldY + "  Z= " + Spawn.WorldZ);
                        Out.WriteByte(0);
                        Out.WriteUInt16(Menu.Oid);
                        Out.WriteUInt16(0);
                        Out.WriteUInt16(MenuItems);
                        if (HasQuests)
                        {
                            QtsInterface.BuildInteract(Plr, this, Out);
                        }
                        if (Text.Length > 0)
                        {
                            Out.WriteByte(0);       // added and fixed the dye screen error, was missing this byte now working whoohooo
                        }
                        Out.WriteShortString(Text); // need to fix this ??
                        //Out.WritePascalString(Text);// added this because above gives error
                        Out.WriteByte(0);           // added this is on live server mite not need this byte
                        Plr.SendPacket(Out);
                    } break;
                    }
                }
            }
            base.SendInteract(Plr, Menu);
        }
        public void SendRenownAbilityInfo()
        {
            /*
             * byte pointsAvailable = _player.Renown;
             * pointsAvailable -= PointsSpent;
             */

            // RB   6/18/2016   Limiting spendable renown points to character level, instead of locking renown growth
            int pointsAvailable = GetMaxPoints();

            pointsAvailable -= PointsSpent;

            uint respecCost = (uint)PointsSpent * 1000;

            respecCost = 58000;

            string renName = "Renown Stats A";

            PacketOut Out = new PacketOut((byte)Opcodes.F_CAREER_CATEGORY, 512);

            Out.WriteByte(0x09);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteByte((byte)PointsSpent);
            Out.WriteByte((byte)pointsAvailable);
            Out.Fill(0, 3);
            Out.WriteUInt32(respecCost);     //?
            Out.WriteByte(0);
            Out.WriteByte(1);
            Out.WriteByte(0x86);
            Out.WriteByte(0xA0);
            Out.WritePascalString(renName);
            Out.WriteByte(0);
            Out.WriteByte(0x14);   // ability count
            Out.WriteByte(0);
            for (int i = 1; i <= 20; i++)
            {
                Out.WriteByte((byte)i);
                Out.WriteByte(0);
            }
            Out.Fill(0, 2);
            _player.SendPacket(Out);

            for (int i = 0; i < CharMgr.RenownAbilityInfo[9].Count; i++)
            {
                SendRenownAbility(CharMgr.RenownAbilityInfo[9][i], (byte)(_trained[0][i] > 0 ? 1:0));
            }

            Out = new PacketOut((byte)Opcodes.F_CAREER_CATEGORY, 48);
            Out.WriteUInt16(0x0A01);
            Out.WriteByte(0);
            Out.WriteByte((byte)PointsSpent);
            Out.WriteByte((byte)pointsAvailable);
            Out.Fill(0, 3);
            Out.WriteUInt32(respecCost);
            Out.WriteHexStringBytes("000182B80E52656E6F776E20537461747320420014000100020003000400050006000700080009000A000B000C000D000E000F00100011001200130014000000");
            _player.SendPacket(Out);


            for (int i = 0; i < CharMgr.RenownAbilityInfo[10].Count; i++)
            {
                SendRenownAbility(CharMgr.RenownAbilityInfo[10][i], (byte)(_trained[1][i] > 0 ? 1 : 0));
            }


            Out = new PacketOut((byte)Opcodes.F_CAREER_CATEGORY, 48);


            Out.WriteUInt16(0x0B01);
            Out.WriteByte(0);
            Out.WriteByte((byte)PointsSpent);
            Out.WriteByte((byte)pointsAvailable);
            Out.Fill(0, 3);
            Out.WriteUInt32(respecCost);
            Out.WriteHexStringBytes("000138801952656E6F776E204F6666656E7369766520437269746963616C0010000100020003000400050006000700080009000A000B000C000D000E000F0010000000");
            _player.SendPacket(Out);

            for (int i = 0; i < CharMgr.RenownAbilityInfo[11].Count; i++)
            {
                SendRenownAbility(CharMgr.RenownAbilityInfo[11][i], (byte)(_trained[2][i] > 0 ? 1 : 0));
            }


            Out = new PacketOut((byte)Opcodes.F_CAREER_CATEGORY, 48);

            Out.WriteUInt16(0x0C01);
            Out.WriteByte(0);
            Out.WriteByte((byte)PointsSpent);
            Out.WriteByte((byte)pointsAvailable);
            Out.Fill(0, 3);
            Out.WriteUInt32(respecCost);
            Out.WriteHexStringBytes("000075301952656E6F776E20446566656E7369766520437269746963616C000700010002000300040005000600070008000000");
            _player.SendPacket(Out);


            for (int i = 0; i < CharMgr.RenownAbilityInfo[12].Count; i++)
            {
                SendRenownAbility(CharMgr.RenownAbilityInfo[12][i], (byte)(_trained[3][i] > 0 ? 1 : 0));
            }

            Out = new PacketOut((byte)Opcodes.F_CAREER_CATEGORY, 48);
            Out.WriteUInt16(0x0D01);
            Out.WriteByte(0);
            Out.WriteByte((byte)PointsSpent);
            Out.WriteByte((byte)pointsAvailable);
            Out.Fill(0, 3);
            Out.WriteUInt32(respecCost);
            Out.WriteHexStringBytes("000138801752656E6F776E2047656E65726963205061737369766573000B000100020003000400050006000700080009000A000B000000");
            _player.SendPacket(Out);

            for (int i = 0; i < CharMgr.RenownAbilityInfo[13].Count; i++)
            {
                SendRenownAbility(CharMgr.RenownAbilityInfo[13][i], (byte)(_trained[4][i] > 0 ? 1 : 0));
            }

            Out = new PacketOut((byte)Opcodes.F_CAREER_CATEGORY, 48);
            Out.WriteUInt16(0x0E01);
            Out.WriteByte(0);
            Out.WriteByte((byte)PointsSpent);
            Out.WriteByte((byte)pointsAvailable);
            Out.Fill(0, 3);
            Out.WriteUInt32(respecCost);
            Out.WriteHexStringBytes("000138801952656E6F776E20446566656E736976652050617373697665730011000100020003000400050006000700080009000A000B000C000D000E000F00100011000000");
            _player.SendPacket(Out);

            for (int i = 0; i < CharMgr.RenownAbilityInfo[14].Count; i++)
            {
                SendRenownAbility(CharMgr.RenownAbilityInfo[14][i], (byte)(_trained[5][i] > 0 ? 1 : 0));
            }

            Out = new PacketOut((byte)Opcodes.F_CAREER_CATEGORY, 48);
            Out.WriteUInt16(0x0F01);
            Out.WriteByte(0);
            Out.WriteByte((byte)PointsSpent);
            Out.WriteByte((byte)pointsAvailable);
            Out.Fill(0, 3);
            Out.WriteUInt32(respecCost);
            Out.WriteHexStringBytes("000138801052656E6F776E20416374697661746573000A000100020003000400050006000700080009000A000000");
            _player.SendPacket(Out);

            for (int i = 0; i < CharMgr.RenownAbilityInfo[15].Count; i++)
            {
                SendRenownAbility(CharMgr.RenownAbilityInfo[15][i], (byte)(_trained[6][i] > 0 ? 1 : 0));
            }
        }
Beispiel #22
0
        public static void F_CONNECT(BaseClient client, PacketIn packet)
        {
            Log.Success("F_CONNECT", "Entering F_CONNECT " + client.Id.ToString() + " " + packet.Opcode.ToString());
            GameClient cclient = (GameClient)client;

            packet.Skip(8);
            uint   Tag   = packet.GetUint32();
            string Token = packet.GetString(80);

            packet.Skip(21);
            string Username = packet.GetString(23);

            // TODO
            AuthResult Result = Program.AcctMgr.CheckToken(Username, Token);

#if DEBUG
            Result = AuthResult.AUTH_SUCCESS;
#endif

            if (Result == AuthResult.AUTH_ACCT_SUSPENDED)
            {
                Log.Error("F_CONNECT", "Banned Account =" + Username);
                cclient.Disconnect("Banned account");
            }
            else if (Result != AuthResult.AUTH_SUCCESS)
            {
                Log.Error("F_CONNECT", "Invalid Token =" + Username + " " + Result);

                // Kick people who spam the god damn button for 5 minutes straight before they clock on.
                PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_QUIT, 4);
                Out.WriteHexStringBytes("01000000");
                cclient.SendPacket(Out);

                cclient.Disconnect("Invalid token");
            }
            else
            {
                cclient._Account = Program.AcctMgr.GetAccount(Username);
                if (cclient._Account == null)
                {
                    Log.Error("F_CONNECT", "Invalid Account =" + Username);
                    cclient.Disconnect("Invalid account");
                }
                else
                {
                    Log.Success("F_CONNECT", "MeId=" + cclient.Id);
                    Log.Success("F_CONNECT", "User connection : " + Username);

                    GameClient Other = ((TCPServer)cclient.Server).GetClientByAccount(cclient, cclient._Account.AccountId);
                    if (Other != null)
                    {
                        Other.Disconnect("Failed to get GameClient for account");
                    }

                    // Check if ip is banned. (they may have been just banned so launcher server wouldnt have picked it up)
                    if (!Program.AcctMgr.CheckIp(cclient.GetIp().Split(':')[0]))
                    {
                        Log.Error("F_CONNECT", "Banned IP =" + Username);
                        cclient.Disconnect("Banned by IP");
                    }

                    // Load characters before connection instead of later on
                    CharMgr.LoadCharacters(cclient._Account.AccountId);

                    {
                        cclient.PacketLog = cclient._Account.PacketLog;

                        PacketOut Out = new PacketOut((byte)Opcodes.S_CONNECTED, 48);
                        Out.WriteUInt32(0);
                        Out.WriteUInt32(Tag);
                        Out.WriteByte(Program.Rm.RealmId);
                        Out.WriteByte(0);
                        Out.WriteByte(0);
                        Out.WriteByte(0);
                        Out.WriteByte(0); // TRANSFER_FLAG (1 - Low population server..free transfers...)
                        Out.WritePascalString(Username);
                        Out.WritePascalString(Program.Rm.Name);
                        Out.WriteByte(0);
                        Out.WriteUInt16(0);
                        cclient.SendPacket(Out);
                    }
                }
            }
        }