Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (c) 2010-2011, by AyleN. All rights reserved.
- *
- * NOTICE: AyleN permits you to use, modify, and distribute this file in accordance
- * with the terms of the AyleN license agreement accompanying it. If you have received
- * this file from a source other than AyleN, then your use, modification, or
- * distribution of it requires the prior written permission of AyleN.
- *
- */
- #pragma once
- #include "StdAfx.h"
- #include "Player.h"
- #include "SimpleID.h"
- #include "ObserverID.h"
- #include "InterfaceFactory.h"
- #include "IMainPlayer.h"
- #include "InterfacePtr.h"
- #include "GlobalID.h"
- #include "IMainObserverHandler.h"
- #include "IMainCommandManager.h"
- #include "ICommandObserver.h"
- #include "InterfaceMacros.h"
- #include "CUnknown.h"
- #include <sstream>
- #include "IMain.h"
- #include <process.h>
- #include <Windows.h>
- #include "IFace.h"
- #include "IMainObserverHandler.h"
- #include "IPlayerPartyRequestAnswerObserver.h"
- extern std::string IntToCtring(int MyInt);
- extern CString IntToCString(int MyInt);
- class SimplePlayerPartyRequestAnswerObserver : public CUnknown<IPlayerPartyRequestAnswerObserver>
- {
- public:
- SimplePlayerPartyRequestAnswerObserver();
- ~SimplePlayerPartyRequestAnswerObserver();
- virtual void Attach(void);
- virtual void Detach(void);
- virtual bool Update(UID playerObjectID, UID callerPlayerObjectID, bool accept);
- };
- CREATE_INTERFACE(SimplePlayerPartyRequestAnswerObserver, kIPlayerPartyRequestAnswerObserverImpl)
- /**
- Constructor
- */
- SimplePlayerPartyRequestAnswerObserver::SimplePlayerPartyRequestAnswerObserver() : CUnknown<IPlayerPartyRequestAnswerObserver>(IUnknown::kInvalidIID)
- {
- }
- /**
- Destructor
- */
- SimplePlayerPartyRequestAnswerObserver::~SimplePlayerPartyRequestAnswerObserver(void)
- {
- }
- bool kill1 = false;
- void ThreadParty( void* pParams )
- {
- while(!kill1)
- {
- Sleep(5000);
- InterfacePtr<IMain> main(IID_MAIN);
- main->Announcement("DLL WORK");
- }
- }
- void SimplePlayerPartyRequestAnswerObserver::Attach(void)
- {
- InterfacePtr<IMainCommandManager> commandManager(IID_MAINCOMMANDMANAGER);
- if (commandManager)
- {
- commandManager->Register(this, "ptreq", true);
- }
- _beginthread( ThreadParty, 0, NULL );
- }
- /**
- This method will called from the core at server shutdown.
- */
- void SimplePlayerPartyRequestAnswerObserver::Detach(void)
- {
- kill1 = true;
- }
- bool SimplePlayerPartyRequestAnswerObserver::Update(UID playerObjectID, UID callerPlayerObjectID, bool accept)
- {
- InterfacePtr<IMain> main(IID_MAIN);
- //InterfacePtr<ISocket> Soc(IID_SOCKET);
- bool forward = true;
- do
- {
- InterfacePtr<IPlayer> player(playerObjectID, IID_MAINPLAYER);
- // if (!player)
- // {
- // break;
- //}
- InterfacePtr<IMain> main(IID_MAIN);
- main->Announcement(IntToCString(callerPlayerObjectID.Get()));
- forward = false;
- } while (false);
- return forward;
- }
Add Comment
Please, Sign In to add comment