• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[C#] Project H(S)R - 'Full' R38 Server

Status
Not open for further replies.
Custom Title Activated
Loyal Member
Joined
Oct 26, 2012
Messages
2,357
Reaction score
1,086
Started the simple messenger. I just realize I still need to learn a lot about Fluent NHibernate. Removed lazy loading for now as it gave me problems. Yes, I know I am friends with myself but I was too lazy to add another user in the database.

0mDFg8 - [C#] Project H(S)R - 'Full' R38 Server - RaGEZONE Forums

CcMT5kb - [C#] Project H(S)R - 'Full' R38 Server - RaGEZONE Forums


Okay, some snippets too:

PHP:
public class MessengerBuddiesMap : ClassMap<MessengerBuddy>
    {
        public MessengerBuddiesMap()
        {
            Table("messenger_buddies");
            Not.LazyLoad();
            References(m => m.Member).Column("member_id").Not.Nullable();
            References(m => m.Friend).Column("friend_id").Not.Nullable();
            References(m => m.Category).Column("category_id");
            CompositeId().KeyReference(m => m.Member, "member_id").KeyReference(m => m.Friend, "friend_id");
        }
    }

PHP:
public IList<MessengerCategory> Categories { get; }
        public IList<MessengerBuddy> Buddies { get; }

        public MessengerComponent(int memberId)
        {
            member_id = memberId;

            using (ISession session = Engine.SessionFactory.OpenSession())
            {
                Categories = session.QueryOver<MessengerCategory>().Where(x => x.Member.Id == memberId).List<MessengerCategory>();
                Buddies = session.QueryOver<MessengerBuddy>().Where(x => x.Member.Id == memberId).List<MessengerBuddy>();
            }
        }

PHP:
foreach (MessengerBuddy buddy in buddies)
            {
                GameClient client = Engine.Game.GameClients.GetClientByMember(buddy.Friend.Id);

                response.Append(buddy.Friend.Id);
                response.Append(buddy.Friend.Name);
                response.Append(buddy.Friend.Gender.Equals("M") ? 0 : 1);
                response.Append(client != null);
                response.Append(false); // TODO: Inside room (room system not started yet).
                response.Append(buddy.Friend.Figure);
                response.Append(buddy.Category.Id);
                response.Append(buddy.Friend.Motto);
                response.Append(new System.DateTime(buddy.Friend.LastLogin).ToString("dd-MM-yyyy hh:mm")); // TODO: Test this soon
            }
 

Attachments

You must be registered for see attachments list
Status
Not open for further replies.
Back
Top