mirror of
https://github.com/evennia/evennia.git
synced 2026-04-18 06:09:06 +02:00
Re-organization.
This commit is contained in:
parent
5db3ae2933
commit
5421ab7f6e
38 changed files with 0 additions and 0 deletions
29
functions_help.py
Normal file
29
functions_help.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from apps.helpsys.models import HelpEntry
|
||||
"""
|
||||
Help system functions.
|
||||
"""
|
||||
def find_topicmatch(pobject, topicstr):
|
||||
"""
|
||||
Searches for matching topics based on player's input.
|
||||
"""
|
||||
is_staff = pobject.is_staff()
|
||||
if topicstr.isdigit():
|
||||
if is_staff:
|
||||
return HelpEntry.objects.filter(id=topicstr)
|
||||
else:
|
||||
return HelpEntry.objects.filter(id=topicstr).exclude(staff_only=1)
|
||||
else:
|
||||
if is_staff:
|
||||
return HelpEntry.objects.filter(topicname__istartswith=topicstr)
|
||||
else:
|
||||
return HelpEntry.objects.filter(topicname__istartswith=topicstr).exclude(staff_only=1)
|
||||
|
||||
def find_topicsuggestions(pobject, topicstr):
|
||||
"""
|
||||
Do a fuzzier "contains" match.
|
||||
"""
|
||||
is_staff = pobject.is_staff()
|
||||
if is_staff:
|
||||
return HelpEntry.objects.filter(topicname__icontains=topicstr)
|
||||
else:
|
||||
return HelpEntry.objects.filter(topicname__icontains=topicstr).exclude(staff_only=1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue