Ejemplo n.º 1
0
int CWhisperCash::AddCash(char* id)
{
	int count =0;
	int maxcount = 2;
	int result;

	result=this->SearchCash(id);

	if (result != -1)
	{
		if (gObjUserIdConnectCheck(id,result) == 0)
		{
			return -1;
		}
		return result;
	}

	result=gObjGetIndex(id);

	if (result == -1)
	{
		return -1;
	}

	count=this->WChashCount ;

	while ( maxcount-- != 0)
	{
		count++;

		if (count > 1)
		{
			count=0;
		}

		if ( this->WChash[count].Live == 0 )
		{
			memcpy(&this->WChash[count].szId[0], id, 10 );
			this->WChash[count].Live = 1;
			this->WChash[count].m_Index = result;
			this->WChash[count].m_Time = GetTickCount();
			this->WChashCount++;

			if ( this->WChashCount > 1)
			{
				this->WChashCount = 0;
			}
			return result;
		}
	}
	return result;
}
Ejemplo n.º 2
0
void Ccloseplayer::Load(char* filename)
{
    int Token;
    int aIndex;
    char closeplayerid[50];
    SMDFile=fopen(filename, "r");

    if (SMDFile == 0)
    {
        LogAdd(lMsg.Get(MSGGET(1, 213)), filename);
    }
    else
    {
        aIndex=0;
        while ( true )
        {
            Token=GetToken();
            if (Token == 2)
            {
                break;
            }
            memset(closeplayerid, 0, sizeof(closeplayerid) );
            strcpy(&closeplayerid[0], TokenString);

            if ( strlen(closeplayerid) > 0 )
            {
                aIndex=gObjGetIndex(closeplayerid);
                if ( aIndex >= 0 )
                {
                    LogAdd(lMsg.Get(MSGGET(1, 191)), closeplayerid);
                    CloseClient(aIndex);
                }
            }
        }
        fclose(SMDFile);
    }
}
Ejemplo n.º 3
0
int CGMMng::ManagementProc(LPOBJ lpObj, char* szCmd, int aIndex)
{
	char * szCmdToken;
	char string[256]={0};
	char szId[20]={0};
	char * pId = szId;
	int len = strlen(szCmd);
	int command_number;

	if ( len < 1 || len > 250 )
	{
		return 0;
	}

	strcpy_s(string, sizeof(string), szCmd);
	szCmdToken = InitTokenString(string);
	command_number = this->GetCmd(szCmdToken);

	switch ( command_number )
	{

        case 331:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 0, pId);
        }
        break;
        case 332:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 1, pId);
        }
        break;
        case 333:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 2, pId);
        }
        break;
        case 334:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 3, pId);
        }
        break;
        case 335:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 4, pId);
        }
        break;
        case 336:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 5, pId);
        }
        break;
        case 337:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 6, pId);
        }
        break;
        case 338:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 7, pId);
        }
        break;
        case 340:
        {
                pId = this->GetTokenString();

				if (pId == NULL)
					return 0;

                g_CastleSiege.OperateGmCommand(lpObj->m_Index, 8, pId);
        }
        break;

		case 217:	//116:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, "FIRECRACK.");
				int x = lpObj->X;
				int y = lpObj->Y;
				PMSG_SERVERCMD pMsg;

				PHeadSubSetB((LPBYTE)&pMsg,0xF3,0x40, sizeof(pMsg));
				pMsg.CmdType = 0;

				for ( int i=0;i<15;i++)
				{
					pMsg.X = x+Random(0,4)*2 - 4;
					pMsg.Y = y+Random(0,4)*2 - 4;
					MsgSendV2(lpObj,(UCHAR*)&pMsg, sizeof(pMsg));
					::DataSend(lpObj->m_Index ,(UCHAR*)&pMsg, sizeof(pMsg));
				}
			}
			break;

		case 216:	//115:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				LPOBJ lpTargetObj = gObjFind(pId);

				if ( lpTargetObj == NULL )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]	[ %s ]	[ %s ] / Target : [%s][%s] : %s ",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
					lpTargetObj->Name, "User Watching");

				char szTemp[256];

				if ( this->WatchTargetIndex == lpTargetObj->m_Index )
				{
					this->WatchTargetIndex = -1;
					
					wsprintf(szTemp, "%s : Off guard", lpTargetObj->Name);	
					GCServerMsgStringSend(szTemp, lpObj->m_Index, 1);
				}
				else
				{
					wsprintf(szTemp, "%s : Start monitoring", lpTargetObj->Name);	
					GCServerMsgStringSend(szTemp, lpObj->m_Index, 1);
					this->WatchTargetIndex = lpTargetObj->m_Index;
				}
			}
			break;

		case 215:	//114:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int map;
				int iX;
				int iY;
				LPOBJ lpTargetObj = gObjFind(pId);
				int iIndex;

				if ( lpTargetObj == NULL )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
					lpTargetObj->Name, "User Tracking");
				map = lpTargetObj->MapNumber;
				iX = lpTargetObj->X;
				iY = lpTargetObj->Y;
				iIndex = lpObj->m_Index;

				if ( iIndex >= 0 )
				{
					gObjTeleport(iIndex, map, iX, iY);
				}
			}
			break;

		case 214:	//113:
			{
				if ( (lpObj->Authority & 2) != 2 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, 
					"User Stat (connection)");

				int lc151 = 0;
				int lc152 = 400;
				int iTokenNumber = this->GetTokenNumber();

				if ( iTokenNumber > 0 )
				{
					lc151 = iTokenNumber;
				}

				int iTokenNumber2 = this->GetTokenNumber();

				if ( iTokenNumber2 > 0 )
				{
					lc152 = iTokenNumber2;
				}

				gObjSendUserStatistic(lpObj->m_Index, lc151, lc152);
			}
			break;

		case 100:	//100:
			{
				if ( (lpObj->AuthorityCode &4) != 4 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int iTargetIndex = gObjGetIndex(pId);
				
				if ( iTargetIndex == -1)
					iTargetIndex=0;

				if ( iTargetIndex >= 0 )
				{
					LPOBJ lpTargetObj = gObjFind(pId);

					if ( lpTargetObj == NULL )
					{
						return 0;
					}

					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
						lpTargetObj->Name, "User Disconnect");
					LogAdd("%s is forced to disconnect.", pId);
					CloseClient(iTargetIndex);
				}
			}
			break;

		case 112:	//108:
			{
				if ( (lpObj->AuthorityCode &4) != 4 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
					"Guild Disconnect");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				_GUILD_INFO_STRUCT * lpGuild = Guild.SearchGuild(pId);
				int iIndex;

				if ( lpGuild != NULL )
				{
					for ( int i=0;i<MAX_USER_GUILD ; i++ )
					{
						if ( lpGuild->Index[i] >= 0 )
						{
							iIndex = lpGuild->Index[i];

							if ( iIndex >= 0 )
							{
								LogAdd("%s is forced to disconnect.", pId);
								CloseClient(iIndex);
							}
						}
					}
				}
			}
			break;

		case 101:	//101: /move
			{
				char* map_name=this->GetTokenString();

				if (map_name == NULL)
					return 0;

				int iTokenNumber1 = this->GetTokenNumber();

				if ( (lpObj->AuthorityCode &8) == 8 && iTokenNumber1 != -1)
				{

					int iTokenNumber2 = this->GetTokenNumber();
					int iTokenNumber3 = this->GetTokenNumber();

					if (iTokenNumber2 == -1)
						iTokenNumber2 = 0;

					if (iTokenNumber3 == -1)
						iTokenNumber3 = 0;

					int iIndex = gObjGetIndex(map_name);

					if ( iIndex >= 0 )
					{
						LPOBJ lpTargetObj = gObjFind(map_name);

						if ( lpTargetObj == NULL )
						{
							return 0;
						}

						LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
							lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
							lpTargetObj->Name, "User SetPosition");

						gObjTeleport(iIndex, iTokenNumber1, iTokenNumber2, iTokenNumber3);
					}
				}
				else
				{

					int lc165 = -1;
					int lc166 = 0;
					int lc167 = 0;

					if ( lpObj->Teleport != 0 )
					{
						GCServerMsgStringSend("You are currently not able to warp.", lpObj->m_Index, 1);
						return 0;
					}

					if ( (lpObj->m_IfState.use) != 0 )
					{
						if ( lpObj->m_IfState.type  == 3 )
						{
							lpObj->TargetShopNumber = -1;
							lpObj->m_IfState.type = 0;
							lpObj->m_IfState.use = 0;
						}
					}

					if ( lpObj->m_IfState.use > 0 )
					{
						GCServerMsgStringSend("You are currently not able to warp.", lpObj->m_Index, 1);
						return 0;
					}

					if ( gObj[aIndex].IsInBattleGround != false )
					{
						GCServerMsgStringSend("You are currently not able to warp.", lpObj->m_Index, 1);
						return 0;
					}

					if ( lpObj->m_PK_Level >= gPKLvlToCantWarp )
					{
						GCServerMsgStringSend("An outlaw cannot use the /warp command. ", lpObj->m_Index, 1);
						return 0;
					}

					gMoveCommand.Move(lpObj, map_name);
				}
			}
			break;

		case 108:	//104:
			{
				if ( (lpObj->AuthorityCode &8)!= 8 )
				{
					return 0;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, 
					"Guild SetPosition");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int iTokenNumber1 = this->GetTokenNumber();
				int iTokenNumber2 = this->GetTokenNumber();
				int iTokenNumber3 = this->GetTokenNumber();

				if (iTokenNumber1 == -1)
					iTokenNumber1 = 0;

				if (iTokenNumber2 == -1)
					iTokenNumber2 = 0;

				if (iTokenNumber3 == -1)
					iTokenNumber3 = 0;

				_GUILD_INFO_STRUCT* lpGuild = Guild.SearchGuild(pId);
				int iIndex;

				if ( lpGuild != NULL )
				{
					for ( int i=0;i<MAX_USER_GUILD;i++)
					{
						if (lpGuild->Index[i] >= 0 )
						{
							iIndex = lpGuild->Index[i];
							gObjTeleport(iIndex, iTokenNumber1, iTokenNumber2++, iTokenNumber3);
						}
					}
				}
			}
			break;

		case 109:	//105:
			{
				if ( (lpObj->Authority &2)== 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
						"Start BattleSoccer");

					BattleSoccerGoalStart(0);
				}
			}
			break;

		case 110:	//106:
			{
				if ( (lpObj->Authority &2) == 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
						"Stop BattleSoccer");

					BattleSoccerGoalEnd(0);
				}
				else
				{
					if ( gObj[aIndex].lpGuild != NULL )
					{
						if (gObj[aIndex].lpGuild->WarType == 1 )
						{
							strcmp(gObj[aIndex].Name, gObj[aIndex].lpGuild->Names[0] );
						}
					}
				}
			}

			break;

		case 111:	//107:
			{
				if ( (lpObj->Authority & 2) == 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, "End GuildWar");

					char * szGuild = this->GetTokenString();

					if ( szGuild != NULL )
					{
						GCManagerGuildWarEnd(szGuild);
					}
				}
				else
				{
					if ( gObj[aIndex].lpGuild != NULL && gObj[aIndex].lpGuild->lpTargetGuildNode != NULL)
					{
						if ( strcmp( gObj[aIndex].Name, gObj[aIndex].lpGuild->Names[0] ) ==  0)
						{
							if ( gObj[aIndex].lpGuild->BattleGroundIndex >= 0 && gObj[aIndex].lpGuild->WarType == 1 )
							{
								::gObjAddMsgSendDelay(&gObj[aIndex], 7, aIndex, 10000, 0);

								char szTemp[100];

								wsprintf(szTemp, "Because of %s's request, the match will end automatically in 10 seconds", gObj[aIndex].lpGuild->Names[0] );
								::GCServerMsgStringSendGuild(gObj[aIndex].lpGuild, szTemp, 1);
								::GCServerMsgStringSendGuild(gObj[aIndex].lpGuild->lpTargetGuildNode, szTemp, 1);
							}
						}
					}
				}
			}
			break;

		case 104:	//102:
			{
				if ( (lpObj->AuthorityCode&0x20 ) != 0x20 )
				{
					return FALSE;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "Ban Chatting");

				pId = this->GetTokenString();

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

				int Index = ::gObjGetIndex(pId);

				if ( Index >= 0 )
				{
					gObj[Index].Penalty |= 2;
				}

			}
			break;

		case 106:	//103:
			{
				if ( (lpObj->AuthorityCode & 32 ) != 32 )
				{
					return FALSE;
				}

				LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "Free Ban-Chatting");

				pId = this->GetTokenString();

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

				int Index = ::gObjGetIndex(pId);

				if ( Index >= 0 )
				{
					gObj[Index].Penalty &= ~2;
				}
			}
			break;

		case 200:	//109:
			{
				pId = this->GetTokenString();

				if ( pId != NULL )
				{
					if ( strlen(pId) >= 1 )
					{
						::GCGuildWarRequestResult(pId, aIndex, 0);
					}
				}
			}

			break;

		case 202:	//111:
			{
				if ( (lpObj->Authority & 2 ) == 2 )
				{
					LogAdd("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
						lpObj->Name, "Set GuildWar");
		
					pId = this->GetTokenString();

					if ( pId != NULL )
					{
						char * Rival = this->GetTokenString();

						if ( Rival != NULL )
						{
							if ( strlen(pId) >= 1 )
							{
								if ( strlen(Rival) >= 1 )
								{
									::GCManagerGuildWarSet(pId, Rival, 1);
								}
							}
						}
					}
				}
				else
				{
					if ( gEnableBattleSoccer != FALSE )
					{
						pId = this->GetTokenString();

						if ( pId != NULL )
						{
							if ( strlen(pId) >= 1 )
							{
								::GCGuildWarRequestResult(pId, aIndex, 1);
							}
						}
					}
				}
			}

			break;

		case 201:	//110:
			{
				gObjBillRequest(&gObj[aIndex]);
			}
			break;

		case 203:	//112:
			{
				pId = this->GetTokenString();

				if ( pId != NULL )
				{
					BOOL bState;

					if ( strcmp(pId, "on" ) == 0 )
					{
						bState = TRUE;
					}
					else if ( strcmp(pId, "off") == 0 )
					{
						bState = FALSE;
					}

					if ( bState >= FALSE && bState <= TRUE )
					{
						::gObjSetTradeOption(aIndex, bState);
						::gObjSetDuelOption(aIndex, bState);
					}
				}
			}
			break;

		case 320:	//117:
			{
				if ( (lpObj->Authority &2) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "View the status of kundun");	
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "View the status of kundun");	

				for ( int n=0;n<MAX_VIEWPORT;n++)
				{
					if ( lpObj->VpPlayer[n].state != 0 )
					{
						if ( lpObj->VpPlayer[n].type == OBJ_MONSTER )
						{
							if ( lpObj->VpPlayer[n].number >= 0 )
							{
								LPOBJ lpTarget = &gObj[lpObj->VpPlayer[n].number];

								if ( lpTarget->Class == 275 )
								{
									TNotice pNotice(1);

									pNotice.SendToUser(lpObj->m_Index, "Kundun HP = %7.0f / %7.0f", lpTarget->Life, lpTarget->MaxLife); 
									pNotice.SendToUser(lpObj->m_Index, "Kundun RefillHP/Sec = %d RefillHP = %d RefillHPTime = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation
								}
							}
						}
					}
				}

			}
			break;

		case 321:	//118:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP설정");	// Require Translation

				int iLife = this->GetTokenNumber();

				if (iLife == -1)
					iLife = 0;

				for ( int n=0;n<MAX_VIEWPORT;n++)
				{
					if ( lpObj->VpPlayer[n].state != FALSE )
					{
						if ( lpObj->VpPlayer[n].type == OBJ_MONSTER )
						{
							if ( lpObj->VpPlayer[n].number >= 0 )
							{
								LPOBJ lpTarget = &gObj[lpObj->VpPlayer[n].number];

								if ( lpTarget->Class == 275 )
								{
									if  ( iLife <= 5000 )
									{
										iLife = 5000 ;
									}

									if ( iLife > lpTarget->MaxLife )
									{
										iLife = (int)lpTarget->MaxLife;
									}

									lpTarget->Life = iLife;
								
									TNotice pNotice(1);

									pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP = %7.0f / %7.0f", lpTarget->Life, lpTarget->MaxLife); //Require Translation
								}
							}
						}
					}
				}
			}
			break;

		case 322:	//119:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복량설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복량설정");	// Require Translation

				int RefillHP = this->GetTokenNumber();

				if ( RefillHP <= 0 || RefillHP > 5000000 )
				{
					return 0;
				}

				giKundunRefillHP = RefillHP;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP 초당회복량 = %d 회복량 = %d 회복시간 = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}

			break;

		case 323:	//120:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP초당회복량설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP초당회복량설정");	// Require Translation

				int RefillHPSec = this->GetTokenNumber();

				if ( RefillHPSec <= 0 || RefillHPSec > 10000 )
				{
					return 0;
				}

				giKundunRefillHPSec = RefillHPSec;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP 초당회복량 = %d 회복량 = %d 회복시간 = %d",
					giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}

			break;

		case 324:	//121:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAdd("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복시간설정");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "쿤둔HP회복시간설정");	// Require Translation

				int RefillHPTime = this->GetTokenNumber();

				if ( RefillHPTime < 0 || RefillHPTime > 60000 )
				{
					return 0;
				}

				giKundunRefillHPTime = RefillHPTime;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "쿤둔 HP 초당회복량 = %d 회복량 = %d 회복시간 = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}
			break;
 
		case 345:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 1);
			break;
		case 346:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 2);
			break;
		case 347:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 3);
			break;
		case 348:
			g_Crywolf.OperateGmCommand(lpObj->m_Index, 0);
			break;

		case 369:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 0);
			break;
		case 370:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 1);
			break;
		case 371:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 2);
			break;
		case 372:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 3);
			break;
		case 373:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 4);
			break;
		case 374:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 5);
			break;
		case 375:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 6);
			break;
		case 376:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 7);
			break;
		case 377:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 8);
			break;
		case 378:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 9);
			break;
		case 379:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 10);
			break;
		case 380:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 11);
			break;
		case 381:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 12);
			break;
		case 382:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 13);
			break;
		case 383:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 14);
			break;
		case 384:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 15);
			break;
		case 385:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 16);
			break;
		case 386:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 17);
			break;
		case 387:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 18);
			break;
		case 388:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 19);
			break;
		case 389:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 20);
			break;
	    case 390:
        {
                if ( (lpObj->Authority &2 ) != 2 )
                {
                        return FALSE;
                }

                int type, index,ItemLevel,ItemSkill,ItemLuck,ItemOpt,ItemExc,ItemAncient;
                type = GetTokenNumber();
                index = GetTokenNumber();
                ItemLevel = GetTokenNumber();
                ItemSkill = GetTokenNumber();
                ItemLuck = GetTokenNumber();
                ItemOpt = GetTokenNumber();
                ItemExc = GetTokenNumber();
                ItemAncient = GetTokenNumber();

				if (type == -1)
					type = 0;
                
				if (index == -1)
					index = 0;

				if (ItemLevel == -1)
					ItemLevel = 0;

				if (ItemSkill == -1)
					ItemSkill = 0;

				if (ItemLuck == -1)
					ItemLuck = 0;

				if (ItemOpt == -1)
					ItemOpt = 0;

				if (ItemExc == -1)
					ItemExc = 0;

				if (ItemAncient == -1)
					ItemAncient = 0;

                if( (type >= 0 && type <= 15) )
                {
					int Item = ItemGetNumberMake( type, index);
					ItemSerialCreateSend(aIndex, gObj[aIndex].MapNumber, (BYTE)gObj[aIndex].X, (BYTE)gObj[aIndex].Y, Item,ItemLevel,0,ItemSkill,ItemLuck,ItemOpt,-1,ItemExc,ItemAncient);
                }
                break;
        }
        case 391:
        {
                int value = GetTokenNumber();

				if (value == -1)
					value = 0;

                g_Crywolf.OperateGmCommand(lpObj->m_Index,value);
        }
        break;

	}
	return 0;
}
Ejemplo n.º 4
0
int CGMMng::ManagementProc(LPOBJ lpObj, char* szCmd, int aIndex)
{
	char * szCmdToken;
	char string[256];
	char szId[20];
	char * pId = szId;
	int len = strlen(szCmd);
	int command_number;

	if ( len < 1 || len > 250 )
	{
		return 0;
	}

	memset(szId, 0, sizeof(szId));
	strcpy(string, szCmd);
	szCmdToken = strtok(string, " ");
	command_number = this->GetCmd(szCmdToken);

	strcpy(Message, szCmd);

	if ( stricmp(szCmdToken, "/add0") == 0 )
	{
		int nAddStrength = 100;
		LevelUpPointAdd(0,nAddStrength,aIndex);
		GCSendEffectInfo(aIndex, 17);
	}
	if ( stricmp(szCmdToken, "/add1") == 0 )
	{
		int nAddStrength = 100;
		LevelUpPointAdd(1,nAddStrength,aIndex);
		GCSendEffectInfo(aIndex, 3);
	}
	if ( stricmp(szCmdToken, "/add2") == 0 )
	{
		int nAddStrength = 100;
		LevelUpPointAdd(2,nAddStrength,aIndex);
		GCSendEffectInfo(aIndex, 17);
	}
	if ( stricmp(szCmdToken, "/add3") == 0 )
	{
		int nAddStrength = 100;
		LevelUpPointAdd(3,nAddStrength,aIndex);
		GCSendEffectInfo(aIndex, 17);
	}
	switch ( command_number )
	{
		#if(GS_CASTLE == 1)
		case 331:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 0, pId);
		}
		break;
		case 332:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 1, pId);
		}
		break;
		case 333:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 2, pId);
		}
		break;
		case 334:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 3, pId);
		}
		break;
		case 335:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 4, pId);
		}
		break;
		case 336:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 5, pId);
		}
		break;
		case 337:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 6, pId);
		}
		break;
		case 338:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 7, pId);
		}
		break;
		case 340:
		{
			pId = this->GetTokenString();
			g_CastleSiege.OperateGmCommand(lpObj->m_Index, 8, pId);
		}
		break;
#endif
		case 502:
			{
				MMSG->Msg(lpObj->m_Index,"@@God of MuGlobal is Wolf");
				break;
			}
		case 501:
			{
				int OnlineCount = 0;
				for (int n=OBJ_STARTUSERINDEX;n<OBJMAX;n++)
				{
					if(gObjIsConnected(n))
						OnlineCount++;
				}
				MMSG->Msg(lpObj->m_Index,"[%d] Online Players",OnlineCount);
				break;
			}
		case 500:
			{
				char* szuText = this->GetTokenString();
				if(szuText != NULL)
				{
					int uTick = GetTickCount();
					//if(lpObj->Money < 299999);
					//{
					//	MMSG->Msg(lpObj->m_Index,"@[POST] Eww ti co - bisplatnij sir toka v mi6elovki");
					//	return 0;
					//}
					//{
					//	MMSG->Msg(lpObj->m_Index,"@[POST] Eww ti co - level netu :(");
					//	return 0;
					//}
					if(lpObj->Money < 500000)
					{
						MMSG->Msg(lpObj->m_Index,"@[POST] You need 500k Zen to POST");
						return 0;
					}
					if(lpObj->Level < 50)
					{
						MMSG->Msg(lpObj->m_Index,"@[POST] You need 50 Level to POST");
						return 0;
					}
					else
					{
						char *Content = (char*) Message;
						GetLongParam(Message, Content);
						lpObj->Money -= 500000;
						GCMoneySend(lpObj->m_Index , lpObj->Money);
						wsprintf(szuTemp,"[POST] %s: %s",lpObj->Name,Message);
						MMSG->PMAll(szuTemp);
						return 0;
					}
				}
				else
				{
					MMSG->Msg(lpObj->m_Index,"@[POST] The Correct Syntax is: /post message");
					return 0;
				}
				break;
			}
			case 503:	// MakeSet CMD
			{
								if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}
				if (!strcmpi(Message, "/MakeSet"))
				{
					MMSG->Msg(aIndex, "Useage: /Make <Name> <Index> <Level> <Option> <Skill> <Luck> <Exc> <Ancient> <Amount> <Dur>");
					return 0;
				}
				//Name Index Level Option Skill Luck Exc Ancient Amount Dur
				char Name[100];
				memset(Name, 0, 100);
				int Index, Level, Option, Luck, Skill, Exc, Ancient, Amount, Dur; 
				char ParamBuff[100];
				memset(ParamBuff, 0, 100);
				GetParam(1, Message, ParamBuff);
				strcpy(Name, ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(2, Message, ParamBuff)) strcpy(ParamBuff, "0");
				Index = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(3, Message, ParamBuff)) strcpy(ParamBuff, "13");
				Level = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(4, Message, ParamBuff)) strcpy(ParamBuff, "4");
				Option = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(5, Message, ParamBuff)) strcpy(ParamBuff, "1");
				Luck = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(6, Message, ParamBuff)) strcpy(ParamBuff, "1");
				Skill = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(7, Message, ParamBuff)) strcpy(ParamBuff, "127");
				Exc = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(8, Message, ParamBuff)) strcpy(ParamBuff, "0");
				Ancient = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(9, Message, ParamBuff)) strcpy(ParamBuff, "1");
				Amount = atoi(ParamBuff);
				memset(ParamBuff, 0, 100);
				if (!GetParam(10, Message, ParamBuff)) strcpy(ParamBuff, "255");
				Dur = atoi(ParamBuff);
				int tIndex = gObjGetIndexByName(Name);
				if (!tIndex) return 0;
				for (int i=0; i<Amount; i++)
				{
					for (int type=7; type<12; type++)
						ItemSerialCreateSend(tIndex, lpObj->MapNumber, lpObj->X, lpObj->Y, type*512 + Index, Level, Dur, Skill, Luck, Option, tIndex, Exc, Ancient);
				}
				break;
			}
		case 218:
			{
				AllSendServerMsg("[MU GLOBAL ADMINISTRATORS]");
				AllSendServerMsg("Sacred & Wolf");
				AllSendServerMsg("www.muglobal.ru");
				break;
			}
		case 217:	//116:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, "FIRECRACK.");
				int x = lpObj->X;
				int y = lpObj->Y;
				PMSG_SERVERCMD pMsg;

				PHeadSubSetB((LPBYTE)&pMsg,0xF3,0x40, sizeof(pMsg));
				pMsg.CmdType = 0;

				for ( int i=0;i<15;i++)
				{
					pMsg.X = x+(rand() % 5)*2 - 4;
					pMsg.Y = y+(rand() % 5)*2 - 4;
					MsgSendV2(lpObj,(UCHAR*)&pMsg, sizeof(pMsg));
					::DataSend(lpObj->m_Index ,(UCHAR*)&pMsg, sizeof(pMsg));
				}
			}
			break;

		case 216:	//115:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				LPOBJ lpTargetObj = gObjFind(pId);

				if ( lpTargetObj == NULL )
				{
					return 0;
				}

				LogAddTD("Use GM Command -> [ %s ]	[ %s ]	[ %s ] / Target : [%s][%s] : %s ",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
					lpTargetObj->Name, "User Watching");

				char szTemp[256];

				if ( this->WatchTargetIndex == lpTargetObj->m_Index )
				{
					this->WatchTargetIndex = -1;
					
					wsprintf(szTemp, "%s : °¨½ÃÇØÁ¦", lpTargetObj->Name);	// #translation
					GCServerMsgStringSend(szTemp, lpObj->m_Index, 1);
				}
				else
				{
					wsprintf(szTemp, "%s : °¨½Ã½ÃÀÛ", lpTargetObj->Name);	// #translation
					GCServerMsgStringSend(szTemp, lpObj->m_Index, 1);
					this->WatchTargetIndex = lpTargetObj->m_Index;
				}
			}
			break;

		case 215:	//114:
			{
				if ( (lpObj->Authority & 2) != 2 && (lpObj->Authority & 0x20) != 0x20 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int map;
				int iX;
				int iY;
				LPOBJ lpTargetObj = gObjFind(pId);
				int iIndex;

				if ( lpTargetObj == NULL )
				{
					return 0;
				}

				LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
					lpTargetObj->Name, "User Tracking");
				map = lpTargetObj->MapNumber;
				iX = lpTargetObj->X;
				iY = lpTargetObj->Y;
				iIndex = lpObj->m_Index;

				if ( iIndex >= 0 )
				{
					gObjTeleport(iIndex, map, iX, iY);
				}
			}
			break;

		case 214:	//113:
			{
				if ( (lpObj->Authority & 2) != 2 )
				{
					return 0;
				}

				LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, 
					"User Stat (connection)");

				int lc151 = 0;
				int lc152 = 400;
				int iTokenNumber = this->GetTokenNumber();

				if ( iTokenNumber > 0 )
				{
					lc151 = iTokenNumber;
				}

				int iTokenNumber2 = this->GetTokenNumber();

				if ( iTokenNumber2 > 0 )
				{
					lc152 = iTokenNumber2;
				}

				gObjSendUserStatistic(lpObj->m_Index, lc151, lc152);
			}
			break;

		case 100:	//100:
			{
				if ( (lpObj->AuthorityCode &4) != 4 )
				{
					return 0;
				}

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int iTargetIndex = gObjGetIndex(pId);
				

				if ( iTargetIndex >= 0 )
				{
					LPOBJ lpTargetObj = gObjFind(pId);

					if ( lpTargetObj == NULL )
					{
						return 0;
					}

					LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
						lpTargetObj->Name, "User Disconnect");
					LogAdd(lMsg.Get(MSGGET(1, 191)), pId);
					CloseClient(iTargetIndex);
				}
			}
			break;

		case 112:	//108:
			{
				if ( (lpObj->AuthorityCode &4) != 4 )
				{
					return 0;
				}

				LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
					"Guild Disconnect");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				_GUILD_INFO_STRUCT * lpGuild = Guild.SearchGuild(pId);
				int iIndex;

				if ( lpGuild != NULL )
				{
					for ( int i=0;i<MAX_USER_GUILD ; i++ )
					{
						if ( lpGuild->Index[i] >= 0 )
						{
							iIndex = lpGuild->Index[i];

							if ( iIndex >= 0 )
							{
								LogAdd(lMsg.Get(MSGGET(1, 191)), pId);
								CloseClient(iIndex);
							}
						}
					}
				}
			}
			break;

		case 101:	//101:
			{
				if ( (lpObj->AuthorityCode &8) == 8 )
				{
					pId = this->GetTokenString();

					if ( pId == NULL )
					{
						return 0;
					}

					int iTokenNumber1 = this->GetTokenNumber();
					int iTokenNumber2 = this->GetTokenNumber();
					int iTokenNumber3 = this->GetTokenNumber();
					int iIndex = gObjGetIndex(pId);
					LPOBJ lpTargetObj;

					if ( iIndex >= 0 )
					{
						lpTargetObj = gObjFind(pId);

						if ( lpTargetObj == NULL )
						{
							return 0;
						}

						LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] / Target : [%s][%s] : %s",
							lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, lpTargetObj->AccountID,
							lpTargetObj->Name, "User SetPosition");

						gObjTeleport(iIndex, iTokenNumber1, iTokenNumber2, iTokenNumber3);
					}
				}
				else
				{
					pId = this->GetTokenString();

					if ( pId != NULL )
					{
						int lc165 = -1;
						int lc166 = 0;
						int lc167 = 0;

						if ( lpObj->Teleport != 0 )
						{
							GCServerMsgStringSend(lMsg.Get(MSGGET(6, 68)), lpObj->m_Index, 1);
							return 0;
						}

						if ( (lpObj->m_IfState.use) != 0 )
						{
							if ( lpObj->m_IfState.type  == 3 )
							{
								lpObj->TargetShopNumber = -1;
								lpObj->m_IfState.type = 0;
								lpObj->m_IfState.use = 0;
							}
						}

						if ( lpObj->m_IfState.use > 0 )
						{
							GCServerMsgStringSend(lMsg.Get(MSGGET(6, 68)), lpObj->m_Index, 1);
							return 0;
						}

						if ( gObj[aIndex].IsInBattleGround != false )
						{
							GCServerMsgStringSend(lMsg.Get(MSGGET(6, 68)), lpObj->m_Index, 1);
							return 0;
						}

						if ( lpObj->m_PK_Level >= 6 )
						{
							GCServerMsgStringSend(lMsg.Get(MSGGET(4, 101)), lpObj->m_Index, 1);
							return 0;
						}

						gMoveCommand.Move(lpObj, pId);
					}
				}
			}
			break;

		case 108:	//104:
			{
				if ( (lpObj->AuthorityCode &8)!= 8 )
				{
					return 0;
				}

				LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
					lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, 
					"Guild SetPosition");

				pId = this->GetTokenString();

				if ( pId == NULL )
				{
					return 0;
				}

				int iTokenNumber1 = this->GetTokenNumber();
				int iTokenNumber2 = this->GetTokenNumber();
				int iTokenNumber3 = this->GetTokenNumber();
				_GUILD_INFO_STRUCT* lpGuild = Guild.SearchGuild(pId);
				int iIndex;

				if ( lpGuild != NULL )
				{
					for ( int i=0;i<MAX_USER_GUILD;i++)
					{
						if (lpGuild->Index[i] >= 0 )
						{
							iIndex = lpGuild->Index[i];
							gObjTeleport(iIndex, iTokenNumber1, iTokenNumber2++, iTokenNumber3);
						}
					}
				}
			}
			break;

		case 109:	//105:
			{
				if ( (lpObj->Authority &2)== 2 )
				{
					LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
						"Start BattleSoccer");

					BattleSoccerGoalStart(0);
				}
			}
			break;

		case 110:	//106:
			{
				if ( (lpObj->Authority &2) == 2 )
				{
					LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name,
						"Stop BattleSoccer");

					BattleSoccerGoalEnd(0);
				}
				else
				{
					if ( gObj[aIndex].lpGuild != NULL )
					{
						if (gObj[aIndex].lpGuild->WarType == 1 )
						{
							strcmp(gObj[aIndex].Name, gObj[aIndex].lpGuild->Names[0] );
						}
					}
				}
			}

			break;

		case 111:	//107:
			{
				if ( (lpObj->Authority & 2) == 2 )
				{
					LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s",
						lpObj->Ip_addr, lpObj->AccountID, lpObj->Name, "End GuildWar");

					char * szGuild = this->GetTokenString();

					if ( szGuild != NULL )
					{
						GCManagerGuildWarEnd(szGuild);
					}
				}
				else
				{
					if ( gObj[aIndex].lpGuild != NULL && gObj[aIndex].lpGuild->lpTargetGuildNode != NULL)
					{
						if ( strcmp( gObj[aIndex].Name, gObj[aIndex].lpGuild->Names[0] ) ==  0)
						{
							if ( gObj[aIndex].lpGuild->BattleGroundIndex >= 0 && gObj[aIndex].lpGuild->WarType == 1 )
							{
								::gObjAddMsgSendDelay(&gObj[aIndex], 7, aIndex, 10000, 0);

								char szTemp[100];

								wsprintf(szTemp, lMsg.Get(MSGGET(4, 129)), gObj[aIndex].lpGuild->Names[0] );
								::GCServerMsgStringSendGuild(gObj[aIndex].lpGuild, szTemp, 1);
								::GCServerMsgStringSendGuild(gObj[aIndex].lpGuild->lpTargetGuildNode, szTemp, 1);
							}
						}
					}
				}
			}
			break;

		case 104:	//102:
			{
				if ( (lpObj->AuthorityCode&0x20 ) != 0x20 )
				{
					return FALSE;
				}

				LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "Ban Chatting");

				pId = this->GetTokenString();

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

				int Index = ::gObjGetIndex(pId);

				if ( Index >= 0 )
				{
					gObj[Index].Penalty |= 2;
				}

			}
			break;

		case 106:	//103:
			{
				if ( (lpObj->AuthorityCode & 32 ) != 32 )
				{
					return FALSE;
				}

				LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "Free Ban-Chatting");

				pId = this->GetTokenString();

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

				int Index = ::gObjGetIndex(pId);

				if ( Index >= 0 )
				{
					gObj[Index].Penalty &= ~2;
				}
			}
			break;

		case 200:	//109:
			{
				pId = this->GetTokenString();

				if ( pId != NULL )
				{
					if ( strlen(pId) >= 1 )
					{
						::GCGuildWarRequestResult(pId, aIndex, 0);
					}
				}
			}

			break;

		case 202:	//111:
			{
				if ( (lpObj->Authority & 2 ) == 2 )
				{
					LogAddTD("Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
						lpObj->Name, "Set GuildWar");
		
					pId = this->GetTokenString();

					if ( pId != NULL )
					{
						char * Rival = this->GetTokenString();

						if ( Rival != NULL )
						{
							if ( strlen(pId) >= 1 )
							{
								if ( strlen(Rival) >= 1 )
								{
									::GCManagerGuildWarSet(pId, Rival, 1);
								}
							}
						}
					}
				}
				else
				{
					if ( gEnableBattleSoccer != FALSE )
					{
						pId = this->GetTokenString();

						if ( pId != NULL )
						{
							if ( strlen(pId) >= 1 )
							{
								::GCGuildWarRequestResult(pId, aIndex, 1);
							}
						}
					}
				}
			}

			break;

		case 201:	//110:
			{
				gObjBillRequest(&gObj[aIndex]);
			}
			break;

		case 203:	//112:
			{
				pId = this->GetTokenString();

				if ( pId != NULL )
				{
					BOOL bState;

					if ( strcmp(pId, "on" ) == 0 )
					{
						bState = TRUE;
					}
					else if ( strcmp(pId, "off") == 0 )
					{
						bState = FALSE;
					}

					if ( bState >= FALSE && bState <= TRUE )
					{
						::gObjSetTradeOption(aIndex, bState);
						::gObjSetDuelOption(aIndex, bState);
					}
				}
			}
			break;

		case 320:	//117:
			{
				if ( (lpObj->Authority &2) != 2 )
				{
					return FALSE;
				}

				LogAddTD("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐ»óź¸±â");	// #translation Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐ»óź¸±â");	// #translation  Require Translation

				for ( int n=0;n<MAX_VIEWPORT;n++)
				{
					if ( lpObj->VpPlayer[n].state != 0 )
					{
						if ( lpObj->VpPlayer[n].type == OBJ_MONSTER )
						{
							if ( lpObj->VpPlayer[n].number >= 0 )
							{
								LPOBJ lpTarget = &gObj[lpObj->VpPlayer[n].number];

								if ( lpTarget->Class == 275 )
								{
									TNotice pNotice(1);

									pNotice.SendToUser(lpObj->m_Index, "ÄïµÐ HP = %7.0f / %7.0f", lpTarget->Life, lpTarget->MaxLife); //Require Translation
									pNotice.SendToUser(lpObj->m_Index, "ÄïµÐ HP ÃÊ´çȸº¹·® = %d ȸº¹·® = %d ȸº¹½Ã°£ = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation
								}
							}
						}
					}
				}

			}
			break;

		case 321:	//118:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAddTD("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHP¼³Á¤");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHP¼³Á¤");	// Require Translation

				int iLife = this->GetTokenNumber();

				for ( int n=0;n<MAX_VIEWPORT;n++)
				{
					if ( lpObj->VpPlayer[n].state != FALSE )
					{
						if ( lpObj->VpPlayer[n].type == OBJ_MONSTER )
						{
							if ( lpObj->VpPlayer[n].number >= 0 )
							{
								LPOBJ lpTarget = &gObj[lpObj->VpPlayer[n].number];

								if ( lpTarget->Class == 275 )
								{
									if  ( iLife <= 5000 )
									{
										iLife = 5000 ;
									}

									if ( iLife > lpTarget->MaxLife )
									{
										iLife = lpTarget->MaxLife;
									}

									lpTarget->Life = iLife;
								
									TNotice pNotice(1);

									pNotice.SendToUser(lpObj->m_Index, "ÄïµÐ HP = %7.0f / %7.0f", lpTarget->Life, lpTarget->MaxLife); //Require Translation
								}
							}
						}
					}
				}
			}
			break;

		case 322:	//119:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAddTD("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHPȸº¹·®¼³Á¤");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHPȸº¹·®¼³Á¤");	// Require Translation

				int RefillHP = this->GetTokenNumber();

				if ( RefillHP <= 0 || RefillHP > 5000000 )
				{
					return 0;
				}

				giKundunRefillHP = RefillHP;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "ÄïµÐ HP ÃÊ´çȸº¹·® = %d ȸº¹·® = %d ȸº¹½Ã°£ = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}

			break;

		case 323:	//120:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAddTD("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHPÃÊ´çȸº¹·®¼³Á¤");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHPÃÊ´çȸº¹·®¼³Á¤");	// Require Translation

				int RefillHPSec = this->GetTokenNumber();

				if ( RefillHPSec <= 0 || RefillHPSec > 10000 )
				{
					return 0;
				}

				giKundunRefillHPSec = RefillHPSec;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "ÄïµÐ HP ÃÊ´çȸº¹·® = %d ȸº¹·® = %d ȸº¹½Ã°£ = %d",
					giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}

			break;

		case 324:	//121:
			{
				if ( (lpObj->Authority &2 ) != 2 )
				{
					return FALSE;
				}

				LogAddTD("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHPȸº¹½Ã°£¼³Á¤");	// Require Translation
				KUNDUN_GM_LOG.Output("[KUNDUN] Use GM Command -> [ %s ]\t[ %s ]\t[ %s ] : %s", lpObj->Ip_addr, lpObj->AccountID,
					lpObj->Name, "ÄïµÐHPȸº¹½Ã°£¼³Á¤");	// Require Translation

				int RefillHPTime = this->GetTokenNumber();

				if ( RefillHPTime < 0 || RefillHPTime > 60000 )
				{
					return 0;
				}

				giKundunRefillHPTime = RefillHPTime;

				TNotice pNotice(0);

				pNotice.SendToUser(lpObj->m_Index, "ÄïµÐ HP ÃÊ´çȸº¹·® = %d ȸº¹·® = %d ȸº¹½Ã°£ = %d", giKundunRefillHPSec, giKundunRefillHP, giKundunRefillHPTime);	// Require Translation

			}
			break;
		case 369:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 0);
			break;
		case 370:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 1);
			break;
		case 371:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 2);
			break;
		case 372:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 3);
			break;
		case 373:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 4);
			break;
		case 374:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 5);
			break;
		case 375:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 6);
			break;
		case 376:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 7);
			break;
		case 377:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 8);
			break;
		case 378:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 9);
			break;
		case 379:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 10);
			break;
		case 380:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 11);
			break;
		case 381:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 12);
			break;
		case 382:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 13);
			break;
		case 383:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 14);
			break;
		case 384:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 15);
			break;
		case 385:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 16);
			break;
		case 386:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 17);
			break;
		case 387:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 18);
			break;
		case 388:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 19);
			break;
		case 389:
			g_Kanturu.OperateGmCommand(lpObj->m_Index, 20);
			break;
	}
	return 0;
}
Ejemplo n.º 5
0
void GensPvP::JoinGens(int aIndex)
{
	if(OBJMAX_RANGE(aIndex) == 0)
	{
		return;
	}

	PMSG_GENSREPLY pResult = {0};
	PHeadSubSetB((LPBYTE)&pResult,0xF8,0x02,sizeof(PMSG_GENSREPLY));

	LPOBJ lpObj = &gObj[aIndex];
	int Family = 0;
	if(lpObj->m_IfState.type >= 100 && lpObj->m_IfState.type <= 101)
	{
		Family = lpObj->m_IfState.type - 99;
	}else
	{
		//error
		return;
	}
	
	if (lpObj->PlayerExtraInfoReceived != 1)
	{
		GCServerMsgStringSend ("ERROR: Please relogin!",lpObj->m_Index,0x01 ) ;
		LogAddC(2, "ERROR: GENS Info [%s][%s] Line: %d", lpObj->AccountID, lpObj->Name, __LINE__);
		return;
	}

	if(lpObj->GensFam != 0)
	{
		//U r already in a family
		pResult.state = 1;
		goto DSEND;
	}
	if(lpObj->GensNotAllow == 1 && this->AllowJoinIfLeftLessThan3Days == 0)
	{
		//You can not join coz need to pass 3 days before join again
		pResult.state = 2;
		goto DSEND;
	}
	if(lpObj->Level < this->MinLevel)
	{
		//Need X Level to Join in Gens
		pResult.state = 3;
		goto DSEND;
	}

	if(lpObj->Resets < this->MinReset)
	{
		//Need X Level to Join in Gens
		char sbuf[100]={0};
		wsprintf(sbuf,"You need %d Resets before join Gens",this->MinReset);
		GCServerMsgStringSend(sbuf,lpObj->m_Index, 0x01);
		pResult.state = 3;
		goto DSEND;
	}

	if(lpObj->PartyNumber >= 0 && this->AllowJoinInParty == 0)
	{
		//Cant Join if you are in Party
		pResult.state = 6;
		goto DSEND;
	}
	
	if(lpObj->GuildNumber > 0)
	{			
		
		//DWORD dwGuildNumber = lpObj->GuildNumber;
		//_GUILD_INFO_STRUCT * lpGuildInfo = Guild.SearchGuild_Number(dwGuildNumber);

		if(lpObj->lpGuild != NULL)
		{
			if(lpObj->lpGuild->GensFam != Family && lpObj->lpGuild->GensFam != 0 && this->AllowJoinIfGuildMemberIsInOtherGens == 0)
			{
				//Your GM is in other family
				pResult.state = 4;
				goto DSEND;
			}else if(lpObj->lpGuild->GensFam == 0 && ( strcmp(lpObj->Name, lpObj->lpGuild->Names[0] ) ) && this->AllowJoinInGuild == 0)
			{
				//Your GM must be in gens before join you
				pResult.state = 5;
				goto DSEND;
			}else
			{
				TUnionInfo * pUnionInfo = UnionManager.SearchUnion(lpObj->lpGuild->iGuildUnion);

				if ( pUnionInfo && this->AllowJoinInGuildAlliance == 0)
				{
					//Cant join if you are in guild alliance
					pResult.state = 7;
					goto DSEND;
				}else
				{	
					if(this->AllowJoinIfGuildMemberIsInOtherGens == 0)
					{
						for ( int n=0;n<MAX_USER_GUILD;n++)
						{
							if ( lpObj->lpGuild->Use[n] == TRUE )
							{
								int gpIndex = gObjGetIndex(lpObj->lpGuild->Names[n]);
								if ( gpIndex != -1 )
								{
									if(gObj[gpIndex].GensFam != Family && gObj[gpIndex].GensFam != 0)
									{
										//Your guild is part of a different gens
										pResult.state = 4;
										goto DSEND;
									}
								}
							}
						}
					}
				}
			}
		}
	}

	//All Ok Join in GENS Family
	pResult.state = 0;

	lpObj->GensFam = Family;
	lpObj->GensCont = 0;
	lpObj->RecvRewItem = 0;
	lpObj->GensLevel = 14;

	gObj[aIndex].PlayerExtraInfoModified = 1;
	gObjViewportListProtocolCreate(&gObj[aIndex]);
	LogAddTD("[GensPvP] [%s][%s] Join Gens Family", lpObj->AccountID, lpObj->Name);

	if(lpObj->GuildNumber > 0)
	{			
		if(lpObj->lpGuild != NULL)
		{
			if ( strcmp(lpObj->lpGuild->Names[0], lpObj->Name) == 0) // Case Guild Master
			{
				lpObj->lpGuild->GensFam = Family;
				if(this->JoinGuildIntoGensWhenYouAreGM == 1)
				{
					for ( int n=0;n<MAX_USER_GUILD;n++)
					{
						if ( lpObj->lpGuild->Use[n] == TRUE )
						{
							int gpIndex = gObjGetIndex(lpObj->lpGuild->Names[n]);
							if ( gpIndex != -1 && gpIndex != aIndex )
							{
								if(gObj[gpIndex].GensFam == 0)
								{
									if (gObj[gpIndex].PlayerExtraInfoReceived != 1)
									{
										GCServerMsgStringSend ("ERROR: Please relogin!",gpIndex,0x01 ) ;
										LogAddC(2, "ERROR: GENS Info [%s][%s] Line: %d", lpObj->AccountID, lpObj->Name, __LINE__);
										continue;
									}
									gObj[gpIndex].PlayerExtraInfoModified = 1;
									gObj[gpIndex].RecvRewItem = 0;
									gObj[gpIndex].GensFam = Family;
									gObj[gpIndex].GensCont = 0;
									gObj[gpIndex].GensLevel = 14;
									this->Ranking(gpIndex);
									gObjViewportListProtocolCreate(&gObj[gpIndex]);
									LogAddTD("[GensPvP] [%s][%s] Leave Gens Family", gObj[gpIndex].AccountID, gObj[gpIndex].Name);
								}
							}
						}
					}
				}
			}
		}
	}
	
	DataSend(aIndex,(UCHAR *)&pResult, pResult.h.size);
	this->Ranking(aIndex);
	return;

DSEND:
	DataSend(aIndex,(UCHAR *)&pResult, pResult.h.size);
}