Esempio n. 1
0
//玩家属性变化
func (ts *TaskSystem) OnPropertyChange(self datatype.Entityer, prop string, old interface{}) int {
	if !entity.IsPlayer(self) {
		return 1
	}
	player := self.(*entity.Player)

	switch prop {
	}

	val, _ := player.Get(prop)

	row := player.TaskPropRecord_r.FindProperty(prop)
	for row != -1 {
		taskid, _, needval, _ := player.TaskPropRecord_r.GetRow(row)
		res, err := datatype.CompareNumber(needval, val)
		if err != nil {
			log.LogError(err)
		}

		if res <= 0 { //已经满条件,删除这条记录
			player.TaskPropRecord_r.Del(row)
			task := ts.GetTask(taskid)
			if task != nil {
				ts.TestComplete(player, task)
			}
			row--
		}

		row = player.TaskPropRecord_r.FindNextProperty(prop, row)
	}
	return 1
}
Esempio n. 2
0
func (ts *TaskSystem) OnCommand(self datatype.Entityer, sender datatype.Entityer, msgid int, msg interface{}) int {
	if !entity.IsPlayer(self) {
		return 1
	}

	//player := self.(*entity.Player)
	switch msgid {

	}
	return 1
}