public Associate(DbAssociate dbAssoc) { UID = dbAssoc.AssociateID; Name = dbAssoc.Name; Type = (AssociateType)dbAssoc.Type; UpdateClient(true); }
public void AddEnemyOf(Player enemyof) { if (enemyof == null) { return; } if (HasEnemyOf(enemyof.UID)) { return; } DbAssociate assoc = new DbAssociate(); assoc.AssociateID = enemyof.UID; assoc.Name = enemyof.Name; assoc.Type = (byte)AssociateType.EnemyOf; assoc.UID = Owner.UID; ServerDatabase.Context.Associates.Add(assoc); var associate = new Associate(assoc); EnemyOf.TryAdd(enemyof.UID, associate); }
public void AddFriend(Player friend) { if (friend == null) { return; } if (HasFriend(friend.UID)) { return; } DbAssociate assoc = new DbAssociate(); assoc.AssociateID = friend.UID; assoc.Name = friend.Name; assoc.Type = (byte)AssociateType.Friend; assoc.UID = Owner.UID; ServerDatabase.Context.Associates.Add(assoc); var associate = new Associate(assoc); Friends.TryAdd(friend.UID, associate); Owner.Send(AssociatePacket.Create(associate, AssociateAction.AddFriend)); }
public void AddEnemy(Player enemy) { if (enemy == null) { return; } if (HasEnemy(enemy.UID)) { return; } DbAssociate assoc = new DbAssociate(); assoc.AssociateID = enemy.UID; assoc.Name = enemy.Name; assoc.Type = (byte)AssociateType.Enemy; assoc.UID = Owner.UID; ServerDatabase.Context.Associates.Add(assoc); var associate = new Associate(assoc); Enemies.TryAdd(enemy.UID, associate); Owner.Send(AssociatePacket.Create(associate, AssociateAction.AddEnemy)); }