public void CancelGameCallback(RPCContext context)
        {
            BattleNetCSharp sharp = BattleNet.Get() as BattleNetCSharp;

            if ((sharp != null) && (sharp.Games != null))
            {
                BattleNetErrors status = (BattleNetErrors)context.Header.Status;
                sharp.Games.ApiLog.LogDebug("CancelGameCallback, status=" + status);
                switch (status)
                {
                case BattleNetErrors.ERROR_OK:
                case BattleNetErrors.ERROR_GAME_MASTER_INVALID_GAME:
                    if (sharp.Games.IsFindGamePending || ((sharp.Games.CurrentGameRequest != 0) && (sharp.Games.CurrentGameRequest != this.m_gameRequestId)))
                    {
                        object[] args = new object[] { this.m_gameRequestId, sharp.Games.CurrentGameRequest };
                        sharp.Games.ApiLog.LogDebug("CancelGameCallback received for id={0} but is not the current gameRequest={1}, ignoring it.", args);
                    }
                    else
                    {
                        sharp.Games.CurrentGameRequest = 0L;
                        sharp.Games.AddQueueEvent(BattleNet.QueueEvent.Type.QUEUE_CANCEL, 0, 0, 0, null);
                    }
                    break;

                default:
                    sharp.EnqueueErrorInfo(BnetFeature.Games, BnetFeatureEvent.Games_OnCancelGame, status, context.Context);
                    break;
                }
            }
        }
 public static void DissolveParty(PartyId partyId)
 {
     if (IsInParty(partyId))
     {
         BattleNet.DissolveParty(partyId.ToDllEntityId());
     }
 }
 public void SendWhisper(BnetGameAccountId gameAccount, string message)
 {
     if (!string.IsNullOrEmpty(message))
     {
         bnet.protocol.notification.Notification notification = new bnet.protocol.notification.Notification();
         notification.SetType("WHISPER");
         EntityId val = new EntityId();
         val.SetLow(gameAccount.GetLo());
         val.SetHigh(gameAccount.GetHi());
         notification.SetTargetId(val);
         bnet.protocol.attribute.Attribute attribute = new bnet.protocol.attribute.Attribute();
         attribute.SetName("whisper");
         bnet.protocol.attribute.Variant variant = new bnet.protocol.attribute.Variant();
         variant.SetStringValue(message);
         attribute.SetValue(variant);
         notification.AddAttribute(attribute);
         base.m_rpcConnection.QueueRequest(base.m_battleNet.NotificationService.Id, 1, notification, new RPCContextDelegate(this.WhisperSentCallback), 0);
         BnetGameAccountId id   = BnetGameAccountId.CreateFromDll(BattleNet.GetMyGameAccountId());
         BnetWhisper       item = new BnetWhisper();
         item.SetSpeakerId(id);
         item.SetReceiverId(gameAccount);
         item.SetMessage(message);
         TimeSpan elapsedTimeSinceEpoch = TimeUtils.GetElapsedTimeSinceEpoch(null);
         item.SetTimestampMilliseconds(elapsedTimeSinceEpoch.TotalMilliseconds);
         this.m_whispers.Add(item);
     }
 }
 public static KeyValuePair <string, object>[] GetAllPartyAttributes(PartyId partyId)
 {
     string[] strArray;
     if (partyId == null)
     {
         return(new KeyValuePair <string, object> [0]);
     }
     BattleNet.GetAllPartyAttributes(partyId.ToDllEntityId(), out strArray);
     KeyValuePair <string, object>[] pairArray = new KeyValuePair <string, object> [strArray.Length];
     for (int i = 0; i < pairArray.Length; i++)
     {
         string attributeKey       = strArray[i];
         object obj2               = null;
         long?  partyAttributeLong = GetPartyAttributeLong(partyId, attributeKey);
         if (partyAttributeLong.HasValue)
         {
             obj2 = partyAttributeLong;
         }
         string partyAttributeString = GetPartyAttributeString(partyId, attributeKey);
         if (partyAttributeString != null)
         {
             obj2 = partyAttributeString;
         }
         byte[] partyAttributeBlob = GetPartyAttributeBlob(partyId, attributeKey);
         if (partyAttributeBlob != null)
         {
             obj2 = partyAttributeBlob;
         }
         pairArray[i] = new KeyValuePair <string, object>(attributeKey, obj2);
     }
     return(pairArray);
 }
 public static string GetMessage(string message)
 {
     if (Localization.GetLocale() == Locale.zhCN)
     {
         return(BattleNet.FilterProfanity(message));
     }
     return(message);
 }
Esempio n. 6
0
 private bool UseKoreanRating()
 {
     if (SceneMgr.Get().IsInGame())
     {
         return(false);
     }
     return(BattleNet.GetAccountCountry() == "KOR");
 }
 public static int CountMembers(PartyId partyId)
 {
     if (partyId == null)
     {
         return(0);
     }
     return(BattleNet.GetCountPartyMembers(partyId.ToDllEntityId()));
 }
 private void InitMaximums()
 {
     BattleNet.DllFriendsInfo info = new BattleNet.DllFriendsInfo();
     BattleNet.GetFriendsInfo(ref info);
     this.m_maxFriends         = info.maxFriends;
     this.m_maxReceivedInvites = info.maxRecvInvites;
     this.m_maxSentInvites     = info.maxSentInvites;
 }
 public void FindGame(byte[] requestGuid, BnetGameType gameType, int scenario, long deckId, long aiDeckId, bool setScenarioIdAttr)
 {
     if (this.s_gameRequest != 0)
     {
         Debug.LogWarning("WARNING: FindGame called with an active game");
         this.CancelFindGame(this.s_gameRequest);
         this.s_gameRequest = 0L;
     }
     if (this.IsNoAccountTutorialGame(gameType))
     {
         this.GoToNoAccountTutorialServer(scenario);
     }
     else
     {
         object[] args = new object[] { gameType, scenario, deckId, aiDeckId, !setScenarioIdAttr ? 0 : 1, (requestGuid != null) ? requestGuid.ToHexString() : "null" };
         base.ApiLog.LogInfo("FindGame type={0} scenario={1} deck={2} aideck={3} setScenId={4} request_guid={5}", args);
         bnet.protocol.game_master.Player val = new bnet.protocol.game_master.Player();
         Identity identity = new Identity();
         identity.SetGameAccountId(base.m_battleNet.GameAccountId);
         val.SetIdentity(identity);
         val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)gameType));
         val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
         val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)deckId)));
         val.AddAttribute(ProtocolHelper.CreateAttribute("aideck", (long)((int)aiDeckId)));
         val.AddAttribute(ProtocolHelper.CreateAttribute("request_guid", requestGuid));
         GameProperties  properties = new GameProperties();
         AttributeFilter filter     = new AttributeFilter();
         filter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL);
         if (!BattleNet.IsVersionInt() && (BattleNet.GetVersionString() == "PAX"))
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString() + BattleNet.GetVersionInt().ToString()));
         }
         else if (BattleNet.IsVersionInt())
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)BattleNet.GetVersionInt()));
         }
         else
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString()));
         }
         filter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", (long)gameType));
         if (setScenarioIdAttr)
         {
             filter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario));
         }
         properties.SetFilter(filter);
         properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", (long)gameType));
         properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
         FindGameRequest request = new FindGameRequest();
         request.AddPlayer(val);
         request.SetProperties(properties);
         request.SetAdvancedNotification(true);
         FindGameRequest request2 = request;
         this.PrintFindGameRequest(request2);
         this.IsFindGamePending = true;
         base.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3, request2, new RPCContextDelegate(this.FindGameCallback), 0);
     }
 }
 public static InviteRequest[] GetInviteRequests(PartyId partyId)
 {
     InviteRequest[] requestArray;
     if (partyId == null)
     {
         return(new InviteRequest[0]);
     }
     BattleNet.GetPartyInviteRequests(partyId.ToDllEntityId(), out requestArray);
     return(requestArray);
 }
Esempio n. 11
0
 public static Locale[] GetLoadOrder(Locale locale, bool isCardTexture = false)
 {
     Locale[] array = LOAD_ORDERS[locale];
     if ((Network.IsRunning() && (BattleNet.GetAccountCountry() == "CHN")) && isCardTexture)
     {
         Array.Resize <Locale>(ref array, array.Length + 1);
         Array.Copy(array, 0, array, 1, array.Length - 1);
         array[0] = Locale.zhCN;
     }
     return(array);
 }
Esempio n. 12
0
    private uint SendToUtil(SystemChannel system, ulong route, ClientRequestType request, PendingMapType pendingMap)
    {
        uint key = this.GenerateContextId();

        BattleNet.SendUtilPacket(request.Type, system.SystemId, request.Body, request.Body.Length, request.SubID, (int)key, route);
        request.Context  = key;
        request.System   = system;
        request.SendTime = DateTime.Now;
        this.m_state.m_contextIdToRequestMap.Add(key, request);
        string str = !request.IsSubsribeRequest ? request.Phase.ToString() : "SUBSCRIBE";

        return(key);
    }
 private void GoToNoAccountTutorialServer(int scenario)
 {
     BattleNet.GameServerInfo gameServer = new BattleNet.GameServerInfo();
     if (!BattleNet.IsVersionInt() && (BattleNet.GetVersionString() == "PAX"))
     {
         gameServer.Version = BattleNet.GetVersionString() + BattleNet.GetVersionInt().ToString();
     }
     else
     {
         gameServer.Version = BattleNet.GetVersion();
     }
     if (Vars.Key("Loopback.Active").GetBool(false))
     {
         gameServer.Address        = Vars.Key("Loopback.Address").GetStr(string.Empty);
         gameServer.Port           = Vars.Key("Loopback.Port").GetInt(0);
         gameServer.AuroraPassword = BattleNet.GetVersionString();
     }
     else
     {
         Network.BnetRegion currentRegionId = MobileDeviceLocale.GetCurrentRegionId();
         if (ApplicationMgr.GetMobileEnvironment() == MobileEnv.PRODUCTION)
         {
             string str;
             try
             {
                 str = RegionToTutorialName[currentRegionId];
             }
             catch (KeyNotFoundException)
             {
                 Debug.LogWarning("No matching tutorial server name found for region " + currentRegionId);
                 str = "us";
             }
             gameServer.Address = string.Format("{0}-tutorial{1}.actual.battle.net", str, BattleNet.TutorialServer);
             gameServer.Port    = 0x45f;
         }
         else
         {
             gameServer.Address = "10.130.126.28";
             MobileDeviceLocale.ConnectionData connectionDataFromRegionId = MobileDeviceLocale.GetConnectionDataFromRegionId(currentRegionId, true);
             gameServer.Port    = connectionDataFromRegionId.tutorialPort;
             gameServer.Version = connectionDataFromRegionId.version;
         }
         object[] args = new object[] { currentRegionId, gameServer.Address, gameServer.Port, gameServer.Version };
         Log.JMac.Print(string.Format("Connecting to account-free tutorial server for region {0}.  Address: {1}  Port: {2}  Version: {3}", args), new object[0]);
         gameServer.AuroraPassword = string.Empty;
     }
     gameServer.GameHandle   = 0;
     gameServer.ClientHandle = 0L;
     gameServer.Mission      = scenario;
     this.ResolveAddressAndGotoGameServer(gameServer);
 }
Esempio n. 14
0
    private void TerminateImpl()
    {
        Unsubscribe protobuf = new Unsubscribe();

        byte[] bytes = ProtobufUtil.ToByteArray(protobuf);
        foreach (KeyValuePair <int, SystemChannel> pair in this.m_state.m_systems.Systems)
        {
            SystemChannel channel = pair.Value;
            if ((channel.SubscriptionStatus.CurrentState == SubscriptionStatusType.State.SUBSCRIBED) && (channel.Route != 0))
            {
                BattleNet.SendUtilPacket(0x149, channel.SystemId, bytes, bytes.Length, 0, 0, channel.Route);
            }
        }
    }
    public void CreateFriendlyChallengeGame(long myDeck, long hisDeck, EntityId hisGameAccount, int scenario)
    {
        FindGameRequest request = new FindGameRequest();

        bnet.protocol.game_master.Player val = new bnet.protocol.game_master.Player();
        Identity identity = new Identity();

        identity.SetGameAccountId(base.m_battleNet.GameAccountId);
        GameProperties  properties = new GameProperties();
        AttributeFilter filter     = new AttributeFilter();

        filter.SetOp(AttributeFilter.Types.Operation.MATCH_ALL);
        if (!BattleNet.IsVersionInt() && (BattleNet.GetVersionString() == "PAX"))
        {
            filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString() + BattleNet.GetVersionInt().ToString()));
        }
        else if (BattleNet.IsVersionInt())
        {
            filter.AddAttribute(ProtocolHelper.CreateAttribute("version", (long)BattleNet.GetVersionInt()));
        }
        else
        {
            filter.AddAttribute(ProtocolHelper.CreateAttribute("version", BattleNet.GetVersionString()));
        }
        filter.AddAttribute(ProtocolHelper.CreateAttribute("GameType", (long)1L));
        filter.AddAttribute(ProtocolHelper.CreateAttribute("ScenarioId", (long)scenario));
        properties.SetFilter(filter);
        properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("type", (long)1L));
        properties.AddCreationAttributes(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
        val.SetIdentity(identity);
        val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)1L));
        val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
        val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)myDeck)));
        request.AddPlayer(val);
        identity = new Identity();
        val      = new bnet.protocol.game_master.Player();
        identity.SetGameAccountId(hisGameAccount);
        val.SetIdentity(identity);
        val.AddAttribute(ProtocolHelper.CreateAttribute("type", (long)1L));
        val.AddAttribute(ProtocolHelper.CreateAttribute("scenario", (long)scenario));
        val.AddAttribute(ProtocolHelper.CreateAttribute("deck", (long)((int)hisDeck)));
        request.AddPlayer(val);
        request.SetProperties(properties);
        request.SetAdvancedNotification(true);
        FindGameRequest request2 = request;

        this.PrintFindGameRequest(request2);
        this.IsFindGamePending = true;
        base.m_rpcConnection.QueueRequest(this.m_gameMasterService.Id, 3, request2, new RPCContextDelegate(this.FindGameCallback), 0);
    }
Esempio n. 16
0
 public void OnLoggedIn()
 {
     Network.Get().SetPartyHandler(new Network.PartyHandler(this.OnPartyUpdate));
     NetCache.Get().RegisterFriendChallenge(new NetCache.NetCacheCallback(this.OnNetCacheReady));
     SceneMgr.Get().RegisterSceneUnloadedEvent(new SceneMgr.SceneUnloadedCallback(this.OnSceneUnloaded));
     SceneMgr.Get().RegisterSceneLoadedEvent(new SceneMgr.SceneLoadedCallback(this.OnSceneLoaded));
     BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged));
     BnetFriendMgr.Get().AddChangeListener(new BnetFriendMgr.ChangeCallback(this.OnFriendsChanged));
     BnetNearbyPlayerMgr.Get().AddChangeListener(new BnetNearbyPlayerMgr.ChangeCallback(this.OnNearbyPlayersChanged));
     BnetEventMgr.Get().AddChangeListener(new BnetEventMgr.ChangeCallback(this.OnBnetEventOccurred));
     GameMgr.Get().RegisterFindGameEvent(new GameMgr.FindGameCallback(this.OnFindGameEvent));
     BnetParty.OnJoined += new BnetParty.JoinedHandler(this.BnetParty_OnJoined);
     BnetParty.RegisterAttributeChangedHandler("WTCG.Friendly.DeclineReason", new BnetParty.PartyAttributeChangedHandler(this.BnetParty_OnPartyAttributeChanged_DeclineReason));
     BnetParty.RegisterAttributeChangedHandler("error", new BnetParty.PartyAttributeChangedHandler(this.BnetParty_OnPartyAttributeChanged_Error));
     this.AddChangedListener(new ChangedCallback(this.OnChallengeChanged));
     BnetPresenceMgr.Get().SetGameField(0x13, BattleNet.GetVersion());
     BnetPresenceMgr.Get().SetGameField(20, BattleNet.GetEnvironment());
 }
Esempio n. 17
0
            public static void OnMessageRecv(Message msg)
            {
                var response = new MsgAccountInfoResponse();

                var    p      = BnetPresenceMgr.Get().GetMyPlayer();
                string name   = p.GetBattleTag().GetName();
                string region = BattleNet.GetCurrentRegion().ToString().Substring(7);

                response.Name = name + "-" + region;

                response.Dust  = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance;
                response.Gold  = NetCache.Get().GetNetObject <NetCache.NetCacheGoldBalance>().GetTotal();
                response.Packs = NetCache.Get().GetNetObject <NetCache.NetCacheBoosters>().GetTotalNumBoosters();

                var rm    = RankMgr.Get();
                var rpf   = rm.GetRankPresenceField(p);
                var medal = rpf.GetCurrentMedal();

                response.Rank  = medal.rank;
                response.Stars = medal.earnedStars;

                HSMPClient.Get().Send(response);

                // TEST

                var deckList = new MsgDeckList();
                var list     = new List <MsgDeckList.Deck>();

                var cm = CollectionManager.Get();

                foreach (var k in cm.GetDecks())
                {
                    var deck = new MsgDeckList.Deck();
                    deck.ID        = k.Value.ID;
                    deck.Name      = k.Value.Name;
                    deck.HeroClass = k.Value.GetClass();
                    list.Add(deck);
                }

                deckList.Decks = list;
                HSMPClient.Get().Send(deckList);
            }
    public static void CreateParty(PartyType partyType, PrivacyLevel privacyLevel, CreateSuccessCallback successCallback)
    {
        string szPartyType = EnumUtils.GetString <PartyType>(partyType);

        if ((s_pendingPartyCreates != null) && s_pendingPartyCreates.ContainsKey(partyType))
        {
            object[] args = new object[] { partyType };
            RaisePartyError(true, szPartyType, BnetFeatureEvent.Party_Create_Callback, 6, "CreateParty: Already creating party of type {0}", args);
        }
        else
        {
            if (s_pendingPartyCreates == null)
            {
                s_pendingPartyCreates = new Map <PartyType, CreateSuccessCallback>();
            }
            s_pendingPartyCreates[partyType] = successCallback;
            byte[] creatorBlob = ProtobufUtil.ToByteArray(BnetEntityId.CreateForNet(BnetPresenceMgr.Get().GetMyGameAccountId()));
            BattleNet.CreateParty(szPartyType, (int)privacyLevel, creatorBlob);
        }
    }
    private string GetParamString(Param paramType)
    {
        switch (paramType)
        {
        case Param.LOCALE:
            return(Localization.GetLocale().ToString());

        case Param.REGION:
        {
            Network.BnetRegion accountRegion = BattleNet.GetAccountRegion();
            if (!s_regionToStrMap.ContainsKey(accountRegion))
            {
                Debug.LogError(string.Format("StoreURL unrecognized region {0}", accountRegion));
                return(s_regionToStrMap[Network.BnetRegion.REGION_US]);
            }
            return(s_regionToStrMap[accountRegion]);
        }
        }
        return(string.Empty);
    }
 private void CacheMyAccountInfo()
 {
     if (this.m_idString == null)
     {
         BnetGameAccountId myGameAccountId = BnetPresenceMgr.Get().GetMyGameAccountId();
         if (myGameAccountId != null)
         {
             BnetPlayer myPlayer = BnetPresenceMgr.Get().GetMyPlayer();
             if (myPlayer != null)
             {
                 BnetAccountId accountId = myPlayer.GetAccountId();
                 if (accountId != null)
                 {
                     BnetBattleTag battleTag = myPlayer.GetBattleTag();
                     if (battleTag != null)
                     {
                         this.m_myGameAccountLo = myGameAccountId.GetLo();
                         StringBuilder builder = new StringBuilder();
                         builder.Append(accountId.GetHi());
                         builder.Append(',');
                         builder.Append(accountId.GetLo());
                         builder.Append(',');
                         builder.Append(myGameAccountId.GetHi());
                         builder.Append(',');
                         builder.Append(myGameAccountId.GetLo());
                         builder.Append(',');
                         builder.Append(battleTag.GetName());
                         builder.Append(',');
                         builder.Append(battleTag.GetNumber());
                         builder.Append(',');
                         builder.Append(BattleNet.GetVersion());
                         builder.Append(',');
                         builder.Append(BattleNet.GetEnvironment());
                         this.m_idString = builder.ToString();
                     }
                 }
             }
         }
     }
 }
Esempio n. 21
0
    public static void Initialize()
    {
        Locale locale;
        Locale?nullable = null;

        if ((LOCALE_FROM_OPTIONS != null) && EnumUtils.TryGetEnum <Locale>(Options.Get().GetString(Option.LOCALE), out locale))
        {
            nullable = new Locale?(locale);
        }
        if (!nullable.HasValue)
        {
            Locale locale2;
            string launchOption = null;
            if (ApplicationMgr.IsPublic())
            {
                launchOption = BattleNet.GetLaunchOption("LOCALE");
            }
            if (string.IsNullOrEmpty(launchOption))
            {
                launchOption = Vars.Key("Localization.Locale").GetStr(DEFAULT_LOCALE_NAME);
            }
            if (ApplicationMgr.IsInternal())
            {
                string str = Vars.Key("Localization.OverrideBnetLocale").GetStr(string.Empty);
                if (!string.IsNullOrEmpty(str))
                {
                    launchOption = str;
                }
            }
            if (EnumUtils.TryGetEnum <Locale>(launchOption, out locale2))
            {
                nullable = new Locale?(locale2);
            }
            else
            {
                nullable = 0;
            }
        }
        SetLocale(nullable.Value);
    }
    protected void Awake()
    {
        this.Show(false);
        this.m_headers           = new Dictionary <string, string>();
        this.m_headers["Accept"] = "application/json";
        string str  = (BattleNet.GetCurrentRegion() != Network.BnetRegion.REGION_CN) ? "us" : "cn";
        string str2 = "https://api.battlenet.com.cn/cms/ad/list?locale=zh_cn&community=hearthstone&mediaCategory=IN_GAME_AD&apikey=4r78qhz9atqzsxkk2qhqku6gy7p9tj8c";
        string str3 = string.Format("https://us.api.battle.net/cms/ad/list?locale={0}&community=hearthstone&mediaCategory=IN_GAME_AD&apikey=4r78qhz9atqzsxkk2qhqku6gy7p9tj8c", Localization.GetLocaleName());

        if (str.Equals("cn"))
        {
            this.m_url = str2;
        }
        else
        {
            this.m_url = str3;
        }
        Log.InnKeepersSpecial.Print("Inkeeper Ad: " + this.m_url, new object[0]);
        this.m_link = null;
        this.adButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.Click));
        this.Update();
    }
Esempio n. 23
0
    private void RequestPlayerPresence()
    {
        BattleNet.DllEntityId entityId = new BattleNet.DllEntityId {
            hi = this.m_gameAccountId.GetHi(),
            lo = this.m_gameAccountId.GetLo()
        };
        List <BattleNet.DllPresenceFieldKey> list = new List <BattleNet.DllPresenceFieldKey>();

        BattleNet.DllPresenceFieldKey item = new BattleNet.DllPresenceFieldKey {
            programId = BnetProgramId.BNET.GetValue(),
            groupId   = 2,
            fieldId   = 7,
            index     = 0L
        };
        list.Add(item);
        item.programId = BnetProgramId.BNET.GetValue();
        item.groupId   = 2;
        item.fieldId   = 3;
        item.index     = 0L;
        list.Add(item);
        item.programId = BnetProgramId.BNET.GetValue();
        item.groupId   = 2;
        item.fieldId   = 5;
        item.index     = 0L;
        list.Add(item);
        if (GameUtils.ShouldShowRankedMedals())
        {
            BattleNet.DllPresenceFieldKey key2 = new BattleNet.DllPresenceFieldKey {
                programId = BnetProgramId.HEARTHSTONE.GetValue(),
                groupId   = 2,
                fieldId   = 0x12,
                index     = 0L
            };
            list.Add(key2);
        }
        BattleNet.DllPresenceFieldKey[] fieldList = list.ToArray();
        BattleNet.RequestPresenceFields(true, entityId, fieldList);
    }
Esempio n. 24
0
 private void DropPack()
 {
     PegCursor.Get().SetMode(PegCursor.Mode.STOPDRAG);
     this.m_Socket.OnPackReleased();
     this.m_SocketAccent.OnPackReleased();
     if (UniversalInputManager.Get().InputIsOver(this.m_Socket.gameObject))
     {
         if (BattleNet.GetAccountCountry() == "KOR")
         {
             m_hasAcknowledgedKoreanWarning = true;
         }
         this.OpenBooster(this.m_draggedPack);
         this.HideHint();
     }
     else
     {
         this.PutBackBooster();
         this.DestroyHint();
     }
     this.DestroyDraggedPack();
     this.UpdateUIEvents();
     this.m_DragPlane.SetActive(false);
 }
    private ClientRequest CreateClientRequest(int type, int sys, byte[] bs, ulong route)
    {
        ClientRequest request = new ClientRequest();

        byte[] dst = new byte[bs.Length + 2];
        dst[0] = (byte)(type & 0xff);
        dst[1] = (byte)((type & 0xff00) >> 8);
        Buffer.BlockCopy(bs, 0, dst, 2, bs.Length);
        request.AddAttribute(ProtocolHelper.CreateAttribute("p", dst));
        if (BattleNet.IsVersionInt())
        {
            request.AddAttribute(ProtocolHelper.CreateAttribute("v", (long)((10 * BattleNet.GetVersionInt()) + sys)));
        }
        else
        {
            request.AddAttribute(ProtocolHelper.CreateAttribute("v", BattleNet.GetVersionString() + ((sys != 0) ? "b" : "c")));
        }
        if (route != 0)
        {
            request.AddAttribute(ProtocolHelper.CreateAttribute("r", route));
        }
        return(request);
    }
Esempio n. 26
0
 private bool CurrentRegionIsCN()
 {
     return(BattleNet.GetCurrentRegion() == Network.BnetRegion.REGION_CN);
 }
 public static void ClearPartyAttribute(PartyId partyId, string attributeKey)
 {
     BattleNet.ClearPartyAttribute(partyId.ToDllEntityId(), attributeKey);
 }
 public static void AcceptReceivedInvite(ulong inviteId)
 {
     BattleNet.AcceptPartyInvite(inviteId);
 }
 public static void DeclineReceivedInvite(ulong inviteId)
 {
     BattleNet.DeclinePartyInvite(inviteId);
 }
Esempio n. 30
0
 private void ChinaRestrictions()
 {
     BattleNet.GetPlayRestrictions(ref this.m_Restrictions, true);
     base.StartCoroutine(this.ChinaRestrictionsUpdate());
 }