Combine Friend/Ignore lists

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Combine Friend/Ignore lists

Post by John Adams » Tue Dec 29, 2009 6:40 pm

LE/Scat,

I'd like to propose making a single table for friends/ignore (character_social?) that holds both friends and ignore lists. Current tables look like this:

Code: Select all

CREATE TABLE `character_friendlist` (
  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `name` VARCHAR(64) NOT NULL DEFAULT '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `CharIDNameIdx` (`char_id`,`name`)
) ENGINE=MYISAM

Code: Select all

CREATE TABLE `character_ignorelist` (               
  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,    
  `char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',  
  `name` VARCHAR(64) NOT NULL DEFAULT '',           
  PRIMARY KEY  (`id`),                              
  UNIQUE KEY `CharNameIdx` (`char_id`,`name`)       
) ENGINE=INNODB
Combine the two into a single table, named accordingly. Engine InnoDB. Add a column called "flag" or "option" or something, where 0 = friend, 1 = ignore.

New table (just a suggestion)

Code: Select all

CREATE TABLE `character_social` (               
  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,    
  `char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',  
  `name` VARCHAR(64) NOT NULL DEFAULT '',           
  `type` TINYINT(1) NOT NULL DEFAULT '0',           
  PRIMARY KEY  (`id`),                              
  UNIQUE KEY `CharNameIdx` (`char_id`,`name`)       
) ENGINE=INNODB
I am ok with leaving a varchar(64) for name, because this prevents anyone from deleting and re-creating an annoying character who can then start chatting at the ignorer again ;) (you know how I prefer int's to varchar's) but yeah, i can see name being the best approach here.


If you do not see any issues with doing this, please go for it. Just trying to minimize the tables we're creating. We're out of control! :D though imo, there can never be too many tables :)

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Combine Friend/Ignore lists

Post by Scatman » Tue Dec 29, 2009 11:41 pm

Should be an easy change. Once we get our DB stuff worked or for guilds (looked at IRC), I can make the change so LE can work on more uber stuff :P

User avatar
Arremis
Retired
Posts: 388
Joined: Sun Sep 02, 2007 10:11 am
Location: Memphis, TN

Re: Combine Friend/Ignore lists

Post by Arremis » Wed Dec 30, 2009 7:58 pm

What about people who are neither friend, nor ignored? If everyone starts out on your friend list, all during the game you'll get spammed with "Friend has logged in." If everyone starts out on your ignore list, then you can't chat to anyone. We need some neutral ground on this one.
I am the UI Master...there is no charge for my awesomeness.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Combine Friend/Ignore lists

Post by Scatman » Wed Dec 30, 2009 11:04 pm

No one starts out on any list. If in game you type /friend blah, they'll get put into the friends list. If you type /ignore blah they'd get put into the ignore list. The table would simply keep an additional field (I think) to determine which list you are on.

User avatar
Arremis
Retired
Posts: 388
Joined: Sun Sep 02, 2007 10:11 am
Location: Memphis, TN

Re: Combine Friend/Ignore lists

Post by Arremis » Thu Dec 31, 2009 4:20 am

Oh I see...sometimes I can be pretty thick...but yes, anything that makes complex things more simple is definitely better :)
I am the UI Master...there is no charge for my awesomeness.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: Combine Friend/Ignore lists

Post by LethalEncounter » Fri Jan 01, 2010 9:10 pm

Hey John, that is a great idea, but I would suggest making the type an ENUM ('FRIEND', 'IGNORED'), that way it is easy for people modifying the database to understand what the type values are for. I have tried to do this with the newer tables to avoid having to constantly look in the code to check with value goes in the db for a particular type.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Combine Friend/Ignore lists

Post by John Adams » Sat Jan 02, 2010 2:46 pm

Good idea. I'll see if Scat can tweak that code once he's got a free moment - if he survived New Year's Eve ;)

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Combine Friend/Ignore lists

Post by Scatman » Sat Jan 02, 2010 2:49 pm

Yup survived!

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Combine Friend/Ignore lists

Post by John Adams » Mon Jan 11, 2010 9:22 am

The new table for combining Friends/Ignore is as follows:

Code: Select all

CREATE TABLE `character_social` (               
  `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,   
  `char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', 
  `name` VARCHAR(64) NOT NULL DEFAULT '',           
  `type` ENUM('FRIEND','IGNORE') NOT NULL DEFAULT 'FRIEND',           
  PRIMARY KEY  (`id`),                             
  UNIQUE KEY `CharNameIdx` (`char_id`,`name`)       
) ENGINE=INNODB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC;
...and is minor version 100, but hold off on bumping the version in code just yet. I have about 50 more updates to apply ;)

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Combine Friend/Ignore lists

Post by Scatman » Mon Jan 11, 2010 11:40 am

Finished.

User avatar
Arremis
Retired
Posts: 388
Joined: Sun Sep 02, 2007 10:11 am
Location: Memphis, TN

Re: Combine Friend/Ignore lists

Post by Arremis » Mon Jan 11, 2010 2:47 pm

Good work Scatman. It's Miller Time! :D
I am the UI Master...there is no charge for my awesomeness.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest