Register for your free account! | Forgot your password?

You last visited: Today at 06:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help]Converting...

Discussion on [Help]Converting... within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
felipeboladao's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 255
Received Thanks: 273
[Help]Converting...

How to convert the packet

Code:
 public static byte[] ItemLock(int ItemUID, int Type01, int Type02, int Series)
        {
            PacketBuilder Packet = new PacketBuilder(2048, 16);
            Packet.Long(ItemUID);
            Packet.Int(Type01);
            Packet.Int(Type02);
            Packet.Short(0);//where do u call ItemLock method
            Packet.Long(Series);
            return Packet.getFinal();
        }
to 5165 source?
felipeboladao is offline  
Old 02/02/2010, 14:44   #2
 
.Ocularis's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 309
Received Thanks: 208
I made my own item lock system for the item lock button ;-;

I couldn't help you with yours, but I could help you build your own... I just can't post my script

Add me on msn
.Ocularis is offline  
Old 02/02/2010, 17:19   #3


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
Probably, something like this... But I don't know the two methods and I don't have the source.

Code:
        public static COPacket ItemLock(int ItemUID, int Type01, int Type02, int Series)
        {
            byte[] Packet = new byte[8 + 16];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)(Packet.Length - 8));
            P.WriteInt16(2048);
            P.WriteInt64(ItemUID);
            P.WriteInt32(Type01);
            P.WriteInt32(Type02);
            P.WriteInt16(0x00);
            P.WriteInt64(Series);

            return P;
        }
CptSky is offline  
Old 02/02/2010, 17:34   #4
 
elite*gold: 0
Join Date: Dec 2009
Posts: 36
Received Thanks: 1
The code you post, as is done in the source look 5165:

Quote:
public static COPacket Packet2048 (uint Charu)
(
byte [] packet = new byte [8 + 16];
COPacket P = new COPacket (Packet);
P.WriteInt16 ((ushort) (Packet.Length - 8));
P.WriteInt16 ((ushort) 2048);
P.WriteInt32 (Charu);
P.WriteInt32 (4);
P.WriteInt32 (0);

return P;
)
|_Beetle_| is offline  
Old 02/02/2010, 18:50   #5
 
felipeboladao's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 255
Received Thanks: 273
I've been working on this code, and not getting much success to add 5 days to unlock the item, I ask your help to finish the code ... thank you very much!

Create an ItemLocking.cs in PacketHandling/ItemPacket... and paste a code bellow...

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewestCOServer.PacketHandling
{
    public class ItemLocking
    {
        public static void Handle(Main.GameClient GC, byte[] Data)
        {
            uint ItemUID = BitConverter.ToUInt32(Data, 4);
            Game.Item I = GC.MyChar.FindInvItem(ItemUID);
            byte TheType = Data[8];

            switch (TheType)
            {
                case 0: //Item Lock
                    {
                        GC.MyChar.RemoveItem1(ItemUID);
                        I.Locked = true;
                        //GC.AddSend(Packets.ItemLock(ItemUID, TheType, 1, 0));
                        GC.MyChar.AddItem(I);

                        if (I.Locked == false) { GC.AddSend(Packets.ItemLock(ItemUID, 1, 3, I.LockedDays)); }
                        return;
                    }
                case 1: //Item re-Lock
                    {

                        GC.MyChar.RemoveItem1(ItemUID);
                        DateTime datetounlock = DateTime.Now;
                        datetounlock = datetounlock.AddDays(5);                       
                        I.LockedDays = Convert.ToUInt32(datetounlock.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture));
                        I.Locked = false;
                        GC.MyChar.AddItem(I);

                        if (I.Locked == false) { GC.AddSend(Packets.ItemLock(ItemUID, 1, 3, I.LockedDays)); }
                        break;
                    }
            }
        }
    }
}
and go to PacketHandler.cs and search for

Code:
                        
case 10005:
                            {
                                PacketHandling.WalkRun.Handle(GC, Data);
                                break;
                            }
and paste bellow...

Code:
                        case 2048:
                            {
                                PacketHandling.ItemLock.Handle(GC, Data);
                                break;
                            }
Thanks, we will finalize this code ...
felipeboladao is offline  
Reply


Similar Threads Similar Threads
[HELP] Converting INI To Sql
08/10/2010 - CO2 Private Server - 1 Replies
Hey guys I have run into a problem converting my INI Source to Sql. I am in the process of converting the NPCs from INI. I have converted the ini file thats the easy part but I am stuck on the spawning. I can get the NPCs to load but not to spawn.. **EDIT** Just figured it out. #Request Close
Converting nc models
07/05/2010 - General Gaming Discussion - 3 Replies
ok, i try to convert the nc model files (actor files) in a other format, do anyone know, how kk protect the actor files? No modelprogramm can open/work with the files :(
[Help]Packet Converting :P
01/18/2010 - CO2 Private Server - 1 Replies
Hello Everybody, I was Wondering if anybody could help me out i want to learn how to convert packets from 5195 back to 5165 preferably the Flower Packets...Add me on Msn [email protected] Thanks, LeGend
Converting !
10/24/2009 - CO2 Private Server - 13 Replies
I want to know how to Convert a LOTF Source that is .ini into a Non ini Source Any Guides? Tips, ty. Co B,c,
converting
01/27/2009 - Dekaron - 3 Replies
when using winhex after you change the offsets u want how do u convert the winhex file to the files that acclaim uses is there a program? or do i have to get the full version of winhex to do this



All times are GMT +2. The time now is 06:06.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.