 |
Obduction Backer |
Joined: Sun Feb 14, 2010 7:53 pm Posts: 157
|
Sweet. Thanks, AdamJohnso.
I wasn't able to test this, because xKI depends on a bunch of stuff that isn't present like xRPSEnglish, but here's the patch.
[spoiler=This is wrong. Preserved for historical interest.]Code: diff --git a/python/xKI.py b/python/xKI.py index 3a051ec..6c0b94d 100644 --- a/python/xKI.py +++ b/python/xKI.py @@ -292,0 +293 @@ gFeather = 0 +userdefined_CensorRating = xCensor.xRatedG @@ -6662,0 +6664,43 @@ class xKI(ptModifier): + + + + # New stuff starts here. --------------------------------------------- + + # A quick rgrep didn't turn up the definition of PtGetLocalizedString, + # only a forward-declaration, so I won't be using it. + # Sorry, non-English-speakers. :( + + if string.lower(chatmessage).startswith("/rating x"): + if AmICCR: + userdefined_CensorRating = xCensor.xRatedX + self.IAddRTChat(None, "Wordfilter rating set to X.", kChatSystemMessage) + else: + userdefined_CensorRating = xCensor.xRatedR + self.IAddRTChat(None, "Wordfilter rating set to R.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating r"): + userdefined_CensorRating = xCensor.xRatedR + self.IAddRTChat(None, "Wordfilter rating set to R.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating pg13") or string.lower(chatmessage).startswith("/rating pg-13"): + userdefined_CensorRating = xCensor.xRatedPG13 + self.IAddRTChat(None, "Wordfilter rating set to PG-13.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating pg"): + userdefined_CensorRating = xCensor.xRatedPG + self.IAddRTChat(None, "Wordfilter rating set to PG.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating g"): + userdefined_CensorRating = xCensor.xRatedG + self.IAddRTChat(None, "Wordfilter rating set to G.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating"): + # Command recognized, but argument(s) missing or invalid. + self.IAddRTChat(None, "Usage: /rating <rating>\nValid ratings are G, PG, PG-13, R.", kChatSystemMessage) + return None + + + # New stuff ends here. --------------------------------------------- + + + [/spoiler] I put the prefix userdefined_ on my variable to minimize the chance of collision with anything Cyan does.
(Edit: the command doesn't actually do anything yet. Working on that.)
(Edit 2: I just realized I did this completely wrong in every way. Starting over.)
(Edit 3: This should -- no, might -- work. Again, I have no way to test.)
[spoiler=Click to embiggen.]Code: diff --git a/python/xKI.py b/python/xKI.py index 3a051ec..e79716e 100644 --- a/python/xKI.py +++ b/python/xKI.py @@ -6662,0 +6663,46 @@ class xKI(ptModifier): + + + # New stuff begins here. --------------------------------------------- + + # A quick rgrep didn't turn up the definition of PtGetLocalizedString, + # only a forward-declaration, so I won't be using it. + # Sorry, non-English-speakers. :( + + if string.lower(chatmessage).startswith("/rating x"): + if AmICCR: + theCensorLevel = xCensor.xRatedX + self.ISaveCensorLevel(None) + self.IAddRTChat(None, "Wordfilter rating set to X.", kChatSystemMessage) + else: + theCensorLevel = xCensor.xRatedR + self.ISaveCensorLevel(None) + self.IAddRTChat(None, "Wordfilter rating set to R.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating r"): + theCensorLevel = xCensor.xRatedR + self.ISaveCensorLevel(None) + self.IAddRTChat(None, "Wordfilter rating set to R.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating pg13") or string.lower(chatmessage).startswith("/rating pg-13"): + theCensorLevel = xCensor.xRatedPG13 + self.ISaveCensorLevel(None) + self.IAddRTChat(None, "Wordfilter rating set to PG-13.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating pg"): + theCensorLevel = xCensor.xRatedPG + self.ISaveCensorLevel(None) + self.IAddRTChat(None, "Wordfilter rating set to PG.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating g"): + theCensorLevel = xCensor.xRatedG + self.ISaveCensorLevel(None) + self.IAddRTChat(None, "Wordfilter rating set to G.", kChatSystemMessage) + return None + if string.lower(chatmessage).startswith("/rating"): + # Command recognized, but argument(s) missing or invalid. + self.IAddRTChat(None, "Usage: /rating <rating>\nValid ratings are G, PG, PG-13, R.", kChatSystemMessage) + return None + + # New stuff ends here. --------------------------------------------- + + [/spoiler]
_________________ Have Ages, and link to them without bindings. [Words 1:13] Seltani
|
|