Exemplo n.º 1
0
        internal static void OnAttackStop(RealmServerSession session, PacketReader handler)
        {
            PacketServer packet = new PacketServer(RealmCMD.SMSG_ATTACKSTOP);

            packet.Write(session.Entity.ObjectGuid.RawGuid);
            packet.Write(session.Entity.ObjectGuid.RawGuid);
            packet.Write((int)0);
            packet.Write((byte)0);
            session.SendPacket(packet);

            //SendAttackStop(client.Character.GUID, client.Character.TargetGUID, client)
            //client.Character.attackState.AttackStop()

            /*
             * 'AttackerGUID stopped attacking victimGUID
             * Dim SMSG_ATTACKSTOP As New PacketClass(OPCODES.SMSG_ATTACKSTOP)
             * SMSG_ATTACKSTOP.AddPackGUID(attackerGUID)
             * SMSG_ATTACKSTOP.AddPackGUID(victimGUID)
             * SMSG_ATTACKSTOP.AddInt32(0)
             * SMSG_ATTACKSTOP.AddInt8(0)
             * client.Character.SendToNearPlayers(SMSG_ATTACKSTOP)
             */
        }
Exemplo n.º 2
0
        internal static void OnCharCreate(RealmServerSession session, CmsgCharCreate handler)
        {
            int result;

            // Char name Profane            result = (int) LoginErrorCode.CHAR_NAME_PROFANE;
            // Char name reserved           result = (int) LoginErrorCode.CHAR_NAME_RESERVED;
            // Char name invalid            result = (int) LoginErrorCode.CHAR_NAME_FAILURE;
            // Check Ally or Horde          result = (int) LoginErrorCode.CHAR_CREATE_PVP_TEAMS_VIOLATION;
            // Check char limit create      result = (int) LoginErrorCode.CHAR_CREATE_SERVER_LIMIT;

            // Check for both horde and alliance
            // Only if it's a pvp realm
            try
            {
                result = (int)LoginErrorCode.CHAR_CREATE_SUCCESS;
                MainForm.Database.CreateChar(handler, session.Users);
            }
            catch (Exception)
            {
                result = (int)LoginErrorCode.CHAR_CREATE_ERROR;
            }

            session.SendPacket(new SmsgCharCreate(result));
        }
Exemplo n.º 3
0
        internal static void OnTextEmote(RealmServerSession session, PacketReader handler)
        {
            if (handler.BaseStream.Length < 20)
            {
                return;
            }

            uint  textEmote = handler.ReadUInt32();
            uint  unk       = handler.ReadUInt32();
            ulong guid      = handler.ReadUInt64();

            Log.Print(LogType.Debug, $"[{session.ConnectionSocket}] CMSG_TEXT_EMOTE [TEXTENITE={textEmote} UNK={unk} GUID={guid}]");

            // DONE: Send Emote animation
            var checkEmote = MainForm.EmotesTextReader.GetData((int)textEmote);

            if (checkEmote != null)
            {
                session.Entity.SetUpdateField((int)UnitFields.UNIT_NPC_EMOTESTATE, checkEmote.EmoteId);
            }

            // DONE: Send Packet
            session.SendPacket(new SmsgTextEmote(session.Character.Id, textEmote, (int)unk));
        }
Exemplo n.º 4
0
        public static void Handler(RealmServerSession session, byte[] data)
        {
            var characters = Characters.GetCharacters(session.Users.username);

            session.SendPacket(new SMSG_CHAR_ENUM(characters));
        }
Exemplo n.º 5
0
 internal static void OnBattlefieldStatus(RealmServerSession session, PacketReader handler)
 {
     // ???? nao implementado
 }
Exemplo n.º 6
0
 internal static void OnQueryTime(RealmServerSession session, byte[] data)
 {
     session.SendPacket(new SmsgQueryTimeResponse());
 }
Exemplo n.º 7
0
 internal static void OnSetActiveMover(RealmServerSession session, PacketReader handler)
 {
     //ulong guid = handler.ReadUInt64();
 }
Exemplo n.º 8
0
 public void Move(RealmServerSession session)
 {
     session.SendPacket(new SmsgMonsterMove(session, ObjectGuid.RawGuid, MapX, MapY, MapZ));
 }
Exemplo n.º 9
0
 internal static void OnMoveTimeSkipped(RealmServerSession session, CmsgMoveTimeSkipped handler)
 {
     session.OutOfSyncDelay = handler.OutOfSyncDelay;
 }
Exemplo n.º 10
0
 internal static void OnChannelAnnouncements(RealmServerSession session, PacketReader handler)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 11
0
        internal static void OnPlayerLogin(RealmServerSession session, CmsgPlayerLogin handler)
        {
            session.Character = MainForm.Database.GetCharacter(handler.Guid);

            // Change Player Status Online

            // Part One
            session.SendPacket(new SmsgLoginVerifyWorld(session.Character));  // DONE
            session.SendPacket(new SmsgAccountDataTimes());                   // DONE
            session.SendMessageMotd("Welcome to World of Warcraft.");         // DONE
            session.SendMessageMotd("Servidor do caralho vai curintia ...."); // DONE

            // Part Two
            session.SendPacket(new SmsgSetRestStart());
            session.SendPacket(new SmsgBindpointupdate(session.Character));    // DONE
            session.SendPacket(new SmsgTutorialFlags());
            session.SendPacket(new SmsgLoginSettimespeed());                   // DONE
            session.SendPacket(new SmsgInitialSpells(session.Character));
            session.SendPacket(new SmsgActionButtons(session.Character));      // DONE
            session.SendPacket(new SmsgInitializeFactions(session.Character)); // DONE

            // Send Cinematic if first time
            if (session.Character.is_movie_played == false)
            {
                ChrRaces chrRaces = MainForm.ChrRacesReader.GetData(session.Character.race);
                session.SendPacket(new SmsgTriggerCinematic(chrRaces.CinematicId)); // DONE
            }

            // Part Three
            session.SendPacket(new SmsgCorpseReclaimDelay()); // DONE

            // Spawn Player
            session.SendPacket(new SmsgInitWorldStates(session.Character));
            session.SendPacket(UpdateObject.CreateOwnCharacterUpdate(session.Character, out session.Entity));

            // Set Sesstion Player
            session.Entity.Session = session;

            WorldManager.DispatchOnPlayerSpawn(session.Entity);

            // Generate Inventory
            foreach (var inventory in MainForm.Database.GetInventory(session.Character))
            {
                session.SendPacket(UpdateObject.CreateItem(inventory, session.Character));
            }


            /*
             * // Cast talents and racial passive spells
             *
             * /////////////////////////////// PT1
             * // Setting instance ID
             *
             * // Set player to transport
             *
             * // If we have changed map
             *
             * // Loading map cell if not loaded
             *
             * // SMSG_SET_PROFICIENCY
             *
             * // SMSG_UPDATE_AURA_DURATION
             *
             *  //FillAllUpdateFlags();
             *  //SendUpdate() -> Contem ao envio dos itens
             *
             * // Adding to World
             *  // AddToWorld(Me)
             *
             * // Enable client moving
             *  // SendTimeSyncReq(client)
             *
             * // Send update on aura durations
             *
             * /////////////////////////////// PT2
             * // Update character status in database
             *
             * // Guild Message Of The Day
             *
             * // Social lists
             *
             * // Send "Friend online"
             *
             * // Send online notify for guild
             *
             * // Put back character in group if disconnected
             */
        }
Exemplo n.º 12
0
 internal static void OnMeetingstoneInfo(RealmServerSession session, PacketReader handler)
 {
     // ???? nao implementado
 }
Exemplo n.º 13
0
 internal static void OnGmTicketSystemStatus(RealmServerSession session, PacketReader handler)
 {
     // check if system is available
     session.SendPacket(new SmsgGmticketSystemstatus(GMTicketSystemStatus.GMTICKET_SYSTEMSTATUS_ENABLED));
 }
Exemplo n.º 14
0
        public CommandsHelper(RealmServerSession session, string message)
        {
            string[] splitMessage = message.Split(' ');

            Console.WriteLine($@"[Comando]: {splitMessage[0].ToLower()}");

            if (splitMessage[0].ToLower() == "db")
            {
                XmlReader.Boot();
            }

            if (splitMessage[0].ToLower() == "obj")
            {
                session.SendPacket(UpdateObject.CreateGameObject(session.Character.MapX, session.Character.MapY, session.Character.MapZ));
            }

            if (splitMessage[0].ToLower() == "unt")
            {
                session.SendPacket(UpdateObject.CreateUnit(session.Character.MapX, session.Character.MapY, session.Character.MapZ, session.Character.MapO));
            }

            if (splitMessage[0].ToLower() == "item")
            {
                Console.WriteLine($@"Veio item aqui {Aba} => {int.Parse(splitMessage[1].ToLower())}");
                MainForm.Database.ItemUpdate(int.Parse(splitMessage[1].ToLower()));

                Thread.Sleep(1500);

                var inventory = MainForm.Database.GetInventory(session.Character);
                for (int j = 0; j < 112; j++)
                {
                    if (inventory.Find(item => item.slot == j) != null)
                    {
                        if (j < 19)
                        {
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_0 + (int)inventory.Find(item => item.slot == j).slot * 12, inventory.Find(item => item.slot == j).item);
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_PROPERTIES + j * 12, 0);
                        }

                        session.Entity.SetUpdateField((int)PlayerFields.PLAYER_FIELD_INV_SLOT_HEAD + j * 2, inventory.Find(item => item.slot == j).item);

                        session.SendPacket(UpdateObject.CreateItem(inventory.Find(item => item.slot == j), session.Character));
                    }
                    else
                    {
                        if (j < 19)
                        {
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_0 + j * 12, 0);
                            session.Entity.SetUpdateField((int)PlayerFields.PLAYER_VISIBLE_ITEM_1_PROPERTIES + j * 12, 0);
                        }

                        session.Entity.SetUpdateField((int)PlayerFields.PLAYER_FIELD_INV_SLOT_HEAD + j * 2, 0);
                    }
                }
                Aba++;
            }

            if (splitMessage[0].ToLower() == "gps")
            {
                session.SendMessageMotd(
                    $"MapX: {session.Character.MapX} = MapY: {session.Character.MapY} = MapZ: {session.Character.MapZ} = MapO: {session.Character.MapO}");
                Console.WriteLine($@"MapX: {session.Character.MapX} = MapY: {session.Character.MapY} = MapZ: {session.Character.MapZ} = MapO: {session.Character.MapO}");
                Console.WriteLine($@"----------------------------");
                Console.WriteLine($@"Players: {session.Entity.KnownPlayers.Count}");
                Console.WriteLine($@"Objects: {session.Entity.KnownGameObjects.Count} ");
                // Creatures
                // Corpses
                // You are seen by:
            }

            if (splitMessage[0].ToLower() == "a")
            {
                //session.SendPacket(new SmsgSetRestStart());
                session.SendPacket(new SmsgTriggerCinematic(int.Parse(splitMessage[1].ToLower())));
            }

            if (splitMessage[0].ToLower() == "c")
            {
                session.Entity.SetUpdateField((int)UnitFields.UNIT_NPC_EMOTESTATE, int.Parse(splitMessage[1].ToLower()));
            }

            if (splitMessage[0].ToLower() == "b")
            {
                // Disable Movement
                session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_FLAGS, UnitFlags.UNIT_FLAG_STUNTED); // UNIT_FLAG_STUNTED
                Console.WriteLine($@"Atual: [{Value}] NEW {Enum.GetValues(typeof(UnitFlags)).Cast<UnitFlags>().SkipWhile(e => e != Value).Skip(1).First()}");
                Value = Enum.GetValues(typeof(UnitFlags)).Cast <UnitFlags>().SkipWhile(e => e != Value).Skip(1).First();

                // StandState -> Sit
                session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_1, 1);  //StandStates.STANDSTATE_SIT);

                Thread.Sleep(1000);

                session.SendPacket(new SmsgStandstateUpdate(1));

                Console.WriteLine(Aba);
                Aba++;
            }

            if (splitMessage[0].ToLower() == "emote")
            {
                session.SendPacket(new SmsgTextEmote((int)session.Entity.ObjectGuid.RawGuid,
                                                     Convert.ToUInt32(splitMessage[2]), Convert.ToInt32(splitMessage[1])));
            }

            if (splitMessage[0].ToLower() == "vai")
            {
                string attributeName  = splitMessage[1].ToLower();
                string attributeValue = splitMessage[2];

                switch (attributeName)
                {
                case "l":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_LEVEL, int.Parse(attributeValue));
                    break;

                case "s":
                    session.Entity.Scale = float.Parse(attributeValue);
                    break;

                case "g":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_0,
                                                  (byte)int.Parse(attributeValue), 2);
                    break;

                case "m":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_DISPLAYID, int.Parse(attributeValue));
                    break;

                case "e":
                    session.Entity.SetUpdateField((int)UnitFields.UNIT_NPC_EMOTESTATE,
                                                  (byte)int.Parse(attributeValue));
                    break;
                }
            }
        }
Exemplo n.º 15
0
 internal static void OnFriendList(RealmServerSession session, PacketReader handler)
 {
     session.SendPacket(new SmsgFriendList());
     session.SendPacket(new SmsgIgnoreList());
 }
Exemplo n.º 16
0
        internal static void OnMessageChat(RealmServerSession session, PacketReader handler)
        {
            ChatMessageType     msgType     = (ChatMessageType)handler.ReadUInt32();
            ChatMessageLanguage msgLanguage = (ChatMessageLanguage)handler.ReadUInt32();

            string toUser  = null;
            string channel = null;

            if (msgType == ChatMessageType.CHAT_MSG_CHANNEL)
            {
                channel = handler.ReadCString();
            }

            if (msgType == ChatMessageType.CHAT_MSG_WHISPER)
            {
                toUser = handler.ReadCString();
            }

            string message = handler.ReadCString();

            // Call Commands
            new CommandsHelper(session, message);

            switch ((ChatMessageType)msgType)
            {
            case ChatMessageType.CHAT_MSG_SAY:
            case ChatMessageType.CHAT_MSG_YELL:
            case ChatMessageType.CHAT_MSG_EMOTE:
                session.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)session.Character.Id, message));
                session.Entity.KnownPlayers.ForEach(s => s.Session.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)session.Character.Id, message)));
                break;

            case ChatMessageType.CHAT_MSG_WHISPER:
                try
                {
                    RealmServerSession remoteSession = RealmServerSession.GetSessionByPlayerName(toUser);

                    // Check if player is the same faction?

                    // Send packet
                    session.SendPacket(new SmsgMessagechat(ChatMessageType.CHAT_MSG_WHISPER_INFORM,
                                                           ChatMessageLanguage.LANG_UNIVERSAL, (ulong)remoteSession.Character.Id, message));
                    remoteSession.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL,
                                                                 (ulong)session.Character.Id, message));
                }
                catch (Exception e)
                {
                    // Envia mensagem que nao achou
                    Console.WriteLine($@"naoa chei nada {e.Message}");
                }
                break;

            default:
                Console.WriteLine($@"veio aqui algo [{msgType}]");
                session.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)session.Character.Id, message));
                break;
            }

            /*
             *  2 - Raid
             *  3 - Guild
             *  4 - Officer
             *  6 - Whisper From
             *  7 - Whisper To
             *  8 - Emote
             *  9 - nao sei
             *  10 - Server
             *  17 - nao sei  cinza
             *  20 - AFK
             *  21 - DND
             *  22 - Ignore
             *  23 - nao sei azul
             *  24 - verde
             *              Write((byte) type);
             *              Write((uint) msgLanguage);
             *              Write(characterId);
             *              Write((uint) message.Length + 1);
             *              Write(Encoding.UTF8.GetBytes(message + '\0'));
             *              Write((byte)0); // Flag????
             *
             *  13 - ti´po emote
             *  26 - whispers: algo
             *              Write((byte) type);
             *              Write((uint) msgLanguage);
             *              Write((uint) 0);
             *              Write(characterId);
             *              Write((uint) message.Length + 1);
             *              Write(Encoding.UTF8.GetBytes(message + '\0'));
             *              Write((byte) 0); // 0 = normal / 1 = AFK / 2 = DND / 3 = GM
             *
             *  11 - npc Says
             *  12 - npc Yells
             *              Write((byte) type);
             *              Write((uint) msgLanguage);
             *              Write((uint) 0);
             *              Write(characterId);
             *              Write(characterId);
             *              Write((uint) message.Length + 1);
             *              Write(Encoding.UTF8.GetBytes(message + '\0'));
             *              Write((byte) 0); // 0 = normal / 1 = AFK / 2 = DND / 3 = GM
             *
             *  0- say
             *  1 - party
             *  5 - yell
             *              Write((byte) type);
             *              Write((uint) msgLanguage);
             *              Write(characterId);
             *              Write(characterId);
             *              Write((uint) message.Length + 1);
             *              Write(Encoding.UTF8.GetBytes(message + '\0'));
             *              Write((byte) 0); // 0 = normal / 1 = AFK / 2 = DND / 3 = GM
             */
        }
Exemplo n.º 17
0
        internal static void OnCharEnum(RealmServerSession session, byte[] data)
        {
            List <Characters> characters = MainForm.Database.GetCharacters(session.Users.username);

            session.SendPacket(new SmsgCharEnum(characters));
        }
Exemplo n.º 18
0
        internal static void OnSetsHeathed(RealmServerSession session, PacketReader handler)
        {
            SHEATHE_SLOT sheathed = (SHEATHE_SLOT)handler.ReadInt32();

            SetSheath(session.Entity, sheathed);
        }
Exemplo n.º 19
0
 internal static void OnCancelTrade(RealmServerSession session, PacketReader handler)
 {
     session.SendPacket(new SmsgTradeStatus(TradeStatus.TRADE_STATUS_CANCELED));
 }
Exemplo n.º 20
0
 internal static void OnUpdateAccountData(RealmServerSession session, CmsgUpdateAccountData handler)
 {
     // Nao Implementado ????
 }
Exemplo n.º 21
0
 // [DONE]  After complete set movieplayed to true
 internal static void OnCompleteCinematic(RealmServerSession session, PacketReader handler)
 {
     MainForm.Database.UpdateCharacter(session.Character.Id, "firstlogin");
 }
Exemplo n.º 22
0
 internal static void OnTutorialClear(RealmServerSession session, PacketReader handler)
 {
     // Aqui seta como feito tutorial
     Console.WriteLine(@"Tutoriais Feitos");
 }
Exemplo n.º 23
0
 internal static void OnTutorialReset(RealmServerSession session, PacketReader handler)
 {
     Console.WriteLine(@"Tutoriais Resetados");
 }
Exemplo n.º 24
0
 internal static void OnMoveHeartbeat(RealmServerSession session, PacketReader handler)
 {
 }
Exemplo n.º 25
0
 /// <summary>
 ///     Packet received of the client to ping the server.
 /// </summary>
 /// <param name="session"></param>
 /// <param name="handler"></param>
 public static void Handler(RealmServerSession session, CMSG_PING handler)
 {
     session.SendPacket(new SMSG_PONG(handler.Latency));
 }