package shop

import (
	"fmt"
	"server/msg"
	"server/user"

	"github.com/name5566/leaf/gate"
)

func init() {
	fmt.Printf("注册BuyShopItem")
}

func OnBuy(args []interface{}) {
	m := args[0].(*msg.BuyShopItem)
	fmt.Printf("玩家购买了商品id为：%s \n", m.Id)
	a := args[1].(gate.Agent)
	user_id := a.UserData().(*msg.UserInfo).UserId
	user.AddUserCoin(100, user_id)
}
