قديم 2019-07-12, 10:01 PM
المشاركة 2
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكلة عندي في السيرفر الصطف بتتحول لي صول
جرب تفتح كلاس ConquerItemTable.cs و تبدل كل الي جواه ب ده

و متنساش تغير اسم البروجيكت




كود:
using System;
using System.Linq;
using KhaledMohamed.Network.GamePackets;
using System.Collections.Generic;
using KhaledMohamed.Game;
using KhaledMohamed.Network;

namespace 
KhaledMohamed.Database
{
    public class 
ConquerItemTable
    
{
        
#region Blob
        #region Main

        
public Network.GamePackets.ConquerItem ReadItem(System.IO.BinaryReader reader)
        {
            
Network.GamePackets.ConquerItem item = new ConquerItem(true);
            
item.ID reader.ReadUInt32();//4
            
item.UID reader.ReadUInt32();//8
            
item.Durability reader.ReadUInt16();//10
            
item.MaximDurability reader.ReadUInt16();//12
            
item.Position reader.ReadUInt16();//14
            
item.SocketProgress reader.ReadUInt32();//18
            
item.PlusProgress reader.ReadUInt32();//22
            
item.SocketOne = (Game.Enums.Gem)reader.ReadUInt16();//24
            
item.SocketTwo = (Game.Enums.Gem)reader.ReadUInt16();//26
            
item.Effect = (Game.Enums.ItemEffect)reader.ReadUInt16();//28
            
item.Mode Game.Enums.ItemMode.Default;
            
item.Plus reader.ReadByte();//29
            
item.Bless reader.ReadByte();//30
            
item.Bound reader.ReadBoolean();//31
            
item.Enchant reader.ReadByte();//32
            
item.Lock reader.ReadByte();//33

            
item.UnlockEnd DateTime.FromBinary(reader.ReadInt64());//41
            
item.Suspicious reader.ReadBoolean();//42
            
item.SuspiciousStart DateTime.FromBinary(reader.ReadInt64());//50

            
item.Color = (Game.Enums.Color)reader.ReadUInt32();//54
            
if ((byte)item.Color || (byte)item.Color 2)
                
item.Color = (Game.Enums.Color)Kernel.Random.Next(28);
            
item.Warehouse reader.ReadUInt16();//56
            
item.StackSize reader.ReadUInt16();//58


            
if (item.Lock == 2)
                if (
DateTime.Now >= item.UnlockEnd)
                    
item.Lock 0;

            return 
item;
        }

        
#endregion

        #region other

        
public void WriteItem(System.IO.BinaryWriter writerNetwork.GamePackets.ConquerItem item)
        {
            
writer.Write(item.ID); //= reader.ReadUInt32();
            
writer.Write(item.UID);
            
writer.Write(item.Durability);
            
writer.Write(item.MaximDurability);
            
writer.Write(item.Position);
            
writer.Write(item.SocketProgress);
            
writer.Write(item.PlusProgress);
            
writer.Write((ushort)item.SocketOne);
            
writer.Write((ushort)item.SocketTwo);
            
writer.Write((ushort)item.Effect);
            
writer.Write(item.Plus);
            
writer.Write(item.Bless);
            
writer.Write(item.Bound);
            
writer.Write(item.Enchant);
            
writer.Write(item.Lock);
            
writer.Write(item.UnlockEnd.Ticks);
            
writer.Write(item.Suspicious);
            
writer.Write(item.SuspiciousStart.Ticks);
            
writer.Write((uint)item.Color);
            
writer.Write(item.Warehouse);
            
writer.Write(item.StackSize);
            
// writer.Write((uint)(item.NextGreen | (item.NextBlue << 8) | (item.NextRed << 16)));
        
}
        
#endregion

        #endregion
        
public static ConquerItem LoadItem(uint OwnerUIduint Position)
        {
            
ConquerItem item null;
            
using (var cn = new MySql.Data.MySqlClient.MySqlConnection(DataHolder.MySqlConnection.ConnectionString))
            
using (var cm = new MySql.Data.MySqlClient.MySqlCommand("SELECT * FROM items WHERE EntityID = @u AND Position =@p"cn))
            {
                
cn.Open();
                
cm.Parameters.AddWithValue("@u"OwnerUId);
                
cm.Parameters.AddWithValue("@p"Position);
                
using (MySql.Data.MySqlClient.MySqlDataReader rdr cm.ExecuteReader())
                    if (
rdr.Read())
                        
item deserialzeItem(rdr);
            }
            return 
item;
        }
        public static 
ConquerItem deserialzeItem(MySql.Data.MySqlClient.MySqlDataReader reader)
        {
            
ConquerItem item = new Network.GamePackets.ConquerItem(true);
            
item.ID reader.GetUInt32("Id");
            
item.UID reader.GetUInt32("Uid");
            
item.Stars = (byte)reader.GetUInt32("Stars");
            
item.Owner reader.GetString("Owner");
            
item.OwnerUID reader.GetUInt32("OwnerUID");
            
item.Signature reader.GetString("Signature");
            
item.Durability reader.GetUInt16("Durability");
            if (
item.ID == 750000)
            {
                
item.MaximDurability reader.GetUInt16("MaximDurability");
            }
            else
            {
                
item.MaximDurability reader.GetUInt16("MaximDurability");
                
item.Durability item.MaximDurability;
            }
            
item.Position reader.GetUInt16("Position");
            
item.SocketProgress reader.GetUInt32("SocketProgress");
            
item.PlusProgress reader.GetUInt32("PlusProgress");
            
item.SocketOne = (Game.Enums.Gem)reader.GetUInt16("SocketOne");
            
item.SocketTwo = (Game.Enums.Gem)reader.GetUInt16("SocketTwo");
            
item.Effect = (Game.Enums.ItemEffect)reader.GetUInt16("Effect");
            
item.Mode Game.Enums.ItemMode.Default;
            
item.Plus = (byte)(reader.GetUInt16("Plus"));
            
item.Bless = (byte)(reader.GetUInt16("Bless"));
            
item.Bound reader.GetBoolean("Bound");
            
item.Enchant = (byte)(reader.GetUInt16("Enchant"));
            
item.Lock = (byte)(reader.GetUInt16("Locked"));
            
item.UnlockEnd DateTime.FromBinary(reader.GetInt64("UnlockEnd"));
            
item.Suspicious reader.GetBoolean("Suspicious");
            
item.SuspiciousStart DateTime.FromBinary(reader.GetInt64("SuspiciousStart"));
            
item.Color = (Game.Enums.Color)reader.GetUInt32("Color");
            
item.Warehouse reader.GetUInt16("Warehouse");
            
item.StackSize reader.GetUInt16("StackSize");

            
item.SuspiciousStart DateTime.FromBinary(reader.GetInt64("SuspiciousStart"));
            if (
item.StackSize 10)
                
item.StackSize 0;
            
item.RefineItem reader.GetUInt32("RefineryItem");

            if (
item.ID == 300000)
            {
                
uint NextSteedColor reader.GetUInt32("NextSteedColor");
                
item.NextGreen = (byte)(NextSteedColor 0xFF);
                
item.NextBlue = (byte)((NextSteedColor >> 8) & 0xFF);
                
item.NextRed = (byte)((NextSteedColor >> 16) & 0xFF);
            }

            
Int64 rTime reader.GetInt64("RefineryTime");
            if (
item.RefineItem && rTime != 0)
            {
                
item.RefineryTime DateTime.FromBinary(rTime);
                if (
DateTime.Now item.RefineryTime)
                {
                    
item.RefineryTime = new DateTime(0);
                    
item.RefineItem 0;
                }
            }
            if (
item.Lock == 2)
                if (
DateTime.Now >= item.UnlockEnd)
                    
item.Lock 0;
            return 
item;
        }
        public static 
void UpdateItemID(ConquerItem Item)
        {
            
UpdateData(Item"ID"Item.ID);
        }
        public static 
void LoadItems(Client.GameState client)
        {
            
client.Entity.StorageItems = new Dictionary<uintConquerItem>();
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("EntityID"client.Entity.UID))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    var 
item deserialzeItem(reader);
                    if (!
ConquerItemInformation.BaseInformations.ContainsKey(item.ID))
                        continue;
                    
HandleInscribing(itemclient);
                    
ItemAddingTable.GetAddingsForItem(item);
                    if ((
byte)Network.PacketHandler.GetPositionFromID(item.ID) == ConquerItem.Garment || (byte)Network.PacketHandler.GetPositionFromID(item.UID) == ConquerItem.SteedArmor || (byte)Network.PacketHandler.GetPositionFromID(item.UID) == ConquerItem.Bottle)
                    {
                        if (
item.SocketOne != Game.Enums.Gem.NoSocket || item.SocketTwo != Game.Enums.Gem.NoSocket)
                        {
                            
item.SocketOne Game.Enums.Gem.NoSocket;
                            
item.SocketTwo Game.Enums.Gem.NoSocket;
                            
UpdateSockets(item);
                        }
                    }
                    
                    
#region*WareHouse

                    
if (item.Warehouse == 0)//Mr.khled
                    
{
                        switch (
item.Position)
                        {
                            case 
0:
                                {
                                    if (
item.InWardrobe)
                                        
client.Entity.StorageItems.Add(item.UIDitem);
                                    else
                                    {
                                        
client.Inventory.Add(itemGame.Enums.ItemUse.None);
                                        break;
                                    }
                                    break;
                                }
                            default:
                                if (
item.Position 40) continue;
                                if (
client.Equipment.Free((byte)item.Position))
                                    
client.Equipment.Add(itemGame.Enums.ItemUse.None);
                                else
                                {
                                    if (
client.Inventory.Count 40)
                                    {
                                        if (
item.InWardrobe)
                                        {

                                        }
                                        
item.Position 0;
                                        
client.Inventory.Add(itemGame.Enums.ItemUse.None);
                                        if (
client.Warehouses[KhaledMohamed.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity].Count 20)
                                            
client.Warehouses[KhaledMohamed.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity].Add(item);
                                        
UpdatePosition(item);
                                    }
                                }
                                break;
                        }
                    }
                    else
                    {
                        if (
item != null)
                        {
                            
KhaledMohamed.Game.ConquerStructures.Warehouse.WarehouseID whID = (Game.ConquerStructures.Warehouse.WarehouseID)item.Warehouse;
                            if (
client.Warehouses.ContainsKey(whID))
                            {
                                
client.Warehouses[whID].Add(item);
                            }
                            else
                            {
                                
using (var cmdx = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("Uid", (uint)item.Warehouse))
                                
using (var readerx = new MySqlReader(cmdx))
                                    if (
readerx.Read())
                                    {
                                        
client.Warehouses.Add((KhaledMohamed.Game.ConquerStructures.Warehouse.WarehouseID)(uint)item.Warehouse, new KhaledMohamed.Game.ConquerStructures.Warehouse(client, (KhaledMohamed.Game.ConquerStructures.Warehouse.WarehouseID)(uint)item.Warehouse));
                                        
client.Warehouses[(KhaledMohamed.Game.ConquerStructures.Warehouse.WarehouseID)(uint)whID].Add(item);
                                    }
                            }
                        }
                    }
                    
#endregion*WareHouse*
                    
                    
if (item.Minutes != 0)
                    {
                        
uint num;
                        if (
DateTime.Now >= item.TimeStamp.AddMinutes(item.Minutes))
                        {
                            
DeleteItem(item.UID);
                        }
                        else
                        {
                            
TimeSpan span = new TimeSpan(item.TimeStamp.AddMinutes(item.Minutes).Ticks);
                            
TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks);
                            
num = (uint)(span.TotalSeconds span2.TotalSeconds);
                            
item.TimeLeftInMinutes num;
                        }
                    }
                    
item.TimeStamp DateTime.FromBinary(reader.ReadInt64("TimeStamp"));
                    
item.Minutes reader.ReadUInt64("MinutesLeft");
                    if (
item.ID == 720828)
                    {
                        
string str reader.ReadString("agate");
                        
uint key 0;
                        
string[] strArray str.Split(new char[] { '#' });
                        foreach (
string str2 in strArray)
                        {
                            if (
str2.Length 6)
                            {
                                
item.Agate_map.Add(keystr2);
                                
key++;
                            }
                        }
                    }
                }
            }
        }

        public static 
ConquerItem deserialzeItem(MySqlReader reader)
        {
            
ConquerItem item = new Network.GamePackets.ConquerItem(true);
            
item.ID reader.ReadUInt32("Id");
            
item.UID reader.ReadUInt32("Uid");
            
item.Durability reader.ReadUInt16("Durability");
            
item.MaximDurability reader.ReadUInt16("MaximDurability");
            
//  item.Durability = item.MaximDurability;
            
item.Position reader.ReadUInt16("Position");
            
item.Agate reader.ReadString("Agate");
            
item.SocketProgress reader.ReadUInt32("SocketProgress");
            
item.PlusProgress reader.ReadUInt32("PlusProgress");
            
item.SocketOne = (Game.Enums.Gem)reader.ReadUInt16("SocketOne");
            
item.SocketTwo = (Game.Enums.Gem)reader.ReadUInt16("SocketTwo");
            
item.Effect = (Game.Enums.ItemEffect)reader.ReadUInt16("Effect");
            
item.Mode Game.Enums.ItemMode.Default;
            
item.Plus reader.ReadByte("Plus");
            
item.Bless reader.ReadByte("Bless");
            
item.Bound reader.ReadBoolean("Bound");
            
item.Enchant reader.ReadByte("Enchant");
            
item.Signature reader.ReadString("Signature");
            
item.Stars reader.ReadByte("Stars");
            
item.PerfectionProgress reader.ReadUInt32("PerfectionProgress");
            
item.Owner reader.ReadString("Owner");
            
item.OwnerUID reader.ReadUInt32("OwnerUID");
            
item.Lock reader.ReadByte("Locked");
            
item.UnlockEnd DateTime.FromBinary(reader.ReadInt64("UnlockEnd"));
            
item.Suspicious reader.ReadBoolean("Suspicious");
            
item.SuspiciousStart DateTime.FromBinary(reader.ReadInt64("SuspiciousStart"));
            
item.Color = (Game.Enums.Color)reader.ReadUInt32("Color");
            
item.Warehouse reader.ReadUInt32("Warehouse");
            
item.StackSize reader.ReadUInt16("StackSize");
            
item.RefineItem reader.ReadUInt32("RefineryItem");
            
Int64 rTime reader.ReadInt64("RefineryTime");
            
item.InWardrobe reader.ReadBoolean("InWardrobe");

            if (
item.ID == 300000)
            {
                
uint NextSteedColor reader.ReadUInt32("NextSteedColor");
                
item.NextGreen = (byte)(NextSteedColor 0xFF);
                
item.NextBlue = (byte)((NextSteedColor >> 8) & 0xFF);
                
item.NextRed = (byte)((NextSteedColor >> 16) & 0xFF);
            }
            if (
item.RefineItem && rTime != 0)
            {
                
item.RefineryTime DateTime.FromBinary(rTime);
                if (
DateTime.Now item.RefineryTime)
                {
                    
item.RefineryTime = new DateTime(0);
                    
item.RefineItem 0;
                }
            }
            if (
item.Lock == 2)
                if (
DateTime.Now >= item.UnlockEnd)
                    
item.Lock 0;

            
item.DayStamp DateTime.FromBinary(reader.ReadInt64("DayStamp"));
            
item.Days reader.ReadByte("Days");
            return 
item;
        }

        public static 
void UpdateDurabilityItem2(ConquerItem Itemuint ItemID)
        {
            if (
Item != null)
            {
                
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                    
cmd.Update("items").Set("Durability", (long)Item.Durability).Where("UID", (long)Item.UID).And("ID", (long)ItemID).Execute();
            }
        }

        public static 
void SetDurabilityItem0(ConquerItem Item)
        {
            
using (MySql.Data.MySqlClient.MySqlConnection connection DataHolder.MySqlConnection)
            {
                
connection.Open();
                
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                    
cmd.Update("items").Set("Durability", (long)0L).Where("UID", (long)Item.UID).Execute(connection);
                
connection.Close();
            }
        }

        public static 
void HandleInscribing(ConquerItem itemClient.GameState clientbool detained false)
        {
            if (
client.Entity.GuildID != 0)
            {
                if (
client.Guild != null)
                {
                    
int itemPosition Network.PacketHandler.ArsenalPosition(item.ID);
                    if (
itemPosition != -1)
                    {
                        var 
arsenal client.Guild.Arsenals[itemPosition];
                        if (
arsenal.Unlocked)
                        {
                            if (
arsenal.ItemDictionary.ContainsKey(item.UID))
                            {
                                var 
arsenalItem arsenal.ItemDictionary[item.UID];
                                
arsenalItem.Update(itemclient);
                                
item.Inscribed true;
                                
client.ArsenalDonations[itemPosition] += arsenalItem.DonationWorth;
                            }
                        }
                    }
                }
            }
        }
        public static 
ConquerItem LoadItem(uint UID)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("items").Where("UID"UID))
            
using (var reader = new MySqlReader(cmd))
                if (
reader.Read())
                    return 
deserialzeItem(reader);
            return new 
ConquerItem(true);
        }
        public static 
void AddItem(ref ConquerItem ItemClient.GameState client)
        {
            try
            {
                
using (var cmd = new MySqlCommand(MySqlCommandType.INSERT).Insert("items"))
                    
cmd.Insert("ID"Item.ID).Insert("UID"Item.UID)
                   .
Insert("Plus"Item.Plus).Insert("Bless"Item.Bless)
                   .
Insert("Enchant"Item.Enchant).Insert("SocketOne", (byte)Item.SocketOne)
                   .
Insert("SocketTwo", (byte)Item.SocketTwo).Insert("Durability"Item.Durability)
                   .
Insert("MaximDurability"Item.MaximDurability).Insert("SocketProgress"Item.SocketProgress)
                   .
Insert("PlusProgress"Item.PlusProgress).Insert("Effect", (ushort)Item.Effect)
                   .
Insert("TimeStamp"Item.TimeStamp.Ticks).Insert("MinutesLeft"Item.Minutes)
                   .
Insert("Bound"Item.Bound).Insert("DayStamp"Item.DayStamp.Ticks).Insert("Days"Item.Days).Insert("Locked"Item.Lock).Insert("UnlockEnd"Item.UnlockEnd.Ticks)
                   .
Insert("Suspicious"Item.Suspicious).Insert("SuspiciousStart"Item.SuspiciousStart.Ticks)
                   .
Insert("Color", (ushort)Item.Color).Insert("Position"Item.Position).Insert("StackSize"Item.StackSize)
                   .
Insert("RefineryItem"Item.RefineItem).Insert("RefineryTime"Item.RefineryTime.Ticks).Insert("EntityID"client.Entity.UID)
                   .
Insert("Warehouse"Item.Warehouse).Execute();
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e);
                
DeleteItem(Item.UID);
                
AddItem(ref Itemclient);
            }
        }
        private static 
void UpdateData(ConquerItem Itemstring columnobject value)
        {
            
UpdateData(Item.UIDcolumnvalue);
        }
        private static 
void UpdateData(uint UIDstring columnobject value)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                
cmd.Update("items").Set(columnvalue.ToString())
                    .
Where("UID"UID).Execute();
        }
        public static 
void UpdateBless(ConquerItem Item)
        {
            
UpdateData(Item"Bless"Item.Bless);
        }
        public static 
void UpdateRefineryItem(ConquerItem Item)
        {
            
UpdateData(Item"RefineryItem"Item.RefineItem);
        }
        public static 
void UpdateRefineryTime(ConquerItem Item)
        {
            
UpdateData(Item"RefineryTime"Item.RefineryTime.Ticks);
        }
        public static 
void UpdateMinutes(ConquerItem Item)
        {
            
UpdateData(Item"MinutesLeft"Item.Minutes);
        }
        public static 
void UpdateTimeStamp(ConquerItem Item)
        {
            
UpdateData(Item"TimeStamp"Item.TimeStamp);
        }
        public static 
void UpdateItemAgate(ConquerItem Item)
        {
            
string agate "";
            if (
Item.ID == 720828)
            {
                foreach (
string coord in Item.Agate_map.Values)
                {
                    
agate += coord "#";
                    
UpdateData(Item"agate"agate);
                }
            }
        }
        public static 
void UpdateWardrobe(bool inWardrobeuint UID)
        {
            
using (MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE))
            {
                
command.Update("items")
                    .
Set("InWardrobe"inWardrobe)
                    .
Where("UID"UID).Execute();
            }
        }
        public static 
void UpdateColor(ConquerItem Item)
        {
            
UpdateData(Item"Color", (uint)Item.Color);
        }
        public static 
void UpdateStack(ConquerItem Item)
        {
            
UpdateData(Item"StackSize"Item.StackSize);
        }
        public static 
void UpdateEnchant(ConquerItem Item)
        {
            
UpdateData(Item"Enchant"Item.Enchant);
        }
        public static 
void UpdateLock(ConquerItem Item)
        {
            
UpdateData(Item"Locked"Item.Lock);
            
UpdateData(Item"UnlockEnd"Item.UnlockEnd.ToBinary());
        }
        public static 
void UpdateSockets(ConquerItem Item)
        {
            
UpdateData(Item"SocketOne", (byte)Item.SocketOne);
            
UpdateData(Item"SocketTwo", (byte)Item.SocketTwo);
        }
        public static 
void UpdateSocketProgress(ConquerItem Item)
        {
            
UpdateData(Item"SocketProgress"Item.SocketProgress);
        }
        public static 
void UpdateNextSteedColor(ConquerItem Item)
        {
            
UpdateData(Item"NextSteedColor"Item.NextGreen | (Item.NextBlue << 8) | (Item.NextRed << 16));
        }
        public static 
void UpdateDurabilityItem(ConquerItem Item)
        {
        }
        public static 
void UpdateLocation(ConquerItem ItemClient.GameState client)
        {
            if (
IsThere(Item.UID))
            {
                
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                    
cmd.Update("items").Set("EntityID"client.Entity.UID)
                        .
Set("Position"Item.Position).Set("Warehouse", (uint)Item.Warehouse)
                        .
Where("UID"Item.UID).Execute();
            }
            else
            {
                
using (var cmd = new MySqlCommand(MySqlCommandType.INSERT).Insert("items"))
                    
cmd.Insert("ID"Item.ID).Insert("UID"Item.UID)
                        .
Insert("Plus"Item.Plus).Insert("Bless"Item.Bless)
                        .
Insert("Enchant"Item.Enchant).Insert("SocketOne", (byte)Item.SocketOne)
                        .
Insert("SocketTwo", (byte)Item.SocketTwo).Insert("Durability"Item.Durability)
                        .
Insert("MaximDurability"Item.MaximDurability).Insert("SocketProgress"Item.SocketProgress)
                        .
Insert("PlusProgress"Item.PlusProgress).Insert("Effect", (ushort)Item.Effect)
                        .
Insert("Bound"Item.Bound).Insert("DayStamp"Item.DayStamp.ToString()).Insert("Days"Item.Days).Insert("Locked"Item.Lock).Insert("UnlockEnd"Item.UnlockEnd.Ticks)
                        .
Insert("Suspicious"Item.Suspicious).Insert("SuspiciousStart"Item.SuspiciousStart.Ticks)
                        .
Insert("Color", (ushort)Item.Color).Insert("Position"Item.Position).Insert("StackSize"Item.StackSize)
                        .
Insert("RefineryItem"Item.RefineItem).Insert("RefineryTime"Item.RefineryTime.Ticks).Insert("EntityID"client.Entity.UID)
                        .
Execute();
            }
        }
        public static 
void UpdatePosition(ConquerItem Item)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                
cmd.Update("items").Set("Position"Item.Position).Set("Warehouse"Item.Warehouse)
                .
Where("UID"Item.UID).Execute();

        }
        public static 
void UpdatePlus(ConquerItem Item)
        {
            
UpdateData(Item"Plus"Item.Plus);
        }

        public static 
void UpdateBound(ConquerItem Item)
        {
            
UpdateData(Item"Bound"0);
        }
        public static 
void UpdatePlusProgress(ConquerItem Item)
        {
            
UpdateData(Item"PlusProgress"Item.PlusProgress);
        }
        public static 
void UpdatePerfection(ConquerItem Item)
        {
            
UpdateData(Item"PerfectionProgress"Item.PerfectionProgress);
            
UpdateData(Item"Stars"Item.Stars);
            
UpdateData(Item"Owner"Item.Owner);
            
UpdateData(Item"OwnerUID"Item.OwnerUID);
            
UpdateData(Item"Signature"Item.Signature);
        }
        public static 
void UpdateItemID(ConquerItem ItemClient.GameState client)
        {
            
UpdateData(Item"ID"Item.ID);
        }
        public static 
void RemoveItem(uint UID)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                
cmd.Update("items").Set("EntityID"0)
                    .
Set("Position"0).Where("UID"UID).Execute();
        }
        public static 
void DeleteItem(uint UID)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.DELETE))
                
cmd.Delete("items""UID"UID).Execute();
        }
        public static 
void ClearPosition(uint EntityIDbyte position)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                
cmd.Update("items").Set("EntityID"0).Set("Position"0)
                    .
Where("EntityID"EntityID).And("Position"position).Execute();
        }
        public static 
void RefineryUpdate(ConquerItem ItemClient.GameState client)
        {
        }

        public static 
void ClearNulledItems()
        {
            
Dictionary<uintintdict = new Dictionary<uintint>();
            
using (var = new MySqlCommand(MySqlCommandType.SELECT).Select("detaineditems"))
            
using (var c.CreateReader())
                while (
r.Read())
                    
dict[r.ReadUInt32("ItemUID")] = 0;
            
using (var = new MySqlCommand(MySqlCommandType.SELECT).Select("claimitems"))
            
using (var c.CreateReader())
                while (
r.Read())
                    
dict[r.ReadUInt32("ItemUID")] = 0;

            var array = 
dict.Keys.ToArray();
            foreach (var 
item in array)
                
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("items")
                    .
Set("entityid"1).Where("entityid"0).And("uid"item))
                    
cmd.Execute();

            
using (var cmd = new MySqlCommand(MySqlCommandType.DELETE).Delete("items""entityid"0))
                
cmd.Execute();
        }  

        public static 
bool IsThere(uint uid)
        {
            
MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
            
command.Select("items").Where("UID", (long)uid);
            
MySqlReader reader = new MySqlReader(command);
            if (
reader.Read())
            {
                
//  Reader.Close();
                ////  Reader.Dispose();
                
return true;
            }
            
//  Reader.Close();
            ////  Reader.Dispose();
            
return false;
        }

        public static 
void Update_Free(ConquerItem ItemClient.GameState client)
        {
            
MySqlCommand command = new MySqlCommand(MySqlCommandType.UPDATE);
            
command.Update("items").Set("EntityID"client.Entity.UID).Set("DayStamp"Item.DayStamp.Ticks).Set("Days"Item.Days).Where("UID"Item.UID).Execute();
        }
    }




العلامات المرجعية



الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 

الانتقال السريع

المواضيع المتشابهه للموضوع: مشكلة عندي في السيرفر الصطف بتتحول لي صول
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
حل مشكلة اختفاء الاصطف او الايرور الي بيجي بسبب الصطف سورس رايزو و متركس محمودمحمدسالم تطوير سيرفرات كونكر 6 2021-08-01 04:34 AM
مشكلا الاتيم بتتحول لي سول مؤمن مشكلات السيرفيرات كونكر الشخصيه 4 2021-07-28 11:55 PM
نفسى اعمل النظام ده عندى ف السيرفر abdocoder مشكلات السيرفيرات كونكر الشخصيه 5 2020-05-09 05:19 AM
عايز امسح ايتم من السيرفر كلو وهو السيرفر بيرستر .. لسورس اليكس MaNGaWy مشكلات السيرفيرات كونكر الشخصيه 8 2020-05-08 10:30 PM
يارجاله دلؤتي restart مش شغال في السيرفر عندي ولما بقفل القنصل الانر بور بيتمسح ahmedfathy مشكلات السيرفيرات كونكر الشخصيه 1 2019-10-25 01:43 PM


الساعة الآن 01:43 AM

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.