Esempio n. 1
0
void TNotice::SendToUser(int aIndex, LPSTR szMsg, ...)
{
#ifdef GS_UNICODE
	unsigned char szTempMsg[4096]={0};
#endif

	va_list pArguments;

#ifdef GS_UNICODE
	memset(this->m_pNotice.szNoticeMessage , 0, sizeof(this->m_pNotice.szNoticeMessage ));
#endif


	va_start(pArguments, szMsg);

#ifdef GS_UNICODE
	vsprintf((char*)szTempMsg, (char*)szMsg, pArguments);
#else
	vsprintf_s(this->m_Notice.Notice, (char*)szMsg, pArguments);
#endif

	va_end(pArguments);

#ifdef GS_UNICODE
	MultiByteToWideChar( 1258, 0, (char*)szTempMsg,  strlen((char*)szTempMsg), (unsigned short*)this->m_pNotice.szNoticeMessage, sizeof(this->m_pNotice.szNoticeMessage) );
	this->m_pNotice.szNoticeMessage[254]=0;
	this->m_pNotice.szNoticeMessage[255]=0;
	PHeadSetB( &this->m_pNotice.PacketHeader, 0x0D, wcslen((unsigned short*)this->m_pNotice.szNoticeMessage )*2+0x12);
#else
	PHeadSetB((LPBYTE)&this->m_Notice, 0x0D, strlen(this->m_Notice.Notice)  + sizeof(PMSG_NOTICE) - sizeof(this->m_Notice.Notice) + 1);
#endif

	DataSend(aIndex, (LPBYTE)&this->m_Notice , this->m_Notice.h.size );

}
Esempio n. 2
0
void CRingAttackEvent::ProcState_Closed()
{
	int iTICK_MSEC = GetTickCount() - this->m_iTIME_TICK_COUNT;

	if ( iTICK_MSEC >= 1000 )
	{
		this->m_iTIME_MSEC_REMAIN -= iTICK_MSEC;
		this->m_iTIME_TICK_COUNT = GetTickCount();

		if ( this->m_bDoEvent )
		{
			if ( this->m_iTIME_MSEC_REMAIN <= (this->m_iTIME_MIN_OPEN * 60 * 1000 ) &&
				 this->m_iTIME_MSEC_REMAIN > 0 &&
				 (this->m_iTIME_MSEC_REMAIN / 60000 ) != this->m_iTIME_NOTIFY_COUNT )
			{
				this->m_iTIME_NOTIFY_COUNT = this->m_iTIME_MSEC_REMAIN / 60000;

				if ( (this->m_iTIME_NOTIFY_COUNT+1) == 3 )
				{
					AllSendServerMsg("The White Wizard and his minions are starting to assemble!");

					PMSG_ANS_CL_EFFECT pMsg;

					PHeadSetB((LPBYTE)&pMsg, 0x9E, sizeof(pMsg));
					pMsg.wEffectNum = 0;

					DataSendAll((LPBYTE)&pMsg, pMsg.h.size);

					LogAdd("[Ring Event] - Before 3 minutes - Advertise");
				}
			}
		}
	}

	if ( this->m_iTIME_MSEC_REMAIN <= 0 )
	{

		AllSendServerMsg("The White Wizard and his Orcs have invaded us!");

		PMSG_ANS_CL_EFFECT pMsg;

		PHeadSetB((LPBYTE)&pMsg, 0x9E, sizeof(pMsg));
		pMsg.wEffectNum = 1;

		DataSendAll((LPBYTE)&pMsg, pMsg.h.size);

		if ( this->m_bDoEvent )
		{
			this->SetState(2);
		}
		else
		{
			this->SetState(0);
		}

		LogAdd("[Ring Event] - Event Started");
	}
}
Esempio n. 3
0
void GCDamageSend(int aIndex,int TargetIndex,int AttackDamage,int MSBFlag,int MSBDamage,int iShieldDamage)
{
    PMSG_ATTACKRESULT pResult;

#if (IS_PROTOCOL_JPN == 0)
    PHeadSetB((LPBYTE)&pResult,0x11,sizeof(pResult));	// (1.03P 1.03.16 main)
#else
    PHeadSetB((LPBYTE)&pResult,0xDC,sizeof(pResult));	// (1.03K 1.03.11 main)
#endif

    pResult.NumberH = SET_NUMBERH(TargetIndex);
    pResult.NumberL = SET_NUMBERL(TargetIndex);
    pResult.DamageH = SET_NUMBERH(AttackDamage);
    pResult.DamageL = SET_NUMBERL(AttackDamage);

    pResult.btShieldDamageH = SET_NUMBERH(iShieldDamage);
    pResult.btShieldDamageL = SET_NUMBERL(iShieldDamage);

    if(MSBFlag != false)
    {
        pResult.NumberH &= 0x7F;
        pResult.NumberH |= 0x80;
    }

    pResult.DamageType = MSBDamage;

    OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
    OBJECTSTRUCT * gTarg = (OBJECTSTRUCT*)OBJECT_POINTER(TargetIndex);

    pResult.Life = gTarg->Life;
    pResult.MaxLife = gTarg->MaxLife + gTarg->AddLife;

    pResult.X = gTarg->X;
    pResult.Y = gTarg->Y;

    if(gTarg->Type == OBJECT_MONSTER)
    {
        pResult.Life = gTarg->Life;
        pResult.MaxLife = gTarg->MaxLife + gTarg->AddLife;
    }

    if(gTarg->Type == OBJECT_USER)
    {
        DataSend(TargetIndex, (LPBYTE)&pResult, pResult.h.size);
    }

    if(gObj->Type == OBJECT_USER)
    {
        DataSend(aIndex, (LPBYTE)&pResult, pResult.h.size);
    }

    lpGCDamageSend(aIndex, TargetIndex, AttackDamage, MSBFlag, MSBDamage, iShieldDamage);
}
Esempio n. 4
0
void EGAnsEnterDoubleGoer(LPBYTE aRecv,int aIndex)
{
	LPMSG_DOUBLEGOER_REQ_ENTER_EVENT lpMsg = (LPMSG_DOUBLEGOER_REQ_ENTER_EVENT)aRecv;


	PMSG_DOUBLEGOER_ANS_ENTER_EVENT pMsg;

	PHeadSetB((LPBYTE)&pMsg,0x40,sizeof(pMsg));
	pMsg.btPos = lpMsg->btPos;
	pMsg.aIndex = lpMsg->aIndex;
	pMsg.iResult = 0;

	char szQuery[512];

	wsprintf(szQuery,"SELECT DATEDIFF(mi,getdate(),NEXT_EVENT) as LeftHour FROM DG_ROOM WHERE CHAR_NAME = '%s' AND NEXT_EVENT > getdate()",lpMsg->szName);

	if( g_EventDB.Exec(szQuery) != FALSE )
	{
		if( g_EventDB.Fetch() != SQL_NO_DATA )
		{
			pMsg.iResult = g_EventDB.GetInt("LeftHour");
		}
	}
	else
	{
		pMsg.iResult = -1;
	}

	g_EventDB.Clear();


	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Esempio n. 5
0
void EGAnsPCBangUpdateUser(LPBYTE aRecv,int aIndex)
{
	PMSG_PCBANGUSER_SENDINFO* lpMsg = (PMSG_PCBANGUSER_SENDINFO*)aRecv;
	PMSG_PCBANGUSER_SENDINFO pMsg;

	char szAccountId[MAX_IDSTRING+1];

	memcpy(szAccountId,lpMsg->szAccountID,MAX_IDSTRING);
	szAccountId[MAX_IDSTRING] = '\0';

	PHeadSetB((LPBYTE)&pMsg,0x24,sizeof(pMsg));
	pMsg.aIndex = lpMsg->aIndex;
	pMsg.Point = lpMsg->Point;
	pMsg.btResult = 0;

	char szQuery[256];
	sprintf(szQuery,"UPDATE PCBANG_USER SET pcbang_points = %d WHERE pcbang_id = '%s'",
		lpMsg->Point,szAccountId);

	if( g_EventDB.Exec(szQuery) == TRUE )
	{
		pMsg.btResult = TRUE;
	}
	g_EventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));

}
Esempio n. 6
0
void EGAnsPCBangUserConnect(LPBYTE aRecv,int aIndex)
{
	PMSG_PCBANGUSER_CONNECT* lpMsg = (PMSG_PCBANGUSER_CONNECT*)aRecv;

	char szAccountId[MAX_IDSTRING+1];
	szAccountId[MAX_IDSTRING] = '\0';
	memcpy(szAccountId,lpMsg->szAccountID,MAX_IDSTRING);

	char szQuery[256];
	sprintf(szQuery,"SELECT pcbang_id,pcbang_points FROM PCBANG_USER WHERE pcbang_id = '%s'",szAccountId);

	PMSG_PCBANG_USERDATA_GETINFO pMsg ={0};
	PHeadSetB((LPBYTE)&pMsg,0x23,sizeof(pMsg));
	pMsg.aIndex = lpMsg->aIndex;
	pMsg.Points = 0;

	if( g_EventDB.Exec(szQuery) == TRUE )
	{
		if( g_EventDB.Fetch() != SQL_NO_DATA )
		{
			pMsg.Points = g_EventDB.GetInt("pcbang_points");
		}
		else
		{
			g_EventDB.Clear();
			sprintf(szQuery,"INSERT INTO PCBANG_USER (pcbang_id,pcbang_points,reset_date) VALUES ('%s',0,getdate()+7)",szAccountId);
			g_EventDB.Exec(szQuery);
		}
	}

	g_EventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
void CRingMonsterHerd::SendEventGiftWinner(int iIndex, int iGiftKind)
{
    if ( gObjIsConnected(iIndex) == FALSE )
    {
        return;
    }

    if ( gObj[iIndex].UseEventServer != FALSE )
    {
        return;
    }

    gObj[iIndex].UseEventServer = TRUE;

    PMSG_REQ_REG_RINGGIFT pMsg;

    PHeadSetB((LPBYTE)&pMsg, GMSG_BEATTACK, sizeof(pMsg));
    pMsg.iINDEX  = iIndex;
    memcpy(pMsg.szUID, gObj[iIndex].AccountID, MAX_ACCOUNT_LEN);
    pMsg.szUID[MAX_ACCOUNT_LEN+1] = 0;	// #error Remove the +1 to avoid problems
    pMsg.btGiftKind = iGiftKind;

    DataSendEventChip((PCHAR)&pMsg, sizeof(pMsg));

    LogAddTD("[Ring Event] [%s][%s] Request to Register Gift - Gift Kind (%d)",
             gObj[iIndex].AccountID, gObj[iIndex].Name,  iGiftKind);

}
Esempio n. 8
0
void BroadCastMessage(BroadCastMessageInfo* lpResult)
{
	if( strlen(lpResult->Text) < 2 )
	{
		return;
	}
	
	switch(lpResult->Type)
	{
	case 0:
		{
			AllSendServerMsg(&lpResult->Text[1]);
		}
		break;
	case 1:
		{
			USER_REQ_POST lpInfo = { 0 };
			PHeadSetB((LPBYTE)&lpInfo, 0, sizeof(lpInfo));
			lpInfo.h.headcode = 2;
			lpInfo.chatmsg[0] = '!';
			memcpy(lpInfo.id, lpResult->Sender, 10);
			strcat(lpInfo.chatmsg, lpResult->Text);
			DataSendAll((LPBYTE)&lpInfo, sizeof(lpInfo));
		}
		break;
	}
	
}
Esempio n. 9
0
void DGGetWarehouseList(LPSDHP_GETWAREHOUSEDB lpMsg,int aIndex)
{
	char szAccountID[MAX_IDSTRING+1] = {0};
	memcpy(szAccountID,lpMsg->AccountID,MAX_IDSTRING);

	SDHP_GETWAREHOUSEDB_SAVE pResult;

	PHeadSetW((LPBYTE)&pResult, 0x08, sizeof(pResult));
	memcpy(pResult.AccountID, szAccountID, MAX_IDSTRING);
	pResult.aIndex = lpMsg->aIndex;

	if( GetWarehouseData(szAccountID,&pResult) == FALSE )
	{
		CreateWarehouseData(szAccountID);

		SDHP_GETWAREHOUSEDB_RESULT pMsg;

		PHeadSetB((LPBYTE)&pMsg, 0x10, sizeof(pMsg));
		pMsg.aIndex = lpMsg->aIndex;
		memcpy(pMsg.AccountID, szAccountID, 10);

		DataSend(aIndex, (LPBYTE)&pMsg, pMsg.h.size);
		return;
	}

	DataSend(aIndex,(LPBYTE)&pResult,sizeof( pResult ));
}
Esempio n. 10
0
void cVipSystem::BuyItem(LPOBJ lpObj, int IDNumber)
{
	if(IDNumber >= 0 && IDNumber <= (this->ItemsCount-1))
	{
		BOOL IfBuy = FALSE;	
		PMSG_BUYRESULT pResult;
		PHeadSetB((LPBYTE)&pResult, 0x32, sizeof(pResult));

		if(this->Shop[IDNumber].Cost < lpObj->VipMoney)
		{
			pResult.Result = gObjShopBuyInventoryInsertItem(lpObj->m_Index,this->m_item[IDNumber]);
				
			if ( pResult.Result != 0xFF )
			{
				lpObj->AccountExtraInfoModified = 1;

				ItemByteConvert((LPBYTE)&pResult.ItemInfo, this->m_item[IDNumber]);
				DataSend(lpObj->m_Index, (LPBYTE)&pResult, pResult.h.size);
				lpObj->VipMoney -= this->Shop[IDNumber].Cost;
				IfBuy = TRUE;
			}else
			{				
				GCServerMsgStringSend(lMsg.Get(MSGGET(14, 58)),lpObj->m_Index, 0x01);
			}
		}
		//Log
		if(IfBuy == TRUE)
		{
			LogAddTD("[VIPShop] BuyItem [%s][%s] Item {%d %d} Cost: %d",lpObj->AccountID,lpObj->Name,this->Shop[IDNumber].Type,this->Shop[IDNumber].Index,this->Shop[IDNumber].Cost);
		} else 
		{
			LogAddTD("[VIPShop] Attempt to BuyItem [%s][%s] Item {%d %d} Cost: %d",lpObj->AccountID,lpObj->Name,this->Shop[IDNumber].Type,this->Shop[IDNumber].Index,this->Shop[IDNumber].Cost);
		}
	}
}
Esempio n. 11
0
void MuItemShopGiftBuyRecv(cExtraServer * sManager, int aIndex, SDHP_MUITEMSHOPGIFTBUY * aRecv)
{
	//OutputDebugString("ItemSerialCreateRecv\n");

	SDHP_MUITEMSHOPGIFTBUY		pResult = {0};
	int							Serial2	= 0;
	// ----
	PHeadSetB((LPBYTE)&pResult, SCFExDB_GSRecv_CShopDataGiftRecv, sizeof(pResult));
	// ----
	sManager->db.ExecQuery("EXEC TT_GetMuShopItemSerial");
	sManager->db.Fetch();
	// ----
	Serial2				= sManager->db.GetResult(0);
	// ----
	sManager->db.Close();
	// ----
	strcpy(pResult.AccountID,aRecv->AccountID);
	pResult.m_Serial2	= Serial2;
	pResult.aIndex		= aRecv->aIndex;
	pResult.ItemID		= aRecv->ItemID;
	pResult.ID1			= aRecv->ID1;
	pResult.ID2			= aRecv->ID2;
	strcpy(pResult.Name,aRecv->Name);
	strcpy(pResult.Msg,aRecv->Msg);
	// ----
	sManager->DataSend(aIndex, (unsigned char*)&pResult, pResult.h.size);
}
void GCUseBuffEffect(LPOBJ lpObj, BYTE btEffectIndex, BYTE btEffectUseOption, WORD wOptionType, WORD wEffectType, int iLeftTime)
{
	PMSG_SEND_BUFF_ICON pMsg;

	PHeadSetB((LPBYTE)&pMsg, 0x2D, sizeof(PMSG_SEND_BUFF_ICON));

	pMsg.btEffectIndex = btEffectIndex;
	pMsg.byEffectOption = btEffectUseOption;
	pMsg.wOptionType = wOptionType;
	pMsg.wEffectType = wEffectType;
	pMsg.iLeftTime = iLeftTime;

	if ( lpObj->Type == OBJ_USER )
	{
		DataSend(lpObj->m_Index, (LPBYTE)&pMsg, pMsg.h.size);
	}

	if(btEffectUseOption == 0)
	{
		GCStateInfoSend(lpObj, 1, btEffectIndex);
	}
	else
	{
		GCStateInfoSend(lpObj, 0, btEffectIndex);
	}
}
Esempio n. 13
0
void GJReqMapSvrMove(int iIndex, WORD wDesMapSvrCode, WORD wMapNumber, BYTE btX, BYTE btY)
{
	PMSG_REQ_MAPSVRMOVE pMsg;
	
	if ( gObjIsConnected(iIndex) == PLAYER_EMPTY )
	{
		LogAddC(2, "[MapServerMng] Packet Error GJ [0x7A] - User not Connected : %d", iIndex);
	}
	else
	{
		PHeadSetB((LPBYTE)&pMsg, 0x7A, sizeof(PMSG_REQ_MAPSVRMOVE));
		pMsg.iIndex = iIndex;

		memcpy(pMsg.szAccountID , gObj[iIndex].AccountID, sizeof( pMsg.szAccountID)-1);
		pMsg.szAccountID[10] = 0;
		memcpy(pMsg.szCharName, gObj[iIndex].Name, sizeof( pMsg.szCharName)-1);
		pMsg.szCharName[10] = 0;

		pMsg.wCurMapSvrCode = gGameServerCode;
		pMsg.wDstMapSvrCode = wDesMapSvrCode;
		pMsg.wMapNumber = wMapNumber;
		pMsg.btX = btX;
		pMsg.btY = btY;

		wsJServerCli.DataSend((char*)&pMsg, pMsg.h.size);
	}
}
Esempio n. 14
0
void JGPGetCharList(LPSDHP_GETCHARLIST lpMsg,int aIndex)
{
	char cBUFFER[10000]={0};

	LPSDHP_CHARLISTCOUNT pCount = (LPSDHP_CHARLISTCOUNT)(cBUFFER);
	LPSDHP_CHARLIST pCL = (LPSDHP_CHARLIST)(cBUFFER + sizeof(SDHP_CHARLISTCOUNT));

	char szAccountID[MAX_IDSTRING+1];
	memcpy(szAccountID,lpMsg->Id,MAX_IDSTRING);
	szAccountID[MAX_IDSTRING] = 0;

	PMSG_ANS_SUMMONER_CREATE pMsg;
	PHeadSetB((LPBYTE)&pMsg,0x72,sizeof(pMsg));

	memcpy(pMsg.szAccount,szAccountID,MAX_IDSTRING);
	pMsg.Number = lpMsg->Number;
	pMsg.Result = GetSummonerCreate(&pMsg,szAccountID);

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));

	pCount->Number = lpMsg->Number;
	lstrcpy(pCount->AccountId,szAccountID);

	pCount->Count = GetCharList(szAccountID,pCount,pCL);

	PHeadSetW((LPBYTE)pCount, 0x01, sizeof(SDHP_CHARLISTCOUNT) + sizeof(SDHP_CHARLIST) * pCount->Count);

	DataSend(aIndex,(LPBYTE)&cBUFFER,sizeof(SDHP_CHARLISTCOUNT) + sizeof(SDHP_CHARLIST) * pCount->Count);
}
Esempio n. 15
0
void SCNoUpdateSend(int aIndex)
{
	PMSG_DEFRESULT	pMsg={0};	
	PHeadSetB((LPBYTE)&pMsg, 2, sizeof(pMsg));

	pMsg.result     = 0;

	DataSend(aIndex, (LPBYTE)&pMsg, pMsg.h.size);
	ObjDel(aIndex);
}
Esempio n. 16
0
void TNotice::MakeNoticeMsg(void * lpNotice, BYTE btType, std::string sNoticeMsg)
{
	PMSG_NOTICE * pNotice = (PMSG_NOTICE *)lpNotice;
	pNotice->type  = btType;

#ifdef GS_UNICODE
	unsigned char szTempMsg[4096]={0};
	memset( pNotice->szNoticeMessage, 0, sizeof(pNotice->szNoticeMessage));
	MultiByteToWideChar( 1258, 0, (char*)szNoticeMsg,  strlen((char*)szNoticeMsg), (unsigned short*)szTempMsg, sizeof(szTempMsg) );
	memcpy(pNotice->szNoticeMessage, szTempMsg, sizeof(pNotice->szNoticeMessage));
	pNotice->szNoticeMessage[254]=0;
	pNotice->szNoticeMessage[255]=0;
	wsprintf(pNotice->Notice, szNoticeMsg);
	PHeadSetB(&pNotice->PacketHeader, 0x0D, wcslen((unsigned short *)pNotice->szNoticeMessage)*2+ 0x12);
#else
	wsprintf(pNotice->Notice, sNoticeMsg.c_str());
	PHeadSetB((LPBYTE)pNotice, 0x0D, strlen(pNotice->Notice) + sizeof(PMSG_NOTICE) - sizeof(pNotice->Notice) + 1 );
#endif
}
Esempio n. 17
0
BOOL NpcEventChipNPC(LPOBJ lpNpc, LPOBJ lpObj)
{
	if ( (lpObj->m_IfState.use) > 0 )
	{
		return TRUE;
	}
	
	if ( lpNpc->MapNumber == 0 )
	{
		PMSG_REQ_VIEW_EC_MN pMsgTha;

		PHeadSetB((LPBYTE)&pMsgTha, 0x01, sizeof(pMsgTha));
		pMsgTha.iINDEX = lpObj->m_Index;
		strcpy(pMsgTha.szUID, lpObj->AccountID);
		pEventObj = lpNpc;

		DataSendEventChip((char*)&pMsgTha, sizeof(pMsgTha));
		
		lpObj->m_IfState.type = 9;
		lpObj->m_IfState.state = 0;
		lpObj->m_IfState.use = 1;

		return TRUE;
	}

	if ( lpNpc->MapNumber == 2 )
	{
		PMSG_EVENTCHIPINFO Result;

		PHeadSetB((LPBYTE)&Result, 0x94, sizeof(Result));
		Result.Type = 2;
		
		DataSend(lpObj->m_Index, (LPBYTE)&Result, Result.h.size);

		lpObj->m_IfState.type = 9;
		lpObj->m_IfState.state = 0;
		lpObj->m_IfState.use = 1;

		return TRUE;
	}

	return FALSE;
}
Esempio n. 18
0
void TNotice::SendToAllUser(LPSTR szMsg, ...)
{
#ifdef GS_UNICODE
	unsigned char szTempMsg[4096]={0};
#endif

	va_list pArguments;

#ifdef GS_UNICODE
	memset(this->m_Notice.Notice , 0, sizeof(this->m_Notice.Notice ));
#endif


	va_start(pArguments, szMsg);

#ifdef GS_UNICODE
	vsprintf((char*)szTempMsg, (char*)szMsg, pArguments);
#else
	vsprintf_s(this->m_Notice.Notice, (char*)szMsg, pArguments);
#endif

	va_end(pArguments);

#ifdef GS_UNICODE
	MultiByteToWideChar( 1258, 0, (char*)szTempMsg,  strlen((char*)szTempMsg), (unsigned short*)this->m_Notice.Notice, sizeof(this->m_Notice.Notice) );
	this->m_Notice.Notice[254] = 0;
	this->m_Notice.Notice[255] =0;
	PHeadSetB( &this->m_pNotice.PacketHeader, 0x0D, wcslen((unsigned short*)this->m_Notice.Notice )*2 + 0x12);
#else
	PHeadSetB((LPBYTE)&this->m_Notice, 0x0D, strlen(this->m_Notice.Notice)  + sizeof(PMSG_NOTICE) - sizeof(this->m_Notice.Notice) + 1);
#endif

	for ( int n = OBJ_STARTUSERINDEX ; n < OBJMAX ; n++)
	{
		if ( gObj[n].Connected == PLAYER_PLAYING )
		{
			if ( gObj[n].Type  == OBJ_USER )
			{
				DataSend(n, (LPBYTE)&this->m_Notice , this->m_Notice.h.size );
			}
		}
	}
}
BOOL TMonsterAIUtil::SendMonsterMoveMsg(LPOBJ lpObj)
{
	PMSG_RECVMOVE pMove;
#if (__ENG__ == 1)
		// KOR PROTOCOL
	PHeadSetB((LPBYTE)&pMove, 0xD4, sizeof(pMove));
#else
	// KOR PROTOCOL
	PHeadSetB((LPBYTE)&pMove, 0xD7, sizeof(pMove));
#endif

	pMove.NumberH = SET_NUMBERH(lpObj->m_Index);
	pMove.NumberL = SET_NUMBERL(lpObj->m_Index);
	pMove.X = lpObj->MTX;
	pMove.Y = lpObj->MTY;
	pMove.Path = lpObj->Dir << 4;

	this->SendMonsterV2Msg(lpObj, (LPBYTE)&pMove, pMove.h.size);
	return TRUE;
}
Esempio n. 20
0
void PartyClass::PartyMemberLifeSend(int party_number)
{
	if ( this->IsParty(party_number) == FALSE )
	{
		return;
	}

	PMSG_DEFAULT_COUNT pCount;
	PMSG_PARTYLIFEALL pList;
	int usern;
	char sendbuf[512];
	int lOfs = 0;
	int tlife = 0;

	PHeadSetB((LPBYTE)&pCount, 0x44, sizeof(pCount));
	pCount.Count = this->m_PartyS[party_number].Count;
	lOfs += sizeof(pCount);
	
	for ( int i = 0; i<MAX_USER_IN_PARTY ; i++ )
	{
		if ( (this->m_PartyS[party_number].Number[i] >= 0 ) && (this->m_PartyS[party_number].DbNumber[i] >= 0) )
		{
			usern = this->m_PartyS[party_number].Number[i];

			if ( gObjIsConnected(usern) != PLAYER_EMPTY )
			{
				pList.Number = (i * 16) & 0xF0 ;
				tlife = ( (BYTE)(  gObj[usern].Life / ((gObj[usern].MaxLife + gObj[usern].AddLife )/10.0f)     )  ) & 0x0F;
				pList.Number |= tlife;
				memcpy(&sendbuf[lOfs], &pList, 1);
				lOfs++;
			}
			else
			{
				this->m_PartyS[party_number].Number[i] = -1;
				this->m_PartyS[party_number].DbNumber[i] = -1;
				this->m_PartyS[party_number].Count--;
			}
		}
	}

	pCount.h.size = lOfs;
	memcpy(sendbuf, &pCount, sizeof(pCount));

	for (int i=0 ; i<MAX_USER_IN_PARTY ; i++ )
	{
		usern = this->m_PartyS[party_number].Number[i];

		if ( usern >= 0 )
		{
			DataSend(usern, (unsigned char*)sendbuf, lOfs);
		}
	}
}
Esempio n. 21
0
void GJNotifyMaxUserCount()
{
	PMSG_NOTIFY_MAXUSER pMsg;

	PHeadSetB((LPBYTE)&pMsg, 0x7C, sizeof(PMSG_NOTIFY_MAXUSER));
	pMsg.iSvrCode = gGameServerCode;
	pMsg.iMaxUserCount = gServerMaxUser;
	pMsg.iCurUserCount = gObjTotalUser;
	
	wsJServerCli.DataSend((char*)&pMsg, pMsg.h.size);
}
void CIllusionTempleEvent::GEReqIllusionTempleIncEnterCount(LPOBJECTSTRUCT lpObj)
{
	PMSG_REQ_ILLUSION_TEMPLE_INC_COUNT pMsg;	
	PHeadSetB((LPBYTE)&pMsg, 0x13, sizeof(pMsg));
	
	memcpy(pMsg.AccountID, lpObj->AccountID, MAX_IDSTRING);
	memcpy(pMsg.GameID, lpObj->Name, MAX_IDSTRING);
	pMsg.ServerCode = gGameServerCode;
	
	DataSendRank((char *)&pMsg, pMsg.h.size);
}
Esempio n. 23
0
void GJUpdateMatchDBUserCharacters(LPOBJ lpObj)
{
	SDHP_REQ_UPDATE_MATCHDB_USERCHARACTERS pMsg;

	PHeadSetB((LPBYTE)&pMsg, 0x16, sizeof(SDHP_REQ_UPDATE_MATCHDB_USERCHARACTERS));
	pMsg.DbClass = lpObj->DbClass;
	pMsg.Level = lpObj->Level;
	memcpy(pMsg.szId, lpObj->AccountID, sizeof(pMsg.szId));
	//memcpy(pMsg.szName, lpObj->BackName, sizeof(pMsg.szName));

	wsJServerCli.DataSend((PCHAR)&pMsg, pMsg.h.size);
}
Esempio n. 24
0
void SendRaceReward()
{
	SDHP_SETRACEREWARD_INFOSAVE pMsg = {0};
	PHeadSetB((LPBYTE)&pMsg, SCFExDB_GSSend_RaceReward, sizeof(pMsg));
	pMsg.Count = BotRacer.RewardCount;
	for(int i=0;i<BotRacer.RewardCount;i++)
	{
		memcpy(&pMsg.rew[i],&BotRacer.reward[i],sizeof(BotRacer.reward[i]));
	}

	cDBSMng.Send((char*)&pMsg, pMsg.h.size);
}
Esempio n. 25
0
void SendReward(int aIndex, int FromEvent, botReward_Data_Struct rew)
{
	SDHP_GETREWARD_INFOSAVE pMsg = {0};
	PHeadSetB((LPBYTE)&pMsg, SCFExDB_GSSend_RewardInfo, sizeof(pMsg));

	strcpy(pMsg.AccountID, gObj[aIndex].AccountID);
	strcpy(pMsg.Name,gObj[aIndex].Name);
	pMsg.aIndex = aIndex;
	pMsg.ID_Num = FromEvent;
	memcpy(&pMsg.rew,&rew,sizeof(pMsg.rew));
	cDBSMng.Send((char*)&pMsg, pMsg.h.size);
}
Esempio n. 26
0
void TNotice::MakeNoticeMsgEx(void * lpNotice, BYTE btType, char * szNoticeMsg, ...)
{
	PMSG_NOTICE * pNotice = (PMSG_NOTICE *)lpNotice;
	pNotice->type = btType;

#ifdef GS_UNICODE
	unsigned char szTempMsg[4096]={0};
#endif


	va_list pArguments;

#ifdef GS_UNICODE
	memset( pNotice->szNoticeMessage, 0, sizeof(pNotice->szNoticeMessage));
#endif


	va_start(pArguments, szNoticeMsg);

#ifdef GS_UNICODE
	vsprintf((char*)szTempMsg, (char*)szNoticeMsg, pArguments);
#else
	vsprintf_s(pNotice->Notice, szNoticeMsg, pArguments);
#endif

	va_end(pArguments);


#ifdef GS_UNICODE
	MultiByteToWideChar(1258, 0, (char*)szTempMsg,  strlen((char*)szTempMsg), (unsigned short*)pNotice->szNoticeMessage, sizeof(pNotice->szNoticeMessage) );
	pNotice->szNoticeMessage[254]=0;
	pNotice->szNoticeMessage[255]=0;
	PHeadSetB(&pNotice->PacketHeader, 0x0D, wcslen((unsigned short *)pNotice->szNoticeMessage)*2+ 0x12);
#else
	PHeadSetB((LPBYTE)pNotice, 0x0D, strlen(pNotice->Notice)  + sizeof(PMSG_NOTICE) - sizeof(pNotice->Notice) + 1);
#endif

}
Esempio n. 27
0
void SendRaceInfo(int aIndex)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return;
	}

	SDHP_SETPLAYERRACE_INFOSAVE pMsg = {0};
	PHeadSetB((LPBYTE)&pMsg, SCFExDB_GSSend_RaceInsert, sizeof(pMsg));
	memcpy(pMsg.AccountID, gObj[aIndex].AccountID, MAX_ACCOUNT_LEN);
	memcpy(pMsg.Name, gObj[aIndex].Name, MAX_ACCOUNT_LEN);
	pMsg.Seconds = gObj[aIndex].RaceTime;
	cDBSMng.Send((char*)&pMsg, pMsg.h.size);
}
Esempio n. 28
0
BOOL TMonsterAIUtil::SendMonsterMoveMsg(LPOBJ lpObj)
{
	PMSG_RECVMOVE pMove;

	PHeadSetB((LPBYTE)&pMove, PROTOCOL_MOVE, sizeof(pMove));
	pMove.NumberH = SET_NUMBERH(lpObj->m_Index);
	pMove.NumberL = SET_NUMBERL(lpObj->m_Index);
	pMove.X = lpObj->MTX;
	pMove.Y = lpObj->MTY;
	pMove.Path = lpObj->Dir << 4;

	this->SendMonsterV2Msg(lpObj, (LPBYTE)&pMove, pMove.h.size);
	return TRUE;
}
Esempio n. 29
0
void DelTitanReward(int aIndex, int ID_Num)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return;
	}

	SDHP_GETREWARD_INFODEL pMsg = {0};
	PHeadSetB((LPBYTE)&pMsg, SCFExDB_GSSend_DelBotReward, sizeof(pMsg));
	memcpy(pMsg.AccountID, gObj[aIndex].AccountID, MAX_ACCOUNT_LEN);
	memcpy(pMsg.Name, gObj[aIndex].Name, MAX_ACCOUNT_LEN);
	pMsg.ID_Num = ID_Num;
	cDBSMng.Send((char*)&pMsg, pMsg.h.size);
}
Esempio n. 30
0
void ConnectEx::SendGame(int UserIndex)
{
	/*if(		g_License.GetLicenseID() != Customer::Zeon
		&&	g_License.GetLicenseID() != Customer::Refinery
		&&	g_License.GetLicenseID() != Customer::Bereznuk
		&&	g_License.GetLicenseID() != Customer::Reedlan
		&&	g_License.GetLicenseID() != Customer::MUAngel
		&&	g_License.GetLicenseID() != Customer::MUAngel2
		&&	g_License.GetLicenseID() != Customer::White
		&&	g_License.GetLicenseID() != Customer::White2 
		&&  g_License.GetLicenseID() != Customer::drynea 
		&&  g_License.GetLicenseID() != Customer::virnet )
	{
		return;
	}*/
	// ----
	gObj[UserIndex].m_ConnectEx = false;
	DataServerGetCharListRequest(UserIndex);
	// ----
	if ( !PacketCheckTime2(&gObj[UserIndex]))
	{
		return;
	}
	// ----
	if ( !gObjIsAccontConnect(UserIndex, gObj[UserIndex].AccountID))
	{
		return;
	}
	// ----
	if ( gObj[UserIndex].Connected == PLAYER_PLAYING )
	{
		return;
	}
	// ----
	gObj[UserIndex].bEnableDelCharacter = FALSE;
	// ----
	char _name[MAX_ACCOUNT_LEN+1];
	SDHP_DBCHARINFOREQUEST pCRequest;
	// ----
	PHeadSetB((LPBYTE)&pCRequest, 0x06, sizeof(pCRequest));
	memset(_name, 0, MAX_ACCOUNT_LEN);
	memcpy(_name, gObj[UserIndex].Name, MAX_ACCOUNT_LEN);
	BuxConvert(_name, MAX_ACCOUNT_LEN);
	memcpy(pCRequest.Name, _name, MAX_ACCOUNT_LEN);
	strcpy(pCRequest.AccountID, gObj[UserIndex].AccountID);
	pCRequest.Number = UserIndex;
	// ----
	cDBSMng.Send((char*)&pCRequest, pCRequest.h.size);
}