public class WhiteStat
{
/*
* Created by Daxter (2012)
* Credits to Stratti for his awesome code example
*/
private ulong _value;
public ulong Value
{
get
{
return _value;
}
set
{
_value = value;
UpdateStats();
}
}
private Types _type;
public Types Type
{
get { return _type; }
//set { _type = value; }
}
#region WhiteStat Fields
//Weapon: Slot 0
//Armor: Slot 0
//Shield: Slot 0
private byte _Durability;
public byte Durability
{
get { return _Durability; }
set
{
if (value <= 31) //less or equal 31
{
_Durability = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte DurabilityPercentage
{
get
{
return (byte)(_Durability * 100 / 31);
}
set
{
if (value <= 100)
{
_Durability = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Weapon: Slot 3
private byte _HitRatio;
public byte HitRatio
{
get { return _HitRatio; }
set
{
if (value <= 31) //less or equal 31
{
_HitRatio = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte HitRatioPercentage
{
get
{
return (byte)(_HitRatio * 100 / 31);
}
set
{
if (value <= 100)
{
_HitRatio = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Armor: Slot 5
private byte _ParryRatio;
public byte ParryRatio
{
get { return _ParryRatio; }
set
{
if (value <= 31) //less or equal 31
{
_ParryRatio = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte ParryRatioPercentage
{
get
{
return (byte)(_ParryRatio * 100 / 31);
}
set
{
if (value <= 100)
{
_ParryRatio = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Shield: Slot 3
private byte _BlockRatio;
public byte BlockRatio
{
get { return _BlockRatio; }
set
{
if (value <= 31) //less or equal 31
{
_BlockRatio = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte BlockRatioPercentage
{
get
{
return (byte)(_BlockRatio * 100 / 31);
}
set
{
if (value <= 100)
{
_BlockRatio = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Weapon: Slot 6
private byte _CriticalRatio;
public byte CriticalRatio
{
get { return _CriticalRatio; }
set
{
if (value <= 31) //less or equal 31
{
_CriticalRatio = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte CriticalRatioPercentage
{
get
{
return (byte)(_CriticalRatio * 100 / 31);
}
set
{
if (value <= 100)
{
_CriticalRatio = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Weapon: Slot 1
//Armor: Slot 1
//Shield: Slot 1
private byte _PhyReinforce;
public byte PhyReinforce
{
get { return _PhyReinforce; }
set
{
if (value <= 31) //less or equal 31
{
_PhyReinforce = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte PhyReinforcePercentage
{
get
{
return (byte)(_PhyReinforce * 100 / 31);
}
set
{
if (value <= 100)
{
_PhyReinforce = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Weapon: Slot 2
//Armor: Slot 2
//Shield: Slot 2
private byte _MagReinforce;
public byte MagReinforce
{
get { return _MagReinforce; }
set
{
if (value <= 31) //less or equal 31
{
_MagReinforce = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte MagReinforcePercentage
{
get
{
return (byte)(_MagReinforce * 100 / 31);
}
set
{
if (value <= 100)
{
_MagReinforce = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Weapon: Slot 4
private byte _PhyAttack;
public byte PhyAttack
{
get { return _PhyAttack; }
set
{
if (value <= 31) //less or equal 31
{
_PhyAttack = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte PhyAttackPercentage
{
get
{
return (byte)(_PhyAttack * 100 / 31);
}
set
{
if (value <= 100)
{
_PhyAttack = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Weapon: Slot 5
private byte _MagAttack;
public byte MagAttack
{
get { return _MagAttack; }
set
{
if (value <= 31) //less or equal 31
{
_MagAttack = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte MagAttackPercentage
{
get
{
return (byte)(_MagAttack * 100 / 31);
}
set
{
if (value <= 100)
{
_MagAttack = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Armor: Slot 3
//Shield: Slot 4
private byte _PhyDefense;
public byte PhyDefense
{
get { return _PhyDefense; }
set
{
if (value <= 31) //less or equal 31
{
_PhyDefense = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte PhyDefensePercentage
{
get
{
return (byte)(_PhyDefense * 100 / 31);
}
set
{
if (value <= 100)
{
_PhyDefense = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Armor: Slot 4
//Shield: Slot 5
private byte _MagDefense;
public byte MagDefense
{
get { return _MagDefense; }
set
{
if (value <= 31) //less or equal 31
{
_MagDefense = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte MagDefensePercentage
{
get
{
return (byte)(_MagDefense * 100 / 31);
}
set
{
if (value <= 100)
{
_MagDefense = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Accessory: Slot 0
private byte _PhyAbsorb;
public byte PhyAbsorb
{
get { return _PhyAbsorb; }
set
{
if (value <= 31) //less or equal 31
{
_PhyAbsorb = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte PhyAbsorbPercentage
{
get
{
return (byte)(_PhyAbsorb * 100 / 31);
}
set
{
if (value <= 100)
{
_PhyAbsorb = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
//Accessory: Slot 1
private byte _MagAbsorb;
public byte MagAbsorb
{
get { return _MagAbsorb; }
set
{
if (value <= 31) //less or equal 31
{
_MagAbsorb = value;
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 31");
}
}
}
public byte MagAbsorbPercentage
{
get
{
return (byte)(_MagAbsorb * 100 / 31);
}
set
{
if (value <= 100)
{
_MagAbsorb = (byte)(31f / 100f * (float)value);
UpdateValue();
}
else
{
throw new System.ArgumentOutOfRangeException("value", "value must be less or equal to 100");
}
}
}
#endregion
public WhiteStat(Types type)
{
this._type = type;
this._value = 0;
UpdateStats();
}
public WhiteStat(Types type, ulong input)
{
this._type = type;
this._value = input;
UpdateStats();
}
public WhiteStat(Types type, params byte[] stats)
{
this._type = type;
switch (_type)
{
case Types.Weapon:
_Durability = stats[0];
_PhyReinforce = stats[1];
_MagReinforce = stats[2];
_HitRatio = stats[3];
_PhyAttack = stats[4];
_MagAttack = stats[5];
_CriticalRatio = stats[6];
break;
case Types.Equipment:
_Durability = stats[0];
_PhyReinforce = stats[1];
_MagReinforce = stats[2];
_PhyDefense = stats[3];
_MagDefense = stats[4];
_ParryRatio = stats[5];
break;
case Types.Shield:
_Durability = stats[0];
_PhyReinforce = stats[1];
_MagReinforce = stats[2];
_BlockRatio = stats[3];
_PhyDefense = stats[4];
_MagDefense = stats[5];
break;
case Types.Accessory:
_PhyAbsorb = stats[0];
_MagAbsorb = stats[1];
break;
}
UpdateValue();
}
private void UpdateStats()
{
ulong variance = this._value;
byte counter = 0;
switch (_type)
{
case Types.Weapon: //7 Slots
#region Weapon
while (variance > 0)
{
byte stat = (byte)(variance & 0x1F);
switch (counter)
{
case 0: //Durability
_Durability = stat;
break;
case 1: //Physical Reinforce
_PhyReinforce = stat;
break;
case 2: //Magical Reinforce
_MagReinforce = stat;
break;
case 3: //Hit Ratio (Attack Ratio)
_HitRatio = stat;
break;
case 4: //Physical Attack
_PhyAttack = stat;
break;
case 5: //Magical Attack
_MagAttack = stat;
break;
case 6: //Critical Ratio
_CriticalRatio = stat;
break;
}
//left shit by 5
variance >>= 5;
counter++;
}
#endregion
break;
case Types.Equipment: //6 Slots
#region Eqipment
while (variance > 0)
{
byte stat = (byte)(variance & 0x1F);
switch (counter)
{
case 0: //Durability
_Durability = stat;
break;
case 1: //Physical Reinforce
_PhyReinforce = stat;
break;
case 2: //Magical Reinforce
_MagReinforce = stat;
break;
case 3: //Physical Defense
_PhyDefense = stat;
break;
case 4: //Magical Defense
_MagDefense = stat;
break;
case 5: //Evasion Rate(Parry Rate)
_ParryRatio = stat;
break;
}
//left shit by 5
variance >>= 5;
counter++;
}
#endregion
break;
case Types.Shield: //6 Slots
#region Shield
while (variance > 0)
{
byte stat = (byte)(variance & 0x1F);
switch (counter)
{
case 0: //Durability
_Durability = stat;
break;
case 1: //Physical Reinforce
_PhyReinforce = stat;
break;
case 2: //Magical Reinforce
_MagReinforce = stat;
break;
case 3: //Block Ratio
_BlockRatio = stat;
break;
case 4: //Physical Defense
_PhyDefense = stat;
break;
case 5://Magical Defense
_MagDefense = stat;
break;
}
//left shit by 5
variance >>= 5;
counter++;
}
#endregion
break;
case Types.Accessory: //2 Slots
#region Shield
while (variance > 0)
{
byte stat = (byte)(variance & 0x1F);
switch (counter)
{
case 0: //Durability
_PhyAbsorb = stat;
break;
case 1: //Physical Reinforce
_MagAbsorb = stat;
break;
}
//left shit by 5
variance >>= 5;
counter++;
}
#endregion
break;
}
}
private void UpdateValue()
{
ulong variance = 0;
switch (_type)
{
case Types.Weapon:
variance |= _Durability;
variance <<= 5;
variance |= _PhyReinforce;
variance <<= 5;
variance |= _MagReinforce;
variance <<= 5;
variance |= _HitRatio;
variance <<= 5;
variance |= _PhyAttack;
variance <<= 5;
variance |= _MagAttack;
variance <<= 5;
variance |= _CriticalRatio;
break;
case Types.Equipment:
variance |= _Durability;
variance <<= 5;
variance |= _PhyReinforce;
variance <<= 5;
variance |= _MagReinforce;
variance <<= 5;
variance |= _PhyDefense;
variance <<= 5;
variance |= _MagDefense;
variance <<= 5;
variance |= _ParryRatio;
break;
case Types.Shield:
variance |= _Durability;
variance <<= 5;
variance |= _PhyReinforce;
variance <<= 5;
variance |= _MagReinforce;
variance <<= 5;
variance |= _BlockRatio;
variance <<= 5;
variance |= _PhyDefense;
variance <<= 5;
variance |= _MagDefense;
break;
case Types.Accessory:
variance |= _PhyAbsorb;
variance <<= 5;
variance |= _MagAbsorb;
break;
}
_value = variance;
}
public override string ToString()
{
switch (_type)
{
case Types.Weapon:
return string.Format("Dura:{0}%, PhySpec:{1}%, MagSpec:{2}%, Hit:{3}%, PhyAtk:{4}%, MagAtk:{5}%, Crit:{6}%",
DurabilityPercentage, PhyReinforcePercentage, MagReinforcePercentage, HitRatioPercentage,
PhyAttackPercentage, MagAttackPercentage, CriticalRatioPercentage);
case Types.Shield:
return string.Format("Dura:{0}%, PhySpec:{1}%, MagSpec:{2}%, Block:{3}%, PhyDef:{4}%, MagDef:{5}%",
DurabilityPercentage, PhyReinforcePercentage, MagReinforcePercentage, BlockRatioPercentage,
PhyDefensePercentage, MagDefensePercentage);
case Types.Equipment:
return string.Format("Dura:{0}%, PhySpec:{1}%, MagSpec:{2}%, PhyDef:{3}%, MagDef:{4}%, ParryRate:{5}%",
DurabilityPercentage, PhyReinforcePercentage, MagReinforcePercentage, PhyDefensePercentage,
MagDefensePercentage, ParryRatioPercentage);
case Types.Accessory:
return string.Format("PhyAbsorb:{0}%, MagAbsorb:{1}%", PhyAbsorbPercentage, MagAbsorbPercentage);
default:
return string.Empty;
}
}
//Replace this with your item class type
public enum Types
{
Weapon,
Equipment,
Shield,
Accessory
}
}
Code:
Public Class WhiteStat
' Created by Daxter (2012)
' Credits to Stratti for his awesome code example
Private _value As ULong
Public Property Value() As ULong
Get
Return _value
End Get
Set(value As ULong)
_value = value
UpdateStats()
End Set
End Property
Private _type As Types
Public ReadOnly Property Type() As Types
Get
Return _type
End Get
End Property
#Region "WhiteStat Fields"
'Weapon: Slot 0
'Armor: Slot 0
'Shield: Slot 0
Private _Durability As Byte
Public Property Durability() As Byte
Get
Return _Durability
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_Durability = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property DurabilityPercentage() As Byte
Get
Return CByte(_Durability * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_Durability = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Weapon: Slot 3
Private _HitRatio As Byte
Public Property HitRatio() As Byte
Get
Return _HitRatio
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_HitRatio = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property HitRatioPercentage() As Byte
Get
Return CByte(_HitRatio * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_HitRatio = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Armor: Slot 5
Private _ParryRatio As Byte
Public Property ParryRatio() As Byte
Get
Return _ParryRatio
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_ParryRatio = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property ParryRatioPercentage() As Byte
Get
Return CByte(_ParryRatio * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_ParryRatio = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Shield: Slot 3
Private _BlockRatio As Byte
Public Property BlockRatio() As Byte
Get
Return _BlockRatio
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_BlockRatio = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property BlockRatioPercentage() As Byte
Get
Return CByte(_BlockRatio * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_BlockRatio = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Weapon: Slot 6
Private _CriticalRatio As Byte
Public Property CriticalRatio() As Byte
Get
Return _CriticalRatio
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_CriticalRatio = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property CriticalRatioPercentage() As Byte
Get
Return CByte(_CriticalRatio * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_CriticalRatio = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Weapon: Slot 1
'Armor: Slot 1
'Shield: Slot 1
Private _PhyReinforce As Byte
Public Property PhyReinforce() As Byte
Get
Return _PhyReinforce
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_PhyReinforce = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property PhyReinforcePercentage() As Byte
Get
Return CByte(_PhyReinforce * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_PhyReinforce = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Weapon: Slot 2
'Armor: Slot 2
'Shield: Slot 2
Private _MagReinforce As Byte
Public Property MagReinforce() As Byte
Get
Return _MagReinforce
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_MagReinforce = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property MagReinforcePercentage() As Byte
Get
Return CByte(_MagReinforce * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_MagReinforce = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Weapon: Slot 4
Private _PhyAttack As Byte
Public Property PhyAttack() As Byte
Get
Return _PhyAttack
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_PhyAttack = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property PhyAttackPercentage() As Byte
Get
Return CByte(_PhyAttack * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_PhyAttack = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Weapon: Slot 5
Private _MagAttack As Byte
Public Property MagAttack() As Byte
Get
Return _MagAttack
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_MagAttack = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property MagAttackPercentage() As Byte
Get
Return CByte(_MagAttack * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_MagAttack = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Armor: Slot 3
'Shield: Slot 4
Private _PhyDefense As Byte
Public Property PhyDefense() As Byte
Get
Return _PhyDefense
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_PhyDefense = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property PhyDefensePercentage() As Byte
Get
Return CByte(_PhyDefense * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_PhyDefense = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Armor: Slot 4
'Shield: Slot 5
Private _MagDefense As Byte
Public Property MagDefense() As Byte
Get
Return _MagDefense
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_MagDefense = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property MagDefensePercentage() As Byte
Get
Return CByte(_MagDefense * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_MagDefense = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Accessory: Slot 0
Private _PhyAbsorb As Byte
Public Property PhyAbsorb() As Byte
Get
Return _PhyAbsorb
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_PhyAbsorb = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property PhyAbsorbPercentage() As Byte
Get
Return CByte(_PhyAbsorb * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_PhyAbsorb = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
'Accessory: Slot 1
Private _MagAbsorb As Byte
Public Property MagAbsorb() As Byte
Get
Return _MagAbsorb
End Get
Set(value As Byte)
If value <= 31 Then
'less or equal 31
_MagAbsorb = value
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 31")
End If
End Set
End Property
Public Property MagAbsorbPercentage() As Byte
Get
Return CByte(_MagAbsorb * 100 \ 31)
End Get
Set(value As Byte)
If value <= 100 Then
_MagAbsorb = CByte(Math.Truncate(31.0F / 100.0F * CSng(value)))
UpdateValue()
Else
Throw New System.ArgumentOutOfRangeException("value", "value must be less or equal to 100")
End If
End Set
End Property
#End Region
Public Sub New(type As Types)
Me._type = type
Me._value = 0
UpdateStats()
End Sub
Public Sub New(type As Types, input As ULong)
Me._type = type
Me._value = input
UpdateStats()
End Sub
Public Sub New(type As Types, ParamArray stats As Byte())
Me._type = type
Select Case _type
Case Types.Weapon
_Durability = stats(0)
_PhyReinforce = stats(1)
_MagReinforce = stats(2)
_HitRatio = stats(3)
_PhyAttack = stats(4)
_MagAttack = stats(5)
_CriticalRatio = stats(6)
Exit Select
Case Types.Equipment
_Durability = stats(0)
_PhyReinforce = stats(1)
_MagReinforce = stats(2)
_PhyDefense = stats(3)
_MagDefense = stats(4)
_ParryRatio = stats(5)
Exit Select
Case Types.Shield
_Durability = stats(0)
_PhyReinforce = stats(1)
_MagReinforce = stats(2)
_BlockRatio = stats(3)
_PhyDefense = stats(4)
_MagDefense = stats(5)
Exit Select
Case Types.Accessory
_PhyAbsorb = stats(0)
_MagAbsorb = stats(1)
Exit Select
End Select
UpdateValue()
End Sub
Private Sub UpdateStats()
Dim variance As ULong = Me._value
Dim counter As Byte = 0
Select Case _type
Case Types.Weapon
'7 Slots
'#Region "Weapon"
While variance > 0
Dim stat As Byte = CByte(variance And &H1F)
Select Case counter
Case 0 'Durability
_Durability = stat
Exit Select
Case 1 'Physical Reinforce
_PhyReinforce = stat
Exit Select
Case 2 'Magical Reinforce
_MagReinforce = stat
Exit Select
Case 3 'Hit Ratio (Attack Ratio)
_HitRatio = stat
Exit Select
Case 4 'Physical Attack
_PhyAttack = stat
Exit Select
Case 5 'Magical Attack
_MagAttack = stat
Exit Select
Case 6 'Critical Ratio
_CriticalRatio = stat
Exit Select
End Select
'left shit by 5
variance >>= 5
counter += 1
End While
'#End Region
Exit Select
Case Types.Equipment
'6 Slots
'#Region "Eqipment"
While variance > 0
Dim stat As Byte = CByte(variance And &H1F)
Select Case counter
Case 0 'Durability
_Durability = stat
Exit Select
Case 1 'Physical Reinforce
_PhyReinforce = stat
Exit Select
Case 2 'Magical Reinforce
_MagReinforce = stat
Exit Select
Case 3 'Physical Defense
_PhyDefense = stat
Exit Select
Case 4 'Magical Defense
_MagDefense = stat
Exit Select
Case 5 'Evasion Rate(Parry Rate)
_ParryRatio = stat
Exit Select
End Select
'left shit by 5
variance >>= 5
counter += 1
End While
'#End Region
Exit Select
Case Types.Shield
'6 Slots
'#Region "Shield"
While variance > 0
Dim stat As Byte = CByte(variance And &H1F)
Select Case counter
Case 0 'Durability
_Durability = stat
Exit Select
Case 1 'Physical Reinforce
_PhyReinforce = stat
Exit Select
Case 2 'Magical Reinforce
_MagReinforce = stat
Exit Select
Case 3 'Block Ratio
_BlockRatio = stat
Exit Select
Case 4 'Physical Defense
_PhyDefense = stat
Exit Select
Case 5 'Magical Defense
_MagDefense = stat
Exit Select
End Select
'left shit by 5
variance >>= 5
counter += 1
End While
'#End Region
Exit Select
Case Types.Accessory
'2 Slots
'#Region "Shield"
While variance > 0
Dim stat As Byte = CByte(variance And &H1F)
Select Case counter
Case 0 'Durability
_PhyAbsorb = stat
Exit Select
Case 1 'Physical Reinforce
_MagAbsorb = stat
Exit Select
End Select
'left shit by 5
variance >>= 5
counter += 1
End While
'#End Region
Exit Select
End Select
End Sub
Private Sub UpdateValue()
Dim variance As ULong = 0
Select Case _type
Case Types.Weapon
variance = variance Or _Durability
variance <<= 5
variance = variance Or _PhyReinforce
variance <<= 5
variance = variance Or _MagReinforce
variance <<= 5
variance = variance Or _HitRatio
variance <<= 5
variance = variance Or _PhyAttack
variance <<= 5
variance = variance Or _MagAttack
variance <<= 5
variance = variance Or _CriticalRatio
Exit Select
Case Types.Equipment
variance = variance Or _Durability
variance <<= 5
variance = variance Or _PhyReinforce
variance <<= 5
variance = variance Or _MagReinforce
variance <<= 5
variance = variance Or _PhyDefense
variance <<= 5
variance = variance Or _MagDefense
variance <<= 5
variance = variance Or _ParryRatio
Exit Select
Case Types.Shield
variance = variance Or _Durability
variance <<= 5
variance = variance Or _PhyReinforce
variance <<= 5
variance = variance Or _MagReinforce
variance <<= 5
variance = variance Or _BlockRatio
variance <<= 5
variance = variance Or _PhyDefense
variance <<= 5
variance = variance Or _MagDefense
Exit Select
Case Types.Accessory
variance = variance Or _PhyAbsorb
variance <<= 5
variance = variance Or _MagAbsorb
Exit Select
End Select
_value = variance
End Sub
Public Overrides Function ToString() As String
Select Case _type
Case Types.Weapon
Return String.Format("Dura:{0}%, PhySpec:{1}%, MagSpec:{2}%, Hit:{3}%, PhyAtk:{4}%, MagAtk:{5}%, Crit:{6}%", DurabilityPercentage, PhyReinforcePercentage, MagReinforcePercentage, HitRatioPercentage, PhyAttackPercentage, _
MagAttackPercentage, CriticalRatioPercentage)
Case Types.Shield
Return String.Format("Dura:{0}%, PhySpec:{1}%, MagSpec:{2}%, Block:{3}%, PhyDef:{4}%, MagDef:{5}%", DurabilityPercentage, PhyReinforcePercentage, MagReinforcePercentage, BlockRatioPercentage, PhyDefensePercentage, _
MagDefensePercentage)
Case Types.Equipment
Return String.Format("Dura:{0}%, PhySpec:{1}%, MagSpec:{2}%, PhyDef:{3}%, MagDef:{4}%, ParryRate:{5}%", DurabilityPercentage, PhyReinforcePercentage, MagReinforcePercentage, PhyDefensePercentage, MagDefensePercentage, _
ParryRatioPercentage)
Case Types.Accessory
Return String.Format("PhyAbsorb:{0}%, MagAbsorb:{1}%", PhyAbsorbPercentage, MagAbsorbPercentage)
Case Else
Return String.Empty
End Select
End Function
'Replace this with your item class type
Public Enum Types
Weapon
Equipment
Shield
Accessory
End Enum
End Class
yes i know my first post isnt correct lol. thats why i posted here to get help and if you read all other posts from those other people you have the correct way.
[Help]Editing Item Stats 12/21/2011 - Cabal Online - 2 Replies Someone know how to make something like this?:
Thor's Screenshots - Xfire
Thor's Screenshots - Xfire
If you know please share...dont matter if it works on private server or official server!
Changing item stats 01/06/2011 - CO2 Private Server - 3 Replies Hi all,
I got Kimo's source version 5095.
I want to change my item stats, I first thought that if i go into the database search for the item and then change it attack,defense etc etc it will change it in game to. So i went to cq_item and then searched for shield changed added some more defense and then saved after that I restarted the server so i want to look for the changes and i see that there are no changes. So my question is what am i doing wrong?
char stats, and item stats 01/27/2010 - Lineage 2 - 6 Replies hi all
today.. on a private server. i made a verry strange exp.....
some clannies called me to come to HS to help for pvp
as i came there i seen mass pvp arround 30 ppl
all hitted 1 person ................
a S dagger
items drago set and AS
i watched it....
he needed for everyone just 1 or 2 hits
beamed arround like hell..
Unequip item but still keep its stats 09/28/2006 - World of Warcraft - 7 Replies 1) Get the spider's kiss dagger.
2) Get 2 other weapons.
3) Equip the skd in your main hand.
4) Put one weapon in your off hand.
5) The thrid weapon in your inventory.
6) Switch the main weapon with your off hand (skd should be in your off hand now)
7) Switch your skd with your inventory weapon.
Cool You should have the bonus of your skd even though its in your inventory.