i have proplem in appling purification i have coded but didnt work
| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Text; |
| namespace Hellmouth |
| { |
| public partial class Handler |
| { |
| public static void Refinery(byte[] Packet, Client Client) |
| { |
| uint MainUID = BitConverter.ToUInt32(Packet, 8),//Gets MainItem UID |
| MinorUID = BitConverter.ToUInt32(Packet, 12);//Gets Contribution UID |
| Struct.ItemInfo MainItem = Client.InventoryItem(MainUID),//Retrieves iteminfo from Client of MainUID |
| MinorItem = Client.InventoryItem(MinorUID);//Retrieves iteminfo from Client of MinorUID |
| ushort Points = 0; |
| switch (MinorItem.Refinery.Type)//Converts the MinorItems plus value into composition points |
| { |
| case 1: Points = 312; break; |
| case 2: Points = 301; break; |
| case 3: Points = 302; break; |
| case 4: Points = 304; break; |
| case 5: Points = 308; break; |
| } |
| Client.RemoveInventory(MinorUID);//Removes Contribution |
| if (Points > 0 && MainItem.Refinery.Type < 5) |
| { |
| MainItem.Refinery.Type += Points; |
| while (MainItem.Refinery.Type >= GettypeReq(MainItem.Refinery.Type)) |
| { |
| // MainItem.Composition -= GettypeReq(MainItem.Plus); |
| MainItem.Refinery.Type++; |
| } |
| Client.Inventory[MainItem.UID] = MainItem; |
| Database.UpdateItem(MainItem.UID, (ushort)MainItem.Refinery.Type, "RefineryType"); |
| Database.UpdateItem(MainItem.UID, (byte)MainItem.Refinery.Level, "RefineryLevel"); |
| Database.UpdateItem(MainItem.UID, (byte)MainItem.Refinery.Effect, "RefineryEffects"); |
| Database.UpdateItem(MainItem.UID, (int)MainItem.Refinery.Expires, "RefineryExpires"); |
| Client.Send(Packets.ItemInfo(MainItem, 3)); |
| Packets.Send(Packets.RefineryInfo(MainItem, false), Client); |
| } |
| } |
| private static uint GettypeReq(int p) |
| { |
| switch (p) |
| { |
| case 312: |
| { |
| return 8; |
| } |
| case 310: |
| { |
| return 8; |
| } |
| case 308: |
| { |
| return 8; |
| } |
| default: |
| { |
| return 0; |
| } |
| } |
| } |
| } |
| } |