Purification coding for refinery

03/13/2011 00:44 koko425#1
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;
}
}
}
}
}
03/17/2011 19:58 koko425#2
does any one know
03/17/2011 21:12 pro4never#3
Why are you trying to use composition code for refinery?....

What exactly is it you're trying to do here.

My main concern would be that the minor item DOES NOT have a refinery type.

Refinery type = the effect of it.. by ++ing it you are changing what the effect is in itself (penetration vs say... crit strike).

Never having used the real system, how is purification supposed to work? It raises the level/effect of the applied refinery item? or is it the one that makes the bonus permanent?

It shouldn't be very complicated to code but you'll need to go into much more detail as to what you're trying to do, where it's going wrong, etc.
03/17/2011 23:18 koko425#4
Quote:
Originally Posted by pro4never View Post
Why are you trying to use composition code for refinery?....

What exactly is it you're trying to do here.

My main concern would be that the minor item DOES NOT have a refinery type.

Refinery type = the effect of it.. by ++ing it you are changing what the effect is in itself (penetration vs say... crit strike).

Never having used the real system, how is purification supposed to work? It raises the level/effect of the applied refinery item? or is it the one that makes the bonus permanent?

It shouldn't be very complicated to code but you'll need to go into much more detail as to what you're trying to do, where it's going wrong, etc.
so give me example to start
03/17/2011 23:23 pro4never#5
Ummm you're the one trying to code the system. Explain how the system is supposed to work/how you want it to work and then I can offer suggestions from there.

I have no idea what this code is even trying to do cause it appears there is NOTHING correct about it.
03/17/2011 23:42 Kiyono#6
Well since he called it the purification system, I'm pretty sure it's the system where you make the temporary refinery permanent. I'd read the info about the new systems if I were you, might help when you try to code features.
03/18/2011 04:52 pro4never#7
I have no intention of ever allowing them to be made permanent. My point was more that the code he posted had absolutely NOTHING to do with what he was trying to do (I did assume it had to do with using permanent stones but yet he's talking about things completely unrelated to it)
03/18/2011 15:53 koko425#8
i will explain what is system doing

1st there is 2 things of refinery
1-refine item with dragonsoul iteams like phase 1 2 3 4 5 6 === item+dragonsoulitem+some meteors == refineditem with dragonsoul like hammer phase 6
2refine item with refinery iteams like crictikal strike m-defense breakthrou ==== item+refinery item by click right and chose item to refined



2nd you can permanent iteams with stons to get it unlimited not waited 7 days to finish

mmm i will explain more
control type ArtifactPurification doing refinery item with dragon soul
control type RefineryStabalizer doing permanent items thoes refined by refinery iteams
controltype ArtifactStabilization doing permanent items thoes refined by dragonsoul itemas

thats all
we wish you code appling system of refinery
03/18/2011 16:42 pro4never#9
So all you need to do is code a variable into items (database, item structure and then the item save/loading) to hold purification points. Make a simple method to like... "GetPurificationPoints(Item);} to return the amount of points gained by using a minor item on main item (the permanent stones).

Once you do that just make an npc that opens up the purification window and accepts main item/minor stones (iirc the box holds lots of them). Now log the packet that the client sends to the server and structure it (it's most likely SUPER simple, something like uint Main ItemUID, byte/ushort/uint Count, foreach minorItem Uint UID)

Now just check the minor items for how many points they add, how many main item has and then allow it to make it permanent (IE: 0 expire time)

But yah... what you have there has no relation to what you want to do because you're modifying the wrong things, using values that have nothing to do with purification and not ever assigning a new variable for purification points... as such it makes things a bit difficult (but yes, looks like you have the pts to purify done correctly... just that you're using strange values that don't really apply)