开发者文档

API

等级模块所对外暴露的所有API

    /**
     * 查询玩家等级信息
     * @param uuid 玩家ID
     * @return 玩家等级信息
     */
    IUserLevel getUserLevel(String uuid);

    /**
     * 获取指定等级升级所需经验
     * @param uuid 玩家UUIID字符串
     * @param level 等级
     * @throws NumberParseException 抛出算式解析异常
     * @return 指定等级升级所需经验
     */
    Long getNeededExpByLevel(String uuid , int level) throws NumberParseException;

    /**
     * 获取经验百分比
     * @param uuid 玩家ID
     * @return 获取经验百分比
     */
    Integer getExpPercentage(String uuid);

    /**
     * 获取服务器最大等级值
     * @return 获取服务器最大等级值
     */
    Integer getServerMaxLevel();

    /**
     * 为指定玩家增加经验
     * @param uuid 玩家ID
     * @param exp 经验值
     * @param sourceType 经验来源类型
     * @param isEvent 是否经过监听器
     * @throws ServiceErrorSendMsgException 程序遇到错误,异常中保存了需要对该玩家输出的信息
     */
    void addExp(String uuid , long exp , SourceType sourceType , boolean isEvent) throws ServiceErrorSendMsgException;

    /**
     * 为指定玩家减少经验
     * @param uuid 玩家ID
     * @param exp 经验值
     * @param sourceType 经验来源类型
     * @param isEvent 是否经过监听器
     * @throws ServiceErrorSendMsgException 程序遇到错误,异常中保存了需要对该玩家输出的信息
     */
    void dropExp(String uuid , long exp , SourceType sourceType , boolean isEvent) throws ServiceErrorSendMsgException;

    /**
     * 为指定玩家增加等级
     * @param uuid 玩家ID
     * @param level 等级
     * @throws ServiceErrorSendMsgException 程序遇到错误,异常中保存了需要对该玩家输出的信息
     */
    void addLevel(String uuid , int level) throws ServiceErrorSendMsgException;

    /**
     * 为指定玩家减少等级
     * @param uuid 玩家ID
     * @param level 等级
     * @throws ServiceErrorSendMsgException 程序遇到错误,异常中保存了需要对该玩家输出的信息
     */
    void dropLevel(String uuid , int level) throws ServiceErrorSendMsgException;

    /**
     * 获取服务器多倍经验数据
     * @return 获取服务器多倍经验数据
     */
    IServerMultipleExp getServerMultipleExp();

    /**
     * 获取玩家多倍经验数据
     * @param uuid 玩家ID
     * @return 获取玩家多倍经验数据
     */
    IUserMultipleExp getUserMultipleExpById(String uuid);

    /**
     * 获取服务器多倍经验是否结束
     * @return 获取服务器多倍经验是否结束
     */
    boolean isServerMultipleExpOutTime();

    /**
     * 获取玩家多倍经验是否结束
     * @param uuid 玩家ID
     * @return 获取玩家多倍经验是否结束
     */
    boolean isUserMultipleExpOutTime(String uuid);

    /**
     * 根据传入的经验值实时计算当前玩家与服务器的多倍经验影响后的值
     * @param uuid 玩家ID
     * @param exp 获得的经验值
     * @return 获取用户多倍经验后的经验值
     */
    long getMultipleExp(String uuid , double exp);

    /**
     * 获取玩家下级所需经验值
     * @param uuid 玩家ID
     * @return 玩家下级所需经验值
     * @throws ServiceErrorSendMsgException 程序遇到错误,异常中保存了需要对该玩家输出的信息
     * @throws NumberParseException 抛出算式解析异常
     */
    long getNeededExpByUuid(String uuid) throws ServiceErrorSendMsgException, NumberParseException;

事件

类名说明

ExpChangeEvent

经验变动事件

LevelChangeEvent

等级变动事件

Last updated