Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 00:39

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

Advertisement



[Release]Fix the ShopMall in Coemu Source

Discussion on [Release]Fix the ShopMall in Coemu Source within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
felipeboladao's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 255
Received Thanks: 273
[Release]Fix the ShopMall in Coemu Source

Okay, Best Code...

Look Imag's







Item Amount Fixed.
Buy Stones Plus Fixed.

Go to Handlers, ItemBuy.cs
Copy And replace The Code...

Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/28/2009
 * Time: 12:46 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections;
using System.Collections.Generic;
using CoEmu_v2_GameServer;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Calculations;
using CoEmu_v2_GameServer.Database;

namespace CoEmu_v2_GameServer.Handlers
{
    public partial class Handler
    {
        public static bool itemexist(string find, string where)
        {
            int Begin = where.IndexOf(find);
            int End = where.LastIndexOf(find);
            if (Begin >= 0 && End >= 0)
                return true;
            else
                return false;
        }
        public static void ItemBuy(byte[] Data, ClientSocket CSocket)
        {
            int ID = PacketProcessor.ReadLong(Data, 8);
            int Amount = PacketProcessor.ReadLong(Data, 20);
            {
                if (CSocket.Client.Inventory.Count == 40)
                {
                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Your inventory is full.", Struct.ChatType.Top));
                    return;
                }
                string Shop = System.IO.File.ReadAllText("Shop.dat");
                if (itemexist(Convert.ToString(ID), Shop))
                {
                    //Struct.ItemInfo Item = new Struct.ItemInfo();
                    if (Nano.Items.ContainsKey(ID))
                    {
                        Struct.ItemData NewItem = Nano.Items[ID];
                        if (NewItem.CPCost > 0)
                        {
                            if (CSocket.Client.CPs >= NewItem.CPCost * Data[20])
                            {
                                for (byte x = 0; x < Data[20]; x++)
                                {
                                    Struct.ItemInfo Item = new Struct.ItemInfo();
                                    Item.Color = new Random().Next(3, 9);
                                    Handler.CPs(NewItem.CPCost * -1, CSocket);
                                    Item.ItemID = NewItem.ID;
                                    Item.UID = Nano.Rand.Next(1, 9999999);

                                    if (Item.ItemID == 730001)
                                        Item.Plus = 1;
                                    if (Item.ItemID == 730002)
                                        Item.Plus = 2;
                                    if (Item.ItemID == 730003)
                                        Item.Plus = 3;
                                    if (Item.ItemID == 730004)
                                        Item.Plus = 4;
                                    if (Item.ItemID == 730005)
                                        Item.Plus = 5;
                                    if (Item.ItemID == 730006)
                                        Item.Plus = 6;
                                    if (Item.ItemID == 730007)
                                        Item.Plus = 7;

                                    bool created = Database.Database.NewItem(Item, CSocket);
                                    while (!created)
                                    {
                                        Item.UID = Nano.Rand.Next(1, 9999999);
                                        created = Database.Database.NewItem(Item, CSocket);
                                    }
                                    CSocket.Client.Inventory.Add(Item.UID, Item);
                                    CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus, 0, 0, 0, 0, Item.MaxDura, Item.MaxDura, 0, Item.Color));
                                }
                            }
                            else
                            {
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] You do not have enough CPs.", Struct.ChatType.Top));
                            }
                        }

                        else if (NewItem.Cost > 0)
                        {
                            if (CSocket.Client.Money >= NewItem.Cost)
                            {
                                Struct.ItemInfo Item = new Struct.ItemInfo();
                                Handler.Money(NewItem.Cost * -1, CSocket);
                                Item.ItemID = NewItem.ID;
                                Item.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(Item, CSocket);
                                while (!created)
                                {
                                    Item.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(Item, CSocket);
                                }

                                CSocket.Client.Inventory.Add(Item.UID, Item);
                                CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                            }
                            else
                            {
                                CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] You do not have enough money.", Struct.ChatType.Top));
                            }
                        }
                        else
                        {
                            Struct.ItemInfo Item = new Struct.ItemInfo();
                            Item.ItemID = NewItem.ID;
                            Item.UID = Nano.Rand.Next(1, 9999999);
                            bool created = Database.Database.NewItem(Item, CSocket);
                            while (!created)
                            {
                                Item.UID = Nano.Rand.Next(1, 9999999);
                                created = Database.Database.NewItem(Item, CSocket);
                            }

                            CSocket.Client.Inventory.Add(Item.UID, Item);
                            CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                        }
                    }
                    else
                    {
                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Item does not exist in Shop.dat", Struct.ChatType.Top));
                    }
                }
            }
        }
    }
}
Idit: Fixed All Buy Npcs Bug.
Idit 2: Tranks for alexbigfoot for Fixed Item Count's.

Worked??, give me tranks..
Attached Images
File Type: jpg amooubt.JPG (18.1 KB, 1098 views)
File Type: jpg buy2.JPG (16.3 KB, 1085 views)
File Type: jpg plus.JPG (39.6 KB, 1093 views)
felipeboladao is offline  
Thanks
39 Users
Old 05/27/2009, 07:50   #2
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
Way ahead of ya, but thanks.
Zeroxelli is offline  
Old 05/27/2009, 07:57   #3
 
2coolforu2's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 377
Received Thanks: 80
Thanks for release +K.
2coolforu2 is offline  
Old 05/27/2009, 09:11   #4
 
almoshax.'s Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 76
Received Thanks: 47
thx for release
almoshax. is offline  
Old 05/27/2009, 12:31   #5
 
eralex's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 7
Received Thanks: 28
Thx =)
eralex is offline  
Old 05/27/2009, 13:31   #6
 
ih8you's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 146
Received Thanks: 38
+k keep it up
ih8you is offline  
Old 05/27/2009, 13:40   #7
 
elite*gold: 0
Join Date: Aug 2006
Posts: 82
Received Thanks: 7
+k, working well
laurytalvi is offline  
Old 06/01/2009, 18:07   #8
 
almoshax.'s Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 76
Received Thanks: 47
working well but there is problem its look like give all items same uid i made jewelersun
it working good if you buy one by one but if you bought like 15 at once it take only one any ideas??
almoshax. is offline  
Old 06/01/2009, 18:18   #9
 
elite*gold: 0
Join Date: Dec 2007
Posts: 226
Received Thanks: 55
Code:
/*
 * Created by SharpDevelop.
 * User: sams
 * Date: 3/28/2009
 * Time: 12:46 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections;
using System.Collections.Generic;
using CoEmu_v2_GameServer;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Calculations;
using CoEmu_v2_GameServer.Database;

namespace CoEmu_v2_GameServer.Handlers
{
	public partial class Handler
	{
		public static bool itemexist(string find, string where)
        {
        	int Begin = where.IndexOf(find);
        	int End = where.LastIndexOf(find);
        	if(Begin >= 0 && End >= 0)
        	return true;
        	else
        	return false;
        }
        public static void ItemBuy(byte[] Data, ClientSocket CSocket)
        {
            int ID = PacketProcessor.ReadLong(Data, 8);
            int Amount = PacketProcessor.ReadLong(Data, 20);
            
                if (CSocket.Client.Inventory.Count == 40)
                {
                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Your inventory is full.", Struct.ChatType.Top));
                    return;
                }
                    string Shop = System.IO.File.ReadAllText("Shop.dat");
                    if (itemexist(Convert.ToString(ID), Shop))
                    {
                        [COLOR="Red"]//Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]
                        if (Nano.Items.ContainsKey(ID))
                        {
                            Struct.ItemData NewItem = Nano.Items[ID];
                            if (NewItem.CPCost > 0)
                            {
                                for (int i = 0; i < Amount; i++)
                                {
                                    if (CSocket.Client.CPs >= NewItem.CPCost)
                                    {
                                        [COLOR="Lime"]Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]
                                        Handler.CPs(NewItem.CPCost * -1, CSocket);
                                        Item.ItemID = NewItem.ID;
                                        Item.UID = Nano.Rand.Next(1, 9999999);

[COLOR="Blue"]//byte ItemPlus = 0;
                                        if (Item.ItemID == 730001)
                                            [B]Item.Plus[/B] = 1;
                                        if (Item.ItemID == 730002)
                                            [B]Item.Plus[/B] = 2;
                                        if (Item.ItemID == 730003)
                                            [B]Item.Plus[/B] = 3;
                                        if (Item.ItemID == 730004)
                                            [B]Item.Plus[/B] = 4;
                                        if (Item.ItemID == 730005)
                                            [B]Item.Plus[/B] = 5;
                                        if (Item.ItemID == 730006)
                                            [B]Item.Plus[/B] = 6;
                                        if (Item.ItemID == 730007)
                                            [B]Item.Plus[/B] = 7;[/COLOR]

                                        bool created = Database.Database.NewItem(Item, CSocket);
                                        while (!created)
                                        {
                                            Item.UID = Nano.Rand.Next(1, 9999999);
                                            created = Database.Database.NewItem(Item, CSocket);
                                        }
                                        CSocket.Client.Inventory.Add(Item.UID, Item);
                                        CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, Item.Plus , 0, 0, 0, 0, 0, 0, 0, 0));
                                    }
                                    else
                                    {
                                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] You do not have enough CPs.", Struct.ChatType.Top));
                                    }
                                }
                            }
                            else if (NewItem.Cost > 0)
                            {
                                if (CSocket.Client.Money >= NewItem.Cost)
                                {
                                    [COLOR="Lime"]Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]
                                    Handler.Money(NewItem.Cost * -1, CSocket);
                                    Item.ItemID = NewItem.ID;
                                    Item.UID = Nano.Rand.Next(1, 9999999);
                                    bool created = Database.Database.NewItem(Item, CSocket);
                                    while (!created)
                                    {
                                        Item.UID = Nano.Rand.Next(1, 9999999);
                                        created = Database.Database.NewItem(Item, CSocket);
                                    }
                                    CSocket.Client.Inventory.Add(Item.UID, Item);
                                    CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                                }
                                else
                                {
                                    CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] You do not have enough money.", Struct.ChatType.Top));
                                }
                            }
                            else
                            {
                                [COLOR="Lime"]Struct.ItemInfo Item = new Struct.ItemInfo();[/COLOR]
                                Item.ItemID = NewItem.ID;
                                Item.UID = Nano.Rand.Next(1, 9999999);
                                bool created = Database.Database.NewItem(Item, CSocket);
                                while (!created)
                                {
                                    Item.UID = Nano.Rand.Next(1, 9999999);
                                    created = Database.Database.NewItem(Item, CSocket);
                                }
                                CSocket.Client.Inventory.Add(Item.UID, Item);
                                CSocket.Send(ConquerPacket.ItemInfo(Item.UID, Item.ItemID, 0, 0, 0, 0, 0, 0, 0, 0, 0));
                            }
                        }
                    }
                    else
                    {
                        CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Item does not exist in Shop.dat", Struct.ChatType.Top));
                    }
        }
	}
}
like this it works fine, each item its own UID

EDITE:
i've notised that the +x has been added on the stones but the way it was writen woudn't have saved the +
Item.Plus
now it will work
yuko is offline  
Thanks
2 Users
Old 06/01/2009, 18:37   #10
 
almoshax.'s Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 76
Received Thanks: 47
ok i fixed it from 10 minute but thanks any way
almoshax. is offline  
Old 06/16/2009, 01:09   #11
 
elite*gold: 0
Join Date: Nov 2006
Posts: 65
Received Thanks: 2
Great job guys, but stone from lotto cant compose. you guys have any idea?
killerbee is offline  
Old 07/15/2009, 21:32   #12
 
elite*gold: 0
Join Date: Jun 2009
Posts: 361
Received Thanks: 99
When you add the Wuxing Oven to your server it f*cks everything up unless you fix it somehow. I can't buy anything from shops, anyone know why? =\
Jay1029 is offline  
Old 07/16/2009, 03:02   #13
 
raidenx123's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 1,705
Received Thanks: 441
Cause you post that on multiple threads -_-
raidenx123 is offline  
Old 07/16/2009, 07:47   #14
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
You probably didn't add it right, or didn't do your mysql connection limit right. Remember; however small Progress is to the SQL it IS an addition, so treat it as such.
Zeroxelli is offline  
Old 07/16/2009, 09:17   #15
 
elite*gold: 0
Join Date: Oct 2007
Posts: 36
Received Thanks: 2
good job thanks
phanton101 is offline  
Reply


Similar Threads Similar Threads
[Release] CoEmu v2 Source With Talisman And More
03/24/2010 - CO2 PServer Guides & Releases - 63 Replies
i have Add Many thing from guides that already posted here What i add on source? -Talisman -cps Save -Maps Loaded -fix ShopingMail -CP Admin -scrolls
[Release] SwordCo V5101 Source COEMU
03/17/2010 - CO2 PServer Guides & Releases - 17 Replies
I do not take credit for this i was just being snoopy and found it on megaupload...All Credits goto Main Creator MEGAUPLOAD - The leading online storage and file delivery service
[Release]CoEmu V2 C++ Source
01/02/2010 - CO2 PServer Guides & Releases - 13 Replies
Hello Guys i Writen This Source From Along Time Now Time To Share It DownLoad Link : CoEmu V2 C++ Source Writen By MeGaMaX.rar If You Want It In another lang Just add Me [email protected]
[Release]Talisman in Coemu V2 Source
11/09/2009 - CO2 PServer Guides & Releases - 59 Replies
look Img its works... http://www.elitepvpers.com/forum/attachment.php?at tachmentid=23127&d=1243342272 In game Server Source go to Handles, ItemEquip Search for else if ((ItemID >= 181300 && ItemID <= 192000 || ItemID >= 930000 && ItemID <= 940000) && EquipLocation == 9)//Returns Garment Position {
[Release]NPCs for Coemu V2 source
06/26/2009 - CO2 PServer Guides & Releases - 2 Replies
Post here the Npcs for Coemu Source, thanks for you contribution... case 104839: // BoxerLi PC- TG teleporter { if (LinkBack == 0) { Text("If you are level 20 or above, you may train ub the training ground. Would you like me to teleport you there for 1000 silver.", CSocket); Link("Yes, please.", 1, CSocket); Link("No Thanks.", 255, CSocket);



All times are GMT +1. The time now is 00:43.


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