This commit is contained in:
liwei1dao 2024-02-07 16:49:50 +08:00
commit caa8f1cb83
4 changed files with 436 additions and 336 deletions

View File

@ -525,10 +525,10 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
x = make(map[int]struct{}) x = make(map[int]struct{})
switch skillid { switch skillid {
case 1: case 1: // 随机一组数
randNum := utils.RandomNumbers(0, Total-1, int(value)*2) randNum := utils.RandomNumbers(0, Total-1, int(value)*2)
for _, v := range randNum { for _, v := range randNum {
if this.Plat[v].Special > 0 { if this.Plat[v].Special == 0 {
ids = append(ids, v) ids = append(ids, v)
if len(ids) >= int(value) { if len(ids) >= int(value) {
break break

View File

@ -113,11 +113,12 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
uinfo := comm.GetUserBaseInfo(user) uinfo := comm.GetUserBaseInfo(user)
if !reflect.DeepEqual(uinfo, list.Uinfo) { if !reflect.DeepEqual(uinfo, list.Uinfo) {
list.Uinfo = uinfo
update["uinfo"] = uinfo update["uinfo"] = uinfo
// 同步岛屿上的信息 // 同步岛屿上的信息
var lock *redis.RedisMutex var lock *redis.RedisMutex
lock, err = this.module.modelLand.landMutexLock(list.Landid) lock, err = this.module.modelLand.landMutexLock(list.Landid)
lock.Lock() err = lock.Lock()
if err != nil { if err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, Code: pb.ErrorCode_DBError,
@ -128,16 +129,16 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PlunderGetListRe
} }
defer lock.Unlock() defer lock.Unlock()
for _, v := range land.Uinfo { for pos, v := range land.Uinfo {
if v == list.Uinfo { if v.Uid == uinfo.Uid {
v = uinfo land.Uinfo[pos] = uinfo
this.module.modelLand.changePlunderLandData(list.Landid, map[string]interface{}{ this.module.modelLand.changePlunderLandData(list.Landid, map[string]interface{}{
"uinfo": land.Uinfo, "uinfo": land.Uinfo,
}) })
break break
} }
} }
list.Uinfo = uinfo
} }
} }
if len(update) > 0 { if len(update) > 0 {

View File

@ -1,6 +1,7 @@
package plunder package plunder
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/mgo" "go_dreamfactory/lego/sys/mgo"
@ -75,6 +76,10 @@ func (this *modelPlunder) getPlunderData(session comm.IUserSession) (info *pb.DB
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
if user.Name == "" { // 临时处理没创角不让进 后面走功能开启配置
err = fmt.Errorf("getPlunderData need create ")
return
}
info = &pb.DBPlunder{ info = &pb.DBPlunder{
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(), Uid: session.GetUserId(),

File diff suppressed because it is too large Load Diff