Register for your free account! | Forgot your password?

You last visited: Today at 02:16

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

Advertisement



[HELP] Refinery Item

Discussion on [HELP] Refinery Item within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
littlechris95's Avatar
 
elite*gold: 0
Join Date: Nov 2011
Posts: 150
Received Thanks: 11
Question [HELP] Refinery Item

Hello everybody! So ... Today I started working in the refinery system, so far so good ... just that I have a problem in stabilizing the refinery on the item, or make Permanent refinery.

I've been searching the forum and found a topic where one member said to make a Permanent refinery was just set the time to 0, but when I went to try it, look what happened:



Sorry for my bad English. Thanks!
littlechris95 is offline  
Old 01/03/2014, 13:05   #2
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 238
just remove ur current system and make another one like purification
abdoumatrix is offline  
Old 01/03/2014, 21:51   #3
 
littlechris95's Avatar
 
elite*gold: 0
Join Date: Nov 2011
Posts: 150
Received Thanks: 11
Quote:
Originally Posted by abdoumatrix View Post
just remove ur current system and make another one like purification
But it is not possible to do this on my current refinery system?
littlechris95 is offline  
Old 01/03/2014, 22:32   #4
 
elite*gold: 0
Join Date: Feb 2009
Posts: 262
Received Thanks: 161
full purification and refinary
just convert for you source

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

namespace Project_Terror_v2.Game.MsgServer
{
    public class MsgItemExtra
    {
        public class Artefacts
        {
            public const byte Refinary = 0,
                Purification = 1;
        }
        public enum Typing : uint
        {
            RefinaryAdding = 2,
            PermanentRefinery = 3,
            StabilizationEffectRefined = 4,
            PurificationEffect = 5,
            PurificationAdding = 6,
            ExpireTime = 7,
            StabilizationEffectPurification = 9
        }

        public struct Purification
        {
            public uint ItemUID;
            public Typing Typ;
            public uint PurificationItemID;
            public uint PurificationLevel;
            /// <summary>
            /// In minutes.
            /// </summary>
            public uint PurificationDuration;

            public DateTime AddedOn;
            private bool Available;
            public int SecoundsLeft
            {
                get
                {
                    if (PurificationDuration != 0)
                    {
                        TimeSpan span1 = new TimeSpan(AddedOn.AddSeconds(PurificationDuration).Ticks);
                        TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks);
                        int secondsleft = (int)(span1.TotalSeconds - span2.TotalSeconds);
                        if (secondsleft > 0)
                        {
                            Available = true;
                            return secondsleft;
                        }
                        else
                            Available = false;
                    }
                    else if (PurificationItemID >  1000)
                        Available = true;

                    return 0;
                }
            }
            public bool InLife
            {
                get
                {

                    int secount = SecoundsLeft;//to create time
                    return Available;
                }
            }
        }
      
        public struct Refinery
        {
            public uint ItemUID;
            
            public Typing Typ;
            public uint EffectID;
            public uint EffectLevel;
            public uint EffectPercent;
            /// <summary>
            /// In minutes.
            /// </summary>
            public uint EffectDuration;
            public DateTime AddedOn;
            public bool Available;

            public int SecoundsLeft
            {
                get
                {
                    if (EffectDuration != 0)
                    {
                        TimeSpan span1 = new TimeSpan(AddedOn.AddSeconds(EffectDuration).Ticks);
                        TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks);
                        int secondsleft = (int)(span1.TotalSeconds - span2.TotalSeconds);
                        if (secondsleft > 0)
                        {
                            Available = true;
                            return secondsleft;
                        }
                        else
                            Available = false;
                    }
                    else if (EffectID > 1000)
                        Available = true;

                    return 0;
                }
            }
            public bool InLife
            {
                get
                {

                    int secount = SecoundsLeft;//verified create time
                    return Available;
                }
            }
        }
        public List<Purification> Purifications;
        public List<Refinery> Refinerys;

        public MsgItemExtra()
        {
            Purifications = new List<Purification>();
            Refinerys = new List<Refinery>();

        }

        public Typing Typ;
        private unsafe byte* Data;
        public unsafe void CreateArray()
        {
            byte[] buffer = new byte[16 + 28 * Refinerys.Count + 28 * Purifications.Count];
            fixed (byte* buff = buffer)
            {
                *(ushort*)(buff) = (ushort)(buffer.Length - 8);
                *(ushort*)(buff + 2) = GamePackets.ExtraItem;
                *(uint*)(buff + 4) = (uint)(Refinerys.Count + Purifications.Count);
                byte offset = 8;
                foreach (var item in Purifications)
                {
                    *(Purification*)(buff + offset) = item;
                    *(int*)(buff + offset + 20) = item.SecoundsLeft;
                    offset += 28;
                }
                foreach (var item in Refinerys)
                {
                    *(Refinery*)(buff + offset) = item;
                    *(int*)(buff + offset + 20) = item.SecoundsLeft;
                    offset += 28;
                }
                *(ulong*)(buff + buffer.Length - 8) = ServerSockets.Packet.TqPacket;
                Data = buff;
            }

           
        }
        public unsafe byte* GetArray()
        {
            return Data;
        }
        [PacketAttribute(GamePackets.Stabilization)]
        public unsafe static void Stabilization(Client.GameClient client, ServerSockets.Packet packet)
        {
            uint Mode = *(uint*)(packet.Array + 4);
            uint ItemUID = *(uint*)(packet.Array + 8);
            uint Count = *(uint*)(packet.Array + 12);

            switch (Mode)
            {
                case Artefacts.Refinary:
                    {
                        Game.MsgServer.MsgGameItem Item;
                       if (client.TryGetItem(ItemUID, out Item))
                        {
                            if (!Item.Refinary.InLife) return;
                            if (Item.Refinary.EffectID == 0) return;

                            uint procent = 0;
                            Queue<Game.MsgServer.MsgGameItem> items = new Queue<Game.MsgServer.MsgGameItem>();
                            for (ushort count = 16; count <= 12 + Count * 4; count += 4)
                            {
                                uint stoneUID = *(uint*)(packet.Array + count);

                                Game.MsgServer.MsgGameItem stones;
                                if (client.Inventory.TryGetItem(stoneUID, out stones))
                                {
                                    if (stones.Item.ITEM_ID == 723694)
                                        procent += 10;
                                    if (stones.Item.ITEM_ID == 723695)
                                        procent += 100;
                                    items.Enqueue(stones);
                                }
                            }

                            if (procent >= Database.ItemType.RefineryStabilizationPoints((byte)Item.Refinary.EffectLevel))
                            {
                                Item.Refinary.EffectDuration = 0;
                                Item.Refinary.Typ = Typing.StabilizationEffectRefined;

                                MsgItemExtra effect = new MsgItemExtra();
                                effect.Refinerys.Add(Item.Refinary);
                                effect.CreateArray();
                                client.Send(effect.GetArray());

                                Item.Item.Mode = Role.Flags.ItemMode.Update;
                                Item.Send(client);

                                uint count_remover = (uint)items.Count;
                                for (byte x = 0; x < count_remover; x++)
                                    client.Inventory.Update(items.Dequeue(), Role.Instance.AddMode.REMOVE);

                            }
                        }
                        break;
                    }
                case Artefacts.Purification:
                    {

                        Game.MsgServer.MsgGameItem Item;
                        if (client.TryGetItem(ItemUID, out Item))
                        {
                            if (!Item.Purification.InLife) return;
                            if (Item.Purification.PurificationItemID == 0) return;

                            uint procent = 0;
                            Queue<Game.MsgServer.MsgGameItem> items = new Queue<Game.MsgServer.MsgGameItem>();
                            for (ushort count = 16; count <= 12 + Count * 4; count += 4)
                            {
                                uint stoneUID = *(uint*)(packet.Array + count);

                                Game.MsgServer.MsgGameItem stones;
                                if (client.Inventory.TryGetItem(stoneUID, out stones))
                                {
                                    if (stones.Item.ITEM_ID == 723694)
                                        procent += 10;
                                    if (stones.Item.ITEM_ID == 723695)
                                        procent += 100;
                                    items.Enqueue(stones);
                                }
                            }

                            if (procent >= Database.ItemType.PurifyStabilizationPoints((byte)Item.Purification.PurificationLevel))
                            {
                                Item.Purification.PurificationDuration = 0;
                                Item.Purification.Typ = Typing.StabilizationEffectPurification;

                                MsgItemExtra effect = new MsgItemExtra();
                                effect.Purifications.Add(Item.Purification);
                                effect.CreateArray();
                                client.Send(effect.GetArray());

                                Item.Item.Mode = Role.Flags.ItemMode.Update;
                                Item.Send(client);

                                uint count_remover = (uint)items.Count;
                                for (byte x = 0; x < count_remover; x++)
                                    client.Inventory.Update(items.Dequeue(), Role.Instance.AddMode.REMOVE);

                            }

                        }
                        break;
                    }
            }
        }

        [PacketAttribute(GamePackets.AddExtra)]
        public unsafe static void AddExtra(Client.GameClient client, ServerSockets.Packet packet)
        {
           uint Mode = *(uint*)(packet.Array + 4);
           uint ItemUID = *(uint*)(packet.Array + 8);
           uint ItemArtfact = *(uint*)(packet.Array + 12);
           if (ItemUID == ItemArtfact)
               return;
           switch (Mode)
           {
               case Artefacts.Refinary:
                   {
                       Game.MsgServer.MsgGameItem Item, Artefact;
                       if (client.TryGetItem(ItemUID, out Item) && client.Inventory.TryGetItem(ItemArtfact, out Artefact))
                       {
                           if (Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Bottle
                              || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Garment
                              || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Fan
                              || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Tower
                              || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.RidingCrop
                              || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.SteedMount
                              || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.LeftWeaponAccessory
                              || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.RightWeaponAccessory)
                               return;

                           var BaseAddingItem = Database.Server.RifineryItems[Artefact.Item.ITEM_ID];

                           if (Database.ItemType.ItemPosition(Item.Item.ITEM_ID) != BaseAddingItem.ForItemPosition)
                               return;

                           Item.Refinary = new Refinery();
                           Item.Refinary.AddedOn = DateTime.Now;
                           Item.Refinary.Available = true;
                           Item.Refinary.ItemUID = ItemUID;
                           Item.Refinary.EffectLevel = BaseAddingItem.Level;
                           Item.Refinary.EffectDuration = 7 * 24 * 60 * 60;
                           Item.Refinary.EffectID = Artefact.Item.ITEM_ID;
                           Item.Refinary.EffectPercent = BaseAddingItem.Procent;
                           Item.Item.Mode = Role.Flags.ItemMode.Update;
                           Item.Send(client);

                           client.Equipment.QueryEquipment(client.Equipment.Alternante);

                           client.Inventory.Update(Artefact, Role.Instance.AddMode.REMOVE);
                       }

                       break;
                   }
               case Artefacts.Purification:
                   {
                       Game.MsgServer.MsgGameItem Item, Artefact;
                       if (client.TryGetItem(ItemUID, out Item) && client.Inventory.TryGetItem(ItemArtfact, out Artefact))
                       {
                           if (Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Bottle
                               || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Garment
                               || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Fan
                               || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.Tower
                               || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.RidingCrop
                               || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.SteedMount
                               || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.LeftWeaponAccessory
                               || Database.ItemType.ItemPosition(Item.Item.ITEM_ID) == (ushort)Role.Flags.ConquerItem.RightWeaponAccessory)
                               return;

                           var PurifyInformation = Database.Server.ItemsBase[Artefact.Item.ITEM_ID];
                           var ItemInformation = Database.Server.ItemsBase[Item.Item.ITEM_ID];
                            if (PurifyInformation.PurificationLevel > 0)
                            {
                                if (ItemInformation.Level >= PurifyInformation.Level)
                                {
                                    if (client.Inventory.Contain(1088001, (byte)PurifyInformation.PurificationMeteorNeed))
                                    {
                                        client.Inventory.Remove(1088001, (byte)PurifyInformation.PurificationMeteorNeed);

                                        Item.Purification = new Purification();
                                        Item.Purification.AddedOn = DateTime.Now;
                                        Item.Purification.ItemUID = ItemUID;
                                        Item.Purification.PurificationLevel = PurifyInformation.PurificationLevel;
                                        Item.Purification.PurificationDuration = 7 * 24 * 60 * 60;
                                        Item.Purification.PurificationItemID = Artefact.Item.ITEM_ID;
                                        Item.Purification.Typ = Typing.PurificationEffect;

                                        MsgItemExtra effect = new MsgItemExtra();
                                        effect.Purifications.Add(Item.Purification);
                                        effect.CreateArray();
                                        client.Send(effect.GetArray());

                                        Item.Item.Mode = Role.Flags.ItemMode.Update;
                                        Item.Send(client);

                                        client.Inventory.Update(Artefact, Role.Instance.AddMode.REMOVE);
                                        if(Item.Item.Position != 0)
                                            client.Equipment.QueryEquipment(client.Equipment.Alternante);
                                    }
                                }
                            }
                       }
                       break;
                   }

           }
        }
    }
}

for send
Code:
if (Purification.ItemUID != 0 || Refinary.ItemUID != 0)
            {
                MsgItemExtra extra = new MsgItemExtra();
                if (Purification.InLife)
                {
                    Purification.Typ = MsgItemExtra.Typing.PurificationAdding;
                    extra.Purifications.Add(Purification);
                }
                if (Refinary.InLife)
                {
                    Refinary.Typ = MsgItemExtra.Typing.RefinaryAdding;
                    if (Refinary.EffectDuration == 0)
                        Refinary.Typ = MsgItemExtra.Typing.PermanentRefinery;
                    extra.Refinerys.Add(Refinary);
                }
                extra.CreateArray();
                client.Send(extra.GetArray());
            }
teroareboss1 is offline  
Thanks
2 Users
Old 01/04/2014, 06:05   #5
 
littlechris95's Avatar
 
elite*gold: 0
Join Date: Nov 2011
Posts: 150
Received Thanks: 11
Thumbs up

Is working *-*



What are the values ​​of these variables in your project:
PHP Code:
ServerSockets.Packet.TqPacket ?
GamePackets.ExtraItem 
Thanks so much!

@abdoumatrix
@teroareboss1
littlechris95 is offline  
Old 03/03/2014, 18:02   #6
 
elite*gold: 0
Join Date: Jan 2010
Posts: 2
Received Thanks: 0
were would i add this
boogie12 is offline  
Old 03/03/2014, 20:29   #7
 
elite*gold: 0
Join Date: Mar 2011
Posts: 25
Received Thanks: 0
nice job
uzn1 is offline  
Reply


Similar Threads Similar Threads
refinery ini
02/15/2013 - Archlord - 7 Replies
can someone has refineryitem2.txt file before yesterday maintance and can upload? thx
Refinery Effect?
07/09/2012 - CO2 Private Server - 0 Replies
Main Character: http://oi47.tinypic.com/pog.jpg Second Character: http://oi47.tinypic.com/ek3q4h.jpg Okay, any solution for this? Or Can someone give me an idea on how do I make them visible to other players? Edit: I was checking on my previous threads, and I have decided to update it to remind myself of what I accomplished 3 years ago. I have fixed the issue, it is somehow related to the Observe_Gears (10010).
Pet Refinery???
08/05/2011 - Archlord - 3 Replies
So Webzen just gave a level 3 Serz in the items giveway and I tried to refine it but it says: You have the wrong number of items you must assign them according to the manual in your inventory. Help please :/
Refinery Item Giveaway on Dark!
02/26/2011 - Conquer Online 2 - 0 Replies
Hello everybody. On Dark server I'll be giving away a shit ton of refinery items. http://origin.screensnapr.com/images/HlneVg.png Send a whisper to TheLastTsar asking for what you want.
Refinery glitch?
12/29/2008 - Archlord - 15 Replies
I have heard several people talking about a 'refinery glitch', making you able to dupe elemental stones or something. Also, I have recently seen alot of level 1 toons running from the Safe Keeper to the refinery. So I assume they are all using this glitch. Does anyone know what this glitch exactly does? And how to glitch it? Thanks in advance!



All times are GMT +1. The time now is 02:18.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.