public void Mastery_Up()
{
try
{
List<byte> Masteries = new List<byte>();
MsSQL mastery = new MsSQL("SELECT * FROM mastery WHERE owner='"+Character.Information.CharacterID+"'");
using (SqlDataReader reader = mastery.Read())
{
while (reader.Read())
{
Masteries.Add(reader.GetByte(2));
}
}
int totalmastery = 0;
int masterylimit = 360;
bool euchar = false;
if (Character.Information.Model >= 10000 && Character.Information.Model <= 16000)
{
masterylimit = 239;
euchar = true;
}
for(int i = 0;i < Masteries.Count;i++)
{
totalmastery += Masteries[i];
}
if (totalmastery <= masterylimit)
{
if (!Character.Action.upmasterytimer)
{
Character.Action.upmasterytimer = true;
MasteryupTimer(150);
PacketReader Reader = new PacketReader(PacketInformation.buffer);
int masteryid = Reader.Int32();
byte level = Reader.Byte();
byte m_index = MasteryGet(masteryid);
if (m_index == 0)
{
return;
}
if (!(Character.Information.SkillPoint < Data.MasteryBase[Character.Stat.Skill.Mastery_Level[m_index]]))
{
if (euchar == true)
{
if (Character.Stat.Skill.Mastery_Level[m_index] < Character.Information.Level)
{
Character.Stat.Skill.Mastery_Level[m_index]++;
Character.Information.SkillPoint -= Data.MasteryBase[Character.Stat.Skill.Mastery_Level[m_index]];
client.Send(Packet.InfoUpdate(2, Character.Information.SkillPoint, 0));
client.Send(Packet.MasteryUpPacket(masteryid, Character.Stat.Skill.Mastery_Level[m_index]));
SaveMaster();
}
}
else
{
if (Character.Stat.Skill.Mastery_Level[m_index] < Character.Information.Level)
{
if (!(Character.Stat.Skill.Mastery_Level[m_index] == 120))
{
Character.Stat.Skill.Mastery_Level[m_index]++;
Character.Information.SkillPoint -= Data.MasteryBase[Character.Stat.Skill.Mastery_Level[m_index]];
client.Send(Packet.InfoUpdate(2, Character.Information.SkillPoint, 0));
client.Send(Packet.MasteryUpPacket(masteryid, Character.Stat.Skill.Mastery_Level[m_index]));
SaveMaster();
}
}
}
}
}
}
else
{
//client.Send(Packet.IngameMessages(SERVER_ACTIONSTATE, IngameMessages.UIIT_STT_SKILL_LEARN_MASTERY_TOTAL_LIMIT));
return;
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}