コード例 #1
0
        private void SendEnterWorld(DBCharacter c, ACCESSLEVEL accesslevel)
        {
            WorldPacket pkg = new WorldPacket(WORLDMSG.PLAYER_ENTER_WORLD);

            pkg.Write(c.ObjectId);
            pkg.Write((byte)accesslevel);
            Send(pkg);
        }
コード例 #2
0
        private void SendDBObject(DBObject obj)
        {
            WorldPacket pkg = new WorldPacket(WORLDMSG.DESERIALIZE_OBJ);

            pkg.Write(obj.GetType().ToString());
            pkg.Write(obj.ObjectId);
            obj.Serialize(pkg);
            Send(pkg);
        }
コード例 #3
0
        static void OnAcquireGuids(WorldConnection connection, WORLDMSG msgID, BinReader data)
        {
            WorldPacket pkg = new WorldPacket(WORLDMSG.ACQUIRE_GUIDS_REPLY);

            pkg.Write(current_guid);
            current_guid += 200000;
            pkg.Write(current_guid++);
            connection.Send(pkg);
        }
コード例 #4
0
        public override void FireEvent()
        {
            WorldPacket pkg = new WorldPacket(WORLDMSG.REGISTERVENDOR);

            pkg.Write(m_vendor.GUID);
            pkg.Write(m_vendor.Spawn_ID);
            pkg.Write(m_vendor.Level);
            pkg.Write(m_vendor.Name);
            WorldServer.Send(pkg);
        }
コード例 #5
0
        static bool GroupAccept(LoginClient client, CMSG msgID, BinReader data)
        {
            WorldPacket scrpkg = new WorldPacket(WORLDMSG.GROUPCREATE);

            scrpkg.Write(client.Character.ObjectId);
            scrpkg.Write(client.Character.LastGroupInviterID);
            client.WorldConnection.Send(scrpkg);
            client.Character.LastGroupInviterID = 0;
            client.Character.GroupLook          = 0x00;
            return(true);
        }
コード例 #6
0
        static void InitGuids(WorldConnection connection)
        {
            WorldPacket pkg = new WorldPacket(WORLDMSG.INIT_GUIDS);

            pkg.Write(current_guid);
            current_guid += 200000;
            pkg.Write(current_guid);
            pkg.Write(++current_guid);
            current_guid += 200000;
            pkg.Write(current_guid++);
            connection.Send(pkg);
        }
コード例 #7
0
        public static void DeleteDBObject(DBObject obj)
        {
            if (obj.PendingCreate)
            {
                obj.PendingDelete = true;
                return;
            }
            RemoveDBObject(obj);
            WorldPacket pkg = new WorldPacket(WORLDMSG.DELETE_DBOBJECT);

            pkg.Write(obj.GetType().ToString());
            pkg.Write(obj.ObjectId);
            WorldServer.Send(pkg);
        }
コード例 #8
0
        public static void CreateDBObject(DBObject obj)
        {
            if (obj.PendingCreate)
            {
                return;
            }
            obj.PendingCreate = true;
            int id = currentRequestID++;

            createDBRequests[id] = obj;
            WorldPacket pkg = new WorldPacket(WORLDMSG.CREATE_DBOBJECT);

            pkg.Write(id);
            pkg.Write(obj.GetType().ToString());
            WorldServer.Send(pkg);
        }
コード例 #9
0
 public void LeaveWorld()
 {
     try {
         this.Player.InWorld = false;
         if (m_player.Group != null)
         {
             if (m_player.IsLeader || m_player.Group.Size < 3)
             {
                 m_player.Group.Destroy();
             }
             else
             {
                 m_player.Group.RemoveMember(m_player.Name);
             }
         }
         ChannelManager.Deconnection(this);
         m_player.SaveAndRemove();
         WorldServer.RemoveClient(this);
         WorldPacket pkg = new WorldPacket(WORLDMSG.PLAYER_LEAVE_WORLD);
         pkg.Write(m_character.ObjectId);
         WorldServer.Send(pkg);
     } catch (Exception exp) {
         DebugLogger.Logger.Log("", exp);
     }
 }
コード例 #10
0
        private void SendEnterWorld(DBCharacter c)
        {
            WorldPacket pkg = new WorldPacket(WORLDMSG.PLAYER_ENTER_WORLD);

            pkg.Write(c.ObjectId);
            Send(pkg);
        }
コード例 #11
0
        public static void ChangeMap(WorldClient client)
        {
            if (client.Player.MapTile == null)
            {
                return;
            }
            MapInstance map = GetMap(client.Player.WorldMapID);

            if (map == null)
            {
                WorldPacket pkg = new WorldPacket(WORLDMSG.CHANGE_MAP);
                pkg.Write(client.CharacterID);
                WorldServer.Send(pkg);
                client.LeaveWorld();
                return;
            }
            else
            {
                client.Player.MapTile.Map.Leave(client.Player);
                client.Player.Continent = (uint)map.Continent;
                map.SetObjectPositionInBounds(client.Player);

                ServerPacket pkg = new ServerPacket(SMSG.NEW_WORLD);
                pkg.Write((byte)client.Player.Continent);
                pkg.WriteVector(client.Player.Position);
                pkg.Write(client.Player.Facing);
                pkg.Finish();
                pkg.AddDestination(client.CharacterID);
                WorldServer.Send(pkg);
            }
        }
コード例 #12
0
        static bool OnInitTrainer(LoginClient client, string input)
        {
            if (client.Account.AccessLvl < ACCESSLEVEL.GM)
            {
                Chat.System(client, "You do not have access to this command");
                return(true);
            }

            string[] split = input.Split(' ');
            if (split.Length < 2)
            {
                return(false);
            }


            DataObject[] obj = DataServer.Database.SelectObjects(typeof(DBVendor), "GUID='" + client.Character.Selected + "'");
            if (obj == null || obj.Length == 0)
            {
                Chat.System(client, "Vendor not found");
                return(true);
            }
            DBVendor vendor   = (DBVendor)obj[0];
            CLASS    tmpClass = CLASS.MAGE;

            try
            {
                tmpClass = (CLASS)Enum.Parse(typeof(CLASS), split[1].ToUpper());
            }
            catch (Exception) { Chat.System(client, "Invalid class"); return(false); }
            vendor.Class = (int)tmpClass;
            Chat.System(client, "Setting Trainer Class:" + vendor.Class);
            DataServer.Database.SaveObject(vendor);
            DataServer.Database.FillObjectRelations(vendor);
            string classstr = tmpClass.ToString();

            classstr = classstr.Substring(0, 1).ToUpper() + classstr.Substring(1).ToLower();
            string      chatcmd = "!title " + '\"' + classstr + " Trainer" + '\"';
            WorldPacket pkg     = new WorldPacket(WORLDMSG.CLIENT_MESSAGE);

            pkg.Write(client.Character.ObjectId);
            pkg.Write((int)CMSG.MESSAGECHAT);
            pkg.Write((int)0);
            pkg.Write((int)0);
            pkg.Write(chatcmd);
            client.SendWorldServer(pkg);
            return(true);
        }
コード例 #13
0
ファイル: WorldClient.cs プロジェクト: vata/wowdaemon-reborn
        public void LeaveWorld()
        {
            m_player.SaveAndRemove();
            WorldServer.RemoveClient(this);
            WorldPacket pkg = new WorldPacket(WORLDMSG.PLAYER_LEAVE_WORLD);

            pkg.Write(m_character.ObjectId);
            WorldServer.Send(pkg);
        }
コード例 #14
0
 internal static void LeaveWorld(LoginClient client)
 {
     if (client.Character != null)
     {
         WorldPacket pkg = new WorldPacket(WORLDMSG.PLAYER_LEAVE_WORLD);
         pkg.Write(client.Character.ObjectId);
         client.WorldConnection.Send(pkg);
     }
 }
コード例 #15
0
        public static void SaveDBObject(DBObject obj)
        {
            if (obj.Dirty == false)
            {
                return;
            }
            if (obj.PendingCreate)
            {
                obj.PendingSave = true;
                return;
            }
            WorldPacket pkg = new WorldPacket(WORLDMSG.DESERIALIZE_OBJ);

            pkg.Write(obj.GetType().ToString());
            pkg.Write(obj.ObjectId);
            obj.Serialize(pkg);
            WorldServer.Send(pkg);
            obj.Dirty = false;
        }
コード例 #16
0
 static void OnCreateDBObject(WorldConnection connection, WORLDMSG msgID, BinReader data)
 {
     try
     {
         int      requestID = data.ReadInt32();
         string   str       = data.ReadString();
         Type     type      = dbTypes.GetType(str, true);
         DBObject obj       = (DBObject)Activator.CreateInstance(type);
         DataServer.Database.AddNewObject(obj);
         WorldPacket pkg = new WorldPacket(WORLDMSG.CREATE_DBOBJECT_REPLY);
         pkg.Write(requestID);
         pkg.Write(str);
         pkg.Write(obj.ObjectId);
         connection.Send(pkg);
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in OnCreateDBObject!");
         Console.WriteLine(e);
     }
 }
コード例 #17
0
        public void SendHexPacket(WorldOpcodes opcde, string hex)
        {
            string end = hex.Replace(" ", "").Replace("\n", "");

            byte[] data = Utils.HexToByteArray(end);

            WorldPacket packet = new WorldPacket(opcde);

            packet.Write(data);

            this.SendPacket(packet);
            //throw new Exception("no");
        }
コード例 #18
0
        public void InitSpells()
        {
            DataTable t = DataServer.Database.GetDataSet("Spell").Tables["Spell"];

            DataObject[] spell = DataServer.Database.SelectAllObjects(typeof(DBSpell));
            WorldPacket  pkg   = new WorldPacket(WORLDMSG.INIT_SPELLS);

            pkg.Write(spell.Length);
            for (int i = 0; i < spell.Length; i++)
            {
                ((DBSpell)spell[i]).Serialize(pkg);
            }
            Send(pkg);
        }
コード例 #19
0
 internal static void LeaveWorld(LoginClient client)
 {
     try
     {
         if (client.Character != null)
         {
             WorldPacket pkg = new WorldPacket(WORLDMSG.PLAYER_LEAVE_WORLD);
             pkg.Write(client.Character.ObjectId);
             client.WorldConnection.Send(pkg);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("An error happened in LeaveWorld function. Please report it!");
         Console.WriteLine(e);
     }
 }