Пример #1
0
        private void OnAcceptTcpClient(IAsyncResult ar)
        {
            TcpClient tcpClient = tcpListener.EndAcceptTcpClient(ar);
            BaseProxy proxyClient = null;

            try
            {
                tcpListener.BeginAcceptTcpClient(new AsyncCallback(OnAcceptTcpClient), null);
            }
            catch (Exception)
            {
                tcpListener = null;
                throw;
            }

            switch (proxyType)
            {
                case ProxyType.Bnet :
                    proxyClient = new BnetProxy(tcpClient);
                    proxyClient.ProxyServer = this;
                    BnetProxies.Add((BnetProxy)proxyClient);
                    break;

                case ProxyType.Realm  :
                    proxyClient = new RealmProxy(tcpClient);
                    RealmProxies.Add((RealmProxy)proxyClient);
                    break;

                case ProxyType.Game :
                    proxyClient = new GameProxy(tcpClient);
                    GameProxies.Add((GameProxy)proxyClient);
                    break;
            }

            this.ClientConnected(proxyClient, new EventArgs());

        }
Пример #2
0
        private void RegisterGameProxyEvents(GameProxy proxy)
        {
            // Bnet Events
            proxy.OnAboutPlayer += this.OnAboutPlayer;
            proxy.OnAcceptTrade += this.OnAcceptTrade;
            proxy.OnAddUnit += this.OnAddUnit;
            proxy.OnAssignGameObject += this.OnAssignGameObject;
            proxy.OnAssignMerc += this.OnAssignMerc;
            proxy.OnAssignNPC += this.OnAssignNPC;
            proxy.OnAssignPlayer += this.OnAssignPlayer;
            proxy.OnAssignPlayerCorpse += this.OnAssignPlayerCorpse;
            proxy.OnAssignPlayerToParty += this.OnAssignPlayerToParty;
            proxy.OnAssignSkill += this.OnAssignSkill;
            proxy.OnAssignSkillHotkey += this.OnAssignSkillHotkey;
            proxy.OnAssignWarp += this.OnAssignWarp;
            proxy.OnAttributeNotification += this.OnAttributeNotification;
            proxy.OnDelayedState += this.OnDelayedState;
            proxy.OnEndState += this.OnEndState;
            proxy.OnGainExperience += this.OnGainExperience;
            proxy.OnGameHandshake += this.OnGameHandshake;
            proxy.OnGameLoading += this.OnGameLoading;
            proxy.OnGameLogonReceipt += this.OnGameLogonReceipt;
            proxy.OnGameLogonSuccess += this.OnGameLogonSuccess;
            proxy.OnGameLogoutSuccess += this.OnGameLogoutSuccess;
            proxy.OnGameOver += this.OnGameOver;
            proxy.OnGoldTrade += this.OnGoldTrade;
            proxy.OnInformationMessage += this.OnInformationMessage;
            proxy.OnItemTriggerSkill += this.OnItemTriggerSkill;
            proxy.OnLoadAct += this.OnLoadAct;
            proxy.OnLoadDone += this.OnLoadDone;
            proxy.OnMapAdd += this.OnMapAdd;
            proxy.OnMapRemove += this.OnMapRemove;
            proxy.OnMercAttributeNotification += this.OnMercAttributeNotification;
            proxy.OnMercForHire += this.OnMercForHire;
            proxy.OnMercForHireListStart += this.OnMercForHireListStart;
            proxy.OnMercGainExperience += this.OnMercGainExperience;
            proxy.OnMonsterAttack += this.OnMonsterAttack;
            proxy.OnNPCAction += this.OnNPCAction;
            proxy.OnNPCGetHit += this.OnNPCGetHit;
            proxy.OnNPCHeal += this.OnNPCHeal;
            proxy.OnNPCInfo += this.OnNPCInfo;
            proxy.OnNPCMove += this.OnNPCMove;
            proxy.OnNPCMoveToTarget += this.OnNPCMoveToTarget;
            proxy.OnNPCStop += this.OnNPCStop;
            proxy.OnNPCWantsInteract += this.OnNPCWantsInteract;
            proxy.OnOpenWaypoint += this.OnOpenWaypoint;
            proxy.OnOwnedItemAction += this.OnOwnedItemAction;
            proxy.OnPartyMemberPulse += this.OnPartyMemberPulse;
            proxy.OnPartyMemberUpdate += this.OnPartyMemberUpdate;
            proxy.OnPartyRefresh  += this.OnPartyRefresh;
            proxy.OnPlayerAttributeNotification += this.OnPlayerAttributeNotification;
            proxy.OnPlayerClearCursor += this.OnPlayerClearCursor;
            proxy.OnPlayerCorpseVisible += this.OnPlayerCorpseVisible;
            proxy.OnPlayerInGame += this.OnPlayerInGame;
            proxy.OnPlayerInSight += this.OnPlayerInSight;
            proxy.OnPlayerKillCount += this.OnPlayerKillCount;
            proxy.OnPlayerLeaveGame += this.OnPlayerLeaveGame;
            proxy.OnPlayerLifeManaChange += this.OnPlayerLifeManaChange;
            proxy.OnPlayerMove += this.OnPlayerMove;
            proxy.OnPlayerMoveToTarget += this.OnPlayerMoveToTarget;
            proxy.OnPlayerPartyRelationship += this.OnPlayerPartyRelationship;
            proxy.OnPlayerReassign += this.OnPlayerReassign;
            proxy.OnPlayerRelationship += this.OnPlayerRelationship;
            proxy.OnPlayerStop += this.OnPlayerStop;
            proxy.OnPlaySound += this.OnPlaySound;
            proxy.OnPong += this.OnPong;
            proxy.OnPortalInfo += this.OnPortalInfo;
            proxy.OnPortalOwnership += this.OnPortalOwnership;
            proxy.OnQuestItemState += this.OnQuestItemState;
            proxy.OnReceiveMessage += this.OnReceiveMessage;
            proxy.OnRelator1 += this.OnRelator1;
            proxy.OnRelator2 += this.OnRelator2;
            proxy.OnRemoveGroundUnit += this.OnRemoveGroundUnit;
            proxy.OnReportKill += this.OnReportKill;
            proxy.OnRequestLogonInfo += this.OnRequestLogonInfo;
            proxy.OnSetGameObjectMode += this.OnSetGameObjectMode;
            proxy.OnSetItemState += this.OnSetItemState;
            proxy.OnSetNPCMode += this.OnSetNPCMode;
            proxy.OnSetState += this.OnSetState;
            proxy.OnSkillsLog += this.OnSkillsLog;
            proxy.OnSmallGoldAdd += this.OnSmallGoldAdd;
            proxy.OnSummonAction += this.OnSummonAction;
            proxy.OnSwitchWeaponSet += this.OnSwitchWeaponSet;
            proxy.OnTransactionComplete += this.OnTransactionComplete;
            proxy.OnUnitUseSkill += this.OnUnitUseSkill;
            proxy.OnUnitUseSkillOnTarget += this.OnUnitUseSkillOnTarget;
            proxy.OnUnloadDone += this.OnUnloadDone;
            proxy.OnUpdateGameQuestLog += this.OnUpdateGameQuestLog;
            proxy.OnUpdateItemStats += this.OnUpdateItemStats;
            proxy.OnUpdateItemUI += this.OnUpdateItemUI;
            proxy.OnUpdatePlayerItemSkill += this.OnUpdatePlayerItemSkill;
            proxy.OnUpdateQuestInfo += this.OnUpdateQuestInfo;
            proxy.OnUpdateQuestLog += this.OnUpdateQuestLog;
            proxy.OnUpdateSkill += this.OnUpdateSkill;
            proxy.OnUseSpecialItem += this.OnUseSpecialItem;
            proxy.OnUseStackableItem += this.OnUseStackableItem;
            proxy.OnWalkVerify += this.OnWalkVerify;
            proxy.OnWardenCheck += this.OnWardenCheck;
            proxy.OnWorldItemAction += this.OnWorldItemAction;

            //TODO: Add Diablo events here
            proxy.OnExitGame += this.OnExitGame;
        }