"fix(logic): 增加道具购买价格校验,防止封包领取道具漏洞"
This commit is contained in:
@@ -10,6 +10,9 @@ import (
|
|||||||
"github.com/gogf/gf/v2/util/gconv"
|
"github.com/gogf/gf/v2/util/gconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 防止封包通过领取来获取道具
|
||||||
|
|
||||||
|
// 领取道具包校验价格
|
||||||
func (h Controller) BuyItem(data *item.BuyInboundInfo, c *player.Player) (result *item.BuyOutboundInfo, err errorcode.ErrorCode) {
|
func (h Controller) BuyItem(data *item.BuyInboundInfo, c *player.Player) (result *item.BuyOutboundInfo, err errorcode.ErrorCode) {
|
||||||
tt, ok := xmlres.ItemsMAP[int(data.ItemId)]
|
tt, ok := xmlres.ItemsMAP[int(data.ItemId)]
|
||||||
if ok && tt.Price != 0 && c.UseCoins(data.Count*uint32(tt.Price)) {
|
if ok && tt.Price != 0 && c.UseCoins(data.Count*uint32(tt.Price)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user