Ejemplo n.º 1
0
        public static byte[] SendGuildInfo(guild guildGlobal)
        {
            PacketWriter Writer = new PacketWriter();

            /////////////////////////////////////////////////////////////////////////
            //Opcode information
            /////////////////////////////////////////////////////////////////////////
            Writer.Create(Systems.SERVER_GUILD_INFO_LOAD);
            /////////////////////////////////////////////////////////////////////////
            //Packet Structure
            /////////////////////////////////////////////////////////////////////////
            //Writer.Byte(1); // Guild update
            Writer.DWord(guildGlobal.Guildid);              // Unique Guild ID
            Writer.Text(guildGlobal.Name);                  // Guild Name
            Writer.Byte(guildGlobal.Level);                 // Guild level
            Writer.DWord(guildGlobal.PointsTotal);          // Guild GP
            Writer.Word(guildGlobal.NewsTitle.Length);      // Guild Message Title Lenght
            Writer.String(guildGlobal.NewsTitle);           // Guild Message Title
            Writer.Word(guildGlobal.NewsMessage.Length);    // Guild Message Lenght
            Writer.String(guildGlobal.NewsMessage);         // Guild Message
            Writer.DWord(0);                                // War on guild id
            Writer.Byte(0);                                 // War status?
            /////////////////////////////////////////////////////////////////////////
            // Write Guild Member information for each excisting member.
            /////////////////////////////////////////////////////////////////////////
            Guild_ListPlayersInfo(guildGlobal.MembersInfo, Writer);
            Writer.Byte(0);
            return(Writer.GetBytes());
        }
Ejemplo n.º 2
0
        public static byte[] AttackPetStats(pet_obj c, byte slot)
        {
            PacketWriter writer = new PacketWriter();

            writer.Create(Systems.SERVER_PET_INFORMATION);
            writer.DWord(c.UniqueID);
            writer.DWord(c.Model);
            writer.DWord(0x00000168); //stats
            writer.DWord(0x00000168); //stats
            writer.LWord(c.exp);      //Experience
            writer.Byte(c.Level);     //Level
            writer.Word(0);           //Angle
            writer.DWord(0x00000001); //1 = Attack icon enabled, 2 = disabled
            if (c.Petname != "No name")
            {
                writer.Text(c.Petname);                        //Petname
            }
            else
            {
                writer.Word(0);      //No name
            }
            writer.Byte(0);          //Static perhaps
            writer.DWord(c.OwnerID); //Owner
            writer.Byte(slot);
            return(writer.GetBytes());
        }
Ejemplo n.º 3
0
        public static byte[] FriendGroupManage(string type, string groupname, short groupid, int targetid)
        {
            PacketWriter Writer = new PacketWriter();

            switch (type)
            {
            case "ADD":
                Writer.Create(Systems.SERVER_FRIEND_GROUP);
                Writer.Byte(1);
                Writer.Text(groupname);
                Writer.Word(groupid);
                break;

            case "REMOVE":
                Writer.Create(Systems.SERVER_FRIEND_GROUP_REMOVE);
                Writer.Byte(1);
                Writer.Word(groupid);
                break;

            case "MOVE":
                Writer.Create(Systems.SERVER_FRIEND_GROUP_MANAGE_FRIEND);
                Writer.Byte(1);
                Writer.DWord(targetid);
                Writer.Word(groupid);
                break;
            }
            return(Writer.GetBytes());
        }
Ejemplo n.º 4
0
        public static byte[] AlchemyResponse(bool isSuccess, Global.slotItem sItem, byte type, byte totalblue)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ALCHEMY);
            Writer.Byte(1);
            Writer.Byte(2);
            Writer.Bool(isSuccess);
            Writer.Byte(sItem.Slot);
            if (!isSuccess)
            {
                Writer.Byte(0);
            }
            Writer.DWord(0);
            Writer.DWord(sItem.ID);
            Writer.Byte(sItem.PlusValue);
            Writer.LWord(0);
            Writer.DWord(sItem.Durability);
            Writer.Byte(Data.ItemBlue[sItem.dbID].totalblue);
            for (int i = 0; i <= Data.ItemBlue[sItem.dbID].totalblue - 1; i++)
            {
                Writer.DWord(Data.MagicOptions.Find(mg => (mg.Name == Convert.ToString(Data.ItemBlue[sItem.dbID].blue[i]))).ID);
                Writer.DWord(Data.ItemBlue[sItem.dbID].blueamount[i]);
            }
            Writer.Word(1);
            Writer.Word(2);
            Writer.Word(3);

            return(Writer.GetBytes());
        }
Ejemplo n.º 5
0
        public static byte[] SendFriendList(byte count, character c)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.Create(Systems.SERVER_SEND_FRIEND_LIST);
            //Groups
            Systems.MsSQL ms = new Systems.MsSQL("SELECT * FROM friends_groups WHERE playerid='"+ c.Information.CharacterID  +"'");
            int groupcount = ms.Count();
            groupcount = groupcount + 1;
            Writer.Byte((byte)groupcount);
            
            Writer.Word(0);
            Writer.Text("NonClassified");
            int groupid = 0;
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    string groupname = reader.GetString(2);
                    groupid = groupid +1;
                    Writer.Word((short)groupid);
                    Writer.Text(groupname);
                }
            }
            //Friends
            Writer.Byte(count);
            ms = new Systems.MsSQL("SELECT * FROM friends WHERE owner='"+ c.Information.CharacterID  +"'");
            using (System.Data.SqlClient.SqlDataReader reader = ms.Read())
            {
                while (reader.Read())
                {
                    int model       = Systems.MsSQL.GetDataInt("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "chartype");
                    int status      = Systems.MsSQL.GetDataInt("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "Online");
                    int charid      = Systems.MsSQL.GetDataInt("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "id");
                    string charname = Systems.MsSQL.GetData("SELECT * FROM character WHERE id='" + reader.GetInt32(2) + "'", "name");
                    string groupname = reader.GetString(4);
                    
                    Writer.DWord(charid);               // Friend CharID
                    Writer.Text(charname);              // Friend Name
                    Writer.DWord(model);                // Friend Model Type
                    if (groupname == "none")
                        Writer.Word(0);
                    else
                        Writer.Word(groupid);

                    if (status != 0)
                    {
                        Writer.Byte(0);                 // Friend is online
                    }
                    else
                    {
                        Writer.Byte(1);                 // Inverted, Friend is offline
                    }
                }
                reader.Close();
            }
            ms.Close();
            return Writer.GetBytes();
        }
Ejemplo n.º 6
0
        public static byte[] StorageBox()
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ITEM_STORAGE_BOX);
            Writer.Word(1);
            Writer.Word(1);
            return(Writer.GetBytes());
        }
Ejemplo n.º 7
0
        public static byte[] LoadGame_5()
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PATCH);
            Writer.Word(0x0101);
            Writer.Word(0);
            Writer.Byte(0xA1);
            return(Writer.GetBytes());
        }
Ejemplo n.º 8
0
        public static byte[] guide(byte info1, byte info2, byte info3)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_SEND_GUIDE);
            Writer.Word(info1);
            Writer.DWord(info2);
            Writer.Word(info3);
            Writer.Byte(0);
            return(Writer.GetBytes());
        }
Ejemplo n.º 9
0
        public static byte[] FriendDecline(string name)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_FRIEND_INVITE);
            Writer.Byte(2);
            Writer.Word(0x640B);
            Writer.Byte(0);
            Writer.Word(0x000B);
            Writer.Text(name);
            return(Writer.GetBytes());
        }
Ejemplo n.º 10
0
        public static void Guild_ListPlayersInfo(List <Global.guild_player> guildMembers, PacketWriter Writer)
        {
            Writer.Byte(guildMembers.Count);
            foreach (Global.guild_player m in guildMembers)
            {
                Writer.DWord(m.MemberID);
                Writer.Text(m.Name);
                Writer.Byte(m.Rank);
                Writer.Byte(m.Level);
                Writer.DWord(m.DonateGP);

                System.Collections.BitArray bits = new System.Collections.BitArray(new bool[]
                {
                    m.noticeeditRight,
                    m.guildstorageRight,
                    m.unionRight,
                    m.withdrawRight,
                    m.joinRight,
                    false, false, false
                });
                byte[] bytes = new byte[1];
                bits.CopyTo(bytes, 0);

                Writer.DWord((int)bytes[0]);
                Writer.DWord(0);
                Writer.DWord(0);
                Writer.DWord(0);
                if (m.GrantName != null)
                {
                    if (m.GrantName != "")
                    {
                        Writer.Text(m.GrantName);
                    }
                    else
                    {
                        Writer.Word(0);
                    }
                }
                else
                {
                    Writer.Word(0);
                }

                Writer.DWord(m.Model);
                Writer.Byte(m.FWrank);

                Writer.Byte(m.Xsector);
                Writer.Byte(m.Ysector);
                Writer.DWord(0xFFFFFFFF); // when he entered last time 25794314
                Writer.DWord(0x0189EECA); // when he leveled up last time 25816778 later :P
                Writer.Bool(!m.Online);
            }
        }
Ejemplo n.º 11
0
        public static byte[] LoadGame_2()
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PATCH);
            Writer.Word(0x0100);
            Writer.Word(0x0100);
            Writer.Byte(0x69);
            Writer.Byte(0x0C);
            Writer.DWord(0x00000005);
            Writer.Byte(0x02);
            return(Writer.GetBytes());
        }
Ejemplo n.º 12
0
        public static byte[] StallModifyItem(byte stallSlot, ulong price)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_STALL_ACTION);
            Writer.Byte(1);
            Writer.Byte(1);
            Writer.Byte(stallSlot);
            Writer.Word(1);
            Writer.LWord(price);
            Writer.Word(0);
            return(Writer.GetBytes());
        }
Ejemplo n.º 13
0
        public static byte[] Guild_Create(guild guildGlobal)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_GUILD);
            Writer.Byte(1);
            Writer.DWord(guildGlobal.Guildid);
            Writer.Text(guildGlobal.Name);
            Writer.Byte(1);
            Writer.DWord(0);
            if (guildGlobal.NewsTitle != null)
            {
                if (guildGlobal.NewsTitle != "")
                {
                    Writer.Text(guildGlobal.NewsTitle);
                }
                else
                {
                    Writer.Word(0);
                }
            }
            else
            {
                Writer.Word(0);
            }

            if (guildGlobal.NewsMessage != null)
            {
                if (guildGlobal.NewsMessage != "")
                {
                    Writer.Text(guildGlobal.NewsMessage);
                }
                else
                {
                    Writer.Word(0);
                }
            }
            else
            {
                Writer.Word(0);
            }

            Writer.DWord(0);
            Writer.Byte(0);

            Guild_ListPlayersInfo(guildGlobal.MembersInfo, Writer);

            Writer.Byte(0);
            return(Writer.GetBytes());
        }
Ejemplo n.º 14
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Pet related item inventory movement
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] MoveItemPet(int itemid, byte f_slot, byte t_slot, pet_obj o, short info, string action)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ITEM_MOVE);
            switch (action)
            {
            case "MOVE_TO_PET":
            case "MOVE_FROM_PET":
                Writer.Byte(1);
                Writer.Byte(o.Slots);
                Writer.DWord(itemid);
                Writer.Byte(f_slot);
                Writer.Byte(t_slot);
                break;

            case "MOVE_INSIDE_PET":
                Writer.Byte(1);
                Writer.Byte(0x10);
                Writer.DWord(itemid);
                Writer.Byte(f_slot);
                Writer.Byte(t_slot);
                Writer.Word(info);
                break;
            }
            return(Writer.GetBytes());
        }
Ejemplo n.º 15
0
        //Packet for response of message sending
        public static byte[] PrivateMessageRespond(byte type)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add the opcode to the packet
            Writer.Create(Systems.SERVER_PM_SEND);
            //Switch on type sended by our function
            switch (type)
            {
            case 1:
                //Failed
                Writer.Byte(0x02);
                Writer.Byte(0x0D);
                Writer.Byte(0x64);
                break;

            case 2:
                //Success
                Writer.Byte(0x01);
                break;

            case 3:
                //Inbox full
                Writer.Byte(2);
                Writer.Word(0x6414);
                break;
            }
            //Return all bytes to the void
            return(Writer.GetBytes());
        }
Ejemplo n.º 16
0
 public static byte[] Completeload()
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(0x3077);
     Writer.Word(0);
     return Writer.GetBytes();
 }
Ejemplo n.º 17
0
        public byte[] sendnoticecon(int type, int id, string text, string name)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode for chat
            Writer.Create(Systems.SERVER_CHAT);
            //Write byte chat type 7 = notice
            Writer.Byte(7);
            //Set message to message long from string text given
            string Message = MessageToMessagelong(text);

            //Write textlenght value
            Writer.Textlen(Message);
            //Repeat for message lenght
            for (int g = 0; g < Message.Length;)
            {
                //Writer word value per letter
                Writer.Word(int.Parse(Message.Substring(g, 2), System.Globalization.NumberStyles.HexNumber, null));
                //Set g + 2
                g = g + 2;
            }
            //Return all bytes
            return(Writer.GetBytes());
        }
Ejemplo n.º 18
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Update arrow amount
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] Arrow(short amount)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ARROW_UPDATE);
            Writer.Word(amount);
            return(Writer.GetBytes());
        }
Ejemplo n.º 19
0
        public static byte[] SafeState_SkillUse_Fail()
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(0xB034);
            Writer.Byte(2);
            Writer.Word(DarkEmu_GameServer.IngameMessages.UIIT_STT_SKILLUSE_FAIL_CANT_BATTLE_STATE);
            return(Writer.GetBytes());
        }
Ejemplo n.º 20
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Item Move Error // Refactor needed, since we will only use the below one. And send message code!
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] MoveItemError()
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ITEM_MOVE);    //Select opcode
            Writer.Byte(0x02);                          //Type
            Writer.Word(0x1807);                        //Message info type
            return(Writer.GetBytes());
        }
Ejemplo n.º 21
0
        public static byte[] StallCloseGlobal(int charid)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_STALL_CLOSE);
            Writer.DWord(charid);
            Writer.Word(0);
            return(Writer.GetBytes());
        }
Ejemplo n.º 22
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Movement Angle
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] Angle(int id, ushort angle)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ANGLE);    //Select opcode
            Writer.DWord(id);                       //Character ID
            Writer.Word(angle);                     //Angle
            return(Writer.GetBytes());
        }
Ejemplo n.º 23
0
        public static byte[] IngameMessages(ushort opcode, ushort id)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(opcode);
            Writer.Byte(2);
            Writer.Word(id);
            return(Writer.GetBytes());
        }
Ejemplo n.º 24
0
        public static byte[] TeleportStart()
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_TELEPORTSTART);
            Writer.Byte(2);
            Writer.Word(1);
            return(Writer.GetBytes());
        }
Ejemplo n.º 25
0
        public static byte[] Player_HandleUpdateSlotu(byte slot, short givenitems)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PLAYER_HANDLE_UPDATE_SLOT);
            Writer.Byte(slot);
            Writer.Byte(8);
            Writer.Word(givenitems);
            return(Writer.GetBytes());
        }
Ejemplo n.º 26
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Update quantity of items
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] ItemUpdate_Quantity(byte slot, short amount)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ITEM_QUANTITY_UPDATE);
            Writer.Byte(slot);
            Writer.Byte(8);
            Writer.Word(amount);
            return(Writer.GetBytes());
        }
Ejemplo n.º 27
0
        public static byte[] StallSetState(byte state)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_STALL_ACTION);
            Writer.Byte(1);
            Writer.Byte(5);
            Writer.Byte(state);
            Writer.Word(0);
            return(Writer.GetBytes());
        }
Ejemplo n.º 28
0
        public static byte[] MakeAliasError(string name, byte switchinfo)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_MAKE_ALIAS);
            Writer.Byte(2);
            Writer.Word(0);
            Writer.Byte(0);
            Writer.Text(name);
            return(Writer.GetBytes());
        }
Ejemplo n.º 29
0
        public static byte[] Player_HandleUpdateSlot(byte slot, ushort amount, int packet)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PLAYER_HANDLE_UPDATE_SLOT);
            Writer.Byte(1);
            Writer.Byte(slot);
            Writer.Word(amount);
            Writer.DWord(packet);
            return(Writer.GetBytes());
        }
Ejemplo n.º 30
0
        public static byte[] StallItemMain(List <stall.stallItem> ItemList)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_STALL_ACTION);
            Writer.Byte(1);
            Writer.Byte(2);
            Writer.Word(0);
            StallItemPacket(ItemList, Writer);
            return(Writer.GetBytes());
        }