类型调整
This commit is contained in:
parent
30c78af0bc
commit
54db639bc0
@ -1,50 +1,50 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"coefficient": "1012"
|
"coefficient": 1012
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"coefficient": "1024"
|
"coefficient": 1024
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"coefficient": "1036"
|
"coefficient": 1036
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"coefficient": "1048"
|
"coefficient": 1048
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
"coefficient": "1060"
|
"coefficient": 1060
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
"coefficient": "1072"
|
"coefficient": 1072
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
"coefficient": "900"
|
"coefficient": 900
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 8,
|
"id": 8,
|
||||||
"coefficient": "888"
|
"coefficient": 888
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
"coefficient": "876"
|
"coefficient": 876
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 10,
|
"id": 10,
|
||||||
"coefficient": "864"
|
"coefficient": 864
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 11,
|
"id": 11,
|
||||||
"coefficient": "852"
|
"coefficient": 852
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 12,
|
"id": 12,
|
||||||
"coefficient": "840"
|
"coefficient": 840
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -1,38 +1,38 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"quantity": "5"
|
"quantity": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"quantity": "20"
|
"quantity": 20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"quantity": "40"
|
"quantity": 40
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"quantity": "20"
|
"quantity": 20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
"quantity": "300"
|
"quantity": 300
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
"quantity": "1020"
|
"quantity": 1020
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
"quantity": "980"
|
"quantity": 980
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 8,
|
"id": 8,
|
||||||
"quantity": "5"
|
"quantity": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
"quantity": "1500"
|
"quantity": 1500
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -4,7 +4,6 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@ -75,8 +74,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
|||||||
sellPrice = goods.Goodsprice * goods.StarMoney / 1000
|
sellPrice = goods.Goodsprice * goods.StarMoney / 1000
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
num, _ := strconv.Atoi(p.Coefficient)
|
sellPrice = int32(p.Coefficient) * goods.Goodsprice / 1000
|
||||||
sellPrice = int32(num) * goods.Goodsprice / 1000
|
|
||||||
}
|
}
|
||||||
if sellPrice > trolltrain.Price[k] { // 赚了
|
if sellPrice > trolltrain.Price[k] { // 赚了
|
||||||
earn += (sellPrice - trolltrain.Price[k]) * trolltrain.Items[k]
|
earn += (sellPrice - trolltrain.Price[k]) * trolltrain.Items[k]
|
||||||
@ -84,8 +82,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
|||||||
gold += (sellPrice - trolltrain.Price[k]) * trolltrain.Items[k]
|
gold += (sellPrice - trolltrain.Price[k]) * trolltrain.Items[k]
|
||||||
} else { // 买入 计算平均价格
|
} else { // 买入 计算平均价格
|
||||||
totalGold := trolltrain.Items[k] * trolltrain.Price[k]
|
totalGold := trolltrain.Items[k] * trolltrain.Price[k]
|
||||||
num, _ := strconv.Atoi(p.Coefficient)
|
sellPrice := int32(p.Coefficient) * goods.Goodsprice / 1000
|
||||||
sellPrice := int32(num) * goods.Goodsprice / 1000
|
|
||||||
totalGold += v * goods.Goodsprice * sellPrice
|
totalGold += v * goods.Goodsprice * sellPrice
|
||||||
trolltrain.Price[k] = totalGold / (trolltrain.Items[k] + v)
|
trolltrain.Price[k] = totalGold / (trolltrain.Items[k] + v)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -74,9 +73,7 @@ func (this *Troll) TrollAI(uid string, troll *pb.DBTrollTrain) (code pb.ErrorCod
|
|||||||
if crossTime > fTime[index] { // 获取
|
if crossTime > fTime[index] { // 获取
|
||||||
troll.RangeId += 1
|
troll.RangeId += 1
|
||||||
if _d := this.configure.GetTrollCoefficient(troll.RangeId); _d != nil {
|
if _d := this.configure.GetTrollCoefficient(troll.RangeId); _d != nil {
|
||||||
num, _ := strconv.Atoi(_d.Coefficient)
|
if troll.Buy <= int32(_d.Coefficient) { //
|
||||||
if troll.Buy <= int32(num) { //
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
crossTime -= fTime[index]
|
crossTime -= fTime[index]
|
||||||
|
@ -12,7 +12,7 @@ import "errors"
|
|||||||
|
|
||||||
type GameTrollCoefficientData struct {
|
type GameTrollCoefficientData struct {
|
||||||
Id int32
|
Id int32
|
||||||
Coefficient string
|
Coefficient int32
|
||||||
}
|
}
|
||||||
|
|
||||||
const TypeId_GameTrollCoefficientData = -856241206
|
const TypeId_GameTrollCoefficientData = -856241206
|
||||||
@ -23,7 +23,7 @@ func (*GameTrollCoefficientData) GetTypeId() int32 {
|
|||||||
|
|
||||||
func (_v *GameTrollCoefficientData)Deserialize(_buf map[string]interface{}) (err error) {
|
func (_v *GameTrollCoefficientData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
|
||||||
{ var _ok_ bool; if _v.Coefficient, _ok_ = _buf["coefficient"].(string); !_ok_ { err = errors.New("coefficient error"); return } }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["coefficient"].(float64); !_ok_ { err = errors.New("coefficient error"); return }; _v.Coefficient = int32(_tempNum_) }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import "errors"
|
|||||||
|
|
||||||
type GameTrollRuleData struct {
|
type GameTrollRuleData struct {
|
||||||
Id int32
|
Id int32
|
||||||
Quantity string
|
Quantity int32
|
||||||
}
|
}
|
||||||
|
|
||||||
const TypeId_GameTrollRuleData = 902547931
|
const TypeId_GameTrollRuleData = 902547931
|
||||||
@ -23,7 +23,7 @@ func (*GameTrollRuleData) GetTypeId() int32 {
|
|||||||
|
|
||||||
func (_v *GameTrollRuleData)Deserialize(_buf map[string]interface{}) (err error) {
|
func (_v *GameTrollRuleData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
|
||||||
{ var _ok_ bool; if _v.Quantity, _ok_ = _buf["quantity"].(string); !_ok_ { err = errors.New("quantity error"); return } }
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["quantity"].(float64); !_ok_ { err = errors.New("quantity error"); return }; _v.Quantity = int32(_tempNum_) }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user