Help - item amount of Shops

07/17/2012 22:14 || Dark Prince ||#1
hey guys. i have lil problem with shop item amount
Source Version:5530
every time i buy item from shop. come like that
[Only registered and activated users can see links. Click Here To Register...]

and i want edit it to be like next pic

[Only registered and activated users can see links. Click Here To Register...]

how i can do it ?? :(

this problem with shops only. its better with commands
thank you all
any idea may helps

----------------------------------------
and sorry about my bad english
----------------------------------------
07/18/2012 01:42 .Kinshi#2
Check the itemtype file for the max stack amount and don't stack if its equal to it.
07/18/2012 02:13 shadowman123#3
Yea A Friend of mine had same issue but its too easy smthing you should Add its inside Packethandler.cs / Void Handlebuyfromnpc and check the Shopping mall code you would find smthing like that

client.inventory.add(item, Enums.CreateandAdd);
and item.stacksize = Amount u bought and thats smthing we dont want to do it So make it like that

if (Amount > 0)
{
client.Inventory.Add(item, 0, Amount);
}

this Should Solve your Problem ( These Code isnt Copy paste as i just wrote it In Post not Source )
07/19/2012 02:31 zakkwilde_17#4
Quote:
Originally Posted by || Dark Prince || View Post
hey guys. i have lil problem with shop item amount
Source Version:5530
every time i buy item from shop. come like that
[Only registered and activated users can see links. Click Here To Register...]

and i want edit it to be like next pic

[Only registered and activated users can see links. Click Here To Register...]

how i can do it ?? :(

this problem with shops only. its better with commands
thank you all
any idea may helps

----------------------------------------
and sorry about my bad english
----------------------------------------
Use this infos in your drop config

Code:
if (Map.SelectCoordonates(ref X, ref Y))
                            {
                                Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
                                floorItem.Item = new Network.GamePackets.ConquerItem(true);
                                floorItem.Item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(4, 8);
                                floorItem.Item.ID = Uid;
                                floorItem.Item.MaximDurability = floorItem.Item.Durability = 65535;
                                floorItem.Item.MobDropped = true;
                                floorItem.Item.UID = Network.GamePackets.ConquerItem.ItemUID.Next;
                                floorItem.ValueType = Network.GamePackets.FloorItem.FloorValueType.Item;
                                floorItem.ItemID = Uid;
                                floorItem.MapID = Owner.MapID;
                                floorItem.MapObjType = Game.MapObjectType.Item;
                                floorItem.X = X;
                                floorItem.Y = Y;
                                floorItem.Owner = killer.Owner;
                                floorItem.Type = Network.GamePackets.FloorItem.Drop;
                                floorItem.OnFloor = Time32.Now;
                                floorItem.ItemColor = floorItem.Item.Color;
                                floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
                                while (Map.Npcs.ContainsKey(floorItem.UID))
                                    floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
                                Map.AddFloorItem(floorItem);
                                SendScreenSpawn(floorItem);
                            }
07/19/2012 06:34 || Dark Prince ||#5
i tryed all you told me guys but no one success with this. but
i owe for you guys specially [Only registered and activated users can see links. Click Here To Register...]
but i discovered the reason is at items.txt in data base
every item have number at last. like that

Code:
1088000 DragonBall 0 0 0 0 0 0 0 0 0 0 10000 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 215 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 RareItem It~can~improve~quality~of~weapons~and~equipments. [COLOR=Red]8[/COLOR] 0 0
8 number make the stack of DragonBall 8
this should be quality not stacks
and when i edited it to 0 the problem solved

any idea to make source do not read this as amount ??
07/19/2012 13:24 shadowman123#6
Quote:
Originally Posted by zakkwilde_17 View Post
Use this infos in your drop config

Code:
if (Map.SelectCoordonates(ref X, ref Y))
                            {
                                Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
                                floorItem.Item = new Network.GamePackets.ConquerItem(true);
                                floorItem.Item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(4, 8);
                                floorItem.Item.ID = Uid;
                                floorItem.Item.MaximDurability = floorItem.Item.Durability = 65535;
                                floorItem.Item.MobDropped = true;
                                floorItem.Item.UID = Network.GamePackets.ConquerItem.ItemUID.Next;
                                floorItem.ValueType = Network.GamePackets.FloorItem.FloorValueType.Item;
                                floorItem.ItemID = Uid;
                                floorItem.MapID = Owner.MapID;
                                floorItem.MapObjType = Game.MapObjectType.Item;
                                floorItem.X = X;
                                floorItem.Y = Y;
                                floorItem.Owner = killer.Owner;
                                floorItem.Type = Network.GamePackets.FloorItem.Drop;
                                floorItem.OnFloor = Time32.Now;
                                floorItem.ItemColor = floorItem.Item.Color;
                                floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
                                while (Map.Npcs.ContainsKey(floorItem.UID))
                                    floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
                                Map.AddFloorItem(floorItem);
                                SendScreenSpawn(floorItem);
                            }
R u Blind ? who the Fk Mentioned anything about Dropped Items Read the Entire Thread to know what we Are tal;king ABout

Quote:
Originally Posted by || Dark Prince || View Post
i tryed all you told me guys but no one success with this. but
i owe for you guys specially [Only registered and activated users can see links. Click Here To Register...]
but i discovered the reason is at items.txt in data base
every item have number at last. like that

Code:
1088000 DragonBall 0 0 0 0 0 0 0 0 0 0 10000 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 215 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 RareItem It~can~improve~quality~of~weapons~and~equipments. [COLOR=Red]8[/COLOR] 0 0
8 number make the stack of DragonBall 8
this should be quality not stacks
and when i edited it to 0 the problem solved

any idea to make source do not read this as amount ??
i h8 it when i post the Right Answer and its being ignored .. Check The Code of Shopping Mall in Void Handlebuyfromnpc inside PacketHandler.cs
07/19/2012 15:54 zakkwilde_17#7
Quote:
Originally Posted by shadowman123 View Post
R u Blind ? who the Fk Mentioned anything about Dropped Items Read the Entire Thread to know what we Are tal;king ABout



i h8 it when i post the Right Answer and its being ignored .. Check The Code of Shopping Mall in Void Handlebuyfromnpc inside PacketHandler.cs
Lol

you just need to remove thats lines

Code:
                    if (!Network.PacketHandler.IsEquipment(OwnItemID) && infos.ConquerPointsWorth == 0)
                    {
                        floorItem.Item.StackSize = 1;
                        floorItem.Item.MaxStackSize = infos.StackSize;
                    }
will work fine
07/19/2012 16:12 shadowman123#8
Quote:
Originally Posted by zakkwilde_17 View Post
Lol

you just need to remove thats lines

Code:
                    if (!Network.PacketHandler.IsEquipment(OwnItemID) && infos.ConquerPointsWorth == 0)
                    {
                        floorItem.Item.StackSize = 1;
                        floorItem.Item.MaxStackSize = infos.StackSize;
                    }
will work fine
Oh God ... WAKE UP DUDE IT ISNT ABOUT PICKING UP ITEMS ITS ABOUT BUYING ITEMS WITH STACK NUMBERS
07/19/2012 16:39 matthew 2010#9
shadowman123 's answer is correct and also Items.txt in source and Itemtype.dat in client also has the max stackable value in the code for items i think its something like line 55 for 5530 idk for sure tho on the line
07/19/2012 17:18 shadowman123#10
Quote:
Originally Posted by matthew 2010 View Post
shadowman123 's answer is correct and also Items.txt in source and Itemtype.dat in client also has the max stackable value in the code for items i think its something like line 55 for 5530 idk for sure tho on the line
Itemtye used to Edit on Item infos So its useless in this Problem as the problem isnt in item info Stack size its in Shop handling
07/19/2012 19:52 matthew 2010#11
Quote:
Originally Posted by shadowman123 View Post
Itemtye used to Edit on Item infos So its useless in this Problem as the problem isnt in item info Stack size its in Shop handling
correct and correct is y i told him ur answer is correct so he wouldn't listen to the fool who posted about item drop stack and i only posted the itemtype stuff so as he would know how to change the stack size value incase he wants them unstack able < (*that will not solve ur problem if ur shops are still trying to stack u will just start seeing errors if u dont change the shops 1st*) or other items a higher stacking value
07/21/2012 01:35 || Dark Prince ||#12
shadowman. my pleasure for post to help me. i'm really owe for you
i'm just confused. here is the code. can u tell me pleas where the problem exactly

PHP Code:

        
static void HandleBuyFromNPC(ItemUsage itemUsageClient.GameState client)
        {

            if (
itemUsage == null)
                return;
            if (
client == null)
                return;
            if (
itemUsage.UID == 141)
            {
                if (
itemUsage.dwParam == 721157 || itemUsage.dwParam == 721158)
                {
                    
uint cost 5000;
                    
Interfaces.IConquerItem item = new ConquerItem(true);
                    if (
cost client.Entity.Money)
                        return;
                    if (
client.Entity.Money cost client.Entity.Money)
                        return;
                    
item.ID itemUsage.dwParam;
                    
item.Durability item.MaximDurability 100;
                    
item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(48);
                    
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                    if (
client.Inventory.ContainsUID(item.UID) || item.StackSize == 1)
                        
client.Entity.Money -= cost;
                }
            }
            if (
itemUsage.UID == 2888)
            {
                if (
itemUsage.dwParam == 203009)
                {
                    
uint cost 1290;
                    if (
cost client.Entity.ConquerPoints)
                        return;
                    if (
client.Entity.ConquerPoints cost client.Entity.ConquerPoints)
                        return;
                    
Interfaces.IConquerItem item = new ConquerItem(true);
                    
item.ID itemUsage.dwParam;

                    
item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(48);
                    
item.Durability item.MaximDurability 100;//iteminfo.BaseInformation.Durability;
                    
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                    if (
client.Inventory.ContainsUID(item.UID) || item.StackSize == 1)
                        
client.Entity.ConquerPoints = (uint)Math.Max(0, (uint)((uint)client.Entity.ConquerPoints - (uint)cost));
                }
            }


            if (
itemUsage.UID == 6000)//honorshop
            
{
                if (
client.Inventory.Count == 40)
                    return;
                
uint price 0;
                switch (
itemUsage.dwParam)
                {
                    case 
200006price 300000; break;
                    case 
200207price 500000; break;

                    case 
200208price 800000; break;
                    case 
200007price 2000000; break;
                    case 
200309price 550000; break;
                    case 
200308price 900000; break;
                    case 
200103price 1300000; break;
                    case 
200107price 2000000; break;
                    case 
720842price 8000; break;
                    case 
711083price 50000; break;
                    case 
720598price 20000; break;
                    case 
720774price 10000; break;
                    case 
723651price 25000; break;
                    case 
723652price 62400; break;
                    case 
723653price 156000; break;
                    case 
723654price 12500; break;
                    case 
723655price 31200; break;
                    case 
723656price 78000; break;
                    case 
723657price 25000; break;
                    case 
723658price 62400; break;
                    case 
723659price 156000; break;
                    case 
723660price 5000; break;
                    case 
723661price 12500; break;
                    case 
723662price 31200; break;
                    case 
723663price 10000; break;
                    case 
723664price 25000; break;
                    case 
723665price 62400; break;
                    case 
723666price 10000; break;
                    case 
723667price 25000; break;
                    case 
723668price 62400; break;
                    case 
723669price 12500; break;
                    case 
723670price 31200; break;
                    case 
723671price 78000; break;
                    case 
723672price 16000; break;
                    case 
723673price 41000; break;
                    case 
723674price 104000; break;
                    case 
723675price 16000; break;
                    case 
723676price 41000; break;
                    case 
723677price 104000; break;
                    case 
723678price 13000; break;
                    case 
723679price 33000; break;
                    case 
723680price 83000; break;
                    case 
723681price 13000; break;
                    case 
723682price 33000; break;
                    case 
723683price 83000; break;
                    case 
723690price 13000; break;
                    case 
723691price 33000; break;
                    case 
723692price 83000; break;
                    case 
723684price 10000; break;
                    case 
723685price 25000; break;
                    case 
723686price 62400; break;
                    case 
723130price 10000; break;
                    case 
723131price 25000; break;
                    case 
723132price 62400; break;
                    case 
723133price 25000; break;
                    case 
723134price 62400; break;
                    case 
723135price 156000; break;
                }
                
Interfaces.IConquerItem item = new ConquerItem(true);
                
Database.ConquerItemInformation iteminfo = new Conquer_Online_Server.Database.ConquerItemInformation(itemUsage.dwParam0);
                if (
price client.ArenaStatistic.CurrentHonor)
                    return;
                if (
client.ArenaStatistic.CurrentHonor price client.ArenaStatistic.CurrentHonor)
                    return;
                
item.ID itemUsage.dwParam;
                
item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(48);
                
item.Durability item.MaximDurability iteminfo.BaseInformation.Durability;
                
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                
client.ArenaStatistic.CurrentHonor -= price;
                
Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic);
                return;
            }
            
Interfaces.INpc npc null;
            if (
client.Map.Npcs.TryGetValue(itemUsage.UIDout npc) || itemUsage.UID == 2888)
            {
                if (
client.Inventory.Count == 40)
                    return;
                if (
itemUsage.UID != 2888)
                    if (
ServerBase.Kernel.GetDistance(client.Entity.Xclient.Entity.Ynpc.Xnpc.Y) > 17)
                        return;


                
Database.ShopFile.Shop shop = new Conquer_Online_Server.Database.ShopFile.Shop();
                if (
Database.ShopFile.Shops.TryGetValue(itemUsage.UIDout shop))
                {
                    if (
shop.UID == 0)
                        return;
                    if (!
shop.Items.Contains(itemUsage.dwParam))
                        return;
                    
Database.ConquerItemInformation iteminfo = new Conquer_Online_Server.Database.ConquerItemInformation(itemUsage.dwParam0);
                    
uint Amount itemUsage.dwExtraInfo itemUsage.dwExtraInfo 1;
                    while (
Amount && client.Inventory.Count != 40)
                    {
                        
Interfaces.IConquerItem item = new ConquerItem(true);

                        switch (
shop.MoneyType)
                        {
                            case 
Conquer_Online_Server.Database.ShopFile.MoneyType.Gold:
                                {
                                    if (
iteminfo.BaseInformation.GoldWorth client.Entity.Money)
                                        return;
                                    if (
client.Entity.Money iteminfo.BaseInformation.GoldWorth client.Entity.Money)
                                        return;
                                    
item.ID itemUsage.dwParam;
                                    
item.Durability item.MaximDurability iteminfo.BaseInformation.Durability;
                                    if (!
IsEquipment(item.ID))
                                    {
                                        if (
iteminfo.BaseInformation.StackSize != 0)
                                        {
                                            
item.StackSize 1;
                                            
item.MaxStackSize iteminfo.BaseInformation.StackSize;
                                        }
                                    }
                                    
item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(48);
                                    
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                                    if (
client.Inventory.ContainsUID(item.UID) || item.StackSize == 1)
                                        
client.Entity.Money -= iteminfo.BaseInformation.GoldWorth;
                                    break;
                                }
                            case 
Conquer_Online_Server.Database.ShopFile.MoneyType.ConquerPoints:
                                {
                                    if (
iteminfo.BaseInformation.ConquerPointsWorth client.Entity.ConquerPoints)
                                        return;
                                    if (
client.Entity.ConquerPoints iteminfo.BaseInformation.ConquerPointsWorth client.Entity.ConquerPoints)
                                        return;
                                    
item.ID itemUsage.dwParam;
                                    if (
item.ID >= 730001 && item.ID <= 730008)
                                        
item.Plus = (byte)(item.ID 10);
                                    
item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(48);
                                    
item.Durability item.MaximDurability iteminfo.BaseInformation.Durability;
                                    if (!
IsEquipment(item.ID))
                                    {
                                        if (
iteminfo.BaseInformation.StackSize != 0)
                                        {
                                            
item.StackSize 1;
                                            
item.MaxStackSize iteminfo.BaseInformation.StackSize;
                                        }
                                    }
                                    
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                                    if (
client.Inventory.ContainsUID(item.UID) || item.StackSize == 1)
                                        
client.Entity.ConquerPoints = (uint)Math.Max(0, (uint)((uint)client.Entity.ConquerPoints - (uint)iteminfo.BaseInformation.ConquerPointsWorth));
                                    break;
                                }
                        }
                        
Amount--;
                    }
                }
                else
                {
                    if (
Database.EShopFile.Shops.TryGetValue(itemUsage.UIDout shop))
                    {
                        if (
shop.UID == 0)
                            return;
                        if (!
shop.Items.Contains(itemUsage.dwParam))
                            return;
                        
Database.ConquerItemInformation iteminfo = new Conquer_Online_Server.Database.ConquerItemInformation(itemUsage.dwParam0);
                        
uint Amount itemUsage.dwExtraInfo itemUsage.dwExtraInfo 1;
                        while (
Amount && client.Inventory.Count != 40)
                        {

                            
Interfaces.IConquerItem item = new ConquerItem(true);
                            switch (
shop.MoneyType)
                            {
                                case 
Conquer_Online_Server.Database.ShopFile.MoneyType.Gold:
                                    {
                                        if (
iteminfo.BaseInformation.GoldWorth client.Entity.Money)
                                            return;
                                        if (
client.Entity.Money iteminfo.BaseInformation.GoldWorth client.Entity.Money)
                                            return;
                                        
item.ID itemUsage.dwParam;
                                        
item.Durability item.MaximDurability iteminfo.BaseInformation.Durability;

                                        
item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(48);
                                        
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                                        if (
client.Inventory.ContainsUID(item.UID) || item.StackSize == 1)
                                            
client.Entity.Money -= iteminfo.BaseInformation.GoldWorth;
                                        break;
                                    }
                                case 
Conquer_Online_Server.Database.ShopFile.MoneyType.ConquerPoints:
                                    {
                                        if (
iteminfo.BaseInformation.ConquerPointsWorth client.Entity.ConquerPoints)
                                            return;
                                        if (
client.Entity.ConquerPoints iteminfo.BaseInformation.ConquerPointsWorth client.Entity.ConquerPoints)
                                            return;
                                        
item.ID itemUsage.dwParam;
                                        if (
item.ID >= 730001 && item.ID <= 730008)
                                            
item.Plus = (byte)(item.ID 10);
                                        
item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(48);
                                        
item.Durability item.MaximDurability iteminfo.BaseInformation.Durability;

                                        
client.Inventory.Add(itemGame.Enums.ItemUse.CreateAndAdd);
                                        if (
client.Inventory.ContainsUID(item.UID) || item.StackSize == 1)
                                            
client.Entity.ConquerPoints = (uint)Math.Max(0, (uint)((uint)client.Entity.ConquerPoints - (int)iteminfo.BaseInformation.ConquerPointsWorth));
                                        break;
                                    }
                            }
                            
Amount--;
                        }
                    }
                }
            }
        } 
07/21/2012 02:25 shadowman123#13
Here you Are Replace these Codes

Code:
if (itemUsage.UID == 2888)
            {
                if (itemUsage.dwParam == 203009)
                {
                    uint cost = 1290;
                    if (cost > client.Entity.ConquerPoints)
                        return;
                    if (client.Entity.ConquerPoints - cost > client.Entity.ConquerPoints)
                        return;
                    Interfaces.IConquerItem item = new ConquerItem(true);
                    item.ID = itemUsage.dwParam;

                    item.Color = (Conquer_Online_Server.Game.Enums.Color)ServerBase.Kernel.Random.Next(4, 8);
                    item.Durability = item.MaximDurability = 100;//iteminfo.BaseInformation.Durability;
                    client.Inventory.Add(item, Game.Enums.ItemUse.CreateAndAdd);
                    if (client.Inventory.ContainsUID(item.UID) || item.StackSize == 1)
                        client.Entity.ConquerPoints = (uint)Math.Max(0, (uint)((uint)client.Entity.ConquerPoints - (uint)cost));
                }
            }
with this One

Code:
if (itemUsage.UID == 2888)
            {
                byte RequestedAmount = (byte)itemUsage.dwExtraInfo;
                var ItemInformation = new Database.ConquerItemInformation(itemUsage.dwParam, 0);
                uint ItemPrice = ItemInformation.BaseInformation.ConquerPointsWorth;
                var Item = new ConquerItem(true);
                item.ID = itemUsage.dwParam;
                item.Color = Enums.Color.Red;
                item.Durability = ItemInformation.BaseInformation.Durability;
                if (RequestedAmount > 1)
                {
                    if (client.Entity.ConquerPoints >= ItemPrice * RequestedAmount) { client.Entity.ConquerPoints -= ItemPrice * RequestedAmount; client.Inventory.Add(item.ID, 0, RequestedAmount); }
                    else { client.Send(new Message(" You Dont Have Enough ConquerPoints ", Color.Yellow, Message.Center)); }
                }
                else
                {
                    if (client.Entity.ConquerPoints >= ItemPrice) { client.Entity.ConquerPoints -= ItemPrice; client.Inventory.Add(item.ID, 0, RequestedAmount); }
                    else { client.Send(new Message(" You Dont Have Enough ConquerPoints ", Color.Yellow, Message.Center)); }
                }
            }