|
|
المشاركات 417 |
+التقييم 0.20 |
تاريخ التسجيل Apr 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 63 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project_Terror_v2.Game.MsgServer
{
public unsafe struct MsgRuns
{
public enum RuneType : byte
{
Equip = 57,
UnEquip = 58,
InventoryRune = 61,
UpgradeRune = 63
}
static ushort[] YellowRunePoints = new ushort[10] { 1, 500, 1000, 3000, 8000, 15000, 20000, 25000, 32000, 0 };
private static ushort[] BlueRunePoints = new ushort[26] { 1, 400, 800, 1200, 1800, 2700, 3700, 4500, 5300, 6000, 7500, 8300, 9000, 10500, 12000, 13500, 15000, 22500, 22500, 22500, 22500, 22500, 30000, 30000, 30000, 0, };
public static bool IsRune(uint ID)
{
return ID >= 4010101 && ID <= 4031309 || ID >= 4010001 && ID <= 4010901;
}
public static bool IsRuneEssence(uint ID)
{
return (ID == 4040001) || (ID == 4050001) || (ID == 4060001);
}
public static void Runs(Client.GameClient client, ServerSockets.Packet _stream)
{
var packet = new byte[_stream.Size];
System.Runtime.InteropServices.Marshal.Copy(new IntPtr(_stream.Memory), packet, 0, _stream.Size);
switch ((RuneType)packet[20])
{
case RuneType.UpgradeRune:
{
MsgGameItem Item;
if (client.Warehouse.TryGetItem((uint)Game.MsgNpc.NpcID.WHRune, (uint)BitConverter.ToUInt32(packet, 8), out Item) || client.Warehouse.TryGetItem((uint)Game.MsgNpc.NpcID.MainRune, (uint)BitConverter.ToUInt32(packet, 8), out Item))
{
if (IsRune(Item.ITEM_ID))
{
Queue<MsgGameItem> ItemsPlus = new Queue<MsgGameItem>();
for (int i = 0; i < packet[26]; i++)
{
var uid = BitConverter.ToUInt32(packet, 91 + 4 * i);
MsgGameItem itemuse;
if (client.Warehouse.TryGetItem((uint)Game.MsgNpc.NpcID.WHRune, uid, out itemuse))
ItemsPlus.Enqueue(itemuse);
else if (client.Inventory.TryGetItem(uid, out itemuse))
ItemsPlus.Enqueue(itemuse);
}
while (ItemsPlus.Count > 0)
{
var Stone = ItemsPlus.Dequeue();
if (IsRune(Stone.ITEM_ID))
{
Item.PlusProgress += GetRuneComposePoints(Item.ITEM_ID, (byte)(Item.ITEM_ID % 100));
Item.PlusProgress += Stone.PlusProgress;
}
else if (!IsRuneEssence(Stone.ITEM_ID))
{
Item.PlusProgress += Database.ItemType.StonePlusPoints(Stone.Plus);
Item.PlusProgress += Stone.PlusProgress;
}
else
{
Item.PlusProgress += (uint)Math.Max(1, (int)Stone.StackSize) * 10;
}
while (Item.PlusProgress >= GetRuneComposePoints(Item.ITEM_ID, (byte)(Item.ITEM_ID % 100)) && IsRuneMax(Item.ITEM_ID, (byte)(Item.ITEM_ID % 100)))
{
Item.PlusProgress -= GetRuneComposePoints(Item.ITEM_ID, (byte)(Item.ITEM_ID % 100));
Item.ITEM_ID++;
if (!IsRuneMax(Item.ITEM_ID, (byte)(Item.ITEM_ID % 100)))
Item.PlusProgress = 0;
}
if (Stone.WH_ID != 0)
{
client.Warehouse.DeleteItem((uint)Game.MsgNpc.NpcID.WHRune, Stone.UID);
client.Send(_stream.ItemUsageCreate(MsgItemUsuagePacket.ItemUsuageID.RemoveInventory, Stone.UID, 0, 0, 0, 0, 0));
}
else
client.Inventory.Update(Stone, Role.Instance.AddMode.REMOVE, _stream);
Item.Mode = Role.Flags.ItemMode.Update;
Item.Send(client, _stream);
}
}
}
break;
}
case RuneType.InventoryRune:
{
switch (packet[12])
{
case 0:
{
MsgGameItem items;
if (client.Inventory.TryGetItem((uint)BitConverter.ToUInt32(packet, 8), out items))
{
if (IsRune(items.ITEM_ID) == false)
return;
if (client.Warehouse.AddItem(items, (uint)Game.MsgNpc.NpcID.WHRune))
{
if (client.Inventory.ClientItems.TryRemove(items.UID, out items))
{
items.Position = (byte)Role.Flags.ConquerItem.Rune;
if (Database.ItemType.IsRuneEssence(items.ITEM_ID))
{
client.Send(_stream.ItemUsageCreate(MsgItemUsuagePacket.ItemUsuageID.RemoveInventory, items.UID, 0, 0, 0, 0, 0));
if (client.Warehouse.TryGetItem((uint)Game.MsgNpc.NpcID.WHRune, items.UID, out items))
{
items.Mode = Role.Flags.ItemMode.AddItem;
items.Send(client, _stream);
}
}
client.Send(_stream.ItemUsageCreate((MsgItemUsuagePacket.ItemUsuageID)packet[20], BitConverter.ToUInt32(packet, 8), BitConverter.ToUInt32(packet, 12), BitConverter.ToUInt32(packet, 22), 0, 0, 0));
}
}
}
break;
}
case 1:
{
if (client.Warehouse.RemoveItem(BitConverter.ToUInt32(packet, 8), (uint)Game.MsgNpc.NpcID.WHRune, null))
client.Send(_stream.ItemUsageCreate((MsgItemUsuagePacket.ItemUsuageID)packet[20], BitConverter.ToUInt32(packet, 8), BitConverter.ToUInt32(packet, 12), BitConverter.ToUInt32(packet, 22), 0, 0, 0));
break;
}
}
break;
}
case RuneType.Equip:
{
MsgGameItem DataItem;
if (client.Warehouse.TryGetItem((uint)Game.MsgNpc.NpcID.WHRune, (uint)BitConverter.ToUInt32(packet, 8), out DataItem))
{
if (IsRune(DataItem.ITEM_ID) == false)
return;
var DBItem = Database.ItemType.GetItemRecord(DataItem.ITEM_ID);
if (DBItem != null)
{
if (client.Warehouse.CanEquipRune((ushort)packet[12]))
{
if (client.Warehouse.DeleteItem((uint)Game.MsgNpc.NpcID.WHRune, (uint)BitConverter.ToUInt32(packet, 8)))
{
client.Warehouse.AddItem(DataItem, (uint)Game.MsgNpc.NpcID.MainRune);
DataItem.Mode = Role.Flags.ItemMode.Update;
DataItem.Position = (byte)packet[12];
DataItem.Send(client, _stream);
client.Equipment.QueryEquipment(client.Equipment.Alternante, false);
client.Send(_stream.ItemUsageCreate((MsgItemUsuagePacket.ItemUsuageID)packet[20], BitConverter.ToUInt32(packet, 8), BitConverter.ToUInt32(packet, 12), BitConverter.ToUInt32(packet, 22), 0, 0, 0));
var spell = Database.MagicType.GetSpellRecord(DBItem.SpellID, DBItem.SpellLevel);
if (spell != null)
{
if (!client.MySpells.ClientSpells.ContainsKey((ushort)spell.ID))
client.MySpells.Add(_stream, (ushort)spell.ID);
}
}
}
}
}
break;
}
case RuneType.UnEquip:
{
MsgGameItem DataItem;
if (client.Warehouse.TryGetItem((uint)Game.MsgNpc.NpcID.MainRune, (uint)BitConverter.ToUInt32(packet, 8), out DataItem))
{
if (IsRune(DataItem.ITEM_ID) == false)
return;
if (client.Warehouse.AddItem(DataItem, (uint)Game.MsgNpc.NpcID.WHRune))
{
if (client.Warehouse.DeleteItem((uint)Game.MsgNpc.NpcID.MainRune, (uint)BitConverter.ToUInt32(packet, 8)))
{
DataItem.Mode = Role.Flags.ItemMode.Update;
DataItem.Position = (byte)Role.Flags.ConquerItem.Rune;
DataItem.Send(client, _stream);
client.Equipment.QueryEquipment(client.Equipment.Alternante, false);
client.Send(_stream.ItemUsageCreate((MsgItemUsuagePacket.ItemUsuageID)packet[20], BitConverter.ToUInt32(packet, 8), BitConverter.ToUInt32(packet, 12), BitConverter.ToUInt32(packet, 22), 0, 0, 0));
var DBItem = Database.ItemType.GetItemRecord(DataItem.ITEM_ID);
if (DBItem != null)
{
var spell = Database.MagicType.GetSpellRecord(DBItem.SpellID, DBItem.SpellLevel);
if (spell != null)
{
if (client.MySpells.ClientSpells.ContainsKey((ushort)spell.ID))
client.MySpells.Remove((ushort)spell.ID, _stream);
}
}
}
}
else
client.SendSysMesage("Sorry, your container is full.");
}
break;
}
}
}
public static uint GetRuneComposePoints(uint ID, byte plus)
{
if ((ID >= 4030101 && ID <= 4031309))
return YellowRunePoints[Math.Min((int)plus, 9)];
return BlueRunePoints[Math.Min((int)plus, 27)];
}
public static bool IsRuneMax(uint ID, byte plus)
{
if ((ID >= 4030101 && ID <= 4031309))
{
if (plus < 9)
return true;
}
else
if (plus < 27)
return true;
return false;
}
}
}
|
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
سورس اليكس بي البروتو :] الابيك و الرونز و كل حاجه | محمودمحمدسالم | سورسات كونكر | 255 | 2024-11-08 01:45 AM |
سورس بورتو كامل بي شخصية الجديده بعد التعديل شخصية ثور + باتش[نسخة ماتريكس] | Mr.X | سورسات كونكر | 87 | 2024-09-04 03:21 PM |
npc تكسير الرونز | محمودمحمدسالم | تطوير سيرفرات كونكر | 5 | 2020-04-16 06:44 AM |
الرونز سورس رايزو | محمودمحمدسالم | مشكلات السيرفيرات كونكر الشخصيه | 2 | 2020-03-17 03:19 PM |
بخصوص قيم الرونز فى سورس ماتركس | رفيق القلم | مشكلات السيرفيرات كونكر الشخصيه | 9 | 2019-12-25 06:49 AM |