عرض مشاركة واحدة
قديم 2021-07-28, 04:09 PM
المشاركة 7
disco0o
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: مشكله نجوم الاسكلات
كود:
static void LevelUpSpell

ابعتلي الفويد دا
static void LevelUpSpell(Data generalData, Client.GameState client)
{
if (client.Trade.InTrade)
return;
ushort spellID = (ushort)generalData.dwParam;
Interfaces.ISkill spell = null;
if (client.Spells.TryGetValue(spellID, out spell))
{
var spellInfo = Database.SpellTable.GetSpell(spellID, client);
if (spellInfo != null)
{
if (spellInfo.CPCost != 0)
{
uint cpCost = spellInfo.CPCost;
int max = Math.Max((int)spell.Experience, 1);
int percentage = 100 - (int)(max / Math.Max((spellInfo.NeedExperience / 100), 1));
cpCost = (uint)(cpCost * percentage / 100);
if (client.Entity.ConquerPoints >= cpCost)
{
client.Entity.ConquerPoints -= cpCost;
spell.Level++;
if (spell.Level == spell.PreviousLevel / 2)
spell.Level = spell.PreviousLevel;
spell.Experience = 0;
spell.Send(client);
}
}
else
{
uint cpCost = 5000;
int max = Math.Max((int)spell.Experience, 1);
int percentage = 100 - (int)(max / Math.Max((spellInfo.NeedExperience / 100), 1));
cpCost = (uint)(cpCost * percentage / 100);
if (client.Entity.ConquerPoints >= cpCost)
{
client.Entity.ConquerPoints -= cpCost;
spell.Level++;
if (spell.Level == spell.PreviousLevel / 2)
spell.Level = spell.PreviousLevel;
spell.Experience = 0;
spell.Send(client);
}
}
}
}
}