Ejemplo n.º 1
0
        internal static void OnCharRename(RealmServerSession session, CmsgCharRename handler)
        {
            int result;

            // Check for existing name

            // DONE: Do the rename
            try
            {
                result = (int)LoginErrorCode.RESPONSE_SUCCESS;
                MainForm.Database.UpdateName(handler);
            }
            catch (Exception)
            {
                result = (int)LoginErrorCode.CHAR_NAME_FAILURE;
            }

            // DONE: Send response
            session.SendPacket(new SmsgCharRename(result));

            // ????? NEED TO REVIEW THIS to update CHAR LIST ENUM
            List <Characters> characters = MainForm.Database.GetCharacters(session.Users.username);

            session.SendPacket(new SmsgCharEnum(characters));
        }
Ejemplo n.º 2
0
        internal static void Handler(RealmServerSession session, CMSG_CHAR_CREATE handler)
        {
            session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_SUCCESS));

            try
            {
                // If limit character reached
                if (Characters.GetCharacters(session.Users.username).Count >=
                    Config.Instance.LimitCharacterRealm)
                {
                    session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_SERVER_LIMIT));
                    return;
                }

                // check if name in use
                if (Characters.FindCharacaterByName(handler.Name) != null)
                {
                    session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_NAME_IN_USE));
                    return;
                }

                Characters.Create(handler, session.Users);

                session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_SUCCESS));
            }
            catch (Exception)
            {
                session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_ERROR));
            }
        }
Ejemplo n.º 3
0
        // PARTIAL
        internal static void OnLogoutRequest(RealmServerSession session, byte[] data)
        {
            _logoutQueue = new Dictionary <RealmServerSession, DateTime>();
            if (_logoutQueue.ContainsKey(session))
            {
                _logoutQueue.Remove(session);
            }

            // Lose Invisibility

            // ???? Can't log out in combat

            // DONE: Disable Movement
            session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_FLAGS, UnitFlags.UNIT_FLAG_STUNTED);

            // DONE: StandState -> Sit
            session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_1, StandStates.STANDSTATE_SIT);
            session.Entity.KnownPlayers.ForEach(
                s => s.Session.SendPacket(new SmsgStandstateUpdate((byte)StandStates.STANDSTATE_SIT)));

            // DONE: Send Logout
            session.SendPacket(new SmsgLogoutResponse(LogoutResponseCode.LOGOUT_RESPONSE_ACCEPTED));

            // DONE: While logout, the player can't move
            session.SendPacket(new SmsgForceMoveRoot(session.Character.Id));

            // If the player is resting, then it's instant logout
            _logoutQueue.Add(session, DateTime.Now);
#if DEBUG
            Thread thread = new Thread(() => Update(1));
#else
            Thread thread = new Thread(() => Update(20));
#endif
            thread.Start();
        }
Ejemplo n.º 4
0
        public static void Handler(RealmServerSession session, CMSG_AUTH_SESSION handler)
        {
            // Search Account and set to session.Users
            session.Users = MainProgram.RealmServerDatabase.GetAccount(handler.ClientAccount);

            // Initializing Crypt for user session
            session.PacketCrypto = new VanillaCrypt();
            session.PacketCrypto.Init(session.Users.sessionkey);

            // Check basic addons instaleds
            CheckAddons(handler);

            // Send AuthOK
            session.SendPacket(new SMSG_AUTH_RESPONSE(LoginErrorCode.AUTH_OK));

            session.SendPacket(new SMSG_ADDON_INFO(AddOnsNames));
            // TODO Alternatice to handle errors

            /*
             * RESPONSE_VERSION_MISMATCH
             * AUTH_FAILED
             * AUTH_UNAVAILABLE
             * AUTH_SYSTEM_ERROR
             * AUTH_ALREADY_LOGGING_IN
             * AUTH_SUSPENDED
             *
             * session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.AUTH_FAILED));
             */
        }
Ejemplo n.º 5
0
 internal static void OnCharDelete(RealmServerSession session, CmsgCharDelete handler)
 {
     // if failed                CHAR_DELETE_FAILED
     // if waiting for transfer  CHAR_DELETE_FAILED_LOCKED_FOR_TRANSFER
     // if guild leader          CHAR_DELETE_FAILED_GUILD_LEADER
     MainForm.Database.DeleteCharacter(handler.Id);
     session.SendPacket(new SmsgCharDelete(LoginErrorCode.CHAR_DELETE_SUCCESS));
 }
Ejemplo n.º 6
0
        internal static void OnLeaveChannel(RealmServerSession session, PacketReader handler)
        {
            string channelName = handler.ReadCString();

            Log.Print(LogType.Debug, $"[{session.ConnectionRemoteIp}] Channel leave [{session.Character.name} ({channelName})]");

            // Adicionar a base de dados
            session.SendPacket(new SmsgChannelNotify(ChatChannelNotify.CHAT_YOU_LEFT_NOTICE, (ulong)session.Character.Id, channelName));
        }
Ejemplo n.º 7
0
        // DONE
        internal static void OnLogoutCancel(RealmServerSession session, PacketReader handler)
        {
            // Remove from logout queue
            _logoutQueue.Remove(session);

            // DONE: Enable Turn
            session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_FLAGS, UnitFlags.UNIT_FLAG_NONE);

            // DONE: StandState -> Stand
            session.Entity.SetUpdateField((int)UnitFields.UNIT_FIELD_BYTES_1, StandStates.STANDSTATE_STAND);
            session.Entity.KnownPlayers.ForEach(
                s => s.Session.SendPacket(new SmsgStandstateUpdate((byte)StandStates.STANDSTATE_STAND)));

            // DONE: Stop client logout
            session.SendPacket(new SmsgLogoutCancelAck());

            // DONE: Enable moving
            session.SendPacket(new SmsgForceMoveUnroot(session.Character.Id));
        }
Ejemplo n.º 8
0
        internal static void OnAttackSwing(RealmServerSession session, PacketReader handler)
        {
            ulong guid = handler.ReadUInt64();

            PacketServer packet = new PacketServer(RealmCMD.SMSG_ATTACKSTART);

            packet.Write(session.Entity.ObjectGuid.RawGuid);
            packet.Write(session.Entity.ObjectGuid.RawGuid);
            session.SendPacket(packet);
        }
Ejemplo n.º 9
0
        internal static void OnCastSpell(RealmServerSession session, PacketReader handler)
        {
            uint   spellId = handler.ReadUInt32();
            string target  = handler.ReadCString();

            Log.Print(LogType.Debug, $"CSMG_CAST_SPELL [spellID={spellId}] om = {target}");

            session.SendPacket(new SmsgSpellGo(session.Entity, session.Entity, spellId));

            session.SendPacket(new SmsgCastFailed(spellId));


            // Check if spell exists

            // Check if have spell

            // Get spell cooldown

            //  In duel disable
        }
Ejemplo n.º 10
0
        internal static void OnGmTicketCreate(RealmServerSession session, PacketReader handler)
        {
            uint   ticketMap  = handler.ReadUInt32();
            float  ticketX    = handler.ReadSingle();
            float  ticketY    = handler.ReadSingle();
            float  ticketZ    = handler.ReadSingle();
            string ticketText = handler.ReadCString();

            Log.Print(LogType.Debug, $"Ticket recebido [{ticketMap}] [{ticketX}] [{ticketY}] [{ticketZ}] [{ticketText}] ");

            session.SendPacket(new SmsgGmticketCreate(GMTicketCreateResult.GMTICKET_CREATE_OK));
        }
Ejemplo n.º 11
0
        internal static void OnItemQuerySingle(RealmServerSession session, PacketReader handler)
        {
            // check packet size[length

            // Int32
            int itemId = handler.ReadInt32();

            //short algo = handler.ReadSByte();
            //int itemId = handler.ReadInt32();

            Log.Print(LogType.Debug, $"Checando item de id [{itemId}]");

            session.SendPacket(new SmsgItemQuerySingleResponse());
        }
Ejemplo n.º 12
0
        // [DONE] Set Faction AT War
        internal static void OnSetFactionAtwar(RealmServerSession session, PacketReader handler)
        {
            // Adicionar Faccao a base de dados
            int  faction = handler.ReadInt32();
            byte enabled = handler.ReadByte();

            // [7 Enabled] --- [5 Disabled]
            MainForm.Database.FactionInative(session.Character.Id, faction + 1, (byte)(enabled == 1 ? 7 : 5));

            var factionDb = MainForm.Database.FactionGet(session.Character, faction + 1);

            // SmsgSetFactionStanding
            session.SendPacket(new SmsgSetFactionStanding(faction, enabled, factionDb.standing));
        }
Ejemplo n.º 13
0
        internal static void OnNameQuery(RealmServerSession session, PacketReader handler)
        {
            if (handler.BaseStream.Length < 12)
            {
                return;
            }

            ulong guid = handler.ReadUInt64();

            // Asking for player name
            Characters target = MainForm.Database.GetCharacter((uint)guid);

            if (target != null)
            {
                session.SendPacket(new SmsgNameQueryResponse(target));
            }

            // Asking for creature name (only used in quests?)
        }
Ejemplo n.º 14
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)
             */
        }
Ejemplo n.º 15
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));
        }
Ejemplo n.º 16
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));
        }
Ejemplo n.º 17
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));
 }
Ejemplo n.º 18
0
 internal static void OnCancelTrade(RealmServerSession session, PacketReader handler)
 {
     session.SendPacket(new SmsgTradeStatus(TradeStatus.TRADE_STATUS_CANCELED));
 }
Ejemplo n.º 19
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
             */
        }
Ejemplo n.º 20
0
 internal static void OnFriendList(RealmServerSession session, PacketReader handler)
 {
     session.SendPacket(new SmsgFriendList());
     session.SendPacket(new SmsgIgnoreList());
 }
Ejemplo n.º 21
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
             */
        }
Ejemplo n.º 22
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;
                }
            }
        }
Ejemplo n.º 23
0
 internal static void OnGmTicketSystemStatus(RealmServerSession session, PacketReader handler)
 {
     // check if system is available
     session.SendPacket(new SmsgGmticketSystemstatus(GMTicketSystemStatus.GMTICKET_SYSTEMSTATUS_ENABLED));
 }
Ejemplo n.º 24
0
        internal static void OnCharEnum(RealmServerSession session, byte[] data)
        {
            List <Characters> characters = MainForm.Database.GetCharacters(session.Users.username);

            session.SendPacket(new SmsgCharEnum(characters));
        }
Ejemplo n.º 25
0
        public static void Handler(RealmServerSession session, byte[] data)
        {
            var characters = Characters.GetCharacters(session.Users.username);

            session.SendPacket(new SMSG_CHAR_ENUM(characters));
        }
Ejemplo n.º 26
0
 internal static void OnQueryTime(RealmServerSession session, byte[] data)
 {
     session.SendPacket(new SmsgQueryTimeResponse());
 }
Ejemplo n.º 27
0
 public void Move(RealmServerSession session)
 {
     session.SendPacket(new SmsgMonsterMove(session, ObjectGuid.RawGuid, MapX, MapY, MapZ));
 }