Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
lloyd-delacroix authored Feb 20, 2017
1 parent 8b1f92e commit f385e1b
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
86 changes: 86 additions & 0 deletions display-guild.lic
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Contacts = YAML.load_file('./scripts/data/base-contacts.yaml')
Contacts = Contacts['contacts']

#DEBUG INFO
#puts "---Base Contacts---"
#puts Contacts.inspect
#puts Contacts.class

#Check for <CharName>-contacts.yaml file and merges it if exists
if File.exist?('./scripts/profiles/'+checkname+'-contacts.yaml')
puts "Personal Contact file found! Now importing!"

Personal_Contacts = YAML.load_file('./scripts/profiles/'+checkname+'-contacts.yaml')
Personal_Contacts = Personal_Contacts['contacts']

#DEBUG INFO
#puts "---Personal Contacts---"
#puts Personal_Contacts.inspect
#puts Personal_Contacts.class

Contacts.merge!(Personal_Contacts)
Names = Contacts.map {|row| row[0]}
puts "***Successfully loaded " + Names.length.to_s + " contacts."

#DEBUG INFO
#puts "---Names Array---"
#puts Names.inspect
#puts Names.class
end

#DEBUG INFO
#puts "---Merged Contacts---"
#puts Contacts.inspect
#puts Contacts.class
#puts "-----"


# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#stalker
=end

no_pause_all
no_kill_all

class Stalker
@@subs = {}

def self.subs
@@subs
end

def self.clear
@@subs = {}
end

def self.add(target, result)
@@subs[/#{target}/] = result
end
end

action = proc do |client_string|
matches = Stalker.subs.select { |key, _| key =~ client_string }
matches.each { |target, result| client_string.gsub!(target, result) }
client_string
end

DownstreamHook.remove('stalker')
DownstreamHook.add('stalker', action)

before_dying do
DownstreamHook.remove('stalker')
end

# defaults
for index in 0 ... Names.size
if (Contacts[Names[index]]['guild'] == 'Thief')
Contacts[Names[index]]['guild'] = 'X'
end
if (Contacts[Names[index]]['guild'] == 'Bard')
Contacts[Names[index]]['guild'] = 'D'
end
Stalker.add((Names[index].capitalize),Contacts[Names[index]]['guild'].chr+':'+Names[index].capitalize)
end

clear until script.gets.nil?
56 changes: 56 additions & 0 deletions yellowpages.lic
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#Load base contacts YAML
Contacts = YAML.load_file('./scripts/data/base-contacts.yaml')
Contacts = Contacts['contacts']

#DEBUG INFO
#puts "---Base Contacts---"
#puts Contacts.inspect
#puts Contacts.class

#Check for <CharName>-contacts.yaml file and merges it if exists
if File.exist?('./scripts/profiles/'+checkname+'-contacts.yaml')
puts "Personal Contact file found! Now importing!"

Personal_Contacts = YAML.load_file('./scripts/profiles/'+checkname+'-contacts.yaml')
Personal_Contacts = Personal_Contacts['contacts']

#DEBUG INFO
#puts "---Personal Contacts---"
#puts Personal_Contacts.inspect
#puts Personal_Contacts.class

Contacts.merge!(Personal_Contacts)
end

#DEBUG INFO
#puts "---Merged Contacts---"
#puts Contacts.inspect
#puts Contacts.class
#puts "-----"


arg_definitions = [
[
{ name: 'search', regex: /[a-zA-Z]/, optional: false, description: 'Name of player to look up in contacts.' }
]
]
args = parse_args(arg_definitions)

#DEBUG INFO
#puts args.search
#puts args.class

Record = Contacts[args.search]
if Record.nil?
puts "User not found in contacts"
else
#puts Record.inspect
puts "Information for " + args.search
puts " "
puts "Guild: " + Record['guild'].inspect.gsub(/nil/,'')
puts "Race: " + Record['race'].inspect.gsub(/nil/,'')
puts "Circle: " + Record['circle'].inspect.to_s.gsub(/nil/,'')
puts "Relationship: " + Record['relationship'].inspect.gsub(/nil/,'')
puts "Notes: " + Record['notes'].inspect.gsub(/nil/,'')
puts "Alts: " + Record['alts'].inspect.gsub(/nil/,'')
end

0 comments on commit f385e1b

Please sign in to comment.