Doing Acheivement Dev
This commit is contained in:
parent
23172a5115
commit
9fa3c1c6c9
@ -18,6 +18,7 @@ func (p *generalProcessor) GetName() string {
|
|||||||
func (p *generalProcessor) GetHelp() string {
|
func (p *generalProcessor) GetHelp() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
func (p *generalProcessor) Initialize() {}
|
||||||
|
|
||||||
func (p *generalProcessor) ProcessMessage(slack *Slack, m *Message) {}
|
func (p *generalProcessor) ProcessMessage(slack *Slack, m *Message) {}
|
||||||
func (p *generalProcessor) ProcessBotMessage(slack *Slack, m *Message) {}
|
func (p *generalProcessor) ProcessBotMessage(slack *Slack, m *Message) {}
|
||||||
|
@ -18,6 +18,7 @@ func (p *levelUpStatProcessor) GetStatKeys() []string {
|
|||||||
"levelup-*",
|
"levelup-*",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func (p *levelUpStatProcessor) Initialize() {}
|
||||||
|
|
||||||
func (p *levelUpStatProcessor) ProcessMessage(m *Message) {}
|
func (p *levelUpStatProcessor) ProcessMessage(m *Message) {}
|
||||||
func (p *levelUpStatProcessor) ProcessAdminMessage(m *Message) {}
|
func (p *levelUpStatProcessor) ProcessAdminMessage(m *Message) {}
|
||||||
|
@ -16,13 +16,28 @@ func (p *levelUpAchieveStatProcessor) GetStatKeys() []string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type levelUpAchievement interface {
|
func (p *levelUpAcheiveStatProcessor) Initialize() {
|
||||||
GetName() string
|
// TODO: Set up achievements
|
||||||
GetText() string
|
p.Achievements = append(p.Achievements, levelUpAchievement{
|
||||||
|
GetName: func() string {
|
||||||
|
},
|
||||||
|
GetText: func() string {
|
||||||
|
},
|
||||||
|
DoesUserHave: func(uID string) bool {
|
||||||
|
},
|
||||||
|
ProcessMessage: func(m *Message) bool {
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type levelUpAchievement struct {
|
||||||
|
GetName func() string
|
||||||
|
GetText func() string
|
||||||
// Returns whether the user already has this achievement
|
// Returns whether the user already has this achievement
|
||||||
DoesUserHave(uID string) bool
|
DoesUserHave func(uID string) bool
|
||||||
// Processes the message, returns true if the achievement was triggered
|
// Processes the message, returns true if the achievement was triggered
|
||||||
ProcessMessage(m *Message) bool
|
ProcessMessage func(m *Message) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *levelUpAchieveStatProcessor) ProcessMessage(m *Message) {
|
func (p *levelUpAchieveStatProcessor) ProcessMessage(m *Message) {
|
||||||
@ -42,7 +57,6 @@ func (p *levelUpAchieveStatProcessor) ProcessMessage(m *Message) {
|
|||||||
userStat.Xp, _ = getUserStat(u.ID, "levelup-xp")
|
userStat.Xp, _ = getUserStat(u.ID, "levelup-xp")
|
||||||
userStat.ChannelStats = getAllLevelUpChannelXp(u.ID)
|
userStat.ChannelStats = getAllLevelUpChannelXp(u.ID)
|
||||||
userStat.OtherStats = getAllNonLevelUpStats(u.ID)
|
userStat.OtherStats = getAllNonLevelUpStats(u.ID)
|
||||||
|
|
||||||
}
|
}
|
||||||
func (p *levelUpAchieveStatProcessor) ProcessAdminMessage(m *Message) {}
|
func (p *levelUpAchieveStatProcessor) ProcessAdminMessage(m *Message) {}
|
||||||
func (p *levelUpAchieveStatProcessor) ProcessBotMessage(m *Message) {}
|
func (p *levelUpAchieveStatProcessor) ProcessBotMessage(m *Message) {}
|
||||||
@ -76,7 +90,7 @@ func (wm *levelUpAchieveWebModule) Register() {
|
|||||||
}
|
}
|
||||||
func (wm *levelUpAchieveWebModule) GetMenuEntries() []menuItem {
|
func (wm *levelUpAchieveWebModule) GetMenuEntries() []menuItem {
|
||||||
var ret []menuItem
|
var ret []menuItem
|
||||||
ret = append(ret, menuItem{Text: "Achieve GET!", Link: "/levelup/achieve"})
|
//ret = append(ret, menuItem{Text: "Achieve GET!", Link: "/levelup/achieve"})
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
func (wm *levelUpAchieveWebModule) GetBottomMenuEntries() []menuItem {
|
func (wm *levelUpAchieveWebModule) GetBottomMenuEntries() []menuItem {
|
||||||
|
@ -28,6 +28,7 @@ var messageProcessors []messageProcessor
|
|||||||
type statProcessor interface {
|
type statProcessor interface {
|
||||||
GetName() string
|
GetName() string
|
||||||
GetStatKeys() []string
|
GetStatKeys() []string
|
||||||
|
Initialize() []string
|
||||||
ProcessMessage(m *Message)
|
ProcessMessage(m *Message)
|
||||||
ProcessBotMessage(m *Message)
|
ProcessBotMessage(m *Message)
|
||||||
ProcessUserMessage(m *Message)
|
ProcessUserMessage(m *Message)
|
||||||
@ -191,6 +192,7 @@ func registerStatProcessor(b statProcessor) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
b.Initialize()
|
||||||
statProcessors = append(statProcessors, b)
|
statProcessors = append(statProcessors, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user