| | 1 | | using System; |
| | 2 | |
|
| | 3 | | namespace Variables.RealmsInfo |
| | 4 | | { |
| | 5 | | public class CurrentRealmVariable : BaseVariable<CurrentRealmModel> |
| | 6 | | { |
| | 7 | | public override bool Equals(CurrentRealmModel other) |
| | 8 | | { |
| 6 | 9 | | if (value == null) |
| | 10 | | { |
| 2 | 11 | | return other == null; |
| | 12 | | } |
| | 13 | |
|
| 4 | 14 | | return value.Equals(other); |
| | 15 | | } |
| | 16 | | } |
| | 17 | |
|
| | 18 | | [Serializable] |
| | 19 | | public class CurrentRealmModel |
| | 20 | | { |
| | 21 | | public string layer; |
| | 22 | | public string serverName; |
| | 23 | | public string domain = string.Empty; |
| | 24 | | public string contentServerUrl = string.Empty; |
| | 25 | |
|
| | 26 | | public bool isArchipelagoRealm => string.IsNullOrEmpty(layer); |
| | 27 | |
|
| | 28 | | public bool Equals(CurrentRealmModel other) |
| | 29 | | { |
| | 30 | | if (other == null) |
| | 31 | | return false; |
| | 32 | | return Equals(other.serverName, other.layer, other.domain, other.contentServerUrl); |
| | 33 | | } |
| | 34 | |
|
| | 35 | | public bool Equals(string serverName, string layer, string domain, string contentServerUrl) { return Equals(serv |
| | 36 | |
|
| | 37 | | public bool Equals(string serverName, string layer) |
| | 38 | | { |
| | 39 | | if (isArchipelagoRealm) |
| | 40 | | return this.serverName == serverName; |
| | 41 | | else |
| | 42 | | return this.serverName == serverName && this.layer == layer; |
| | 43 | | } |
| | 44 | |
|
| | 45 | | public CurrentRealmModel Clone() |
| | 46 | | { |
| | 47 | | return new CurrentRealmModel() |
| | 48 | | { |
| | 49 | | serverName = serverName, |
| | 50 | | layer = layer, |
| | 51 | | domain = domain, |
| | 52 | | contentServerUrl = contentServerUrl |
| | 53 | | }; |
| | 54 | | } |
| | 55 | | } |
| | 56 | | } |