Esempio n. 1
0
func (h *Service) Auth(req common.CommonRequest, reply *common.CommonReply) (err error) {
	reply.Type = req.Type
	reply.PlayerId = 10000
	reply.Result = common.ResultSuccess
	reply.Content = common.ClientResponse{Type: reply.Type, Result: reply.Result}
	log.Debugf("Auth:req(%+v),reply(%+v)\n", req, *reply)
	return nil
}
Esempio n. 2
0
func (s *Skill) GetSkillTemplates(req common.CommonRequest, reply *common.CommonReply) (err error) {
	skills := make([]common.SkillAttrs, 0)

	reply.Type = req.Type
	reply.PlayerId = req.PlayerId
	reply.Result = common.ResultFailure

	querySkillTemps := "SELECT skill.id, skill.name, skill.rarity, skill.levellimit, skill.type, skill.nature, skill.height, skill.redir, skill.costmp, skill.icon, skill.desc, skill.descparam, skill.skillrange, skill.skillarea, skill.script, skill.skillparam, skill.growparam, skill.damagetime, skill.damagerate FROM plp_game.skill"
	rows, err := s.DBConn.Query(querySkillTemps)
	if err != nil {
		panic(err.Error())
	}
	defer rows.Close()

	for rows.Next() {
		var descparam, skillrange, skillarea, skillparam string
		var osa common.SkillAttrs
		err = rows.Scan(
			&osa.Id,
			&osa.Name,
			&osa.Rarity,
			&osa.LevelLimit,
			&osa.Type,
			&osa.Nature,
			&osa.Height,
			&osa.Redir,
			&osa.CostMP,
			&osa.Icon,
			&osa.Desc,
			&descparam,
			&skillrange,
			&skillarea,
			&osa.Script,
			&skillparam,
			&osa.GrowParam,
			&osa.DamageTime,
			&osa.DamageRate)
		if err != nil {
			panic(err.Error())
		}

		osa.DescParam = common.L1ParseInt(descparam)
		osa.SkillRange = common.L2ParseInt(skillrange)
		osa.SkillArea = common.L2ParseInt(skillarea)
		osa.SkillParam = common.L1ParseInt(skillparam)

		skills = append(skills, osa)
	}
	rows.Close()

	reply.Result = common.ResultSuccess
	reply.Content = skills
	return
}