// 超级管理员操作 private OpRes doScoreSuperAdmin(ParamScore p, long score, GMUser user) { OpRes res = OpRes.op_res_failed; if (p.isAddScore()) // 加分 { if (p.isToPlayer()) { res = addScorePlayer(p, score, user); } else { res = addScore(p.m_toAcc, score, user); } } else { if (p.isToPlayer()) { res = decScorePlayer(p, score, user); } else { res = decScore(p.m_toAcc, score, user); } } if (res == OpRes.opres_success) { addScoreToOnlineGM(p, score); scoreLog(TableName.GM_SCORE, p, score, user); } return(res); }
private void addScoreToOnlineGM(ParamScore p, long score) { GMUser dstUser = AccountSys.getInstance().getUser(p.m_toAcc); if (dstUser != null) { if (p.isAddScore()) { dstUser.m_money += score; } else { dstUser.m_money -= score; } } }
private OpRes doScore(ParamScore p, long score, GMUser user) { OpRes res = OpRes.op_res_failed; if (p.isAddScore()) // 加分 { if (user.m_money < score) { return(OpRes.op_res_money_not_enough); } res = addScore(p.m_toAcc, score, user); if (res == OpRes.opres_success) { addScoreToOnlineGM(p, score); user.m_money -= score; decScoreDirect(user.m_user, score, user); } } else { res = decScore(p.m_toAcc, score, user); if (res == OpRes.opres_success) { addScoreToOnlineGM(p, score); user.m_money += score; addScoreDirect(user.m_user, score, user); } } if (res == OpRes.opres_success) { scoreLog(TableName.GM_SCORE, p, score, user); } return(res); }
private OpRes doScorePlayer(ParamScore p, long score, GMUser user) { OpRes res = OpRes.op_res_failed; if (p.isAddScore()) // 加分 { if (user.m_money < score) { return(OpRes.op_res_money_not_enough); } res = addScorePlayer(p, score, user); if (res == OpRes.opres_success || res == OpRes.op_res_player_in_game) // 玩家在线时,先扣gm的钱,若实时给玩家加分失败,订单服务器会返还这部分钱 { user.m_money -= score; decScoreDirect(user.m_user, score, user); } } else { res = decScorePlayer(p, score, user); if (res == OpRes.opres_success) // 玩家在线时,先实时给扣玩家分数,成功后,订单服务器会返还这部分钱 { user.m_money += score; addScoreDirect(user.m_user, score, user); } } if (res == OpRes.opres_success) { scoreLog(TableName.GM_SCORE, p, score, user); } return(res); }