|
المشاركات 1,940 |
+التقييم 0.95 |
تاريخ التسجيل Apr 2019 |
الاقامة Egypt |
نظام التشغيل windows 7 |
رقم العضوية 1 |
using Conquer_Online_Server.Database;
using Conquer_Online_Server.Game;
using Conquer_Online_Server.Interfaces;
using System;
using Conquer_Online_Server.Client;
namespace Conquer_Online_Server.Network.GamePackets
{
public unsafe class AuctionItems
{
public static void SaveAuctionItems()
{
string SQL = "DELETE FROM auctionitems";
using (var conn = DataHolder.MySqlConnection)
{
conn.Open();
using (var cmd = new MySql.Data.MySqlClient.MySqlCommand())
{
cmd.Connection = conn;
cmd.CommandText = SQL;
cmd.ExecuteNonQuery();
}
}
foreach (var Item in Kernel.AuctionItems.Values)
{
using (var cmd = new MySqlCommand(MySqlCommandType.INSERT).Insert("auctionitems"))
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("Locked", Item.Lock)
.Insert("UnlockEnd", Item.UnlockEnd.Ticks)
.Insert("Suspicious", Item.Suspicious)
.Insert("SuspiciousStart", Item.SuspiciousStart.Ticks)
.Insert("NextSteedColor", 0)
.Insert("Color", (ushort)Item.Color)
.Insert("Position", Item.Position)
.Insert("StackSize", Item.StackSize)
.Insert("RefineryItem", Item.RefineItem)
.Insert("RefineryTime", Item.RefineryTime.Ticks)
.Insert("EndTime", Item.AuctionInfo.EndTime.Ticks)
.Insert("BidderName", Item.AuctionInfo.BidderName)
.Insert("BasePrice", Item.AuctionInfo.BasePrice)
.Insert("BidderUID", Item.AuctionInfo.BidderUID)
.Insert("FixedPrice", Item.AuctionInfo.FixedPrice)
.Insert("MoneyType", Item.AuctionInfo.MoneyType)
.Insert("SellerName", Item.AuctionInfo.SellerName)
.Insert("SellerUID", Item.AuctionInfo.SellerUID)
.Insert("Time", Item.AuctionInfo.Time)
.Execute();
}
}
public static void LoadAuctionItems()
{
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("auctionitems"))
using (var reader = new MySqlReader(cmd))
{
while (reader.Read())
{
var item = deserialzeAuctionItem(reader);
ItemAddingTable.GetAddingsForItem(item);
item.Mode = Game.Enums.ItemMode.Auction;
Kernel.AuctionItems.Add(item.UID, item);
}
}
}
public static void AddItem(ref ConquerItem Item, UInt32 UID)
{
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("Bound", Item.Bound)
.Insert("Locked", Item.Lock)
.Insert("UnlockEnd", Item.UnlockEnd.Ticks)
.Insert("Suspicious", Item.Suspicious)
.Insert("SuspiciousStart", Item.SuspiciousStart.Ticks)
.Insert("NextSteedColor", 0)
.Insert("Color", (ushort)Item.Color)
.Insert("Position", Item.Position)
.Insert("StackSize", Item.StackSize)
.Insert("RefineryItem", Item.RefineItem)
.Insert("RefineryTime", Item.RefineryTime.Ticks)
.Insert("EntityID", UID)
.Execute();
}
catch (Exception e)
{
Console.WriteLine(e);
ConquerItemTable.DeleteItem(Item.UID);
AddItem(ref Item, UID);
}
}
private static ConquerItem deserialzeAuctionItem(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.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.Auction;
item.Plus = reader.ReadByte("Plus");
item.Bless = reader.ReadByte("Bless");
item.Bound = reader.ReadBoolean("Bound");
item.Enchant = reader.ReadByte("Enchant");
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.ReadUInt16("Warehouse");
item.StackSize = reader.ReadUInt16("StackSize");
item.RefineItem = reader.ReadUInt32("RefineryItem");
item.AuctionInfo = new Auction(true);
item.AuctionInfo.BasePrice = reader.ReadUInt32("BasePrice");
item.AuctionInfo.BidderName = reader.ReadString("BidderName");
item.AuctionInfo.BidderUID = reader.ReadUInt32("BidderUID");
item.AuctionInfo.EndTime = DateTime.FromBinary(reader.ReadInt64("EndTime"));
item.AuctionInfo.FixedPrice = reader.ReadUInt32("FixedPrice");
item.AuctionInfo.ItemUID = item.UID;
item.AuctionInfo.MoneyType = reader.ReadByte("MoneyType");
item.AuctionInfo.SellerName = reader.ReadString("SellerName");
item.AuctionInfo.SellerUID = reader.ReadUInt32("SellerUID");
item.AuctionInfo.Time = reader.ReadByte("Time");
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);
}
Int64 rTime = reader.ReadInt64("RefineryTime");
if (item.RefineItem > 0 && 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 unsafe class AuctionFunctions
{
private IDisposable Subscriber;
public AuctionFunctions()
{
Subscriber = World.Subscribe(work, 60000);
}
public void work(Int32 time)
{
foreach (var item in Kernel.AuctionItems.Values)
{
if (DateTime.Now > item.AuctionInfo.EndTime)
{
#region AuctionDone
if (item.AuctionInfo.BidderUID != 0)
{
Client.GameState Bidder;
Kernel.GamePool.TryGetValue(item.AuctionInfo.BidderUID, out Bidder);
if (Bidder != null)
{
Kernel.AuctionItems.Remove(item.UID);
item.UID = ConquerItem.ItemUID.Next;
item.Mode = Enums.ItemMode.Default;
Bidder.Inventory.Add(item, Game.Enums.ItemUse.CreateAndAdd);
if (item.Purification.PurificationItemID > 0)
{
item.Purification.ItemUID = item.UID;
Database.ItemAddingTable.AddPurification(item.Purification);
}
if (item.ExtraEffect.EffectID > 0)
{
item.ExtraEffect.ItemUID = item.UID;
Database.ItemAddingTable.AddExtraEffect(item.ExtraEffect);
}
item.SendExtras(Bidder);
Bidder.Send(item);
}
else
{
Kernel.AuctionItems.Remove(item.UID);
ConquerItem Item2 = item;
Item2.UID = ConquerItem.ItemUID.Next;
Item2.Mode = Enums.ItemMode.Default;
AuctionItems.AddItem(ref Item2, Item2.AuctionInfo.BidderUID);
if (Item2.Purification.PurificationItemID > 0)
{
Item2.Purification.ItemUID = Item2.UID;
Database.ItemAddingTable.AddPurification(Item2.Purification);
}
if (Item2.ExtraEffect.EffectID > 0)
{
Item2.ExtraEffect.ItemUID = Item2.UID;
Database.ItemAddingTable.AddExtraEffect(item.ExtraEffect);
}
}
Client.GameState Seller;
Kernel.GamePool.TryGetValue(item.AuctionInfo.SellerUID, out Seller);
if (Seller != null)
{
if (item.AuctionInfo.MoneyType == 2)
{
Seller.Entity.ConquerPoints += item.AuctionInfo.BasePrice;
}
else
{
Seller.Entity.Money += item.AuctionInfo.BasePrice;
}
}
else if (item.AuctionInfo.MoneyType == 2)
{
Database.EntityTable.UpdateCps(item.AuctionInfo.SellerUID, item.AuctionInfo.BasePrice);
}
else
{
Database.EntityTable.UpdateMoney(item.AuctionInfo.SellerUID, item.AuctionInfo.BasePrice);
}
item.AuctionInfo = null;
}
else
{
Client.GameState Seller;
Kernel.GamePool.TryGetValue(item.AuctionInfo.SellerUID, out Seller);
if (Seller != null)
{
Kernel.AuctionItems.Remove(item.UID);
item.UID = ConquerItem.ItemUID.Next;
item.Mode = Enums.ItemMode.Default;
Seller.Inventory.Add(item, Game.Enums.ItemUse.CreateAndAdd);
if (item.Purification.PurificationItemID > 0)
{
item.Purification.ItemUID = item.UID;
Database.ItemAddingTable.AddPurification(item.Purification);
}
if (item.ExtraEffect.EffectID > 0)
{
item.ExtraEffect.ItemUID = item.UID;
Database.ItemAddingTable.AddExtraEffect(item.ExtraEffect);
}
item.SendExtras(Seller);
Seller.Send(item);
}
else
{
Kernel.AuctionItems.Remove(item.UID);
ConquerItem Item2 = item;
Item2.UID = ConquerItem.ItemUID.Next;
Item2.Mode = Enums.ItemMode.Default;
AuctionItems.AddItem(ref Item2, Item2.AuctionInfo.SellerUID);
if (Item2.Purification.PurificationItemID > 0)
{
Item2.Purification.ItemUID = Item2.UID;
Database.ItemAddingTable.AddPurification(Item2.Purification);
}
if (Item2.ExtraEffect.EffectID > 0)
{
Item2.ExtraEffect.ItemUID = Item2.UID;
Database.ItemAddingTable.AddExtraEffect(Item2.ExtraEffect);
}
}
item.AuctionInfo = null;
}
#endregion
}
if (item.AuctionInfo != null)
{
if (DateTime.Now < item.AuctionInfo.EndTime)
{
#region UpdateTime
if (item.AuctionInfo.Time == 0)
{
if ((item.AuctionInfo.EndTime - DateTime.Now).TotalHours < 12)
{
item.AuctionInfo.Time = 1;
}
}
if (item.AuctionInfo.Time == 1)
{
if ((item.AuctionInfo.EndTime - DateTime.Now).TotalHours < 2)
{
item.AuctionInfo.Time = 2;
}
}
if (item.AuctionInfo.Time == 2)
{
if ((item.AuctionInfo.EndTime - DateTime.Now).TotalMinutes < 30)
{
item.AuctionInfo.Time = 3;
}
}
#endregion
}
}
}
}
}
public unsafe class Auction : Writer, IPacket
{
public enum Mode : byte
{
newisting,
ListingCancel,
ListingBid,
ListingBuyout
}
Byte[] Packet;
public ConquerItem item;
public Auction(Boolean Create)
{
if (Create)
{
Packet = new Byte[38 + 8];
WriteByte(38, 0, Packet);
WriteUInt16(1320, 2, Packet);
WriteInt32(Time32.Now.AllMilliseconds(), 4, Packet);
}
}
public Mode Action
{
get { return (Mode)Packet[8]; }
set { WriteByte((Byte)value, 8, Packet); }
}
public UInt32 ItemUID
{
get { return System.BitConverter.ToUInt32(Packet, 12); }
set { WriteUInt32(value, 12, Packet); }
}
public Byte MoneyType
{
get { return Packet[16]; }
set { WriteByte(value, 16, Packet); }
}
public UInt32 BasePrice
{
get { return System.BitConverter.ToUInt32(Packet, 20); }
set { WriteUInt32(value, 20, Packet); }
}
public UInt32 FixedPrice
{
get { return System.BitConverter.ToUInt32(Packet, 24); }
set { WriteUInt32(value, 24, Packet); }
}
public Byte Time
{
get { return Packet[28]; }
set { WriteByte(value, 28, Packet); }
}
public Int32 Margin
{
get { return Time == 12 ? 500 : Time == 24 ? 1100 : Time >= 48 ? 2250 : 1000000; }
}
public Auction Confirm(Boolean Value)
{
WriteBoolean(Value, 32, Packet);
return this;
}
public DateTime EndTime;
public Int32 Times = 0;
public UInt32 SellerUID = 0;
public UInt32 BidderUID = 0;
public String BidderName = "";
public String SellerName = "";
public Byte[] ToArray()
{
return Packet;
}
public void Send(GameState client)
{
client.Send(Packet);
}
public void Deserialize(Byte[] packet)
{
Packet = packet;
}
public static void ProcessAuction(Byte[] packet, GameState client)
{
Auction auc = new Auction(true);
auc.Deserialize(packet);
switch (auc.Action)
{
#region new isting
case Auction.Mode.newisting:
{
client.Inventory.TryGetItem(auc.ItemUID, out auc.item);
if (auc.item != null)
{
uint Margin = 0;
uint time = 0;
if (auc.Time == 12)
{
Margin = 500;
time = auc.Time;
auc.Time = 1;
}
if (auc.Time == 24)
{
Margin = 1100;
time = auc.Time;
auc.Time = 0;
}
if (auc.Time == 48)
{
Margin = 2250;
time = auc.Time;
auc.Time = 0;
}
if (auc.MoneyType == 1)
{
if (client.Entity.Money < Margin) return;
client.Entity.Money -= Margin;
}
else if (auc.MoneyType == 2)
{
if (client.Entity.ConquerPoints < Margin) return;
client.Entity.ConquerPoints -= Margin;
}
else return;
client.Inventory.Remove(auc.item, Enums.ItemUse.Remove);
auc.item.AuctionInfo = auc;
auc.item.AuctionInfo.EndTime = DateTime.Now.AddHours(time);
auc.item.AuctionInfo.SellerName = client.Entity.Name;
auc.item.AuctionInfo.SellerUID = client.Entity.UID;
auc.item.AuctionInfo.BidderName = "";
auc.item.AuctionInfo.BidderUID = 0;
auc.item.Mode = Enums.ItemMode.Auction;
Kernel.AuctionItems.Add(auc.item.UID, auc.item);
client.Send(auc.item);
client.Send(AuctionQuery(auc.item, 0, client));
}
break;
}
#endregion
#region ListingCancel
case Auction.Mode.ListingCancel:
{
packet[32] = 1;
Kernel.AuctionItems.TryGetValue(auc.ItemUID, out auc.item);
if (auc.item != null)
{
if (auc.item.AuctionInfo.BidderUID != 0)
{
GameState OldBidder;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.BidderUID, out OldBidder);
if (OldBidder != null)
{
if (auc.item.AuctionInfo.MoneyType == 2)
{
Mailbox.AddPrize(OldBidder, "Auction", "Bidding Failed", "Your Bid Failed", 0, auc.item.AuctionInfo.BasePrice, 0, 0, null);
}
else
{
Mailbox.AddPrize(OldBidder, "Auction", "Bidding Failed", "Your Bid Failed", auc.item.AuctionInfo.BasePrice, 0, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 2)
{
Database.EntityTable.UpdateCps(auc.item.AuctionInfo.BidderUID, auc.item.AuctionInfo.BasePrice);
}
else
{
Database.EntityTable.UpdateMoney(auc.item.AuctionInfo.BidderUID, auc.item.AuctionInfo.BasePrice);
}
}
auc.item.UID = ConquerItem.ItemUID.Next;
auc.item.AuctionInfo = null;
client.Inventory.Add(auc.item, Game.Enums.ItemUse.CreateAndAdd);
if (auc.item.Purification.PurificationItemID > 0)
{
auc.item.Purification.ItemUID = auc.item.UID;
Database.ItemAddingTable.AddPurification(auc.item.Purification);
}
if (auc.item.ExtraEffect.EffectID > 0)
{
auc.item.ExtraEffect.ItemUID = auc.item.UID;
Database.ItemAddingTable.AddExtraEffect(auc.item.ExtraEffect);
}
auc.item.SendExtras(client);
Kernel.AuctionItems.Remove(auc.ItemUID);
client.Send(packet);
}
break;
}
#endregion
#region ListingBid
case Auction.Mode.ListingBid:
{
Kernel.AuctionItems.TryGetValue(auc.ItemUID, out auc.item);
if (auc.item != null)
{
if (auc.item.AuctionInfo.MoneyType == 2)
{
if (client.Entity.ConquerPoints >= auc.BasePrice)
{
if (auc.item.AuctionInfo.BidderUID != 0)
{
GameState OldBidder;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.BidderUID, out OldBidder);
if (OldBidder != null)
{
if (auc.item.AuctionInfo.MoneyType == 2)
{
Mailbox.AddPrize(OldBidder, "Auction", "Bidding Failed", "Your Bid Failed", 0, auc.item.AuctionInfo.BasePrice, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 2)
{
Database.EntityTable.UpdateCps(auc.item.AuctionInfo.BidderUID, auc.item.AuctionInfo.BasePrice);
}
}
if (auc.BasePrice < auc.item.AuctionInfo.FixedPrice)
{
auc.item.AuctionInfo.BidderName = client.Entity.Name;
auc.item.AuctionInfo.BidderUID = client.Entity.UID;
auc.item.AuctionInfo.BasePrice = auc.BasePrice;
client.Entity.ConquerPoints -= auc.BasePrice;
client.Send(AuctionBrowse(auc.item, 1, client));
}
else
{
client.Entity.ConquerPoints -= auc.BasePrice;
client.Send(AuctionBrowse(auc.item, 2, client));
if (auc.item.AuctionInfo.SellerUID != 0)
{
GameState Seller;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.SellerUID, out Seller);
if (Seller != null)
{
if (auc.item.AuctionInfo.MoneyType == 2)
{
Mailbox.AddPrize(Seller, "Auction", "Auctioning Successed", "Your Successed to sell the item", 0, auc.BasePrice, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 2)
{
Database.EntityTable.UpdateCps(auc.item.AuctionInfo.SellerUID, auc.BasePrice);
}
}
auc.item.AuctionInfo = null;
Mailbox.AddPrize(client, "Auction", "Bidding Finished", "Your Bid Successed", 0, 0, 0, 0, auc.item);
Kernel.AuctionItems.Remove(auc.ItemUID);
}
}
else client.Entity.SendSysMesage("You don't have cps to bidding");
}
else if (client.Entity.Money >= auc.BasePrice)
{
if (auc.item.AuctionInfo.BidderUID != 0)
{
Client.GameState OldBidder;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.BidderUID, out OldBidder);
if (OldBidder != null)
{
if (auc.item.AuctionInfo.MoneyType == 1)
{
Mailbox.AddPrize(OldBidder, "Auction", "Bidding Failed", "Your Bid Failed", auc.item.AuctionInfo.BasePrice, 0, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 1)
{
Database.EntityTable.UpdateMoney(auc.item.AuctionInfo.BidderUID, auc.item.AuctionInfo.BasePrice);
}
}
if (auc.BasePrice < auc.item.AuctionInfo.FixedPrice)
{
auc.item.AuctionInfo.BidderName = client.Entity.Name;
auc.item.AuctionInfo.BidderUID = client.Entity.UID;
auc.item.AuctionInfo.BasePrice = auc.BasePrice;
client.Entity.Money -= auc.BasePrice;
client.Send(AuctionBrowse(auc.item, 1, client));
}
else
{
client.Entity.Money -= auc.BasePrice;
client.Send(AuctionBrowse(auc.item, 2, client));
if (auc.item.AuctionInfo.SellerUID != 0)
{
Client.GameState Seller;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.SellerUID, out Seller);
if (Seller != null)
{
if (auc.item.AuctionInfo.MoneyType == 1)
{
Mailbox.AddPrize(Seller, "Auction", "Auctioning Successed", "Your Successed to sell the item", auc.BasePrice, 0, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 1)
{
Database.EntityTable.UpdateMoney(auc.item.AuctionInfo.SellerUID, auc.BasePrice);
}
}
auc.item.AuctionInfo = null;
Mailbox.AddPrize(client, "Auction", "Bidding Finished", "Your Bid Successed", 0, 0, 0, 0, auc.item);
Kernel.AuctionItems.Remove(auc.ItemUID);
}
}
else client.Entity.SendSysMesage("You don't have cps to bidding");
}
break;
}
#endregion
#region ListingBuyout
case Auction.Mode.ListingBuyout:
{
Kernel.AuctionItems.TryGetValue(auc.ItemUID, out auc.item);
if (auc.item != null)
{
auc.FixedPrice = auc.item.AuctionInfo.FixedPrice;
if (auc.item.AuctionInfo.MoneyType == 2)
{
if (client.Entity.ConquerPoints >= auc.FixedPrice)
{
if (auc.item.AuctionInfo.BidderUID != 0)
{
GameState OldBidder;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.BidderUID, out OldBidder);
if (OldBidder != null)
{
if (auc.item.AuctionInfo.MoneyType == 2)
{
Mailbox.AddPrize(OldBidder, "Auction", "Bidding Failed", "Your Failed to sell the item", 0, auc.item.AuctionInfo.BasePrice, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 2)
{
Database.EntityTable.UpdateCps(auc.item.AuctionInfo.BidderUID, auc.item.AuctionInfo.BasePrice);
}
}
if (auc.FixedPrice == auc.item.AuctionInfo.FixedPrice)
{
client.Entity.ConquerPoints -= auc.FixedPrice;
client.Send(AuctionBrowse(auc.item, 2, client));
if (auc.item.AuctionInfo.SellerUID != 0)
{
GameState Seller;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.SellerUID, out Seller);
if (Seller != null)
{
if (auc.item.AuctionInfo.MoneyType == 2)
{
Mailbox.AddPrize(Seller, "Auction", "Auctioning Successed", "Your Successed to sell the item", 0, auc.FixedPrice, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 2)
{
Database.EntityTable.UpdateCps(auc.item.AuctionInfo.SellerUID, auc.FixedPrice);
}
}
Mailbox.AddPrize(client, "Auction", "Bidding Finished", "Your Bid Successed", 0, 0, 0, 0, auc.item);
Kernel.AuctionItems.Remove(auc.ItemUID);
}
}
else client.Entity.SendSysMesage("You don't have cps to buy this item");
}
else if (client.Entity.Money >= auc.FixedPrice)
{
if (auc.item.AuctionInfo.BidderUID != 0)
{
Client.GameState OldBidder;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.BidderUID, out OldBidder);
if (OldBidder != null)
{
if (auc.item.AuctionInfo.MoneyType == 1)
{
Mailbox.AddPrize(OldBidder, "Auction", "Bidding Failed", "Your Failed to sell the item", auc.item.AuctionInfo.BasePrice, 0, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 1)
{
Database.EntityTable.UpdateMoney(auc.item.AuctionInfo.BidderUID, auc.item.AuctionInfo.BasePrice);
}
}
if (auc.item.AuctionInfo.FixedPrice == auc.FixedPrice)
{
client.Entity.Money -= auc.FixedPrice;
client.Send(AuctionBrowse(auc.item, 2, client));
if (auc.item.AuctionInfo.SellerUID != 0)
{
Client.GameState Seller;
Kernel.GamePool.TryGetValue(auc.item.AuctionInfo.SellerUID, out Seller);
if (Seller != null)
{
if (auc.item.AuctionInfo.MoneyType == 1)
{
Mailbox.AddPrize(Seller, "Auction", "Auctioning Successed", "Your Successed to sell the item", auc.FixedPrice, 0, 0, 0, null);
}
}
else if (auc.item.AuctionInfo.MoneyType == 1)
{
Database.EntityTable.UpdateMoney(auc.item.AuctionInfo.SellerUID, auc.FixedPrice);
}
}
auc.item.AuctionInfo = null;
Mailbox.AddPrize(client, "Auction", "Bidding Finished", "Your Bid Successed", 0, 0, 0, 0, auc.item);
Kernel.AuctionItems.Remove(auc.ItemUID);
}
else client.Entity.SendSysMesage("You don't have Money to buy this item");
}
}
break;
}
#endregion
default: Console.WriteLine("[Auction] Unknown Action " + auc.Action); break;
}
client.Send(auc.Confirm(true));
}
public static void ProcessQuery(Byte[] packet, GameState client)
{
switch (packet[8])
{
#region MyAuctionItems
case 0:
{
foreach (var item in Kernel.AuctionItems.Values)
{
if (item.AuctionInfo.SellerUID == client.Entity.UID)
{
client.Send(item);
client.Send(AuctionQuery(item, 0, client));
}
}
break;
}
#endregion
#region MyBiddingItems
case 1:
{
foreach (var item in Kernel.AuctionItems.Values)
{
if (item.AuctionInfo.BidderUID == client.Entity.UID)
{
client.Send(item);
Auction auc = new Auction(true);
auc.Action = Mode.ListingBid;
auc.ItemUID = item.UID;
auc.BasePrice = item.AuctionInfo.BasePrice;
client.Send(auc.Confirm(true));
item.SendExtras(client);
}
}
break;
}
#endregion
default: Console.WriteLine("[Query] Unknown Action " + packet[8]); break;
}
}
public static void ProcessBrowse(Byte[] packet, GameState client)
{
client.Send(packet);
foreach (var item in Kernel.AuctionItems.Values)
{
if (packet[12] == item.AuctionInfo.MoneyType)
{
client.Send(item);
client.Send(AuctionBrowse(item, packet[8], client));
}
else if (packet[12] == item.AuctionInfo.MoneyType)
{
client.Send(item);
client.Send(AuctionBrowse(item, packet[8], client));
}
}
}
public static Byte[] AuctionQuery(ConquerItem item, UInt32 type, GameState client)
{
var Buffer = new byte[8 + 20 + 68];
Writer.WriteUInt16((ushort)(Buffer.Length - 8), 0, Buffer);
Writer.WriteUInt16(1322, 2, Buffer);
Writer.WriteInt32(Time32.timeGetTime().GetHashCode(), 4, Buffer);
Writer.WriteUInt32(type, 8, Buffer);
Writer.WriteUInt32(1, 12, Buffer);
int offset = 20;
Writer.WriteUInt32(item.UID, offset, Buffer);
item.SendExtras(client);
offset += 8;
Writer.WriteUInt32(item.AuctionInfo.SellerUID, offset, Buffer);
offset += 4;
Writer.WriteString(item.AuctionInfo.SellerName, offset, Buffer);
offset += 16;
Writer.WriteUInt32(item.AuctionInfo.MoneyType, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.BasePrice, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.FixedPrice, offset, Buffer);
offset += 4;
Writer.WriteUInt32(0, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.Time, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.BidderUID, offset, Buffer);
offset += 4;
Writer.WriteString(item.AuctionInfo.BidderName, offset, Buffer);
offset += 16;
return Buffer;
}
public static Byte[] AuctionBrowse(ConquerItem item, UInt32 type, GameState client)
{
var Buffer = new byte[60 + 68];
Writer.WriteUInt16((ushort)(Buffer.Length - 8), 0, Buffer);
Writer.WriteUInt16(1321, 2, Buffer);
Writer.WriteUInt32((uint)Time32.timeGetTime().GetHashCode(), 4, Buffer);
Writer.WriteUInt32(type, 8, Buffer);
Writer.WriteUInt32(1, 46, Buffer);
Writer.WriteInt32(Kernel.AuctionItems.Count, 48, Buffer);
int offset = 52;
Writer.WriteUInt32(item.UID, offset, Buffer);
item.SendExtras(client);
offset += 8;
Writer.WriteUInt32(item.AuctionInfo.SellerUID, offset, Buffer);
offset += 4;
Writer.WriteString(item.AuctionInfo.SellerName, offset, Buffer);
offset += 16;
Writer.WriteUInt32(item.AuctionInfo.MoneyType, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.BasePrice, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.FixedPrice, offset, Buffer);
offset += 4;
Writer.WriteUInt32(0, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.Time, offset, Buffer);
offset += 4;
Writer.WriteUInt32(item.AuctionInfo.BidderUID, offset, Buffer);
offset += 4;
Writer.WriteString(item.AuctionInfo.BidderName, offset, Buffer);
offset += 16;
return Buffer;
}
}
}
Enums.cs
public enum ItemMode : byte
Auction = 12
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Conquer_Online_Server.Database
{
public class ConquerItemInformation
{
public static SafeDictionary<uint, SafeDictionary<byte, ConquerItemPlusInformation>> PlusInformations;
public static SafeDictionary<uint, ConquerItemBaseInformation> BaseInformations;
/// <summary>
/// string - item description
/// int - grade key (ConquerItemBaseInformation.GradeKey)
/// </summary>
public static SafeDictionary<string, SafeDictionary<int, ConquerItemBaseInformation>> GradeInformations;
public static SafeDictionary<string, SafeDictionary<uint, int>> GradeInformations2;
public static void Load()
{
BaseInformations = new SafeDictionary<uint, ConquerItemBaseInformation>(10000);
PlusInformations = new SafeDictionary<uint, SafeDictionary<byte, ConquerItemPlusInformation>>(10000);
GradeInformations = new SafeDictionary<string, SafeDictionary<int, ConquerItemBaseInformation>>(10000);
GradeInformations2 = new SafeDictionary<string, SafeDictionary<uint, int>>(10000);
string[] baseText = File.ReadAllLines(Constants.ItemBaseInfosPath);
//string text = "►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄";
//int for1prg = baseText.Length / (System.Console.WindowWidth - text.Length);
int count = 0;
//System.Console.Write(text);
//var old1 = System.Console.BackgroundColor;
//var old2 = System.Console.ForegroundColor;
//System.Console.BackgroundColor = ConsoleColor.Gray;
//System.Console.ForegroundColor = ConsoleColor.Gray;
int gkey = 0;
int lastlevel = 0;
string lastgr = "";
foreach (string line in baseText)
{
count++;
string _item_ = line.Trim();
if (_item_.Length > 11)
{
if (_item_.IndexOf("//", 0, 2) != 0)
{
ConquerItemBaseInformation CIBI = new ConquerItemBaseInformation();
CIBI.Parse(_item_);
var Grades = GradeInformations[CIBI.Description];
BaseInformations.Add(CIBI.ID, CIBI);
if (GradeInformations.ContainsKey(CIBI.Description) == false)
{
GradeInformations2.Add(CIBI.Description, new SafeDictionary<uint, int>(1000));
GradeInformations2[CIBI.Description].Add((uint)(CIBI.ID / 10), 0);
lastlevel = CIBI.Level;
GradeInformations.Add(CIBI.Description, new SafeDictionary<int, ConquerItemBaseInformation>(1000));
gkey = 0;
}
else
{
if (lastgr != CIBI.Description)
gkey = GradeInformations2[CIBI.Description].Count - 1;
if (GradeInformations2[CIBI.Description].ContainsKey(CIBI.ID / 10) && CIBI.Level == lastlevel)
{
CIBI.GradeKey = gkey;
continue;
}
else
{
GradeInformations2[CIBI.Description].Add((uint)(CIBI.ID / 10), 0);
lastlevel = CIBI.Level;
gkey = gkey + 1;
}
}
lastgr = CIBI.Description;
CIBI.GradeKey = gkey;
GradeInformations[CIBI.Description].Add(gkey, CIBI);
}
}
}
GradeInformations2.Clear();
baseText = File.ReadAllLines(Constants.ItemPlusInfosPath);
foreach (string line in baseText)
{
try
{
string _item_ = line.Trim();
ConquerItemPlusInformation CIPI = new ConquerItemPlusInformation();
CIPI.Parse(_item_);
SafeDictionary<byte, ConquerItemPlusInformation> info = null;
if (PlusInformations.TryGetValue(CIPI.ID, out info))
{
info.Add(CIPI.Plus, CIPI);
}
else
{
PlusInformations.Add(CIPI.ID, new SafeDictionary<byte, ConquerItemPlusInformation>(1000));
if (PlusInformations.TryGetValue(CIPI.ID, out info))
{
info.Add(CIPI.Plus, CIPI);
}
}
}
catch
{
Console.WriteLine(line);
}
}
Console.WriteLine("Item Base and Plus information loaded.");
}
public ConquerItemInformation(uint ID, byte Plus)
{
_BaseInformation = null;
if (BaseInformations.TryGetValue(ID, out _BaseInformation))
{
getPlusInformation(ID, Plus);
}
else
{
return;
}
}
public enum ItemSort
{
Invalid = -1,
Expendable = 0,
Helmet = 1,
Necklace = 2,
Armor = 3,
Weapon1 = 4,
Weapon2 = 5,
Shield = 6,
RingR = 7,
Shoes = 8,
Other = 9,
RingL = 10,
Overcoat = 11,
IncreaseDmgArtifact = 12,
DecreaseDmgArtifact = 13,
MountAndAccessory = 14
}
public enum ItemType
{
Invalid = -1,
// Weapon1
Blade = 10000,
Sword = 20000,
Backsword = 21000,
Hook = 30000,
Whip = 40000,
Axe = 50000,
Hammer = 60000,
Club = 80000,
Scepter = 81000,
Dagger = 90000,
// Weapon2
Bow = 00000,
Glaive = 10000,
Poleaxe = 30000,
Longhammer = 40000,
Spear = 60000,
Wand = 61000,
Pickaxe = 62000,
Halbert = 80000,
// Other
Gem = 00000,
TaskItem = 10000,
ActionItem = 20000,
ComposeItem = 30000,
MonsterItem = 50000,
PointCard = 80000,
DarkHorn = 90000,
// Expendable
Physic = 00000,
PhysicMana = 01000,
PhysicLife = 02000,
Arrow = 50000,
Spell = 60000,
Ore = 70000,
Special = 80000,
Silver = 90000,
// MountAndAccessory
Mount = 00000,
Weapon2Accessory = 50000,
Weapon1Accessory = 60000,
BowAccessory = 70000,
ShieldAccessory = 80000,
}
public static ItemSort GetItemSort(uint type)
{
switch ((type % 10000000) / 100000)
{
case 1:
{
switch ((type % 1000000) / 10000)
{
case 11: return ItemSort.Helmet;
case 12: return ItemSort.Necklace;
case 13: return ItemSort.Armor;
case 14: return ItemSort.Helmet;
case 15: return ItemSort.RingR;
case 16: return ItemSort.Shoes;
case 17: break;
case 18: return ItemSort.Overcoat;
case 19: return ItemSort.Overcoat;
}
break;
}
case 2:
{
switch ((type % 10000) / 1000)
{
case 1: return ItemSort.IncreaseDmgArtifact;
case 2: return ItemSort.DecreaseDmgArtifact;
}
break;
}
case 3: return ItemSort.MountAndAccessory;
case 4: return ItemSort.Weapon1;
case 5: return ItemSort.Weapon2;
case 6: return ItemSort.Weapon1;
case 7: return ItemSort.Other;
case 9: return ItemSort.Shield;
case 10: return ItemSort.Expendable;
default:
{
break;
}
}
var sort = ((type % 10000000) / 100000);
if (sort >= 20 && sort < 30) return ItemSort.RingL;
return ItemSort.Invalid;
}
public static ItemType GetItemType(uint type)
{
switch ((type % 10000000) / 100000)
{
case 3:
case 4:
case 5:
case 6:
{
return (ItemType)((type % 100000) / 1000 * 1000);
}
case 7:
case 10:
{
return (ItemType)(((type % 100000) / 10000) * 10000);
}
}
return ItemType.Invalid;
}
private void getPlusInformation(uint ID, byte Plus)
{
var itemtype = ID;
var type = GetItemType(ID);
var sort = GetItemSort(ID);
if (type == ItemType.Backsword || type == ItemType.Bow)
{
}
else if (sort == ItemSort.Weapon1)
{
itemtype = (itemtype / 100000) * 100000 + (itemtype % 1000) + 44000;
}
else if (sort == ItemSort.Weapon2)
{
itemtype = (itemtype / 100000) * 100000 + (itemtype % 1000) + 55000;
}
else if (sort == ItemSort.Helmet || sort == ItemSort.Armor || sort == ItemSort.Shield)
{
itemtype = (itemtype / 1000) * 1000 + (itemtype % 1000);
}
itemtype = itemtype / 10 * 10;
ID = (uint)(
ID - (ID % 10) // [5] = 0
);
uint orID = ID;
byte itemType = (byte)(ID / 10000);
ushort itemType2 = (ushort)(ID / 1000);
if (itemType == 14 && itemType2 != 143 && itemType2 != 142 && itemType2 != 141)//armors
{
ID = (uint)(
(((uint)(ID / 1000)) * 1000) + // [3] = 0
((ID % 100))
);
}
else if (itemType2 == 141 || itemType2 == 142 || itemType2 == 143 || itemType == 13 || itemType == 11 || itemType2 == 123 || itemType == 30 || itemType == 20 || itemType == 12 || itemType == 15 || itemType == 16 || itemType == 50 || itemType2 == 421 || itemType2 == 601 || itemType2 == 610 || itemType == 90)//Necky bow bag
{
ID = (uint)(
ID - (ID % 10) // [5] = 0
);
}
else
{
byte head = (byte)(ID / 100000);
ID = (uint)(
((head * 100000) + (head * 10000) + (head * 1000)) + // [1] = [0], [2] = [0]
((ID % 1000) - (ID % 10)) // [5] = 0
);
}
_PlusInformation = new ConquerItemPlusInformation();
if (Plus > 0)
{
SafeDictionary<byte, ConquerItemPlusInformation> pInfo = null;
if (!PlusInformations.TryGetValue(itemtype, out pInfo)) if (!PlusInformations.TryGetValue(ID, out pInfo)) PlusInformations.TryGetValue(orID, out pInfo);
if (pInfo == null)
{
return;
}
if (!pInfo.TryGetValue(Plus, out _PlusInformation))
{
_PlusInformation = new ConquerItemPlusInformation();
}
}
}
/* private void getPlusInformation(uint ID, byte Plus)
{
var itemtype = ID;
var type = GetItemType(ID);
var sort = GetItemSort(ID);
if (type == ItemType.Backsword || type == ItemType.Bow)
{
}
else if (sort == ItemSort.Weapon1)
{
itemtype = (itemtype / 100000) * 100000 + (itemtype % 1000) + 44000;
}
else if (sort == ItemSort.Weapon2)
{
itemtype = (itemtype / 100000) * 100000 + (itemtype % 1000) + 55000;
}
else if (sort == ItemSort.Helmet || sort == ItemSort.Armor || sort == ItemSort.Shield)
{
itemtype = (itemtype / 1000) * 1000 + (itemtype % 1000);
}
itemtype = itemtype / 10 * 10;
/* byte itemType = (byte)(ID / 10000);
ushort itemType2 = (ushort)(ID / 1000);
if (itemType == 14 && itemType2 != 143 && itemType2 != 142 && itemType2 != 141)//armors
{
ID = (uint)(
(((uint)(ID / 1000)) * 1000) + // [3] = 0
((ID % 100))
);
}
else if (itemType2 == 141 || itemType2 == 142 || itemType2 == 143 || itemType == 13 || itemType == 11 || itemType2 == 123 || itemType == 30 || itemType == 20 || itemType == 12 || itemType == 15 || itemType == 16 || itemType == 50 || itemType2 == 421 || itemType2 == 601 || itemType2 == 610 || itemType == 90)//Necky bow bag
{
ID = (uint)(
ID - (ID % 10) // [5] = 0
);
}
else
{
byte head = (byte)(ID / 100000);
ID = (uint)(
((head * 100000) + (head * 10000) + (head * 1000)) + // [1] = [0], [2] = [0]
((ID % 1000) - (ID % 10)) // [5] = 0
);
}
_PlusInformation = new ConquerItemPlusInformation();
if (Plus > 0)
{
SafeDictionary<byte, ConquerItemPlusInformation> pInfo = null;
if (!PlusInformations.TryGetValue(itemtype, out pInfo))
PlusInformations.TryGetValue(ID, out pInfo);
if (pInfo == null)
if (!pInfo.TryGetValue(Plus, out _PlusInformation))
_PlusInformation = new ConquerItemPlusInformation();
}
}
*/
private ConquerItemPlusInformation _PlusInformation;
private ConquerItemBaseInformation _BaseInformation;
public ConquerItemPlusInformation PlusInformation
{
get
{
if (_PlusInformation == null)
return new ConquerItemPlusInformation();
return _PlusInformation;
}
}
public ConquerItemBaseInformation BaseInformation
{
get
{
if (_BaseInformation == null)
return new ConquerItemBaseInformation();
return _BaseInformation;
}
}
public uint CalculateUplevel()
{
var item = BaseInformations.Values.Where(x => x.Level > this.BaseInformation.Level && (x.ID / 1000) == (this.BaseInformation.ID / 1000) && (x.ID % 10) == (this.BaseInformation.ID % 10)).OrderBy(y => y.Level).FirstOrDefault();
if (item == null)
return BaseInformation.ID;
else
return item.ID;
}
public uint CalculateDownlevel()
{
if (BaseInformation.ID / 1000 == 616)
{
return (uint)(616010 + BaseInformation.ID % 10);
}
if (BaseInformation.ID / 1000 == 620)
{
return (uint)(620003 + BaseInformation.ID % 10);
}
if (BaseInformation.ID / 1000 == 619)//Hossu
{
return (uint)(619000 + BaseInformation.ID % 10);
}
var grades = GradeInformations[this.BaseInformation.Description];
if (grades == null) return BaseInformation.ID;
if (grades[BaseInformation.GradeKey - 1] == null)
return BaseInformation.ID;
else
return (uint)((grades[BaseInformation.GradeKey - 1].ID / 10) * 10 + BaseInformation.ID % 10);
}
public uint LowestID(byte Level)
{
if (BaseInformation.ID / 1000 == 616)// Epic Ninja
{
return (uint)(616010 + BaseInformation.ID % 10);
}
if (BaseInformation.ID / 1000 == 620)//Divin Backsword
{
return (uint)(620003 + BaseInformation.ID % 10);
}
if (BaseInformation.ID / 1000 == 619)//Hossu
{
return (uint)(619000 + BaseInformation.ID % 10);
}
var grades = GradeInformations[this.BaseInformation.Description];
if (grades == null) return BaseInformation.ID;
for (byte gr = 0; gr < grades.Count; gr++)
if (grades[gr].Level == Level)
return (uint)((grades[gr + 1].ID / 10) * 10 + BaseInformation.ID % 10);
return (uint)((grades[0].ID / 10) * 10 + BaseInformation.ID % 10);
}
}
public class ConquerItemPlusInformation
{
public uint ID;
public byte Plus;
public ushort ItemHP;
public uint MinAttack;
public uint MaxAttack;
public ushort PhysicalDefence;
public ushort MagicAttack;
public ushort MagicDefence;
public ushort Agility;
public ushort Vigor { get { return Agility; } }
public byte Dodge;
public ushort Accuracy;
public ushort SpeedPlus { get { return Dodge; } }
public void Parse(string Line)
{
string[] Info = Line.Split(' ');
ID = uint.Parse(Info[0]);
Plus = byte.Parse(Info[1]);
ItemHP = ushort.Parse(Info[2]);
MinAttack = uint.Parse(Info[3]);
MaxAttack = uint.Parse(Info[4]);
PhysicalDefence = ushort.Parse(Info[5]);
MagicAttack = ushort.Parse(Info[6]);
MagicDefence = ushort.Parse(Info[7]);
Agility = ushort.Parse(Info[8]);
Dodge = byte.Parse(Info[9]);
}
public ConquerItemPlusInformation()
{
Accuracy = 0;
ID = MinAttack = MaxAttack = 0;
Plus = Dodge = 0;
PhysicalDefence = MagicAttack = MagicDefence = Agility = 0;
}
}
public class ConquerItemBaseInformation
{
public string LowerName;
public uint ID;
public string Name;
public byte Class;
public byte Proficiency;
public byte Level;
public byte Gender;
public ushort Strength;
public ushort Agility;
public uint GoldWorth;
public ushort MinAttack;
public ushort MaxAttack;
public ushort PhysicalDefence;
public ushort MagicDefence;
public ushort MagicAttack;
public byte Dodge;
public int Accuracy;
public ushort Frequency;
public uint ConquerPointsWorth;
public ushort Durability;
public ushort StackSize;
public ushort ItemHP;
public ushort ItemMP;
public ushort AttackRange;
public ushort AttackSpeed;
public ItemType Type;
public string Description;
public int GradeKey;
public string FinalDescription;
public uint PurificationLevel;
public ushort PurificationMeteorNeed;
public ushort PurificationitemType;
public ushort PurificationPosition;
public int EarthResist,
MetalResist, FireResist, WaterResist, WoodResist, Block, Detoxication,
CounterAction, Penetration, Immunity, BreakThrough, CriticalStrike, SkillCriticalStrike;
public uint Weight;
private ushort auction_class;
private ushort auction_deposit;
public uint Time;
public void Parse(string Line)
{
string[] data = Line.Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
ID = Convert.ToUInt32(data[0]);
Name = data[1].Trim();
LowerName = Name.ToLower();
Class = Convert.ToByte(data[2]);
Proficiency = Convert.ToByte(data[3]);
Level = Convert.ToByte(data[4]);
Gender = Convert.ToByte(data[5]);
Strength = Convert.ToUInt16(data[6]);
Agility = Convert.ToUInt16(data[7]);
Type = Convert.ToUInt32(data[10]) == 0 ? ItemType.Dropable : ItemType.Others;
GoldWorth = Convert.ToUInt32(data[12]);
MaxAttack = Convert.ToUInt16(data[14]);
MinAttack = Convert.ToUInt16(data[15]);
PhysicalDefence = Convert.ToUInt16(data[16]);
Frequency = Convert.ToUInt16(data[17]);
Dodge = Convert.ToByte(data[18]);
ItemHP = Convert.ToUInt16(data[19]);
ItemMP = Convert.ToUInt16(data[20]);
Durability = Convert.ToUInt16(data[22]);
MagicAttack = Convert.ToUInt16(data[30]);
MagicDefence = Convert.ToUInt16(data[31]);
AttackRange = Convert.ToUInt16(data[32]);
ConquerPointsWorth = Convert.ToUInt32(data[37]);
StackSize = Convert.ToUInt16(data[47]);
EarthResist = Convert.ToUInt16(data[52]);
MetalResist = Convert.ToUInt16(data[48]);
FireResist = Convert.ToUInt16(data[51]);
WaterResist = Convert.ToUInt16(data[50]);
WoodResist = Convert.ToUInt16(data[49]);
Block = Convert.ToUInt16(data[44]);
//Detoxication = Convert.ToUInt16(data[43]);
CounterAction = Convert.ToUInt16(data[46]);
Penetration = Convert.ToUInt16(data[43]);
Immunity = Convert.ToUInt16(data[42]);
BreakThrough = Convert.ToUInt16(data[45]);
CriticalStrike = Convert.ToUInt16(data[40]);
SkillCriticalStrike = Convert.ToUInt16(data[41]);
Description = data[53].Replace("`s", "");
if (Description == "NinjaKatana")
Description = "NinjaWeapon";
if (Description == "Earrings")
Description = "Earring";
if (Description == "Bow")
Description = "ArcherBow";
if (Description == "Backsword")
Description = "TaoistBackSword";
Description = Description.ToLower();
if (data.Length >= 58)
{
PurificationLevel = Convert.ToUInt16(data[56]);
PurificationMeteorNeed = Convert.ToUInt16(data[57]);
}
if (data.Length >= 60)
{
auction_class = Convert.ToUInt16(data[59]);
auction_deposit = Convert.ToUInt16(data[60]);
}
Time = Convert.ToUInt32(data[39]);
}
public enum ItemType : byte
{
Dropable = 0,
Others
}
}
}
public class Kernel
{
public static ConcurrentDictionary<uint, Network.GamePackets.ConquerItem> AuctionItems = new ConcurrentDictionary<uint, Network.GamePackets.ConquerItem>();
public Auction AuctionInfo
{
get;
set;
}
#region Chi (2533)
#region Auction House
case 1320:
{
Auction.ProcessAuction(packet, client);
break;
}
case 1321:
{
Auction.ProcessBrowse(packet, client);
break;
}
case 1322:
{
Auction.ProcessQuery(packet, client);
break;
}
#endregion
#region Auction House
case 1650:
{
Data Data = new Data(true);
Data.ID = Data.OpenWindow;
Data.UID = client.Entity.UID;
Data.TimeStamp = Time32.Now;
Data.dwParam = 572;
Data.wParam1 = client.Entity.X;
Data.wParam2 = client.Entity.Y;
client.Send(Data);
break;
}
#endregion
/*
Navicat MySQL Data Transfer
Source Host : localhost:3306
Source Database : tqqq
Target Host : localhost:3306
Target Database : tqqq
Date: 2015-11-19 19:39:51
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for auction
-- ----------------------------
DROP TABLE IF EXISTS `auction`;
CREATE TABLE `auction` (
`ID` bigint(20) NOT NULL default '0',
`SellerUID` bigint(20) default NULL,
`SellerName` varchar(16) default NULL,
`Auction` longblob,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of auction
-- ----------------------------
-- ----------------------------
-- Table structure for auctionitems
-- ----------------------------
DROP TABLE IF EXISTS `auctionitems`;
CREATE TABLE `auctionitems` (
`ID` mediumint(10) unsigned NOT NULL default '0',
`UID` int(250) unsigned NOT NULL default '0',
`Plus` smallint(5) unsigned default '0',
`Bless` smallint(5) unsigned default '0',
`Enchant` smallint(5) unsigned NOT NULL default '0',
`SocketOne` smallint(5) unsigned default '0',
`SocketTwo` smallint(5) unsigned default '0',
`Durability` mediumint(50) unsigned NOT NULL default '0',
`MaximDurability` mediumint(50) unsigned NOT NULL default '0',
`SocketProgress` int(40) unsigned default '0',
`PlusProgress` int(40) unsigned default '0',
`Effect` smallint(5) unsigned default '0',
`Bound` smallint(5) unsigned default '0',
`Locked` smallint(5) unsigned default '0',
`UnlockEnd` bigint(250) unsigned default '0',
`Suspicious` smallint(5) unsigned default '0',
`SuspiciousStart` smallint(5) unsigned default '0',
`Color` smallint(5) unsigned default '0',
`Position` mediumint(10) unsigned default '0',
`Warehouse` mediumint(10) unsigned default '0',
`StackSize` smallint(5) unsigned NOT NULL default '0',
`Inscribed` int(36) unsigned NOT NULL default '0',
`agate` text character set latin1,
`RefineryStarted` bigint(36) NOT NULL default '0',
`RefineryPercent` int(36) NOT NULL default '0',
`RefineryLevel` int(36) NOT NULL default '0',
`RefineryItem` int(4) NOT NULL default '0',
`RefineryTime` bigint(16) NOT NULL default '0',
`NextSteedColor` int(16) NOT NULL default '0',
`EndTime` bigint(250) unsigned default '0',
`BasePrice` bigint(18) unsigned NOT NULL default '0',
`BidderUID` bigint(18) unsigned NOT NULL default '0',
`FixedPrice` bigint(18) unsigned NOT NULL default '0',
`MoneyType` bigint(18) unsigned NOT NULL default '0',
`SellerUID` bigint(18) unsigned NOT NULL default '0',
`Time` bigint(18) unsigned NOT NULL default '0',
`SellerName` varchar(16) NOT NULL default '',
`BidderName` varchar(16) NOT NULL default '',
PRIMARY KEY (`UID`,`SellerName`,`BidderName`),
UNIQUE KEY `myIndex` (`UID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of auctionitems
-- ----------------------------
1650 AuctionManager 2 16500 1002 313 285
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
WarDrobe System | محمد ياسر | تطوير سيرفرات كونكر | 16 | 2024-11-15 03:54 PM |
System GameUpdates | محمد ياسر | تطوير سيرفرات كونكر | 2 | 2024-08-06 06:37 PM |
system language | محمد ياسر | تطوير سيرفرات كونكر | 3 | 2019-06-25 05:43 PM |
System Lottery Done 100% | Mero | تطوير سيرفرات كونكر | 11 | 2019-05-19 04:02 PM |