GetLevelDataByLevel() public static method

public static GetLevelDataByLevel ( byte Level ) : Level_
Level byte
return Level_
Esempio n. 1
0
        private static bool CheckIfNewLevel(int Index_, ulong EXP)
        {
            Silkroad.Level_ tmpLevel = Silkroad.GetLevelDataByLevel(Player.Stats[Index_].Level);
            bool            tmpBool  = false;
            long            tmpLong  = (long)EXP + (long)Player.Stats[Index_].Experience;

            for (byte i = 0; i < 255; i++)
            {
                tmpLong = (long)tmpLevel.Experience - (long)tmpLong;
                if (tmpLong > 0)
                {
                    if (i == 0)
                    {
                        Player.Stats[Index_].Experience += (ulong)EXP;
                    }
                    else
                    {
                        Player.Stats[Index_].Experience += (ulong)(tmpLevel.Experience - (ulong)tmpLong);
                    }
                    return(tmpBool);
                }

                else if (tmpLong <= 0)
                {
                    Player.Stats[Index_].Experience = 0;
                    tmpBool  = true;
                    tmpLong *= -1;
                    Player.Stats[Index_].Attributes += 3;
                    Player.Stats[Index_].Level++;
                    tmpLevel = Silkroad.GetLevelDataByLevel(Player.Stats[Index_].Level);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public static void OnMasteryUpdate(PacketReader reader_, int Index_)
        {
            uint mastery = reader_.ReadDword();

            int[] CharacterMasteryIndex = DatabaseCore.Mastery.GetIndexByName(Player.General[Index_].CharacterName, Player.Stats[Index_].Model >= 14717);

            byte CurrentMasteryIndex = 0;

            for (byte i = 0; i < CharacterMasteryIndex.Length; i++)
            {
                if (DatabaseCore.Mastery.MasteryId[CharacterMasteryIndex[i]] == mastery)
                {
                    CurrentMasteryIndex = i;
                }
            }
            ulong sp_required = Silkroad.GetLevelDataByLevel(DatabaseCore.Mastery.MasteryLevel[CharacterMasteryIndex[CurrentMasteryIndex]]).Skillpoints;

            if (Player.Stats[Index_].Skillpoints >= sp_required)
            {
                DatabaseCore.Mastery.MasteryLevel[CharacterMasteryIndex[CurrentMasteryIndex]]++;
                Player.Stats[Index_].Skillpoints -= (uint)sp_required;
                SPUpdate(Index_);

                writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_MASTERYUPDATE);
                writer.AppendByte(1);
                writer.AppendDword(mastery);
                writer.AppendByte(DatabaseCore.Mastery.MasteryLevel[CharacterMasteryIndex[CurrentMasteryIndex]]);
                ServerSocket.Send(writer.getWorkspace(), Index_);

                DatabaseCore.WriteQuery("UPDATE mastery SET level='{0}' WHERE mastery='{1}' AND owner='{2}'", DatabaseCore.Mastery.MasteryLevel[CharacterMasteryIndex[CurrentMasteryIndex]], mastery, Player.General[Index_].CharacterName);
            }
        }