Exemple #1
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());
        }
Exemple #2
0
        ///////////////////////////////////////////////////////////////////////////
        // Despawn Pet
        ///////////////////////////////////////////////////////////////////////////
        public static byte[] PetSpawn(int petid, byte type, pet_obj o)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PLAYER_SPAWN_PET);   //Select Opcode
            Writer.DWord(petid);                              //Pet ID
            switch (type)
            {
            case 1:
                //Despawn pet
                Writer.Byte(1);
                break;

            case 2:
                //Rename pet respawn
                Writer.Byte(5);
                Writer.Text(o.Petname);
                break;

            case 3:
                //Attack pet respawn for exp info
                Writer.Byte(3);          //Static
                Writer.LWord(o.exp);     //New exp
                Writer.DWord(o.OwnerID); //Owner id
                break;
            }
            return(Writer.GetBytes());
        }
Exemple #3
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());
        }
Exemple #4
0
        public static byte[] InfoUpdate(byte type, int obje, byte bT)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_INFO_UPDATE);
            Writer.Byte(type);
            switch (type)
            {
            case 1:
                Writer.LWord(obje);
                Writer.Byte(0);
                break;

            case 2:
                Writer.DWord(obje);
                Writer.Byte(0);
                break;

            case 4:
                Writer.Byte(bT);
                Writer.DWord(obje);
                break;

            default:
                break;
            }

            return(Writer.GetBytes());
        }
Exemple #5
0
        public static byte[] CreateFormedParty(party pt)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode to packet
            Writer.Create(Systems.SERVER_FORMED_PARTY_CREATED);
            //Static byte
            Writer.Byte(1);
            //Party id
            Writer.DWord(pt.ptid);
            //0 Dword value
            Writer.DWord(0);
            //Party type
            Writer.Byte(pt.Type);
            //Party purpose
            Writer.Byte(pt.ptpurpose);
            //Party min level required
            Writer.Byte(pt.minlevel);
            //Party max level allowed
            Writer.Byte(pt.maxlevel);
            //Party name
            Writer.Text3(pt.partyname);
            //Return all bytes to send
            return(Writer.GetBytes());
        }
Exemple #6
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());
        }
Exemple #7
0
 public static byte[] Silk(int normalsilk, int premsilk)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_SILKPACK);
     Writer.DWord(normalsilk);
     Writer.DWord(premsilk);
     return Writer.GetBytes();
 }
Exemple #8
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();
        }
Exemple #9
0
 public static byte[] BalloonTicket(int charid, int info)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_TICKET);
     Writer.Byte(0);
     Writer.DWord(charid);
     Writer.DWord(info);
     return Writer.GetBytes();
 }
Exemple #10
0
        public static byte[] Effects2Dmg(int id, int dmg)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_EFFECT_DAMAGE);
            Writer.DWord(id);
            Writer.DWord(dmg);
            return(Writer.GetBytes());
        }
Exemple #11
0
        public static byte[] Player_HandleEffect(int id, int itemid)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PLAYER_HANDLE_EFFECT);
            Writer.DWord(id);
            Writer.DWord(itemid);
            return(Writer.GetBytes());
        }
Exemple #12
0
        public static byte[] Transform(int Modelid, int ID)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_TRANSFORM);
            Writer.DWord(ID);
            Writer.DWord(Modelid);
            return(Writer.GetBytes());
        }
Exemple #13
0
 public static byte[] PremiumTicketData(int ticketid, int time)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_TICKET);
     Writer.Byte(0x0F);//Not sure about this byte
     Writer.DWord(ticketid);
     Writer.DWord(time);
     return Writer.GetBytes();
 }
Exemple #14
0
        public static byte[] FriendInviteTarget(character c)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_FRIEND_INVITE_SEND);
            Writer.DWord(c.Information.CharacterID);
            Writer.DWord(c.Information.UniqueID);
            Writer.Text(c.Information.Name);
            return(Writer.GetBytes());
        }
Exemple #15
0
        public static byte[] StallOpenGlobal(string stallname, int CharacterID, int StallModel)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_STALL_OPEN);
            Writer.DWord(CharacterID);
            Writer.Text3(stallname);
            Writer.DWord(StallModel);            //Decoration
            return(Writer.GetBytes());
        }
Exemple #16
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Unequip Item // Needs Switch type for item Type as packet below this one
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] MoveItemUnequipEffect(int id, byte Slot, int iid)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_ITEM_UN_EFFECT);
            Writer.DWord(id);
            Writer.Byte(Slot);
            Writer.DWord(iid);
            return(Writer.GetBytes());
        }
Exemple #17
0
        public static byte[] PlayerUnknowPack(int id)
        {
            TimeSpan ts = Systems.ServerStartedTime - DateTime.Now;
            PacketWriter Writer = new PacketWriter();
            Writer.Create(Systems.SERVER_CHARACTER_CELESTIAL_POSITION);
            Writer.DWord(id);
            Writer.DWord(Math.Abs(ts.TotalSeconds));

            return Writer.GetBytes();
        }
Exemple #18
0
        ///////////////////////////////////////////////////////////////////////////
        // Grab pet settings
        ///////////////////////////////////////////////////////////////////////////
        public static byte[] ChangePetSettings(byte option, int petid, byte type, int settings)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_GPET_SETTINGS);
            Writer.Byte(option);
            Writer.DWord(petid);
            Writer.Byte(type);
            Writer.DWord(settings);
            return(Writer.GetBytes());
        }
Exemple #19
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Player move up to horse
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] Player_UpToHorse(int ownerID, bool type, int petID)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PLAYER_UPTOHORSE); //Select opcode
            Writer.Byte(1);                                 //Static byte
            Writer.DWord(ownerID);                          //Horse Owner ID
            Writer.Byte(type);                              //Horse Type
            Writer.DWord(petID);                            //Horse ID
            return(Writer.GetBytes());
        }
Exemple #20
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Chat Packet
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] ChatPacket(byte type, int id, string text, string name)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_CHAT);
            Writer.Byte(type);
            switch (type)
            {
            case 1:
                Writer.DWord(id);
                Writer.Text3(text);
                break;

            case 3:
                Writer.DWord(id);
                Writer.Text3(text);
                break;

            case 2:
                Writer.Text(name);
                Writer.Text3(text);
                break;

            case 4:
                Writer.Text(name);
                Writer.Text3(text);
                break;

            case 5:
                Writer.Text(name);
                Writer.Text3(text);
                break;

            case 6:
                Writer.Text(name);
                Writer.Text3(text);
                break;

            case 7:
                Writer.Text3(text);
                break;

            case 9:
                Writer.Text(name);
                Writer.Text3(text);
                break;

            case 11:
                Writer.Text(name);
                Writer.Text3(text);
                break;
            }
            return(Writer.GetBytes());
        }
Exemple #21
0
        public static byte[] UpdatePlayer(int objectid, ushort packetcode, byte type, int prob)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_SKILL_EFFECTS);
            Writer.DWord(objectid);
            Writer.Word(packetcode);
            Writer.Byte(type);
            Writer.DWord(prob);
            return(Writer.GetBytes());
        }
Exemple #22
0
        public static byte[] Testeffect(int id)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_SKILL_EFFECTS);
            Writer.DWord(id);
            Writer.Word(1);
            Writer.Byte(5);
            Writer.DWord(0);
            Writer.DWord(0);
            return(Writer.GetBytes());
        }
Exemple #23
0
 public static byte[] UnknownPacket()
 {
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_UNKNOWNINFO);
     Writer.Byte(2);
     Writer.Byte(3);
     Writer.DWord(1);
     Writer.DWord(0x00007531);
     Writer.DWord(0x00004FFB);
     Writer.DWord(0x0000B998);
     return Writer.GetBytes();
 }
Exemple #24
0
        public static byte[] GuildSetTitle2(int guildid, int charid, string title)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_GUILD_SET_TITLE2);
            Writer.Byte(1);
            Writer.DWord(guildid);
            Writer.DWord(charid);
            Writer.Word(title.Length);
            Writer.String(title);
            return(Writer.GetBytes());
        }
Exemple #25
0
        public static byte[] EffectUpdate(int objectid, Effect.EffectNumbers effectid, bool start)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_SKILL_EFFECTS);
            Writer.DWord(objectid);
            Writer.Byte(1);
            Writer.Bool(start);
            Writer.Byte(4); // effect change
            Writer.DWord(effectid);
            return(Writer.GetBytes());
        }
Exemple #26
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Horse Stats
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static byte[] Pet_Information(int id, int model, int hp, int charid, pet_obj o)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_PET_INFORMATION);  //Select opcode
            Writer.DWord(id);                               //Horse ID
            Writer.DWord(model);                            //Horse Model
            Writer.DWord(hp);                               //Horse HP
            Writer.DWord(hp);                               //Horse SEC HP
            Writer.Byte(0);                                 //Static byte ?
            return(Writer.GetBytes());
        }
Exemple #27
0
 void RenameParty()
 {
     try
     {
         //Create new packet reader
         PacketReader reader = new PacketReader(PacketInformation.buffer);
         //First integer is party id
         int partyid = reader.Int32();
         //Second integer is not needed
         int NotNeeded = reader.Int32();
         //Byte party type
         byte ptype = reader.Byte();
         //Byte party purpose
         byte purpose = reader.Byte();
         //Byte minimum level
         byte minlevel = reader.Byte();
         //Byte max level to enter party
         byte maxlevel = reader.Byte();
         //Party name lenght
         short namel = reader.Int16();
         //Party name each character is a word value using text3
         string pname = reader.Text3();
         //Create new packet writer
         PacketWriter Writer = new PacketWriter();
         //Add opcode to server packet
         Writer.Create(Systems.SERVER_PARTY_CHANGENAME);
         //Write static byte 1
         Writer.Byte(1);
         //Write party id
         Writer.DWord(partyid);
         //Write dword 0
         Writer.DWord(0);
         //Write party type
         Writer.Byte(ptype);
         //Write party purpose
         Writer.Byte(purpose);
         //Write party minimum level
         Writer.Byte(minlevel);
         //Write party max level
         Writer.Byte(maxlevel);
         //Write party name
         Writer.Text3(pname);
         //Send bytes to client
         client.Send(Writer.GetBytes());
     }
     //If a error happens
     catch (Exception ex)
     {
         //Write the exception to the log
         Systems.Debugger.Write(ex);
     }
 }
Exemple #28
0
        public static byte[] JoinFormedRequest(character requesting, character owner)
        {
            //Create new packet writer
            PacketWriter Writer = new PacketWriter();

            //Add opcode for packet
            Writer.Create(Systems.SERVER_PARTY_JOIN_FORMED);
            //Character model information (Req).
            Writer.DWord(requesting.Information.Model);
            //Leader id
            Writer.DWord(requesting.Information.UniqueID);
            //Party id
            Writer.DWord(owner.Network.Party.ptid);
            //Static
            Writer.DWord(0);
            Writer.DWord(0);
            Writer.Byte(0);
            Writer.Byte(0xFF);
            //Write character unique id
            Writer.DWord(requesting.Information.UniqueID);
            //Write character name
            Writer.Text(requesting.Information.Name);
            //Write model information
            Writer.DWord(requesting.Information.Model);
            //Write level information
            Writer.Byte(requesting.Information.Level);
            //Static
            Writer.Byte(0xAA);
            //X and Y Sector
            Writer.Byte(requesting.Position.xSec);
            Writer.Byte(requesting.Position.ySec);
            //Static
            Writer.Word(0);
            Writer.Word(0);
            Writer.Word(0);
            Writer.Word(1);
            Writer.Word(1);
            //If character is in a guild
            if (requesting.Network.Guild != null)
            {
                //Write guild name
                Writer.Text(requesting.Network.Guild.Name);
            }
            //If character is not in a guild
            else
            {
                //Write word value 0
                Writer.Word(0);
            }
            //Static
            Writer.Byte(0);
            Writer.DWord(0);
            Writer.DWord(0);
            //Return all bytes to send
            return(Writer.GetBytes());
        }
Exemple #29
0
        public static byte[] SkillIconPacket(int ownerid, int skillid, int overid, bool eu)
        {
            PacketWriter Writer = new PacketWriter();

            Writer.Create(Systems.SERVER_SKILL_ICON);
            Writer.DWord(ownerid);
            Writer.DWord(skillid);
            Writer.DWord(overid);
            if (eu)
            {
                Writer.Byte(1);
            }
            return(Writer.GetBytes());
        }
Exemple #30
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());
        }