Example #1
0
 public void IncreaseSpellExperience(uint experience, ushort id)
 {
     if (Spells.ContainsKey(id))
     {
         switch (id)
         {
             case 1290:
             case 5030:
             case 7030:
                 experience = 100; break;
         }
         experience *= ServerBase.Constants.ExtraSpellRate;
         experience += experience * Entity.Gems[6] / 100;
         if (Map.BaseID == 1039)
             experience /= 40;
         Interfaces.ISkill spell = Spells[id];
         if (spell == null)
             return;
         //if (Entity.VIPLevel > 0)
         //{
         //    experience *= 5;
         //}
         Database.SpellInformation spellInfo = Database.SpellTable.SpellInformations[spell.ID][spell.Level];
         if (spellInfo != null)
         {
             if (spellInfo.NeedExperience != 0 && Entity.Level >= spellInfo.NeedLevel)
             {
                 spell.Experience += experience;
                 bool leveled = false;
                 if (spell.Experience >= spellInfo.NeedExperience)
                 {
                     spell.Experience = 0;
                     spell.Level++;
                     leveled = true;
                     Send(ServerBase.Constants.SpellLeveled);
                 }
                 if (leveled)
                 {
                     spell.Send(this);
                 }
                 else
                 {
                     Network.GamePackets.SkillExperience update = new SkillExperience(true);
                     update.AppendSpell(spell.ID, spell.Experience);
                     update.Send(this);
                 }
             }
         }
     }
 }
Example #2
0
 public void IncreaseProficiencyExperience(uint experience, ushort id)
 {
     if (Proficiencies.ContainsKey(id))
     {
         Interfaces.ISkill proficiency = Proficiencies[id];
         experience *= ServerBase.Constants.ExtraProficiencyRate;
         experience += experience * Entity.Gems[5] / 100;
         if (Map.BaseID == 1039)
             experience /= 40;
         //if (Entity.VIPLevel > 0)
         //{
         //    experience *= 5;
         //}
         proficiency.Experience += experience;
         if (proficiency.Level < 20)
         {
             bool leveled = false;
             while (proficiency.Experience >= Database.DataHolder.ProficiencyLevelExperience(proficiency.Level))
             {
                 proficiency.Experience -= Database.DataHolder.ProficiencyLevelExperience(proficiency.Level);
                 proficiency.Level++;
                 if (proficiency.Level == 20)
                 {
                     proficiency.Experience = 0;
                     proficiency.Send(this);
                     Send(ServerBase.Constants.ProficiencyLeveled);
                     return;
                 }
                 leveled = true;
                 Send(ServerBase.Constants.ProficiencyLeveled);
             }
             if (leveled)
             {
                 proficiency.Send(this);
             }
             else
             {
                 Network.GamePackets.SkillExperience update = new SkillExperience(true);
                 update.AppendProficiency(proficiency.ID, proficiency.Experience, Database.DataHolder.ProficiencyLevelExperience(proficiency.Level));
                 update.Send(this);
             }
         }
     }
     else
     {
         AddProficiency(new Network.GamePackets.Proficiency(true) { ID = id });
     }
 }