Exemple #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
}
Exemple #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
}
Exemple #3
0
func (h *Service) GetSkillTemplates(req common.CommonRequest, reply *common.CommonReply) (err error) {
	log.Debugf("GetSkillTemplates:req(%+v)\n", req)

	var args common.CommonRequest
	args.PlayerId = req.PlayerId
	args.Content = nil
	err = h.connector.CallByMethod("Skill.GetSkillTemplates", args, reply)
	reply.Type = req.Type

	// test Notify
	defer func(args common.CommonRequest, reply *common.CommonReply) {
		var notify struct {
			Type    string
			Message string
		}
		notify.Type = "NotifyTest"
		notify.Message = "Just Test If The Notification Works Well"
		args.Content = notify
		ne := h.connector.CallByMethod("NotifyService.NotifyPush", args, nil)
		if ne != nil {
			log.Debugf("testNotify: %v\n", ne.Error())
		}
	}(args, reply)

	return
}