Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
4efb6a2ce1
@ -261,7 +261,7 @@
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 2,
|
||||
@ -675,7 +675,7 @@
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 0,
|
||||
@ -836,7 +836,7 @@
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 0,
|
||||
@ -859,7 +859,7 @@
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 0,
|
||||
@ -882,7 +882,7 @@
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 2,
|
||||
@ -974,7 +974,7 @@
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 1,
|
||||
@ -1365,7 +1365,7 @@
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 1,
|
||||
@ -1598,7 +1598,12 @@
|
||||
"key": "num_3008",
|
||||
"text": "经验副本"
|
||||
},
|
||||
"main": [],
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 1
|
||||
}
|
||||
],
|
||||
"wkqbx": 0,
|
||||
"kqbx": 0,
|
||||
"img": "",
|
||||
@ -1653,7 +1658,53 @@
|
||||
"text": ""
|
||||
},
|
||||
"uiid": 0,
|
||||
"activateType": 2,
|
||||
"activateType": 0,
|
||||
"notify": []
|
||||
},
|
||||
{
|
||||
"id": "userset",
|
||||
"name": {
|
||||
"key": "num_3008",
|
||||
"text": "设置"
|
||||
},
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 0,
|
||||
"kqbx": 0,
|
||||
"img": "",
|
||||
"prompt": {
|
||||
"key": "opencond_prompt_hero",
|
||||
"text": "功能暂未开启"
|
||||
},
|
||||
"uiid": 0,
|
||||
"activateType": 0,
|
||||
"notify": []
|
||||
},
|
||||
{
|
||||
"id": "vip",
|
||||
"name": {
|
||||
"key": "num_3009",
|
||||
"text": "vip"
|
||||
},
|
||||
"main": [
|
||||
{
|
||||
"key": 1,
|
||||
"param": 9999
|
||||
}
|
||||
],
|
||||
"wkqbx": 0,
|
||||
"kqbx": 0,
|
||||
"img": "",
|
||||
"prompt": {
|
||||
"key": "opencond_prompt_hero",
|
||||
"text": "功能暂未开启"
|
||||
},
|
||||
"uiid": 0,
|
||||
"activateType": 0,
|
||||
"notify": []
|
||||
}
|
||||
]
|
@ -55,6 +55,8 @@ type (
|
||||
BuyUnifiedTicket(session IUserSession, buynum int32) (code pb.ErrorCode)
|
||||
///刷新恢复入场券
|
||||
RecoverTicket(session IUserSession) (code pb.ErrorCode)
|
||||
//出售道具
|
||||
SellItem(session IUserSession, items map[string]int32) (code pb.ErrorCode, atno []*pb.UserAtno)
|
||||
}
|
||||
|
||||
//英雄
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
@ -188,6 +189,73 @@ func (this *Items) RecoverTicket(session comm.IUserSession) (code pb.ErrorCode)
|
||||
return
|
||||
}
|
||||
|
||||
//出售道具
|
||||
func (this *Items) SellItem(session comm.IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode, atno []*pb.UserAtno) {
|
||||
var (
|
||||
grids []string = make([]string, 0, len(items))
|
||||
_itmes []*pb.DB_UserItemData
|
||||
itemcf *cfg.GameItemData
|
||||
_grids map[string]*pb.DB_UserItemData = make(map[string]*pb.DB_UserItemData)
|
||||
sale []*cfg.Gameatn = make([]*cfg.Gameatn, 0)
|
||||
change []*pb.DB_UserItemData = make([]*pb.DB_UserItemData, 0)
|
||||
g *pb.DB_UserItemData
|
||||
err error
|
||||
ok bool
|
||||
)
|
||||
for k, _ := range items {
|
||||
grids = append(grids, k)
|
||||
}
|
||||
if _itmes, err = this.modelItems.QueryUserPackByGridIds(session.GetUserId(), grids); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
for _, v := range _itmes {
|
||||
_grids[v.GridId] = v
|
||||
}
|
||||
|
||||
for k, v := range items {
|
||||
if g, ok = _grids[k]; ok {
|
||||
if int32(g.Amount) <= v {
|
||||
if itemcf, err = this.configure.GetItemConfigure(g.ItemId); err != nil {
|
||||
code = pb.ErrorCode_ConfigurationException
|
||||
return
|
||||
}
|
||||
if itemcf.Sale == nil || len(itemcf.Sale) == 0 {
|
||||
code = pb.ErrorCode_ItemsUseNoCanSell
|
||||
return
|
||||
}
|
||||
for _, v1 := range itemcf.Sale {
|
||||
temp := *v1
|
||||
temp.N = v1.N * v
|
||||
sale = append(sale, &temp)
|
||||
}
|
||||
g.Amount -= uint32(v)
|
||||
if g.Amount > 0 {
|
||||
this.modelItems.UpdateUserPack(session.GetUserId(), g)
|
||||
} else {
|
||||
this.modelItems.DeleteUserPack(session.GetUserId(), g)
|
||||
}
|
||||
change = append(change, g)
|
||||
} else {
|
||||
code = pb.ErrorCode_ItemsNoEnough
|
||||
return
|
||||
}
|
||||
} else {
|
||||
code = pb.ErrorCode_ItemsNoFoundGird
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if code, atno = this.DispenseAtno(session, sale, bPush); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if len(change) > 0 && bPush {
|
||||
this.itemsChangePush(session, change) //推送道具背包变化
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//Evens--------------------------------------------------------------------------------------------------------------------------------
|
||||
//推送道具变化消息
|
||||
func (this *Items) itemsChangePush(session comm.IUserSession, items []*pb.DB_UserItemData) (err error) {
|
||||
|
@ -46,6 +46,17 @@ func (this *apiComp) GymRefresh(session comm.IUserSession, req *pb.PracticeGymRe
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
//过滤掉当前的buff
|
||||
for i, v := range confs {
|
||||
if v.Id == room.Gymaction {
|
||||
confs = append(confs[0:i], confs[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
if len(confs) == 0 {
|
||||
code = pb.ErrorCode_ConfigurationException
|
||||
return
|
||||
}
|
||||
r := rand.New(rand.NewSource(configure.Now().Unix()))
|
||||
room.Gymaction = confs[r.Perm(len(confs))[0]].Id
|
||||
room.Gymrefresh++
|
||||
|
Loading…
Reference in New Issue
Block a user