|
|
@@ -56,7 +56,7 @@ func (this *RoleBase) CopyData(base *serverproto.RoleBase) {
|
|
|
*base = *this.roleBase
|
|
|
}
|
|
|
|
|
|
-//剧情//TODO wangzhaocan 后续放入RoleCommon
|
|
|
+// 剧情//TODO wangzhaocan 后续放入RoleCommon
|
|
|
func (this *RoleBase) CopyStoryData(msgNtf *serverproto.SCRoleStoryNtf) {
|
|
|
for _, data := range this.roleBase.StoryId {
|
|
|
msgNtf.Story = append(msgNtf.Story, data)
|
|
|
@@ -175,7 +175,7 @@ func (this *RoleBase) Rename(name string) {
|
|
|
this.SetDirty(true)
|
|
|
}
|
|
|
|
|
|
-//时效性头像刷新
|
|
|
+// 时效性头像刷新
|
|
|
func (this *RoleBase) Update(ms uint64) {
|
|
|
if this.roleBase.Head_Info == nil || len(this.roleBase.Head_Info.HeadFrameList) <= 0 {
|
|
|
return
|
|
|
@@ -240,11 +240,11 @@ func (this *RoleBase) DailyReset(notify bool) uint64 {
|
|
|
this.SetDirty(true)
|
|
|
if notify {
|
|
|
ntfMsg := &serverproto.SCPayInfoNtf{
|
|
|
- TotalRecharge: this.roleBase.TotalRecharge,
|
|
|
- DayRecharge: this.roleBase.DayRecharge,
|
|
|
+ TotalRecharge: this.roleBase.TotalRecharge,
|
|
|
+ DayRecharge: this.roleBase.DayRecharge,
|
|
|
BtZhenDayRecharge: this.roleBase.BtZhenDayRecharge,
|
|
|
- BtJiaDayRecharge: this.roleBase.BtJiaDayRecharge,
|
|
|
- BtJiaTotalRecharge: this.roleBase.BtJiaTotalRecharge,
|
|
|
+ BtJiaDayRecharge: int32(float32(this.roleBase.BtJiaDayRecharge) * BTJiaChangeDollar),
|
|
|
+ BtJiaTotalRecharge: uint64(float32(this.roleBase.BtJiaTotalRecharge) * BTJiaChangeDollar),
|
|
|
}
|
|
|
this.role.ReplayGate(ntfMsg, true)
|
|
|
|
|
|
@@ -397,7 +397,7 @@ func (this *RoleBase) AddCruise(st AddItemST, add bool) bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
-//获取资源
|
|
|
+// 获取资源
|
|
|
func (this *RoleBase) GetCommonRes(resType int32) int32 {
|
|
|
for _, data := range this.roleBase.ResList {
|
|
|
if data.Key == resType {
|
|
|
@@ -407,7 +407,7 @@ func (this *RoleBase) GetCommonRes(resType int32) int32 {
|
|
|
return 0
|
|
|
}
|
|
|
|
|
|
-//default true
|
|
|
+// default true
|
|
|
func (this *RoleBase) ResetCommonRes(resType int32, notify bool) {
|
|
|
for _, data := range this.roleBase.ResList {
|
|
|
if data.Key == resType {
|
|
|
@@ -426,7 +426,7 @@ func (this *RoleBase) ResetCommonRes(resType int32, notify bool) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//添加资源
|
|
|
+// 添加资源
|
|
|
func (this *RoleBase) AddCommonRes(resType int32, st AddItemST, add bool) bool {
|
|
|
resValue := st.ItemCount
|
|
|
if resValue <= 0 || resValue >= math.MaxInt32 {
|
|
|
@@ -523,15 +523,15 @@ func (this *RoleBase) AddBtJiaRecharge(val int32) {
|
|
|
TotalRecharge: this.roleBase.TotalRecharge,
|
|
|
DayRecharge: this.roleBase.DayRecharge,
|
|
|
BtZhenDayRecharge: this.roleBase.BtZhenDayRecharge,
|
|
|
- BtJiaDayRecharge: this.roleBase.BtJiaDayRecharge,
|
|
|
- BtJiaTotalRecharge: this.roleBase.BtJiaTotalRecharge,
|
|
|
+ BtJiaDayRecharge: int32(float32(this.roleBase.BtJiaDayRecharge) * BTJiaChangeDollar),
|
|
|
+ BtJiaTotalRecharge: uint64(float32(this.roleBase.BtJiaTotalRecharge) * BTJiaChangeDollar),
|
|
|
}
|
|
|
this.role.ReplayGate(ntfMsg, true)
|
|
|
|
|
|
TaskMagCheck(this.role, serverproto.TaskType_BT_ZhenJiaRecharge, val)
|
|
|
}
|
|
|
|
|
|
-//增加累计充值
|
|
|
+// 增加累计充值
|
|
|
func (this *RoleBase) AddPayRecharge(payRewardInfo *serverproto.PayOrderSaveInfo) {
|
|
|
amount := payRewardInfo.Amount
|
|
|
if amount <= 0.00001 {
|
|
|
@@ -560,8 +560,8 @@ func (this *RoleBase) AddPayRecharge(payRewardInfo *serverproto.PayOrderSaveInfo
|
|
|
TotalRecharge: this.roleBase.TotalRecharge,
|
|
|
DayRecharge: this.roleBase.DayRecharge,
|
|
|
BtZhenDayRecharge: this.roleBase.BtZhenDayRecharge,
|
|
|
- BtJiaDayRecharge: this.roleBase.BtJiaDayRecharge,
|
|
|
- BtJiaTotalRecharge: this.roleBase.BtJiaTotalRecharge,
|
|
|
+ BtJiaDayRecharge: int32(float32(this.roleBase.BtJiaDayRecharge) * BTJiaChangeDollar),
|
|
|
+ BtJiaTotalRecharge: uint64(float32(this.roleBase.BtJiaTotalRecharge) * BTJiaChangeDollar),
|
|
|
}
|
|
|
this.role.ReplayGate(ntfMsg, true)
|
|
|
util.InfoF("uid=%v AddPayRecharge old=%v new=%v add=%v", this.role.GetUUid(), oldVal, this.roleBase.TotalRecharge, amount)
|
|
|
@@ -739,7 +739,7 @@ func (this *RoleBase) OnlineTimeReward() serverproto.ErrorCode {
|
|
|
return serverproto.ErrorCode_ERROR_OK
|
|
|
}
|
|
|
|
|
|
-//离线时处理在线时间加成
|
|
|
+// 离线时处理在线时间加成
|
|
|
func (this *RoleBase) OfflineOnlineTimeProcess() {
|
|
|
nowTime := util.GetTimeMilliseconds()
|
|
|
//计算当天累计在线时间
|
|
|
@@ -757,7 +757,7 @@ func (this *RoleBase) OfflineOnlineTimeProcess() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//隔天领取之前天未领取的奖励
|
|
|
+// 隔天领取之前天未领取的奖励
|
|
|
func (this *RoleBase) onlineTImeRewardAll(nowTime uint64) {
|
|
|
curDiffDay := util.GetDurationDay2(this.role.RegisterTime, nowTime) - 1
|
|
|
if curDiffDay <= 0 {
|
|
|
@@ -820,7 +820,7 @@ func (this *RoleBase) FashionChangeNtf() {
|
|
|
//this.role.ReplayGate(ntfMsg, true)
|
|
|
}
|
|
|
|
|
|
-//更新玩家简介信息
|
|
|
+// 更新玩家简介信息
|
|
|
func (this *RoleBase) UpdatePlayerBriefInfo(bOffline bool) {
|
|
|
ssMsg := &serverproto.SSRoleBriefInfoSaveReq{
|
|
|
BriefInfo: &serverproto.CommonPlayerBriefInfo{
|
|
|
@@ -856,7 +856,7 @@ func (this *RoleBase) UpdatePlayerBriefInfo(bOffline bool) {
|
|
|
this.role.SendDb(ssMsg)
|
|
|
}
|
|
|
|
|
|
-//是否是可重置的属性点类型
|
|
|
+// 是否是可重置的属性点类型
|
|
|
func (this *RoleBase) isAttrPointType(attrKey int32) bool {
|
|
|
key := serverproto.Attr(attrKey)
|
|
|
if key == serverproto.Attr_Str || key == serverproto.Attr_Agi || key == serverproto.Attr_Int ||
|
|
|
@@ -866,7 +866,7 @@ func (this *RoleBase) isAttrPointType(attrKey int32) bool {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-//主角经验 + 升级
|
|
|
+// 主角经验 + 升级
|
|
|
func (this *RoleBase) AddBaseExp(st AddItemST) int32 {
|
|
|
exp := st.ItemCount
|
|
|
if exp <= 0 || exp >= math.MaxInt32 {
|
|
|
@@ -981,7 +981,7 @@ func (this *RoleBase) processLevelState(oldLevel int32, newLevel int32) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//返回改变的等级
|
|
|
+// 返回改变的等级
|
|
|
func (this *RoleBase) AddJobExp(st AddItemST) int32 {
|
|
|
exp := st.ItemCount
|
|
|
if exp <= 0 || exp >= math.MaxInt32 {
|
|
|
@@ -1061,7 +1061,7 @@ func (this *RoleBase) AddJobExp(st AddItemST) int32 {
|
|
|
return changLevel
|
|
|
}
|
|
|
|
|
|
-//根据类型获得具体部位索引
|
|
|
+// 根据类型获得具体部位索引
|
|
|
func (this *RoleBase) GetSlotIndexByType(slotType int32) int32 {
|
|
|
switch slotType {
|
|
|
case Equip_Type_Head:
|
|
|
@@ -1158,7 +1158,7 @@ func (this *RoleBase) EquipUp(heroId int32, slotIndex int32, equipId int32) serv
|
|
|
return serverproto.ErrorCode_ERROR_OK
|
|
|
}
|
|
|
|
|
|
-//任意N件装备精炼等级达到X级
|
|
|
+// 任意N件装备精炼等级达到X级
|
|
|
func (this *RoleBase) GetEquipSlotLevelNum(equipLevel int32) int32 {
|
|
|
var retNum int32 = 0
|
|
|
|
|
|
@@ -1171,7 +1171,7 @@ func (this *RoleBase) GetEquipSlotLevelNum(equipLevel int32) int32 {
|
|
|
return retNum
|
|
|
}
|
|
|
|
|
|
-//任意N件装备精炼等级达到X级
|
|
|
+// 任意N件装备精炼等级达到X级
|
|
|
func (this *RoleBase) GetEquipSlotLevelRoleCnt(equipLevel int32) int32 {
|
|
|
var retNum int32 = 0
|
|
|
all := false
|
|
|
@@ -1617,7 +1617,7 @@ func (this *RoleBase) SetFightPower(fightPower uint32) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//设置头像
|
|
|
+// 设置头像
|
|
|
func (this *RoleBase) SetRoleHeadPic(headId int32) serverproto.ErrorCode {
|
|
|
bRet := this.CheckHeadUnlock(headId)
|
|
|
if bRet && this.roleBase.RoleData.HeadId != headId && headId != 0 {
|
|
|
@@ -1628,7 +1628,7 @@ func (this *RoleBase) SetRoleHeadPic(headId int32) serverproto.ErrorCode {
|
|
|
return serverproto.ErrorCode_ERROR_FAIL
|
|
|
}
|
|
|
|
|
|
-//请求头像信息
|
|
|
+// 请求头像信息
|
|
|
func (this *RoleBase) HeadInfoReq() {
|
|
|
ackMsg := &serverproto.SCHeadInfoAck{}
|
|
|
|
|
|
@@ -1640,7 +1640,7 @@ func (this *RoleBase) HeadInfoReq() {
|
|
|
this.role.ReplayGate(ackMsg, true)
|
|
|
}
|
|
|
|
|
|
-//请求激活头像
|
|
|
+// 请求激活头像
|
|
|
func (this *RoleBase) ActiveHead(headId int32) serverproto.ErrorCode {
|
|
|
//检查headId是否已经被激活
|
|
|
if bRet := this.CheckHeadUnlock(headId); bRet {
|
|
|
@@ -1754,7 +1754,7 @@ func (this *RoleBase) HeadFrameChangeNtf(headFrame []*serverproto.HeadFrameData)
|
|
|
this.role.ReplayGate(ntfMsg, true)
|
|
|
}
|
|
|
|
|
|
-//检查头像任务是否激活
|
|
|
+// 检查头像任务是否激活
|
|
|
func (this *RoleBase) CheckHeadUnlock(headId int32) bool {
|
|
|
for _, data := range this.roleBase.Head_Info.HeadList {
|
|
|
if data == headId {
|