Does a cleanup check every round for any follows that have expired.
(e events.Event)
| 198 | |
| 199 | // Does a cleanup check every round for any follows that have expired. |
| 200 | func (f *FollowModule) onNewRound(e events.Event) events.ListenerReturn { |
| 201 | |
| 202 | evt := e.(events.NewRound) |
| 203 | |
| 204 | for fId, rNum := range f.followLimits { |
| 205 | if rNum > evt.RoundNumber { |
| 206 | continue |
| 207 | } |
| 208 | |
| 209 | wasFollowing := f.stopFollowing(fId) |
| 210 | |
| 211 | followTargetUser, followTargetMob := wasFollowing.getFollowIdInstance() |
| 212 | followSourceUser, followSourceMob := fId.getFollowIdInstance() |
| 213 | |
| 214 | // user being followed? |
| 215 | if followTargetUser != nil { |
| 216 | |
| 217 | // user doing the following? Tell both users |
| 218 | if followSourceUser != nil { |
| 219 | followTargetUser.SendText(fmt.Sprintf(`<ansi fg="username">%s</ansi> stopped following you.`, followSourceUser.Character.Name)) |
| 220 | followSourceUser.SendText(fmt.Sprintf(`You are no longer following <ansi fg="username">%s</ansi>.`, followTargetUser.Character.Name)) |
| 221 | continue |
| 222 | } |
| 223 | |
| 224 | // mob doing the following? tell the target user |
| 225 | if followSourceMob != nil { |
| 226 | followTargetUser.SendText(fmt.Sprintf(`<ansi fg="mobname">%s</ansi> stopped following you.`, followSourceMob.Character.Name)) |
| 227 | continue |
| 228 | } |
| 229 | |
| 230 | continue |
| 231 | } |
| 232 | |
| 233 | // mob being followed? |
| 234 | if followTargetMob != nil { |
| 235 | |
| 236 | // user doing the following? Tell the following user |
| 237 | if followSourceUser != nil { |
| 238 | followSourceUser.SendText(fmt.Sprintf(`You are no longer following <ansi fg="mobname">%s</ansi>.`, followTargetMob.Character.Name)) |
| 239 | } |
| 240 | |
| 241 | continue |
| 242 | } |
| 243 | |
| 244 | } |
| 245 | |
| 246 | return events.Continue |
| 247 | } |
| 248 | |
| 249 | // If players make changes (into/out of party) |
| 250 | // Just make sure they aren't following anyone. |
nothing calls this directly
no test coverage detected