示例#1
0
        /// <summary>
        /// Send level up packet to client and update database
        /// </summary>
        /// <param name="client">The MapClient</param>
        /// <param name="type">The LevelType that gained level(s)</param>
        /// <param name="numLevels">The number of levels gained</param>
        private void SendLevelUp(MapClient client, LevelType type, uint numLevels)
        {
            //Update DB
            Packets.Server.LevelUp sendPacket = new SagaMap.Packets.Server.LevelUp();
            sendPacket.SetLevelType((byte)type);
            sendPacket.SetActorID(client.Char.id);
            sendPacket.SetLevels(1);
            client.netIO.SendPacket(sendPacket, client.SessionID);
            switch (type)
            {
            case LevelType.CLEVEL:
                SagaMap.Skills.SkillHandler.CalcHPSP(ref client.Char);
                client.Char.HP        = client.Char.maxHP;
                client.Char.SP        = client.Char.maxSP;
                client.Char.cLevel   += numLevels;
                client.Char.stpoints += (byte)(2 * numLevels);                          // TODO implement getting this from level configuration
                client.SendBattleStatus();
                client.SendCharStatus(0);
                client.SendExtStats();
                break;

            case LevelType.JLEVEL:
                client.Char.jLevel += numLevels;
                client.Char.HP      = client.Char.maxHP;
                client.Char.SP      = client.Char.maxSP;
                client.SendCharStatus(0);
                break;
            }

            Logger.ShowInfo(client.Char.name + " gained " + numLevels + "x" + type.ToString(), null);

            //if (client.Party != null)
            //    client.Party.UpdateMemberInfo(client);
        }
示例#2
0
 public override void CallBack(object o)
 {
     ClientManager.EnterCriticalArea();
     if (client.Char.HP == client.Char.maxHP && client.Char.SP == client.Char.maxSP)
     {
         ClientManager.LeaveCriticalArea();
         return;
     }
     if (client.Char.state == 1)
     {
         try
         {
             if (this.sp != 0)
             {
                 client.Char.SP = (ushort)(client.Char.SP + this.sp + client.Char.BattleStatus.spregbonus + client.Char.BattleStatus.spregskill);
             }
             if (client.Char.SP > client.Char.maxSP)
             {
                 client.Char.SP = client.Char.maxSP;
             }
             client.SendCharStatus(0);
         }
         catch (Exception ex)
         {
             Logger.ShowError(ex);
         }
         ClientManager.LeaveCriticalArea();
         return;
     }
     if (client.Char.stance == Global.STANCE.DIE)
     {
         ClientManager.LeaveCriticalArea();
         return;
     }
     try
     {
         if (this.hp != 0)
         {
             client.Char.HP = (ushort)(client.Char.HP + this.hp + client.Char.BattleStatus.hpregbonus + client.Char.BattleStatus.spregskill);
         }
         if (this.sp != 0)
         {
             client.Char.SP = (ushort)(client.Char.SP + this.sp + client.Char.BattleStatus.spregbonus + client.Char.BattleStatus.hpregskill);
         }
         if (client.Char.HP > client.Char.maxHP)
         {
             client.Char.HP = client.Char.maxHP;
         }
         if (client.Char.SP > client.Char.maxSP)
         {
             client.Char.SP = client.Char.maxSP;
         }
         client.SendCharStatus(0);
     }
     catch (Exception ex)
     {
         Logger.ShowError(ex);
     }
     ClientManager.LeaveCriticalArea();
 }
示例#3
0
 public override void  CallBack(object o)
 {
     ClientManager.EnterCriticalArea();
     if (this.client.Char.state == 1)
     {
         //donot recover during combat
         ClientManager.LeaveCriticalArea();
         return;
     }
     if (client.Char.LP > 0)
     {
         client.Char.LP--;
         client.SendCharStatus(0);
     }
     ClientManager.LeaveCriticalArea();
 }