Exemplo n.º 1
0
BOOL CGuildClass::SetGuildMemberStatus(char* szGuildName, char* szMemberName, int iGuildStatus)
{
	_GUILD_INFO_STRUCT * pNode = this->SearchGuild(szGuildName);
	int iKey = -1;

	if ( pNode == NULL )
	{
		return -1;
	}

	for ( int n=0;n<MAX_USER_GUILD;n++)
	{
		if ( pNode->Use[n] == TRUE )
		{
			if ( strcmp(pNode->Names[n], szMemberName) == 0 )
			{
				iKey = n;
			}
		}
	}

	if ( iKey < 0 )
	{
		return 0;
	}
	
	pNode->GuildStatus[iKey] = iGuildStatus;

	if ( pNode->Index[iKey] > 0 )
	{
		if ( gObjIsConnectedGP(pNode->Index[iKey]) == FALSE )
		{
			LogAdd("@SetGuildMemberStatus() error-L2 : Index %s %d", __FILE__, __LINE__);
			return false;
		}

		if ( !OBJMAX_RANGE(pNode->Index[iKey]) )
		{
			return 0;
		}
		
		LPOBJ lpObj = &gObj[pNode->Index[iKey]];

		if ( strcmp(lpObj->Name, szMemberName) == 0 )
		{
			lpObj->GuildStatus = iGuildStatus;
			GCGuildViewportNowPaint(lpObj->m_Index, lpObj->GuildName, 0, 0);
		}

	}

	return true;
}
Exemplo n.º 2
0
BOOL NpcSiegeMachine_Defense(LPOBJ lpNpc, LPOBJ lpObj)
{
	if ( (lpObj->m_IfState.use ) > 0 )
	{
		return TRUE;
	}

	PMSG_ANS_USE_WEAPON_INTERFACE pResult = {0};

	PHeadSubSetB((LPBYTE)&pResult, 0xB7, 0x00, sizeof(pResult));

	pResult.btResult = 0;
	pResult.btWeaponType = 2;
	pResult.btObjIndexH = SET_NUMBERH(lpNpc->m_Index);
	pResult.btObjIndexL = SET_NUMBERL(lpNpc->m_Index);

	if ( gObjIsConnectedGP(lpNpc->m_iWeaponUser) == FALSE )
	{
		lpNpc->m_iWeaponUser = 0;
		lpNpc->m_btWeaponState = 1;
	}

	lpNpc->m_btWeaponState = 1;


	if ( lpNpc->m_btWeaponState == 1 )
	{
		pResult.btResult = 1;
		lpNpc->m_btWeaponState = 2;
		lpNpc->m_iWeaponUser = lpObj->m_Index;

		DataSend(lpObj->m_Index, (LPBYTE)&pResult, pResult.h.size);

		lpObj->m_IfState.use = 1;
		lpObj->m_IfState.type = 16;
	}
	else
	{
		DataSend(lpObj->m_Index, (LPBYTE)&pResult, pResult.h.size);
	}

	return TRUE;
}
Exemplo n.º 3
0
BOOL ObjBotReward::TradeOpen(int index, int nindex)
{
	if ( gObjIsConnectedGP(index) == FALSE )
	{
		LogAddC(2, "error-L3 [%s][%d]", __FILE__, __LINE__);
		return 0;
	}
	if(gObjIsConnected(nindex) == 0)
	{
		return 0;
	}

	int number = this->GetBotIndex(nindex);
	if(number == -1)
		return 0;

	GetPlayerExtraInfo(index,SCFExDB_GSSend_GetBotReward);
	ChatTargetSend(&gObj[this->bot.index],"Wait, i will check i have some reward for you!",index);
	return 1;
}
Exemplo n.º 4
0
BOOL CGuildClass::SetGuildType(char* szGuildName, int iGuildType)
{
	
	_GUILD_INFO_STRUCT * pNode = this->SearchGuild(szGuildName);

	if (pNode == NULL )
	{
		return FALSE;
	}

	pNode->btGuildType = iGuildType;

	for ( int n=0;n<MAX_USER_GUILD;n++)
	{
		if ( pNode->Use[n] == TRUE )
		{
			if ( pNode->Index[n] > 0 )
			{
				if ( gObjIsConnectedGP(pNode->Index[n]) == FALSE )
				{
					LogAdd("SetGuildType() error-L2 : Index %s %d", __FILE__, __LINE__);
					continue;
				}

				if ( !OBJMAX_RANGE(pNode->Index[n]) )
				{
					continue;
				}

				LPOBJ lpObj = &gObj[pNode->Index[n]];
				GCGuildViewportNowPaint(lpObj->m_Index, lpObj->GuildName, 0, 0);
			}
		}
	}

	return TRUE;
}
Exemplo n.º 5
0
BOOL ObjBotWarper::TradeOpen(int index, int nindex)
{
	if ( gObjIsConnectedGP(index) == FALSE )
	{
		LogAddC(2, "error-L3 [%s][%d]", __FILE__, __LINE__);
		return 0;
	}
	if(gObjIsConnected(nindex) == 0)
	{
		return 0;
	}

	int number = this->GetBotIndex(nindex);
	if(number == -1)
		return 0;

	char sbuf[512]={0};
	LPOBJ lpObj = &gObj[index];
	LPOBJ lpBot = &gObj[nindex];

	if(this->bot[number].OnlyVip == 1 && gObj[index].Vip == 0)
	{
		ChatTargetSend(&gObj[this->bot[number].index],"I only warp VIP Players!",index);
		return 1;
	}
	if(this->bot[number].Zen > gObj[index].Money)
	{
		wsprintf(sbuf,lMsg.Get(MSGGET(14, 160)),this->bot[number].Zen);
		GCServerMsgStringSend(sbuf ,lpObj->m_Index, 0x01);
		return 1;		
	}
	if(this->bot[number].VipMoney > gObj[index].VipMoney)
	{
		wsprintf(sbuf,"You Need %d VipMoney",this->bot[number].VipMoney);
		GCServerMsgStringSend(sbuf ,lpObj->m_Index, 0x01);
		return 1;
	}
	
	if(gObj[index].Level < this->bot[number].MinLevel)
	{
		wsprintf(sbuf,"You Need to be level %d at least",this->bot[number].MinLevel);
		ChatTargetSend(&gObj[this->bot[number].index],sbuf,index);
		return 1;
	}
	
	if(gObj[index].Resets < this->bot[number].MinReset)
	{
		wsprintf(sbuf,"You Need to have %d resets at least",this->bot[number].MinReset);
		ChatTargetSend(&gObj[this->bot[number].index],sbuf,index);
		return 1;
	}


	int m_check1 = gMoveCommand.CheckMainToMove(lpObj);
	int m_check2 = gMoveCommand.CheckEquipmentToMove(lpObj,lpObj->MapNumber);
	int m_check3 = gMoveCommand.CheckInterfaceToMove(lpObj);

	if(m_check1 == false
		|| m_check2 == false
		|| m_check3 == false)
	{
		char szMsg[256];
		wsprintf(szMsg,lMsg.Get(1254));

		GCServerMsgStringSend(szMsg,lpObj->m_Index,1);
		ChatTargetSend(&gObj[this->bot[number].index],"I cant warp you there!",index);
	}
	int addx;
	int addy;
	int count = 50;
	int Find = 0;

	while(count--)
	{
		addx = this->bot[number].Warp_X + rand()%9 - 4;
		addy = this->bot[number].Warp_Y + rand()%9 - 4;

		if(gObjCheckTeleportAreaByMap(this->bot[number].Warp_Map,addx,addy))
		{
			Find = 1;
			break;
		}
	}
	if(Find == 0)
	{
		addx = this->bot[number].Warp_X;
		addy = this->bot[number].Warp_Y;
	}

	ChatTargetSend(&gObj[this->bot[number].index],"I will warp you!",index);

	if(this->bot[number].Zen > 0)
	{
		gObj[index].Money -= this->bot[number].Zen;
		::GCMoneySend(index, gObj[index].Money);
	}
	if(this->bot[number].VipMoney > 0)
	{
		char tmp[256];
		gObj[index].VipMoney -= this->bot[number].VipMoney;
		gObj[index].AccountExtraInfoModified = 1;
		wsprintf(tmp,"VipMoney = %d",gObj[index].VipMoney);
		GCServerMsgStringSend(tmp,index, 1);
	}

	if(lpObj->MapNumber != this->bot[number].Warp_Map)
	{
		short sSvrCode = g_MapServerManager.CheckMoveMapSvr(lpObj->m_Index,this->bot[number].Warp_Map,lpObj->m_sPrevMapSvrCode);

		if(sSvrCode != gGameServerCode)
		{
			if(sSvrCode == -1)
			{
				LogAddC(2,"[MapServerMng] Map Server Move Fail : CheckMoveMapSvr() == -1 [%s][%s] (%d)",lpObj->AccountID,lpObj->Name,lpObj->m_Index);
				return 1;
			}

			if(lpObj->m_bPShopOpen == 1)
			{
				LogAddC(2,"[MapServerMng] Map Server Move Fail : m_bPShopOpen == 1 [%s][%s] (%d)",lpObj->AccountID,lpObj->Name,lpObj->m_Index);
				return 1;
			}

			GJReqMapSvrMove(lpObj->m_Index,sSvrCode,this->bot[number].Warp_Map,addx,addy);
			LogAddTD("[MapServerMng] Request to Move Map Server : (%d) - [%s][%s] (%d)",sSvrCode,lpObj->AccountID,lpObj->Name,lpObj->m_Index);
			return 1;
		}
	}
	
	lpObj->SkillRecallParty_Time = 3;
	lpObj->SkillRecallParty_MapNumber = this->bot[number].Warp_Map;
	lpObj->SkillRecallParty_X = addx;
	lpObj->SkillRecallParty_Y = addy;

	return 1;
}
Exemplo n.º 6
0
//00553d40	-> 100%
void CMasterLevelSystem::DGAnsMasterLevelInfo(BYTE * aRecv)	//OK
{
	if( !aRecv )
	{
		return;
	}
	// ----
	MLP_ANS_MASTERLEVEL_INFO * lpRecvMsg = (MLP_ANS_MASTERLEVEL_INFO*)aRecv;
	// ----
	if( !gObjIsConnectedGP(lpRecvMsg->iUserIndex) )
	{
		return;
	}
	// ----
	int iIndex	= lpRecvMsg->iUserIndex;
	LPOBJ lpObj	= &gObj[lpRecvMsg->iUserIndex];
	// ---
	if( lpObj->m_bMasterLevelDBLoad )
	{
		return;
	}
	// ----
	if( !lpRecvMsg->btResult )
	{
		LogAddTD("[%s][%s] MasterLevel Info Load Fail", lpObj->AccountID, lpObj->Name);	//-> New
		return;
	}
	// ----
	if( lpRecvMsg->btResult == 1 )
	{
		if( lpObj->m_iMasterLevelPoint + lpRecvMsg->nMLPoint != lpRecvMsg->nMLevel )	//-> New (be good use MASTER_MAX_POINT for check)
		{
			LogAddTD("[%s][%s] MasterLevel Info Mismatch!! - Point(%d), Use Point(%d), Level(%d)",
				lpObj->AccountID, lpObj->Name,
				lpRecvMsg->nMLPoint, lpObj->m_bMasterLevelDBLoad, lpRecvMsg->nMLevel);
		}
		// ----
		lpObj->m_bMasterLevelDBLoad = 1;
		// ----
		if( lpRecvMsg->nMLevel == 0 && lpRecvMsg->i64NextMLExp == 0 )
		{
			lpObj->m_nMasterLevel			= lpRecvMsg->nMLevel;
			lpObj->m_i64MasterLevelExp		= lpRecvMsg->i64MLExp;
			lpObj->m_i64NextMasterLevelExp	= m_i64MasterLevelExpTlb[1];
			lpObj->m_iMasterLevelPoint		= lpRecvMsg->nMLPoint;
			// ----
			LogAddTD("[%s][%s] MasterLevel Info First Set [MLevel:%d][MLExp:%I64d][m_i64NextMasterLevelExp:%I64d][MLPoint:%d]",
				lpObj->AccountID, lpObj->Name, lpObj->m_nMasterLevel, 
				lpObj->m_i64MasterLevelExp, lpObj->m_i64NextMasterLevelExp, lpObj->m_iMasterLevelPoint);
			// ----
			this->GDReqMasterLevelInfoSave(lpObj);
		}
		else
		{
			lpObj->m_nMasterLevel			= lpRecvMsg->nMLevel;
			lpObj->m_i64MasterLevelExp		= lpRecvMsg->i64MLExp;
			lpObj->m_i64NextMasterLevelExp	= lpRecvMsg->i64NextMLExp;
			lpObj->m_iMasterLevelPoint		= lpRecvMsg->nMLPoint;
			// ----
			LogAddTD("[%s][%s] Recv MasterLevel Info [MLevel:%d][MLExp:%I64d][m_i64NextMasterLevelExp:%I64d][MLPoint:%d]", 
				lpObj->AccountID, lpObj->Name, lpObj->m_nMasterLevel, 
				lpObj->m_i64MasterLevelExp, lpObj->m_i64NextMasterLevelExp, lpObj->m_iMasterLevelPoint);
			// ----
			this->GDReqMasterLevelInfoSave(lpObj);
		}
		// ----
		lpObj->MaxLife = DCInfo.DefClass[lpObj->Class].Life + (lpObj->Level + lpObj->m_nMasterLevel - 1) * DCInfo.DefClass[lpObj->Class].LevelLife  + ((lpObj->Vitality - DCInfo.DefClass[lpObj->Class].Vitality ) * DCInfo.DefClass[lpObj->Class].VitalityToLife);
		// ----
		if( lpObj->Life > lpObj->MaxLife + lpObj->AddLife )
		{
			lpObj->Life = lpObj->MaxLife;
		}
		// ----
		lpObj->MaxMana = DCInfo.DefClass[lpObj->Class].Mana + (lpObj->Level + lpObj->m_nMasterLevel - 1) * DCInfo.DefClass[lpObj->Class].LevelMana  + ((lpObj->Energy - DCInfo.DefClass[lpObj->Class].Energy ) * DCInfo.DefClass[lpObj->Class].EnergyToMana);
		// ----
		if( lpObj->Mana > lpObj->MaxMana + lpObj->AddMana )
		{
			lpObj->Mana = lpObj->MaxMana;
		}
		// ----
		gObjCalcMaxLifePower(lpObj->m_Index);
		gObjSetBP(lpObj->m_Index);
		gObjCalcShieldPoint(lpObj);
		// ----
		lpObj->iShield = lpObj->iMaxShield + lpObj->iAddShield;
		// ----
		LogAddTD("[%s][%s] Reset Max Value For MasterLevel [MaxLife:%d][MaxMana:%d][MaxSD:%d]", lpObj->AccountID, lpObj->Name, lpObj->MaxLife, lpObj->MaxMana, lpObj->iShield);
		// ----
		this->GCMasterLevelInfo(lpObj);
		// ----
		GCReFillSend(lpObj->m_Index, lpObj->Life, -1, 0, lpObj->iShield);
		GCManaSend(lpObj->m_Index, lpObj->Mana, -1, 0, lpObj->BP);
	}
	// ----
	gObjCalCharacter(lpObj->m_Index);
	// -----
	gObjCalcMLSkillItemOption(lpObj);
	g_MasterSkillSystem.CGReqGetMasterLevelSkillTree(lpObj->m_Index);
}