Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ( @alts, a terrible April fools prank. )
- $include $lib/character
- $def TRUE 1
- $def FALSE 0
- : do_help ( -- )
- ( Display 'helpful' information. )
- { "@Alts, (C) 2013 Kelketek of Winter's Oasis."
- " "
- " This program will list the alts of another character, based on information"
- "gathered by the system to determine, with certainty, which characters are"
- "another one's alts. It may not detect all alts, but any it detects are"
- "verified to be alts of the target player."
- " "
- "Usage:"
- " @alts someone"
- "... where 'someone' is the name of someone you want to look up the alts of."
- }list foreach
- swap pop
- .tell
- repeat
- ;
- : list_alts[ ref:target list:alt_list -- ]
- alt_list @ not if
- { "Could not find any alts for " target @ }cat .tell exit
- then
- { }list var! work_list
- alt_list @ foreach
- swap pop name work_list @ array_appenditem work_list !
- repeat
- { "The following alts were found for " target @ ":\r"
- work_list @ ", " array_join }cat
- .tell
- ;
- : hash_string[ str:name -- int:hash ]
- ( Create a 'hash' of a string. This will just be the average of all
- ASCII values for the target string.
- This is picked because it should have a high degree of collision. )
- var total
- name @ var! workname
- workname @ strlen 1 swap 1 for
- pop
- workname @ 1 strcut swap ctoi total @ + total !
- workname !
- repeat
- total @ name @ strlen /
- ;
- : fake_compare[ ref:player1 ref:player2 -- int:bool ]
- ( Compares two players on superficial, but back and forth
- compatible levels. )
- player1 @ name hash_string player2 @ name hash_string = not if
- FALSE exit
- then
- player1 @ intostr hash_string player2 @ intostr hash_string = not if
- FALSE exit
- then
- TRUE
- ;
- : do_fake_alts[ ref:target -- list:alt_list ]
- ( Generate a bogus but consistent list of alts. )
- ( We only show characters who have at least one approval, )
- ( So that way we're not overcrowding and the players are more likely to )
- ( be known. )
- { }list var! alt_list
- dbtop int 1 swap 1 for
- dbref var! victim
- victim @ player? if
- target @ victim @ fake_compare victim @ getApprovalLevel and
- victim @ target @ dbcmp not and
- me @ "@/email" getpropstr strip victim @ "@/email" getpropstr strip
- stringcmp
- and if
- victim @ alt_list @ array_appenditem alt_list !
- then
- then
- repeat
- alt_list @
- ;
- : do_real_alts[ ref:target -- list:alt_list ]
- ( Generate a legitimate alts listing. )
- { }list var! alt_list
- target @ "@/email" getpropstr strip var! email
- dbtop int 1 swap 1 for
- dbref var! victim
- victim @ player? if
- victim @ "@/email" getpropstr strip email @ stringcmp not
- victim @ target @ dbcmp not
- and if
- victim @ alt_list @ array_appenditem alt_list !
- then
- then
- repeat
- alt_list @
- ;
- : main ( s -- )
- var alt_list
- strip var! arg
- arg @ not if
- "You must specify a player to check their alts." .tell exit
- then
- arg @ "#h*" smatch if
- do_help exit
- then
- arg @ pmatch dup ok? not if
- pop arg @ part_pmatch arg !
- else
- arg !
- then
- arg @ ok? not if
- "Invalid or ambiguous player." .tell exit
- then
- arg @ "@/email" getpropstr var! email
- me @ "@/email" getpropstr strip email @ stringcmp not if
- arg @ do_real_alts alt_list !
- else
- arg @ do_fake_alts alt_list !
- then
- arg @ alt_list @ list_alts
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement