package test

import (
	"fmt"
	orderCfg "server/conf/order"
	"server/game"
	"server/game/mod/order"
	"testing"
)

func TestOrderStart(t *testing.T) {
	p1 := new(game.Player)
	p1.InitPlayer("test")
	game.G_GameLogicPtr.SetPlayer(p1)
	ChessMod := p1.GetChessMod()
	DecorateMod := p1.GetDecorateMod()
	merge_id := []int{64, 249}
	order_facotry := orderCfg.GetOrderFactor(DecorateMod.GetAreaId())
	star := order.GetOrderStar(merge_id, ChessMod.GetStarEmitList())
	star = int(float64(star)*float64(order_facotry)/1000+0.5) * 10
	fmt.Printf("star is %d", star)
}

func TestOrderFinish(t *testing.T) {
	p1 := new(game.Player)
	p1.InitPlayer("3659896")
	game.G_GameLogicPtr.SetPlayer(p1)
	ChessMod := p1.GetChessMod()
	err := ChessMod.FinishOrder([]int{1, 2, 3})
	if err != nil {
		t.Errorf("finish order failed:%v", err)
	}
}

func TestChestRain(t *testing.T) {
	p1 := new(game.Player)
	p1.InitPlayer("3625212")
	ChessMod := p1.GetChessMod()
	LimitEventMod := p1.GetLimitEventMod()
	f := LimitEventMod.GetMeteorReward([]int{226}, ChessMod.GetStarEmitList())
	fmt.Printf("chest rain reward:%v", f)
}
