|
المشاركات 504 |
+التقييم 0.26 |
تاريخ التسجيل Jun 2019 |
الاقامة المنوفية |
نظام التشغيل windows Server 2012R2 |
رقم العضوية 325 |
inventory.cs
public bool Add(
inventory.cs
public bool add(
public bool Add(uint id, byte plus, byte times, bool bound = false)
{
try
{
Database.ConquerItemInformation infos = new Database.ConquerItemInformation(id, plus);
while (times > 0)
{
if (Count <= 39)
{
ConquerItem item;
item = new ConquerItem(true);
{
#region Stacksize
if (infos.BaseInformation.StackSize > 1)
{
//item.StackSize = (byte)times;
ushort _StackCount = infos.BaseInformation.StackSize;
if (times <= infos.BaseInformation.StackSize)
_StackCount = (ushort)times;
item.StackSize = (ushort)_StackCount;
Database.ConquerItemTable.UpdateStack(item);
times -= (byte)_StackCount;
}
else
{
item = new ConquerItem(true);
item.StackSize = 1;
times--;
}
#endregion Stacksize
item.ID = id;
item.Plus = plus;
item.Durability = item.MaximDurability = infos.BaseInformation.Durability;
};
this.Add(item, Enums.ItemUse.CreateAndAdd);
}
else
{
return false;
}
// times--;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return true;
}
public bool Add(uint id, byte plus, byte times, byte soc1, byte soc2, byte Bless = 0)
{
Database.ConquerItemInformation infos = new Database.ConquerItemInformation(id, plus);
while (times > 0)
{
if (Count <= 39)
{
ConquerItem item = new Network.GamePackets.ConquerItem(true);
item.ID = id;
item.Plus = plus;
//if (soc1 != 0)
item.SocketOne = (Enums.Gem)soc1;
item.SocketTwo = (Enums.Gem)soc2;
item.Bless = Bless;
item.Durability = item.MaximDurability = infos.BaseInformation.Durability;
Add(item, Enums.ItemUse.CreateAndAdd);
}
else
{
return false;
}
times--;
}
return true;
}
public bool Add(uint id, Game.Enums.ItemEffect effect)
{
try
{
ConquerItem item = new Network.GamePackets.ConquerItem(true);
item.ID = id;
item.Effect = effect;
Database.ConquerItemInformation infos = new Database.ConquerItemInformation(id, 0);
item.Durability = item.MaximDurability = infos.BaseInformation.Durability;
if (Count <= 39)
{
Add(item, Enums.ItemUse.CreateAndAdd);
}
else
{
return false;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return true;
}
public bool Add(ConquerItem item, Enums.ItemUse use)
{
try
{
if (!Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID))
return true;
if (Count == 40)
{
Owner.Send(Constants.FullInventory);
return false;
}
if (!inventory.ContainsKey(item.UID))
{
item.Position = 0;
switch (use)
{
case Enums.ItemUse.CreateAndAdd:
item.UID = KhaledMohamed.Network.GamePackets.ConquerItem.ItemUID.Next;
Database.ConquerItemTable.AddItem(ref item, Owner);
Database.ConquerItemTable.Update_Free(item, Owner);
item.MobDropped = false;
break;
case Enums.ItemUse.Add:
Database.ConquerItemTable.UpdateLocation(item, Owner);
break;
case Enums.ItemUse.Move:
item.Position = 0;
item.StatsLoaded = false;
Database.ConquerItemTable.UpdateLocation(item, Owner);
break;
}
if (use != Enums.ItemUse.None)
Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Add);
lock (inventory)
{
if (!inventory.ContainsKey(item.UID))
{
inventory.Add(item.UID, item);
}
}
objects = inventory.Values.ToArray();
item.Mode = Enums.ItemMode.Default;
if (use != Enums.ItemUse.None)
item.Send(Owner);
//Data data = new Data(true);
//data.ID = Data.OpenCustom;
//data.UID = Owner.Entity.UID;
//data.TimeStamp = Time32.Now;
//data.dwParam = 3382;
//data.wParam1 = Owner.Entity.X;
//data.wParam2 = Owner.Entity.Y;
//Owner.Send(data);
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(ConquerItem item, Enums.ItemUse use)
{
try
{
if (inventory.ContainsKey(item.UID))
{
switch (use)
{
case Enums.ItemUse.RemoveFromStack:
{
if (item.StackSize > 1)
{
item.StackSize -= 1;
Database.ConquerItemTable.UpdateStack(item);
item.Mode = Game.Enums.ItemMode.Update;
item.Send(Owner);
return true;
}
else
{
Database.ConquerItemTable.RemoveItem(item.UID);
}
break;
}
case Enums.ItemUse.Remove:
case Enums.ItemUse.Delete:
Database.ConquerItemTable.RemoveItem(item.UID); break;
case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(item, Owner); break;
}
Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Remove);
inventory.Remove(item.UID);
objects = inventory.Values.ToArray();
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = item.UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(ConquerItem item, Enums.ItemUse use, bool equipment)
{
try
{
if (inventory.ContainsKey(item.UID))
{
inventory.Remove(item.UID);
objects = inventory.Values.ToArray();
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = item.UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(uint UID, Enums.ItemUse use, bool sendRemove)
{
try
{
if (inventory.ContainsKey(UID))
{
switch (use)
{
case Enums.ItemUse.Remove: Database.ConquerItemTable.RemoveItem(UID); break;
case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(inventory[UID], Owner); break;
}
Database.ItemLog.LogItem(UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Remove);
inventory.Remove(UID);
objects = inventory.Values.ToArray();
if (sendRemove)
{
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
}
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(string name)
{
try
{
string loweredName = name.ToLower();
foreach (var item in inventory.Values)
{
if (Database.ConquerItemInformation.BaseInformations[item.ID].LowerName == loweredName)
{
Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Remove);
Remove(item, Enums.ItemUse.Remove);
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = item.UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
return true;
}
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Add(uint id, byte plus, byte times, bool bound = false)
{
try
{
Database.ConquerItemInformation infos = new Database.ConquerItemInformation(id, plus);
while (times > 0)
{
if (Count <= 39)
{
ConquerItem item;
item = new ConquerItem(true);
{
#region Stacksize
if (infos.BaseInformation.StackSize > 1)
{
//item.StackSize = (byte)times;
ushort _StackCount = infos.BaseInformation.StackSize;
if (times <= infos.BaseInformation.StackSize)
_StackCount = (ushort)times;
item.StackSize = (ushort)_StackCount;
Database.ConquerItemTable.UpdateStack(item);
times -= (byte)_StackCount;
}
else
{
item = new ConquerItem(true);
item.StackSize = 1;
times--;
}
#endregion Stacksize
item.ID = id;
item.Plus = plus;
item.Durability = item.MaximDurability = infos.BaseInformation.Durability;
};
this.Add(item, Enums.ItemUse.CreateAndAdd);
}
else
{
return false;
}
// times--;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return true;
}
public bool Add(uint id, byte plus, byte times, byte soc1, byte soc2, byte Bless = 0)
{
Database.ConquerItemInformation infos = new Database.ConquerItemInformation(id, plus);
while (times > 0)
{
if (Count <= 39)
{
ConquerItem item = new Network.GamePackets.ConquerItem(true);
item.ID = id;
item.Plus = plus;
//if (soc1 != 0)
item.SocketOne = (Enums.Gem)soc1;
item.SocketTwo = (Enums.Gem)soc2;
item.Bless = Bless;
item.Durability = item.MaximDurability = infos.BaseInformation.Durability;
Add(item, Enums.ItemUse.CreateAndAdd);
}
else
{
return false;
}
times--;
}
return true;
}
public bool Add(uint id, Game.Enums.ItemEffect effect)
{
try
{
ConquerItem item = new Network.GamePackets.ConquerItem(true);
item.ID = id;
item.Effect = effect;
Database.ConquerItemInformation infos = new Database.ConquerItemInformation(id, 0);
item.Durability = item.MaximDurability = infos.BaseInformation.Durability;
if (Count <= 39)
{
Add(item, Enums.ItemUse.CreateAndAdd);
}
else
{
return false;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return true;
}
public bool Add(ConquerItem item, Enums.ItemUse use)
{
try
{
if (!Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID))
return true;
if (Count == 40)
{
Owner.Send(Constants.FullInventory);
return false;
}
if (!inventory.ContainsKey(item.UID))
{
item.Position = 0;
switch (use)
{
case Enums.ItemUse.CreateAndAdd:
item.UID = KhaledMohamed.Network.GamePackets.ConquerItem.ItemUID.Next;
Database.ConquerItemTable.AddItem(ref item, Owner);
Database.ConquerItemTable.Update_Free(item, Owner);
item.MobDropped = false;
break;
case Enums.ItemUse.Add:
Database.ConquerItemTable.UpdateLocation(item, Owner);
break;
case Enums.ItemUse.Move:
item.Position = 0;
item.StatsLoaded = false;
Database.ConquerItemTable.UpdateLocation(item, Owner);
break;
}
if (use != Enums.ItemUse.None)
Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Add);
lock (inventory)
{
if (!inventory.ContainsKey(item.UID))
{
inventory.Add(item.UID, item);
}
}
objects = inventory.Values.ToArray();
item.Mode = Enums.ItemMode.Default;
if (use != Enums.ItemUse.None)
item.Send(Owner);
//Data data = new Data(true);
//data.ID = Data.OpenCustom;
//data.UID = Owner.Entity.UID;
//data.TimeStamp = Time32.Now;
//data.dwParam = 3382;
//data.wParam1 = Owner.Entity.X;
//data.wParam2 = Owner.Entity.Y;
//Owner.Send(data);
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(ConquerItem item, Enums.ItemUse use)
{
try
{
if (inventory.ContainsKey(item.UID))
{
switch (use)
{
case Enums.ItemUse.RemoveFromStack:
{
if (item.StackSize > 1)
{
item.StackSize -= 1;
Database.ConquerItemTable.UpdateStack(item);
item.Mode = Game.Enums.ItemMode.Update;
item.Send(Owner);
return true;
}
else
{
Database.ConquerItemTable.RemoveItem(item.UID);
}
break;
}
case Enums.ItemUse.Remove:
case Enums.ItemUse.Delete:
Database.ConquerItemTable.RemoveItem(item.UID); break;
case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(item, Owner); break;
}
Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Remove);
inventory.Remove(item.UID);
objects = inventory.Values.ToArray();
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = item.UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(ConquerItem item, Enums.ItemUse use, bool equipment)
{
try
{
if (inventory.ContainsKey(item.UID))
{
inventory.Remove(item.UID);
objects = inventory.Values.ToArray();
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = item.UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(uint UID, Enums.ItemUse use, bool sendRemove)
{
try
{
if (inventory.ContainsKey(UID))
{
switch (use)
{
case Enums.ItemUse.Remove: Database.ConquerItemTable.RemoveItem(UID); break;
case Enums.ItemUse.Move: Database.ConquerItemTable.UpdateLocation(inventory[UID], Owner); break;
}
Database.ItemLog.LogItem(UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Remove);
inventory.Remove(UID);
objects = inventory.Values.ToArray();
if (sendRemove)
{
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
}
return true;
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
public bool Remove(string name)
{
try
{
string loweredName = name.ToLower();
foreach (var item in inventory.Values)
{
if (Database.ConquerItemInformation.BaseInformations[item.ID].LowerName == loweredName)
{
Database.ItemLog.LogItem(item.UID, Owner.Entity.UID, KhaledMohamed.Database.ItemLog.ItemLogAction.Remove);
Remove(item, Enums.ItemUse.Remove);
Network.GamePackets.ItemUsage iu = new Network.GamePackets.ItemUsage(true);
iu.UID = item.UID;
iu.ID = Network.GamePackets.ItemUsage.RemoveInventory;
Owner.Send(iu);
return true;
}
}
}
catch (Exception e)
{
Program.SaveException(e);
}
return false;
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
بخـصـووص الاستـمـينــاا ! | MRonlineGvrix | مشكلات السيرفيرات كونكر الشخصيه | 5 | 2022-04-09 01:24 AM |
مـشكــلة بخـصـووص الفـي بـي اسـ واللعبـةة يـاريـت حـل . | ابو مروان | مشكلات السيرفيرات كونكر الشخصيه | 12 | 2019-08-23 03:05 AM |
مشــكــلة فــي اللـوتــري !! | osama | مشكلات السيرفيرات كونكر الشخصيه | 8 | 2019-08-21 11:50 PM |
طـلــب بخـصـووص الاوتـوو بــااتـش ! | manshestar | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2019-08-08 04:05 PM |