Ejemplo n.º 1
0
 protected bool Equals(PurchaseInfo other)
 {
     return(OrderId.Equals(other.OrderId) &&
            TradableId.Equals(other.TradableId) &&
            SellerAgentAddress.Equals(other.SellerAgentAddress) &&
            SellerAvatarAddress.Equals(other.SellerAvatarAddress) &&
            ItemSubType == other.ItemSubType &&
            Price.Equals(other.Price));
 }
Ejemplo n.º 2
0
        private void ValidateForCancelOrder(AvatarState avatarState, Guid tradableId)
        {
            if (!avatarState.address.Equals(SellerAvatarAddress) || !avatarState.agentAddress.Equals(SellerAgentAddress))
            {
                throw new InvalidAddressException(
                          $"Invalid Seller Addresses. Expected Addresses: {SellerAgentAddress}, {SellerAvatarAddress}. Actual: {avatarState.agentAddress}, {avatarState.address}");
            }

            if (!TradableId.Equals(tradableId))
            {
                throw new InvalidTradableIdException($"{tradableId} is not equals {TradableId}");
            }
        }
Ejemplo n.º 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = OrderId.GetHashCode();
         hashCode = (hashCode * 397) ^ TradableId.GetHashCode();
         hashCode = (hashCode * 397) ^ SellerAgentAddress.GetHashCode();
         hashCode = (hashCode * 397) ^ SellerAvatarAddress.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)ItemSubType;
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = StartedBlockIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ ExpiredBlockIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ OrderId.GetHashCode();
         hashCode = (hashCode * 397) ^ TradableId.GetHashCode();
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         hashCode = (hashCode * 397) ^ CombatPoint;
         hashCode = (hashCode * 397) ^ Level;
         hashCode = (hashCode * 397) ^ ItemId;
         hashCode = (hashCode * 397) ^ SellerAgentAddress.GetHashCode();
         hashCode = (hashCode * 397) ^ ItemCount;
         return(hashCode);
     }
 }
Ejemplo n.º 5
0
        private int ValidateForTransfer(AvatarState avatarState, Guid tradableId, FungibleAssetValue price, long blockIndex)
        {
            if (!avatarState.address.Equals(SellerAvatarAddress) || !avatarState.agentAddress.Equals(SellerAgentAddress))
            {
                return(Buy.ErrorCodeInvalidAddress);
            }

            if (!TradableId.Equals(tradableId))
            {
                return(Buy.ErrorCodeInvalidTradableId);
            }

            if (!Price.Equals(price))
            {
                return(Buy.ErrorCodeInvalidPrice);
            }

            return(ExpiredBlockIndex < blockIndex ? Buy.ErrorCodeShopItemExpired : 0);
        }