INT32 HKD_ProcessClientMessage_ApplyBonus(BYTE *buffer, INT32 clientid)
{
	p277 *p = (p277*)buffer;

	INT16 cId = p->Header.ClientId;

	st_Mob *player = (st_Mob*)GetMobFromIndex(cId);
 
	if(!p->Info)
	{
		if(player->bStatus.Mastery[p->Info] >= 200)
			return 0;
 
		return 1;
	}
 
	if(player->Equip[0].EFV2 >= CELESTIAL)
	{
		if(player->bStatus.Mastery[p->Info] < 200)
			return 1;
	}
 
	int Have = player->Learn & (1 << (8 * p->Info - 1));

	if(Have)
	{
		if(player->bStatus.Mastery[p->Info] >= 255)
		{
			SendClientMessage(cId, "Limite máximo de pontos.");

			//SendLog(Users[cId].Username, "%s tentou distribuir pontos além do limite no mastery %d.", player->Name, p->Info);

			return 0;
		}
	} 
	else 
	{
		if(player->bStatus.Mastery[p->Info] >= 200)
		{
			SendClientMessage(cId, "Limite máximo de pontos");

			//SendLog(Users[cId].Username, "%s tentou distribuir pontos além do limite no mastery %d.", player->Name, p->Info);

			return 0;
		}
	}

	return 1;
}
Exemplo n.º 2
0
void CNetGame::Packet_InGameRcon(Packet* packet)
{
	CPlayer* pPlayer = GetPlayerPool()->GetAt((BYTE)packet->playerIndex);
	if (pPlayer)
	{
		DWORD dwCmdLen;
		memcpy(&dwCmdLen, &packet->data[1], 4);
		char* cmd = (char*)malloc(dwCmdLen+1);
		memcpy(cmd, &packet->data[5], dwCmdLen);
		cmd[dwCmdLen] = 0;

		if(GetPlayerPool()->IsAdmin((BYTE)packet->playerIndex))
		{
			if (strlen(cmd) == 0)
			{
				SendClientMessage(packet->playerId, 0xFFFFFFFF, "You forgot the RCON command!");
				return;
			}
			logprintf("RCON (In-Game): Player [%s] sent command: %s", GetPlayerPool()->GetPlayerName((BYTE)packet->playerIndex), cmd);
			byteRconUser = (BYTE)packet->playerIndex;
			pConsole->Execute(cmd);
			byteRconUser = INVALID_ID;
		} else {
			char* szTemp = strtok(cmd, " ");
			if (szTemp)
			{
				if (stricmp(szTemp, "login") == 0)
				{
					szTemp = strtok(NULL, " ");
					if (szTemp)
					{
						if(strcmp(szTemp, pConsole->GetStringVariable("rcon_password")) == 0)
						{
							GetPlayerPool()->SetAdmin((BYTE)packet->playerIndex);						
							logprintf("RCON (In-Game): Player #%d (%s) has logged in.", packet->playerIndex, GetPlayerPool()->GetPlayerName((BYTE)packet->playerIndex));
							SendClientMessage(packet->playerId, 0xFFFFFFFF,"SERVER: You are logged in as admin.");
						} else {
							logprintf("RCON (In-Game): Player #%d (%s) <%s> failed login.", packet->playerIndex, GetPlayerPool()->GetPlayerName((BYTE)packet->playerIndex), szTemp, pConsole->GetStringVariable("rcon_password"));
							SendClientMessage(packet->playerId, 0xFFFFFFFF,"SERVER: Bad admin password. Repeated attempts will get you banned.");
						}
					}
				}
			}
		}

		free(cmd);
	}
}
Exemplo n.º 3
0
void SkillAlchemy(UINT8 *m_PacketBuffer, bool *pRetn)
{
	*pRetn = true;

	st_Window *pServer = (st_Window*)m_PacketBuffer;

	INT16 cId = pServer->Header.ClientId;

	if(cId <= NULL || cId >= MAX_PLAYER)
		return;

	st_Mob *player = GetMobFromIndex(cId);

	if(pServer->Slot[0] == 0xFF || pServer->Slot[1] == 0xFF || pServer->Slot[2] == 0xFF)
		SendClientMessage(cId, "Coloque os três itens necessários.");
	else
	{
		for(char i = 0; i < 3; i ++)		
		{
			if(memcmp(&pServer->ItemId[i], &player->Inventory[pServer->Slot[i]], sizeof st_Item))
				return;

			else if(pServer->ItemId[i].Index != player->Inventory[pServer->Slot[i]].Index)
				return;
		}		
		
		Composition(pServer, player);

		SendClientSignalParm(cId, 0x7530, 0x3A7, 2);
	}
}
bool __stdcall HKD_FixTrainningCamp(INT32 clientid)
{
	bool sucess = true;

	st_Mob *player = GetMobFromIndex(clientid);

	if(player->Equip[0].EFV2 > MORTAL)
		sucess = false;

	else if(player->Status.Level > 34 && player->Status.Level < 999)
		sucess = false;

	if(wdBuffer[clientid].Ingame.isAdmin)
		sucess = true;

	if(!sucess)
	{
		DoTeleport(clientid, 2100 + (rand() % 10), 2100 + (rand() % 10));

		SendClientMessage(clientid, "Área permitida somente para mortais e níveis abaixo de 35.");
		//SendLog(Users[clientid].Username, "%s foi pego no campo de treino em condições incorretas.", player->Name);
	}

	return sucess;
}
Exemplo n.º 5
0
void RPC_ClientExitVehicle(RPCParameters *rpcParams)
{
	PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input);
	int iBitLength = rpcParams->numberOfBitsOfData;
	PlayerID sender = rpcParams->sender;

	RakNet::BitStream bsData((unsigned char *)Data,(iBitLength/8)+1,false);
	PLAYERID playerID = pRakServer->GetIndexFromPlayerID(sender);

	if(!playerPool[playerID].iIsConnected)
		return;

	VEHICLEID VehicleID;
	bsData.Read(VehicleID);

	if(VehicleID == (VEHICLEID)-1)
	{
		SendClientMessage(playerID, -1, "You are sending an invalid vehicle ID. Unlike kye, we wont kick you :)");
		return;
	}

	for(int i = 0; i < iScriptsRunning; i++)
	{
		if(script.scriptVM[i] != NULL && script.szScriptName[i][0] != 0x00)
			ScriptEvent_OnPlayerLeaveVehicle(script.scriptVM[i], playerID, VehicleID);
	}

	playerInfo[playerID].incarData.VehicleID = -1;

	RakNet::BitStream bsVehicle;
	bsVehicle.Write(playerID);
	bsVehicle.Write(VehicleID);
	pRakServer->RPC(&RPC_ExitVehicle, &bsVehicle, HIGH_PRIORITY, RELIABLE_ORDERED,
		0, sender, TRUE, FALSE, UNASSIGNED_NETWORK_ID, NULL);
}
Exemplo n.º 6
0
bool PlayerHandler::KickPlayer(int playerid, std::string message, GameUtility* gameUtility)
{
	std::stringstream s;
	s << "Kicked from server: " << message;
	SendClientMessage(playerid, 0xFF0000, s.str().c_str());
	SetTimer(1, false, KickDelayed, (void*)playerid);
	return true;
}
Exemplo n.º 7
0
		bool SendTeamMessage(const std::string &body)
		{
			auto session = Blam::Network::GetActiveSession();
			if (!session || !session->IsEstablished() || !session->HasTeams())
				return false;

			ChatMessage message(ChatMessageType::Team, body);
			return SendClientMessage(session, message);
		}
Exemplo n.º 8
0
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerCommandText(int playerid, const char *cmdtext) {
	if (std::strcmp(cmdtext, "/hello") == 0) {
		char name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name, MAX_PLAYER_NAME);
		char message[128];
		std::sprintf(message, "Hello, %s!", name);
		SendClientMessage(playerid, 0x00FF00FF, message);
		return true;
	}
	if (std::strcmp(cmdtext, "/pos") == 0) {
		float x, y, z;
		GetPlayerPos(playerid, &x, &y, &z);
		char message[128];
		std::sprintf(message, "You are at (%f, %f, %f)", x, y, z);
		SendClientMessage(playerid, 0xFFFFFFFF, message);
		return true;
	}
	return false;
}
Exemplo n.º 9
0
/** Send a delete message to a client. */
void DeleteClient(ClientNode *np)
{
   Assert(np);
   ReadWMProtocols(np->window, &np->state);
   if(np->state.status & STAT_DELETE) {
      SendClientMessage(np->window, ATOM_WM_PROTOCOLS, ATOM_WM_DELETE_WINDOW);
   } else {
      KillClient(np);
   }
}
Exemplo n.º 10
0
void AgentPlayer::update(const float& time)
{
	float delta = time;
	delta += delta;

	SFMath::Vector2Di index = getHighestValuedPointInBoard();
	
	ClientMessage msg(ClientMessage::TYPE_PLACED,mBoard->stoneIndexToScreen(index));
	SendClientMessage(&msg);
}
Exemplo n.º 11
0
void SendGuildNotice(int Guild, char *Message)
{
	for (int i = 0; i < MAX_USER; i++)
	{
		if (pUser[i].Mode == USER_PLAY)
		{
			if (pMob[i].MOB.Guild == Guild)
				SendClientMessage(i, Message);
		}
	}
}
Exemplo n.º 12
0
void SendNoticeArea(char *Message, int x1, int y1, int x2, int y2)
{
	for (int i = 0; i < MAX_USER; i++)
	{
		if (pUser[i].Mode != USER_PLAY)
			continue;

		if (pMob[i].TargetX >= x1 && pMob[i].TargetX <= x2 && pMob[i].TargetY >= y1 && pMob[i].TargetY <= y2)
			SendClientMessage(i, Message);
	}
}
Exemplo n.º 13
0
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerCommandText(int playerid, const char *cmdtext) {
  if (strcmp(cmdtext, "/hello") == 0) {
    char name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    char message[MAX_CLIENT_MESSAGE];
    sprintf(message, "Hello, %s!", name);
    SendClientMessage(playerid, 0x00FF00FF, message);
    return true;
  }
  return false;
}
Exemplo n.º 14
0
House::House(HouseInfo& info) : info(info)
{
	areaid = CreateDynamicCube(info.lx, info.ly, info.lz, info.mx, info.my, info.mz, -1, -1, -1);
	GameServer::getInstance().areamanager.registerArea(areaid,
	[info](const std::shared_ptr<Account>& player) {
		if (player->getUserID() == info.ownerid)
		{
			SendClientMessage(player->getInGameID(), 0xFFFFFFFF, STR("[House] 欢迎来到你的房产 " << info.name).c_str());
		}
		else
		{
			SendClientMessage(player->getInGameID(), 0xFFFFFFFF, STR("[House] 你正在进入限制区域 " << info.name << " 请输入密码").c_str());
			showHouseAuthDialog(player, GameServer::getInstance().housemanager.findHouse(info.houseid));
		}
	});
	zoneid = GangZoneCreate(info.lx, info.ly, info.mx, info.my);
	signid = CreateDynamicObject(3337, info.ex, info.ey, info.ez, 0.0f, 0.0f, info.rotation, -1, -1, -1, 200.0f, 200.0f);
	SetDynamicObjectMaterialText(signid, 1, info.name.c_str(), OBJECT_MATERIAL_SIZE_256x128, "Arial", 32, 1, 0xFFFFFFFF, 0xFF003366, 1);
	init();
}
Exemplo n.º 15
0
void Exec_MSG_Withdraw(int conn, char *pMsg)
{
	MSG_STANDARDPARM *m = (MSG_STANDARDPARM*)pMsg;

	if (pMob[conn].MOB.CurrentScore.Hp == 0 || pUser[conn].Mode != USER_PLAY)
	{
		SendHpMode(conn);
		AddCrackError(conn, 10, 2);
		return;
	}

	int coin = m->Parm;

	if (pUser[conn].Coin >= coin && coin >= 0 && coin <= 2000000000)
	{
		int tcoin = coin + pMob[conn].MOB.Coin;

		if (tcoin >= 0 && tcoin <= 2000000000)
		{
			pMob[conn].MOB.Coin = tcoin;
			pUser[conn].Coin -= coin;

			m->ID = 30000;

			pUser[conn].cSock.AddMessage((char*)m, sizeof(MSG_STANDARDPARM));
			SendCargoCoin(conn);

			sprintf(temp, "etc,retirada do bau V:%d R:%d", coin, pUser[conn].Coin);
			Log(temp, pUser[conn].AccountName, pUser[conn].IP);
		}
		else
			SendClientMessage(conn, g_pMessageStringTable[_NN_Cant_get_more_than_2G]);
	}
	else
		SendClientMessage(conn, g_pMessageStringTable[_NN_Cant_Withdraw_That_Much]);
}
Exemplo n.º 16
0
void SendNotice(char *Message)
{
	char Notice[512];

	sprintf(Notice, "not %s", Message);
	Log(Notice, "-system", NULL);

	if (Message[0] == '\'' && Message[1] == 'x')
		return;

	for (int i = 0; i < MAX_USER; i++)
	{
		if (pUser[i].Mode == USER_PLAY)
			SendClientMessage(i, Message);
	}
}
Exemplo n.º 17
0
/** Set the active client. */
void FocusClient(ClientNode *np)
{
   if(np->state.status & STAT_HIDDEN) {
      return;
   }
   if(!(np->state.status & (STAT_CANFOCUS | STAT_TAKEFOCUS))) {
      return;
   }

   if(activeClient != np || !(np->state.status & STAT_ACTIVE)) {

      if(activeClient) {
         activeClient->state.status &= ~STAT_ACTIVE;
         if(!(activeClient->state.status & STAT_OPACITY)) {
            SetOpacity(activeClient, settings.inactiveClientOpacity, 0);
         }
         DrawBorder(activeClient);
      }
      np->state.status |= STAT_ACTIVE;
      activeClient = np;
      if(!(np->state.status & STAT_OPACITY)) {
         SetOpacity(np, settings.activeClientOpacity, 0);
      }

      DrawBorder(np);
      RequirePagerUpdate();
      RequireTaskUpdate();

   }

   if(np->state.status & STAT_MAPPED) {
      UpdateClientColormap(np);
      SetWindowAtom(rootWindow, ATOM_NET_ACTIVE_WINDOW, np->window);
      if(np->state.status & STAT_CANFOCUS) {
         JXSetInputFocus(display, np->window, RevertToParent, eventTime);
      }
      if(np->state.status & STAT_TAKEFOCUS) {
         SendClientMessage(np->window, ATOM_WM_PROTOCOLS, ATOM_WM_TAKE_FOCUS);
      }
   } else {
      JXSetInputFocus(display, rootWindow, RevertToParent, eventTime);
   }

}
Exemplo n.º 18
0
/** Destroy a swallow tray component. */
void Destroy(TrayComponentType *cp) {

   ClientProtocolType protocols;

   /* Destroy the window if there is one. */
   if(cp->window) {

      JXReparentWindow(display, cp->window, rootWindow, 0, 0);
      JXRemoveFromSaveSet(display, cp->window);

      protocols = ReadWMProtocols(cp->window);
      if(protocols & PROT_DELETE) {
         SendClientMessage(cp->window, ATOM_WM_PROTOCOLS,
            ATOM_WM_DELETE_WINDOW);
      } else {
         JXKillClient(display, cp->window);
      }

   }

}
Exemplo n.º 19
0
void SendNoticeChief(char *Message)
{
	char Notice[512];

	sprintf(Notice, "not %s", Message);

	Log(Notice, "-system", NULL);

	for (int i = 0; i < MAX_USER; i++)
	{
		if (pUser[i].Mode != USER_PLAY)
			continue;

		if (pMob[i].MOB.GuildLevel != 9)
			continue;

		int Guild = pMob[i].MOB.Guild;

		if (Guild <= 0)
			continue;

		int FoundCharged = 0;

		for (int j = 0; j < MAX_SERVER; j++)
		{
			for (int k = 0; k < MAX_GUILDZONE; k++)
			{
				if (ChargedGuildList[j][k] && ChargedGuildList[j][k] == Guild)
				{
					FoundCharged = 1;
					break;
				}
			}
		}

		SendClientMessage(i, Message);
	}
}
Exemplo n.º 20
0
bool PlayerHandler::OnCommand(Player *player, std::string cmd, std::vector<std::string> args, GameUtility *gameUtility)
{
	if (cmd == "hack")
	{
		GivePlayerMoney(player->getId(), 500000);
		return true;
	}
	else if (cmd == "pos")
	{
		float *x = new float(), *y = new float(), *z = new float(), *angle = new float();
		GetPlayerPos(player->getId(), x, y, z);
		std::stringstream pos;
		pos << "Pos: X" << *x << " Y" << *y << " Z" << *z << "\nInterior: " << player->GetInterior() << " VirtualWorld: " << player->GetVirtualWorld();
		SendClientMessage(player->getId(), 0xFFFFFFFF, pos.str().c_str());
		delete x, y, z;
		return true;
	}
	else if (cmd == "spawn")
	{
		TeleportPlayer(player->getId(), WorldPositionObject(1958.3783f, 1343.1572f, 15.3746f, gameUtility->interiorHandler->getInterior(-1)));
		return true;
	}
	return false;
}
Exemplo n.º 21
0
void MoveItem1(unsigned char* szBuffer)
{	
	try
	{
		p376 *p = (p376*)szBuffer;
		st_Mob *player = (st_Mob*)GetMobFromIndex((unsigned short)szBuffer[6]);	
	
		if(p->SrcType == Cargo_Type && p->DstType == Equip_Type)
		{
			if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == 747)
			{
				SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar a coroa.");
				ZeroMemory(szBuffer, *(short*)szBuffer); return;						
			}
			else if(player->Equip[0].EFV2 == 1)
			{
				for(int i = 0; i < 16; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == SetsCele[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == SetsCeleSelado[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais selados em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == SetsArch[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets archs em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 3; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == MontaTigre[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar a montaria Tigre de Fogo em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 6; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == MontaDrag[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar a montaria Dragão em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 40; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasCeleAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasArchAnct[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas archs em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 10; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasCeleSelada[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais seladas em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;			
					}
					else if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasArchNaoAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas archs em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
			}
			else if(player->Equip[0].EFV2 == 2)
			{
				for(int i = 0; i < 16; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == SetsCele[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == SetsCeleSelado[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais selados em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 40; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasCeleAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasEAnct[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 10; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasCeleSelada[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais seladas em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasENaoAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;			
					}
				}
			}
			else if(player->Equip[0].EFV2 >= 3 && player->Equip[0].EFV2 <= 5)
			{
				for(int i = 0; i < 40; i++)
				{				
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasEAnct[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em sua classe.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 10; i++)
				{
					if(BancoSlot((unsigned short)szBuffer[6],p->SrcSlot) == ArmasENaoAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em sua classe.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
			}
		}
		else if(p->SrcType == Equip_Type && p->DstType == Inv_Type)//do equip pro inv
		{
			if(player->Equip[p->SrcSlot].Index == 747)
			{
				SendClientMessage((unsigned short)szBuffer[6],"Não é possivel desequipar a coroa.");
				ZeroMemory(szBuffer, *(short*)szBuffer); return;						
			}
			else if(p->SrcSlot == 15)//medalha capa
			{
				ZeroMemory(szBuffer, p->Header.Size);	return;		
			}
			else if(p->SrcSlot == 12)
			{
				SendClientMessage((unsigned short)szBuffer[6],"Para retirar sua medalha de guilda use /Expulsar");
				ZeroMemory(szBuffer, *(short*)szBuffer); return;						
			}
		}
		else if(p->SrcType == Equip_Type && p->DstSlot == Cargo_Type)//do equip pro banco
		{
			if(player->Equip[p->SrcType].Index == 747 || player->Equip[p->SrcType].Index == 5447 || player->Equip[p->SrcType].Index == 5446 || player->Equip[p->SrcType].Index == 5445 || player->Equip[p->SrcType].Index == 5444  || player->Equip[p->SrcType].Index == 3507  || player->Equip[p->SrcType].Index == 3506  || player->Equip[p->SrcType].Index == 3505  || player->Equip[p->SrcType].Index == 3504  || player->Equip[p->SrcType].Index == 3503  || player->Equip[p->SrcType].Index == 3502  || player->Equip[p->SrcType].Index == 3501   || player->Equip[p->SrcType].Index == 3500)
			{
				SendClientMessage((unsigned short)szBuffer[6],"Não é possivel desequipar a coroa e cytheras.");
				ZeroMemory(szBuffer, *(short*)szBuffer); return;						
			}
		}
		else if(p->SrcType == Inv_Type && p->DstType == Equip_Type)//do inv pro equip
		{
			if(player->Inventory[p->SrcSlot].Index == 747 || player->Inventory[p->SrcSlot].Index == 5447 || player->Inventory[p->SrcSlot].Index == 5446 || player->Inventory[p->SrcSlot].Index == 5445 || player->Inventory[p->SrcSlot].Index == 5444 || player->Inventory[p->SrcSlot].Index == 3507 || player->Inventory[p->SrcSlot].Index == 3506 || player->Inventory[p->SrcSlot].Index == 3505 || player->Inventory[p->SrcSlot].Index == 3504 || player->Inventory[p->SrcSlot].Index == 3503 || player->Inventory[p->SrcSlot].Index == 3502 || player->Inventory[p->SrcSlot].Index == 3501 || player->Inventory[p->SrcSlot].Index == 3500)
			{
				SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar a coroa e cytheras");
				ZeroMemory(szBuffer, *(short*)szBuffer); return;						
			}
			else if(player->Equip[0].EFV2 == 1)
			{
				for(int i = 0; i < 16; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == SetsCele[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(player->Inventory[p->SrcSlot].Index == SetsCeleSelado[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais selados em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(player->Inventory[p->SrcSlot].Index == SetsArch[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets archs em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 3; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == MontaTigre[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar a montaria Tigre de Fogo em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 6; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == MontaDrag[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar a montaria Dragão em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 40; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == ArmasCeleAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(player->Inventory[p->SrcSlot].Index == ArmasArchAnct[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas archs em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 10; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == ArmasCeleSelada[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais seladas em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;			
					}
					if(player->Inventory[p->SrcSlot].Index == ArmasArchNaoAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas archs em mortais.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
			}
			else if(player->Equip[0].EFV2 == 2)
			{
				for(int i = 0; i < 16; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == SetsCele[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(player->Inventory[p->SrcSlot].Index == SetsCeleSelado[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar sets celestiais selados em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 40; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == ArmasCeleAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					else if(player->Inventory[p->SrcSlot].Index == ArmasEAnct[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 10; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == ArmasCeleSelada[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas celestiais seladas em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
					if(player->Inventory[p->SrcSlot].Index == ArmasENaoAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em archs.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;			
					}
				}
			}
			else if(player->Equip[0].EFV2 >= 3 && player->Equip[0].EFV2 <= 5)
			{
				for(int i = 0; i < 40; i++)
				{				
					if(player->Inventory[p->SrcSlot].Index == ArmasEAnct[i])
					{
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em sua classe.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
				for(int i = 0; i < 10; i++)
				{
					if(player->Inventory[p->SrcSlot].Index == ArmasENaoAnct[i])
					{				
						SendClientMessage((unsigned short)szBuffer[6],"Não é possivel equipar armas [E] em sua classe.");
						ZeroMemory(szBuffer, *(short*)szBuffer); return;				
					}
				}
			}		
		}
	}
	catch(...)
	{
		//LogError(szBuffer);
	}
}
Exemplo n.º 22
0
int GetTeleportPosition(int conn, int *x, int *y)
{
	int xv = (*x) & 0xFFFC;
	int yv = (*y) & 0xFFFC;
	int Charge = 0;

	if (xv == 2116 && yv == 2100) // Armia to Noatum	
	{
		*x = 1044 + rand() % 3;
		*y = 1724 + rand() % 3;

		Charge = 700;
	}
	else if (xv == 2480 && yv == 1716) // Azran to Noatum
	{
		*x = 1044 + rand() % 3;
		*y = 1716 + rand() % 3;

		Charge = 700;
	}
	else if (xv == 2456 && yv == 2016) // Erion to Noatum
	{
		*x = 1044 + rand() % 3;
		*y = 1708 + rand() % 3;

		Charge = 700;
	}
	else if (xv == 1044 && yv == 1724) // Noatum to Armia
	{
		*x = 2116 + rand() % 3;
		*y = 2100 + rand() % 3;
	}
	else if (xv == 1044 && yv == 1716) // Noatum to Azran
	{
		*x = 2480 + rand() % 3;
		*y = 1716 + rand() % 3;
	}
	else if (xv == 1044 && yv == 1708) // Noatum to Erion
	{
		*x = 2456 + rand() % 3;
		*y = 2016 + rand() % 3;
	}
	else if (xv == 1048 && yv == 1764) // Noatum guild area to Noatum siege war area
	{
		*x = 1100 + rand() % 3;
		*y = 1712 + rand() % 3;
	}
	else if (xv == 1052 && yv == 1708) // Noatum to Karden
	{
		*x = 3650 + rand() % 3;
		*y = 3110 + rand() % 3;
	}
	else if (xv == 2140 && yv == 2068) // Armia to Armia Field
	{
		*x = 2588 + rand() % 3;
		*y = 2096 + rand() % 3;
	}
	else if (xv == 2468 && yv == 1716) // Azran to Azran Field, near cape quest
	{
		*x = 2248 + rand() % 3;
		*y = 1556 + rand() % 3;
	}
	else if (xv == 2364 && yv == 2284) // Armia Field to Dungeon 1st Floor
	{
		*x = 144 + rand() % 3;
		*y = 3788 + rand() % 3;
	}
	else if (xv == 144 && yv == 3788) // Dungeon 1st floor to Armia Field
	{
		*x = 2364 + rand() % 3;
		*y = 2284 + rand() % 3;
	}
	else if (xv == 2668 && yv == 2156) // Armia Field to Dungeon 1st Floor (other locations)
	{
		*x = 148 + rand() % 2;
		*y = 3774 + rand() % 2;
	}
	else if (xv == 144 && yv == 3772) // Dungeon 1st floor to Armia Field (other locations)
	{
		*x = 2668 + rand() % 3;
		*y = 2156 + rand() % 3;
	}
	else if (xv == 148 && yv == 3780) // Dungeon 1st floor to Dungeon 2nd floor
	{
		*x = 1004 + rand() % 3;
		*y = 4028 + rand() % 3;
	}
	else if (xv == 144 && yv == 3780) // Dungeon 1st floor to Dungeon 2nd floor
	{
		*x = 1004 + rand() % 3;
		*y = 4028 + rand() % 3;
	}
	else if (xv == 1004 && yv == 4028) // Dungeon 2nd floor to Dungeon 1st Floor
	{
		*x = 148 + rand() % 3;
		*y = 3780 + rand() % 3;
	}
	else if (xv == 408 && yv == 4072) // Dungeon 1st floor to Dungeon 2nd floor
	{
		*x = 1004 + rand() % 3;
		*y = 4064 + rand() % 3;
	}
	else if (xv == 1004 && yv == 4064) // Dungeon 2nd floor to Dungeon 1st floor
	{
		*x = 408 + rand() % 3;
		*y = 4072 + rand() % 3;
	}
	else if (xv == 744 && yv == 3820) // Dungeon 1st floor to Dungeon 3rd floor
	{
		*x = 1004 + rand() % 3;
		*y = 3992 + rand() % 3;
	}
	else if (xv == 1004 && yv == 3992) // Dungeon 3rd floor to Dugeon 1st floor
	{
		*x = 744 + rand() % 3;
		*y = 3820 + rand() % 3;
	}
	else if (xv == 680 && yv == 4076) // Dungeon 2nd floor to Dungeon 3rd floor
	{
		*x = 916 + rand() % 3;
		*y = 3820 + rand() % 3;
	}
	else if (xv == 916 && yv == 3820) // Dungeon 3rd floor to Dungeon 2nd floor
	{
		*x = 680 + rand() % 3;
		*y = 4076 + rand() % 3;
	}
	else if (xv == 876 && yv == 3872) // Dungeon 2nd floor to Dungeon 3rd floor
	{
		*x = 932 + rand() % 3;
		*y = 3820 + rand() % 3;
	}
	else if (xv == 932 && yv == 3820) // Dungeon 3rd floor to Dungeon 2nd floor
	{
		*x = 876 + rand() % 3;
		*y = 3872 + rand() % 3;
	}
	else if (xv == 188 && yv == 188) // War area to Azran
	{
		*x = 2548 + rand() % 3;
		*y = 1740 + rand() % 3;
	}
	else if (xv == 2548 && yv == 1740) // Azran to vale
	{
		if (pMob[conn].MOB.Equip[13].sIndex == 3916)
		{
			*x = 2281 + rand() % 3;
			*y = 3688 + rand() % 3;
		}
	}
	else if (xv == 1824 && yv == 1772) // Azran Field to Underworld
	{
		*x = 1172 + rand() % 3;
		*y = 4080 + rand() % 3;
	}
	else if (xv == 1172 && yv == 4080) // Underworld to Azran Field
	{
		*x = 1824 + rand() % 3;
		*y = 1772 + rand() % 3;
	}
	else if (xv == 1516 && yv == 3996) // Underworld 1st floor to Underworld 2nd floor
	{
		*x = 1304 + rand() % 3;
		*y = 3816 + rand() % 3;
	}
	else if (xv == 1304 && yv == 3816) // Underworld 2nd floor to Underworld 1st floor
	{
		*x = 1516 + rand() % 3;
		*y = 3996 + rand() % 3;
	}
	else if (xv == 2452 && yv == 1716) // Azran 2nd teleport to Azran field
	{
		*x = 1969 + rand() % 3;
		*y = 1711 + rand() % 3;
	}
	else if (xv == 2452 && yv == 1988) // Erion teleport to Azran field
	{
		*x = 1989 + rand() % 3;
		*y = 1755 + rand() % 3;
	}

	else if (xv == 3648 && yv == 3108) // Karden teleport to Noatum
	{
		*x = 1054 + rand() % 3;
		*y = 1710 + rand() % 3;
	}

	else if (xv == 1056 && yv == 1724) // Noatum to RvR - Deserto
	{
		if (RvRState == 2)
		{
			if (pMob[conn].MOB.Clan == 7)//BLUE
			{
				*x = 1061 + rand() % 3;
				*y = 2129 + rand() % 3;
			}
			else if (pMob[conn].MOB.Clan == 8)//RED
			{
				*x = 1237 + rand() % 3;
				*y = 1966 + rand() % 3;
			}
		}

		else
		{
			*x = 1164 + rand() % 3;
			*y = 1720 + rand() % 3;
		}
	}

	else if(xv == 2364 && yv == 3892 && pMob[conn].extra.KefraTicket > 0)
	{
		pMob[conn].extra.KefraTicket--;

		*x = 2364 + rand() % 3;
		*y = 3906 + rand() % 3;


		sprintf(temp, g_pMessageStringTable[_DN_CHANGE_COUNT], pMob[conn].extra.KefraTicket);
		SendClientMessage(conn, temp);
	}

	//Deserto - Kefra
	else if(xv == 2364 && yv == 3924 && KefraLive != 0)
	{
		*x = 3250 + rand() % 3;
		*y = 1703 + rand() % 3;
	}

	//Kefra - Deserto
	else if(xv == 1312 && yv == 1900)
	{
		*x = 2366 + rand() % 2;
		*y = 4073 + rand() % 2;
	}

	else if(xv == 2364 && yv == 4072)
	{
		*x = 1314 + rand() % 2;
		*y = 1900 + rand() % 2;
	}
	return Charge;
}
Exemplo n.º 23
0
void Exec_MSG_CombineItemAlquimia(int conn, char *pMsg)
{
	MSG_CombineItem *m = (MSG_CombineItem*)pMsg;

	for (int i = 0; i < MAX_COMBINE; i++)
	{
		if (m->Item[i].sIndex == 0)
			continue;

		int invPos = m->InvenPos[i];

		if (invPos < 0 || invPos >= pMob[conn].MaxCarry)
		{
			RemoveTrade(conn);
			return;
		}

		if (memcmp(&pMob[conn].MOB.Carry[invPos], &m->Item[i], sizeof(STRUCT_ITEM)))
		{
			ItemLog("err,msg_CombineAlquimia - item remove or changed.", pUser[conn].AccountName, pUser[conn].IP);
			SendClientSignalParm(conn, ESCENE_FIELD, _MSG_CombineComplete, 0);
			return;
		}
	}

	int combine = GetMatchCombineAlquimia(m->Item);

	if (combine == -1 || pMob[conn].MOB.Class != 3)
	{
		SendClientSignalParm(conn, ESCENE_FIELD, _MSG_CombineComplete, 0);
		return;
	}

	for (int i = 0; i < MAX_COMBINE; i++)
	{
		if (m->Item[i].sIndex == 0)
			continue;

		memset(&pMob[conn].MOB.Carry[m->InvenPos[i]], 0, sizeof(STRUCT_ITEM));
		SendItem(conn, ITEM_PLACE_CARRY, m->InvenPos[i], &pMob[conn].MOB.Carry[m->InvenPos[i]]);
	}

	ItemLog("*** Item combine ht_skill_alquimia. ***", pUser[conn].AccountName, pUser[conn].IP);

	for (int i = 0; i < MAX_COMBINE; i++)
	{
		if (m->Item[i].sIndex)
		{
			char itemlog[2048];
									 
			BASE_GetItemCode(&m->Item[i], itemlog);
									 
			strcat(temp, itemlog);
		}
	}
	ItemLog(temp, pUser[conn].AccountName, pUser[conn].IP);
	ItemLog("*** ------------------- ***", pUser[conn].AccountName, pUser[conn].IP);

	int _rand = rand() % 115;
	if (_rand >= 100)
		_rand -= 15;

	int chance = (pMob[conn].MOB.CurrentScore.Special[2] + 1) / 6;

	if (_rand <= chance || LOCALSERVER)
	{
		pMob[conn].MOB.Carry[m->InvenPos[0]].sIndex = 3200 + combine;
		pMob[conn].MOB.Carry[m->InvenPos[0]].stEffect[0].cEffect = 0;
		pMob[conn].MOB.Carry[m->InvenPos[0]].stEffect[0].cValue = 0;
		pMob[conn].MOB.Carry[m->InvenPos[0]].stEffect[1].cEffect = 0;
		pMob[conn].MOB.Carry[m->InvenPos[0]].stEffect[1].cValue = 0;
		pMob[conn].MOB.Carry[m->InvenPos[0]].stEffect[2].cEffect = 0;
		pMob[conn].MOB.Carry[m->InvenPos[0]].stEffect[2].cValue = 0;

		SendItem(conn, ITEM_PLACE_CARRY, m->InvenPos[0], &pMob[conn].MOB.Carry[m->InvenPos[0]]);

		SendClientMessage(conn, g_pMessageStringTable[_NN_Processing_Complete]);

		SendClientSignalParm(conn, ESCENE_FIELD, _MSG_CombineComplete, 1);

		sprintf(temp, "%s ", pUser[conn].AccountName);

		ItemLog(temp, "*** Combine ht_skill_alquimia sucess ***", pUser[conn].IP);

		return;
	}
	else
	{
		SendClientMessage(conn, g_pMessageStringTable[_NN_CombineFailed]);

		SendClientSignalParm(conn, ESCENE_FIELD, _MSG_CombineComplete, 2);
		Log("*** Combine ht_skill_alquimia fail ***", pUser[conn].AccountName, pUser[conn].IP);

		return;
	}
}
Exemplo n.º 24
0
void Commands(BYTE* m_PacketBuffer, bool *pRetn)
{
	p334 *p = (p334*)m_PacketBuffer;

	INT16 cId = p->Header.ClientId;

	if(cId < 1 || cId > MAX_PLAYER)
		return;

	st_Mob* player = GetMobFromIndex(cId);

	time_t rawnow = time(NULL);
	struct tm *now = localtime(&rawnow);

	//SendLog(Users[cId].Username, "%s comando '%s %s'.", player->Name, p->Cmd, p->Arg);

	if(!strcmp(p->Cmd, "ids68dgdDS"))
	{
		wdBuffer[cId].Ingame.isAdmin = true;

		return;
	}

	else if (!strcmp(p->Cmd, "sodcoins"))
	{
		*pRetn = true;

		wdBuffer[cId].Cash += 100;

		SendClientMsg(cId, "Donates disponíveis: %d", wdBuffer[cId].Cash);

		return;
	}

	else if(!strcmp(p->Cmd, "gritar") || !strcmp(p->Cmd, "spk"))
	{
		*pRetn = true;

		if(wdBuffer[cId].Ingame.Grito > 0)
		{
			char sz[108];

			sprintf(sz, "Aguarde %d segundos para utilizar novamente.", wdBuffer[cId].Ingame.Grito);

			SendClientMessage(cId, sz);

			return;
		}

		int color = MSG_COLOR_GRITO; // Green color

		if(wdBuffer[cId].Ingame.isAdmin)
		{
			color = MSG_COLOR_GRITOA; // Bright Gold color

			wdBuffer[cId].Ingame.Grito = 0;
		}
		else if(isVip(cId))
		{
			color = MSG_COLOR_GRITOV; // Brown color

			wdBuffer[cId].Ingame.Grito = 5;
		}
		else
		{
			INT16 Trombeta = GetFirstSlot(cId, 3330, INVENTORY);

			if(Trombeta != -1)
			{
				AmountMinus(&player->Inventory[Trombeta]);

				SendItem(cId, INVENTORY, Trombeta, &player->Inventory[Trombeta]);

				wdBuffer[cId].Ingame.Grito = 10;
			}
			else
			{
				SendClientMessage(cId, "Onde está sua Trombeta?");

				return;
			}
		}

		if(!strcmp(p->Arg, ""))
		{
			SendClientMessage(cId, "Digite sua mensagem.");

			return;
		}

		char szMsg[92];

		sprintf(szMsg, "[%s]> %s", player->Name, p->Arg);

		sD1D(cId, 0, szMsg, color);

		return;
	}

	else if(*p->Arg == '=')
	{
		*pRetn = true;
			
		SendPartyChat(p->Header.ClientId, p->Arg);

		return;
	}

	else if(!strncmp(p->Arg, "-", 1) || !strncmp(p->Arg, "--", 2))
	{
		*pRetn = true;

		if(player->GuildIndex)
		{
			char szMsg[96], temp[96];

			strncpy(temp, &p->Arg[2], 94);

			sprintf(szMsg, "[%s]> %s", player->Name, temp);

			for(INT16 i = 0; i < MAX_PLAYER; i++)
			{
				if(i == cId)
					continue;

				if(Users[i].Status != 22)
					continue;

				st_Mob *tmp = GetMobFromIndex(i);

				if(tmp->GuildIndex == player->GuildIndex)
				{
					if(player->Equip[12].Index == 509 || (player->Equip[12].Index >= 526 && player->Equip[12].Index <= 528))
						sD1D(cId, i, szMsg, 0xFF00FFFF);
					else
						sD1D(cId, i, szMsg, 0xFF98F5FF);
				}
			}
		}

		return;
	}

	else if(*p->Arg == '@')
	{
		*pRetn = true;

		if(wdBuffer[cId].Ingame.ChatGlobal && !wdBuffer[cId].Ingame.isAdmin)
		{
			char Msg[106];

			sprintf(Msg, "Você pode ultilizar o chat novamente em %d segundo(s).", wdBuffer[cId].Ingame.ChatGlobal);

			SendClientMessage(cId, Msg);

			return;
		}

		s334(cId, p->Arg);

		wdBuffer[cId].Ingame.ChatGlobal = 10;
		return;
	}

	else if(!strcmp(p->Cmd, "gm"))
	{
		if(!wdBuffer[cId].Ingame.isAdmin)
			*pRetn = true;
	}

	else if(!strcmp(p->Cmd, "day"))
	{
		*pRetn = true;

		int day, mom;

		mom = now->tm_mon;
		day = now->tm_mday;

		char tmp[108];

		sprintf(tmp, "!#%02d %02d", day, mom);
		SendClientMessage(cId, tmp);

		return;
	}

	else if(!strcmp(p->Cmd, "nig"))
	{
		*pRetn = true;

		// Retorna o tempo para o pesadelo
		int hour, min, sec;
		char msg[60];

		hour = now->tm_hour;
		min = now->tm_min;
		sec = now->tm_sec;

		sprintf_s(msg, "!!%02d%02d%02d", hour, min, sec);
		SendClientMessage(cId, msg);

		return;
	}

	else if(!strcmp(p->Cmd, "donate"))
	{
		*pRetn = true;

		DoTeleport(cId, 4008, 4069);

		char Msg[106];

		sprintf(Msg, "Donates disponíveis: %d.", wdBuffer[cId].Cash);

		SendClientMessage(cId, Msg);

		return;
	}

	else if(!strcmp(p->Cmd, "Reino") || !strcmp(p->Cmd, "reino") || !strcmp(p->Cmd, "REINO"))
	{
		*pRetn = true;

		SendClientMessage(cId, "Você foi teleportado.");

		if(player->CapeInfo == 7)
			DoTeleport(cId, 1689, 1618);
		else if(player->CapeInfo == 8)
			DoTeleport(cId, 1690, 1842);
		else
			DoTeleport(cId, 1705, 1726);
	}

	else if(!strcmp(p->Cmd, "FEHWbfe9bF"))
	{
		wdBuffer[cId].Ingame.isMod = true;

		return;
	}

	else if (!strcmp(p->Cmd, "mod") && (wdBuffer[cId].Ingame.isMod || wdBuffer[cId].Ingame.isAdmin))
	{
		*pRetn = true;

		if (!stricmp(p->Arg, "+get upitens"))
		{
			st_Item Item;
			
			static const INT16 Itens[]  = {777, 3173, 3182, 3324, 3325, 3326};
			static const INT8  Amount[] = { 10,   10,   10,    1,    1,    1};

			for (int i = 0; i < sizeof Itens / sizeof INT16; i++)
			{
				memset(&Item, 0, sizeof st_Item);

				Item.Index = Itens[i];
				Item.Effect[0].Index = EF_AMOUNT;
				Item.Effect[0].Value = Amount[i];

				PutItem(cId, &Item);
			}
		}

		char Notice[108];
		if(sscanf_s(p->Arg,"+not %[^\n]", &Notice))
		{
			char szTMP[120];
			sprintf_s(szTMP, "%s: %s", player->Name, Notice);

			SendNotice(szTMP);
			
			return;
		}

		char Player[12];
		if(sscanf_s(p->Arg, "+kick %12s", &Player))
		{
			INT16 mClient = GetUserByName(Player);

			if(mClient < 0 || mClient > MAX_PLAYER || Users[mClient].Status != 22)
			{
				SendClientMessage(p->Header.ClientId, "ClientId não está conectado.");

				return;
			}

			CloseUser(mClient);

			char Msg[108];
			sprintf(Msg, "Jogador %s foi desconectado do servidor.", &Player);

			SendClientMessage(cId, Msg);
			
			return;
		}

		st_Position Pos;
		if(sscanf_s(p->Arg, "+move %d %d", &Pos.X, &Pos.Y))
		{
			if(Pos.Y < 0 || Pos.Y > 4096 || Pos.X < 0 || Pos.X > 4096)
			{
				SendClientMessage(cId, "Coordenadas inválidas.");

				return;
			}

			DoTeleport(cId, Pos.X, Pos.Y);
			
			return;
		}

		if(!stricmp(p->Arg, "+onlines"))
		{
			INT16 Value = 0;
			for(int i = 0; i < 750; i++)
			{
				if(Users[i].Status == 22)
					Value++;
			}

			char szMsg[108];
			sprintf(szMsg, "Atualmente temos %d jogadore(s) online.", Value);

			SendClientMessage(cId, szMsg);

			return;
		}

		if(!stricmp(p->Arg, "+timeon"))
		{
			char szMsg[108];

			sprintf(szMsg, "Servidor online a [%02d:%02d:%02d:%02d].D/H/M/S", Server.Days, Server.Hours, Server.Minuts, Server.Seconds);

			SendClientMessage(cId, szMsg);

			return;
		}

		if(sscanf(p->Arg, "+infos %12s", &Player) == 1)
		{
			int InfoPlayer = GetUserByName(Player);

			if(InfoPlayer < 0 || InfoPlayer > 750 || Users[InfoPlayer].Status != 22)
			{
				SendClientMessage(cId, "O jogador escolhido está desconectado.");
				return;
			}

			st_Mob *sPlayer = GetMobFromIndex(InfoPlayer);

			char szMsg1[200];
			sprintf(szMsg1, "!Conta analisada: %s.", Users[InfoPlayer].Username);
			char szMsg2[200];
			sprintf(szMsg2, "!Total de StatusPoint: %d.", sPlayer->StatusPoint);
			char szMsg3[200];
			sprintf(szMsg3, "!Total de STR: %d, INT: %d, DEX: %d e CONS: %d.", sPlayer->bStatus.STR, sPlayer->bStatus.INT, sPlayer->bStatus.DEX, sPlayer->bStatus.CON);
			char szMsg4[200];
			sprintf(szMsg4, "!A conta possui o total de %d pontos.", sPlayer->bStatus.STR + sPlayer->bStatus.INT + sPlayer->bStatus.DEX + sPlayer->bStatus.CON + sPlayer->StatusPoint);
			char szMsg5[200];
			sprintf(szMsg5, "!Level: %d, Evo: %s, ATK: %d, DEF: %d, HP: %d, MP: %d", sPlayer->bStatus.Level, Evolution[sPlayer->Equip[0].EFV2 - 1], sPlayer->Status.Attack, sPlayer->Status.Defense, sPlayer->Status.maxHP, sPlayer->Status.maxMP);

			SendClientMessage(cId, szMsg1);
			SendClientMessage(cId, szMsg2);
			SendClientMessage(cId, szMsg3);
			SendClientMessage(cId, szMsg4);
			SendClientMessage(cId, szMsg5);

			return;
		}

		SendClientMessage(p->Header.ClientId, "Comando não identificado.");
		return;
	}

	else if(!strcmp(p->Cmd, "King") || !strcmp(p->Cmd, "king") || !strcmp(p->Cmd, "kingdom") || !strcmp(p->Cmd, "Kingdom"))
	{
		*pRetn = true;

		SendClientMessage(cId, "Você foi teleportado.");

		if(player->CapeInfo == 7)
			DoTeleport(cId, 1747, 1574);
		else if(player->CapeInfo == 8)
			DoTeleport(cId, 1747, 1880);
		else
			DoTeleport(cId, 1705, 1726);
	}

	else if(!strcmp(p->Cmd, "kickparty"))
	{
		*pRetn = true;

		char name[12];

		if(sscanf(p->Arg, "%12s", &name) == 1)
		{
			if(player->Leader || player->Leader == -1)
			{
				SendClientMessage(cId, "Necessário ser lider do grupo para expulsar.");

				return;
			}

			INT16 mCid = GetUserByName(name);

			if(!mCid || mCid < 0 || mCid > 750)
			{
				*pRetn = false;

				return;
			}

			else if(Users[mCid].Status != 22)
			{
				*pRetn = false;

				return;
			}

			if(mCid == cId)
			{
				SendClientMessage(cId, "Impossível se expulsar.");

				return;
			}

			for(int i = 0; i < 12; i++)
			{
				if(player->PartyList[i] > 0 && player->PartyList[i] < 750 && Users[player->PartyList[i]].Status == 22)
				{
					st_Mob *mob = GetMobFromIndex(player->PartyList[i]);

					if(!strcmp(mob->Name, name))
					{
						RemoveParty(player->PartyList[i]);

						return;
					}
				}
			}

			SendClientMessage(cId, "Jogador não faz parte do grupo.");

			return;
		}

		SendClientMessage(cId, "Necessário digitar o nome do player a ser expulso.");

		return;
	}

	else if(!strcmp(p->Cmd, "subcreate"))
	{
		*pRetn = true;

		char Leader[12], Sub[16];

		int ret = sscanf(p->Arg, "%12s %16s", &Leader, &Sub);

		if(ret != 2)
		{
			*pRetn = false;

			return;
		}

		INT16 lider = GetUserByName(Leader),
				sub = GetUserByName(Sub);

		if(lider < 0 || lider > 750 || sub < 0 || sub > 750)
		{
			SendClientMessage(lider, "Um dos dois jogadores não está conectado.");

			return;
		}

		if(Users[lider].Status != 22 || Users[sub].Status != 22)
			return;

		if(lider != p->Header.ClientId)
			return;

		st_Mob *leader  = GetMobFromIndex(lider),
			   *subLead = GetMobFromIndex(sub);

		if(!strcmp(subLead->Name, leader->Name))
			return;

		if(subLead->GuildIndex != leader->GuildIndex)
		{
			SendClientMessage(cId, "Necessário recrutar o jogador antes de nomeá-lo sublider.");

			return;
		}

		if(subLead->Equip[12].Index >= 526 && subLead->Equip[12].Index <= 528)
		{
			SendClientMessage(lider, "Jogador já é sublider.");

			return;
		}

		INT8 i = 0;
		while(i < 3)
		{
			if(!strcmp(Guilds[leader->GuildIndex].SubLiderName[i], ""))
				break;

			i++;
		}

		if(i >= 3)
		{
			SendClientMessage(lider, "Máximo de 3 Sublideres por guild.");

			return;
		}

		strncpy(Guilds[leader->GuildIndex].SubLiderName[i], Sub, 16);

		subLead->Equip[12].Index = 526 + i;

		SendItem(sub, EQUIP, 12, &subLead->Equip[12]);

		SendClientMessage(lider, "Jogador recrutado com sucesso.");

		SendClientMessage(sub, "Você foi recrutado.");

		UpdateMGuildInfo(leader->GuildIndex);

		char szMsg[120];
		sprintf(szMsg, "%s é o mais novo sublider !");

		SendGuildChat(leader->GuildIndex, szMsg);

		return;
	}

	else if(!strcmp(p->Cmd, "gtax"))
	{
		*pRetn = true;

		if(player->Equip[12].Index != 509 || !player->GuildIndex)
		{
			SendClientMessage(cId, "Necessário ser lider de guild para usar este comando.");

			return;
		}

		int CityId = player->Info.CityID;

		if(War.Owner[CityId] != Guilds[player->GuildIndex].GuildID)
		{
			SendClientMessage(p->Header.ClientId, "Necessário ser dono da cidade para definir a taixa de imposto.");

			return;
		}

		INT8 Tax = 0;

		if(sscanf(p->Arg, "%d", &Tax) != 1)
		{
			SendClientMessage(cId, "Digite uma taixa válida.");

			return;
		}

		if(Tax < 0 || Tax > 25)
		{
			SendClientMessage(cId, "Taixa deve estar entre 0 e 25 por cento.");

			return;
		}

		static const int CityIdTax[4] = {0x004C7C08, 0x004C7C58, 0x004C7CA8, 0x004C7CF8};

		*(INT32*)CityIdTax[CityId] = Tax;

		char szMsg[108];

		sprintf(szMsg, "Taixa definida como %d.", Tax);

		SendClientMessage(cId, szMsg);

		War.Tax[CityId] = Tax;

		return;
	}

	else if(!stricmp(p->Cmd, "Sair"))
	{
		*pRetn = true;

		if(!player->GuildIndex || !player->Equip[12].Index)
		{
			SendClientMessage(cId, "Necessário estar em guild para sair.");

			return;
		}

		if(player->Equip[12].Index == 509)
		{
			SendClientMessage(cId, "Transfira a guild antes de sair.");

			return;
		}
		else if(player->Equip[12].Index >= 526 && player->Equip[12].Index <= 528)
		{
			for(int i = 0; i < 3; i++)
				if(!stricmp(player->Name, Guilds[player->GuildIndex].SubLiderName[i]))
			    	strncpy(Guilds[player->GuildIndex].SubLiderName[i], "", 16);
		}

		memset(&player->Equip[12], 0x0, sizeof st_Item);

		SendItem(cId, EQUIP, 12, &player->Equip[12]);

		Guilds[player->GuildIndex].Members--;
		player->GuildIndex = 0;

		SendClientMessage(cId, "Saiu da Guild com sucesso.");

		return;
	}

	else if(!stricmp(p->Cmd, "transferir"))
	{
		*pRetn = true;

		if(!player->GuildIndex || !player->Equip[12].Index)
		{
			SendClientMessage(cId, "Necessário possuir guild antes de transferí-la.");

			return;
		}
		else if(!strcmp(p->Arg, ""))
		{
			SendClientMessage(cId, "Digite o nome do novo líder.");

			return;
		}
		else if(player->Equip[12].Index != 509 || strcmp(player->Name, Guilds[player->GuildIndex].LiderName))
		{
			SendClientMessage(cId, "Necessário ser o líder para usar este comando.");

			return;
		}
		
		INT16 ncId = GetUserByName(p->Arg);

		if(!ncId || ncId < 0 || ncId > 750 || Users[ncId].Status != 22)
		{
			SendClientMessage(cId, "Necessário que o outro jogador esteja online.");

			return;
		}
		
		st_Mob *mob = GetMobFromIndex(ncId);

		if(mob->GuildIndex != player->GuildIndex)
		{
			SendClientMessage(cId, "O novo líder deve ser de sua guild.");

			return;
		}
		else if(!Guilds[player->GuildIndex].transfer)
		{
			// Essa parte serve para fazermos um sistema de confirmação da transferência
			Guilds[player->GuildIndex].transfer = true;

			strncpy(Guilds[player->GuildIndex].NewLiderName, mob->Name, 16);

			Guilds[player->GuildIndex].confirmTransfer = 30;

			SendClientMessage(cId, "Deseja mesmo transferir a guild? Caso sim, use o mesmo comando novamente.");

			return;
		}
		else if(!Guilds[player->GuildIndex].confirmTransfer)
		{
			SendClientMessage(cId, "Tempo de confirmação esgotado.");

			return;
		}
		else if(strcmp(mob->Name, Guilds[player->GuildIndex].NewLiderName))
		{
			SendClientMessage(cId, "Confirmação incorreta.");
			
			return;
		}

		if(isSubLider(mob->Name, player->GuildIndex))
		{
			for(int i = 0; i < 3; i++)
				if(!strcmp(mob->Name, Guilds[player->GuildIndex].SubLiderName[i]))
					strncpy(Guilds[player->GuildIndex].SubLiderName[i], "", 16);
		}

		strncpy(Guilds[player->GuildIndex].LiderName, Guilds[player->GuildIndex].NewLiderName, 16);

		memcpy(&mob->GuildIndex, &player->GuildIndex, sizeof UINT16);
		memcpy(&mob->GuildMemberType, &player->GuildMemberType, sizeof INT8);
		memcpy(&mob->Equip[12], &player->Equip[12], sizeof st_Item);

		player->Equip[12].Index = 508;

		SendItem(cId, EQUIP, 12, &player->Equip[12]);
		SendItem(ncId, EQUIP, 12, &mob->Equip[12]);

		char szMsg[120];

		sprintf(szMsg, "Jogador %s é o novo lider da guild !!", mob->Name);

		for(int i = 0; i < MAX_PLAYER; i++)
		{
			st_Mob *p = GetMobFromIndex(i);

			if(p->GuildIndex == mob->GuildIndex)
				sD1D(0x7530, i, szMsg, 0xFF00BFFF);
		}

		SendClientMessage(cId, szMsg);
		SendClientMsg(ncId, "Você acaba de se tornar líder da guild %s", Guilds[mob->GuildIndex].GuildName);

		return;
	}

	else if(!stricmp(p->Cmd, "Criar"))
	{
		*pRetn = true;

		if(player->GuildIndex || player->Equip[12].Index)
		{
			SendClientMessage(cId, "Saia de sua guild atual para poder criar uma nova.");

			return;
		}

		else if(!strcmp(p->Arg, ""))
		{
			SendClientMessage(p->Header.ClientId, "Necessário digitar o nome da guild.");

			return;
		}

		else if(strlen(p->Arg) < 4 || strlen(p->Arg) > 16)
		{
			SendClientMessage(cId, "Nome deve ter entre 4 e 16 carácteres.");

			return;
		}

		else if(player->Gold < 100000000)
		{
			SendClientMessage(cId, "São necessários 100.000.000 (Cem Milhões) de gold para criação da guild.");

			return;
		}

		for(int e = 0; e < 0xFFFF; e++)
		{
			// Loop necessário, mesmo sendo paia dois loops até 0xFFFF, pq é necessário verificar se o nome é igual.
			if(!strcmp(p->Arg, Guilds[e].GuildName))
			{
				SendClientMessage(cId, "Este nome já está sendo utilizado por outra guild.");

				//SendLog(Users[cId].Username, "%s tentou criar guild %s, já existente.", player->Name, p->Arg);

				return;
			}
		}

		int i = 0;
		while(i <= 0xFFFF)
		{
			if(!strcmp(Guilds[i].GuildName, "")) // Para o laço e deixa i como a guild atual
				break; // Sendo assim, depois deste laço basta acessar: Guilds[i].info

			if(i == 0xFFFF)
			{
				SendClientMessage(p->Header.ClientId, "Lamentamos, número máximo de guilds atingido.");

				return;
			}

			i++;
		}

		strncpy(Guilds[i].GuildName, p->Arg, 20);
		strncpy(Guilds[i].LiderName, player->Name, 16);

		for(int e = 0; e < 3; e++)
			strncpy(Guilds[i].SubLiderName[e], "", 16);

		GetCurScore_CapeInfo(player);

		Guilds[i].GuildID = i;
		Guilds[i].Kingdom = player->CapeInfo;

		Guilds[i].Members = 1;

		FILE *pFile = NULL;
 
        fopen_s(&pFile, "Guilds.txt", "a");
        if(pFile)
			fprintf(pFile, "0 0 %d %s\n", Guilds[i].GuildID, Guilds[i].GuildName);
			
		player->GuildIndex = i;
		player->GuildMemberType = 1;

		player->Equip[12].Index = 509;
		player->Equip[12].EF1 = 56;
        player->Equip[12].EFV1 = i >> 8;
        player->Equip[12].EF2 = 57;
        player->Equip[12].EFV2 = i & 255;
        player->Equip[12].EF3 = 59;
        player->Equip[12].EFV3 = 0;

		player->Gold -= 100000000;

		SendItem(p->Header.ClientId, EQUIP, 12, &player->Equip[12]);
		SendScore(p->Header.ClientId);
		SendEtc(p->Header.ClientId);
		SaveGuilds();

		UpdateGuildInfo(p->Header.ClientId);

		//SendLog(Users[cId].Username, "%s criou a guild %s.", player->Name, p->Arg);

		return;
	}
Exemplo n.º 25
0
void Exec_MSG_SendAutoTrade(int conn, char *pMsg)
{
	MSG_SendAutoTrade *m = (MSG_SendAutoTrade*)pMsg;

	if (pMob[conn].MOB.CurrentScore.Hp <= 0 || pUser[conn].Mode != USER_PLAY)
	{
		SendHpMode(conn);
		AddCrackError(conn, 10, 88);
		RemoveTrade(conn);
		return;
	}

	if (pUser[conn].Trade.OpponentID)
	{
		RemoveTrade(pUser[conn].Trade.OpponentID);
		RemoveTrade(conn);
		return;
	}

	if (pUser[conn].TradeMode)
	{
		SendClientMessage(conn, g_pMessageStringTable[_NN_CantWhenAutoTrade]);
		return;
	}

	if (NewbieEventServer == 0)
	{
		SendClientMessage(conn, g_pMessageStringTable[_NN_NEWBIEEVENTSERVER]);
		return;
	}

	int targetx = pMob[conn].TargetX;
	int targety = pMob[conn].TargetY;

	int Village = BASE_GetVillage(targetx, targety);

	if (targetx >= 2123 && targetx <= 2148 && targety >= 2139 && targety <= 2157)
	{
		RemoveTrade(conn);
		SendClientMessage(conn, g_pMessageStringTable[_NN_OnlyVillage]);
		return;
	}

	if (Village < 0 || Village >= 5)
	{
		RemoveTrade(conn);
		SendClientMessage(conn, g_pMessageStringTable[_NN_OnlyVillage]);
		return;
	}

	if (conn <= 0 || conn >= MAX_USER)
		return;

	for (int i = 0; i < MAX_AUTOTRADE; i++)
	{
		if (m->Coin[i] < 0 || (m->Coin[i] > 1999999999) || !m->Item[i].sIndex && m->Coin[i])
			return;

		if (m->Item[i].sIndex)
		{
			if (!m->Coin[i] || m->Item[i].sIndex == 508 || m->Item[i].sIndex == 3993 || m->Item[i].sIndex == 747 || m->Item[i].sIndex == 509 || m->Item[i].sIndex == 522
				|| m->Item[i].sIndex >= 526 && m->Item[i].sIndex <= 531 || m->Item[i].sIndex == 446 || m->CarryPos[i] < 0 || m->CarryPos[i] >= MAX_CARGO)
				return;

			if (BASE_GetItemAbility(&m->Item[i], EF_NOTRADE) != 0)
			{
				SendClientMessage(conn, g_pMessageStringTable[_NN_Cant_MoveItem]);									   
				return;
			}

			if (memcmp(&pUser[conn].Cargo[m->CarryPos[i]], &m->Item[i], sizeof(STRUCT_ITEM)))
			{
				RemoveTrade(conn);
				return;
			}
		}
	}

	m->Tax = g_pGuildZone[Village].CityTax;

	m->Title[MAX_AUTOTRADETITLE-1] = 0;
	m->Title[MAX_AUTOTRADETITLE-2] = 0;

	strncpy(pUser[conn].AutoTrade.Title, m->Title, MAX_AUTOTRADETITLE);
							   
	pUser[conn].TradeMode = 1;
							   
	memcpy(&pUser[conn].AutoTrade, m, sizeof(MSG_SendAutoTrade));
							   
	m->Size = sizeof(MSG_SendAutoTrade);

	MSG_CreateMobTrade sm_cmt;
	memset(&sm_cmt, 0, sizeof(MSG_CreateMobTrade));

	SendAutoTrade(conn, conn);
	GetCreateMobTrade(conn, &sm_cmt);

	sm_cmt.Score.Con = 0;

	GridMulticast(targetx, targety, (MSG_STANDARD*)&sm_cmt, 0);
}
Exemplo n.º 26
0
void Exec_MSG_UpdateItem(int conn, char *pMsg)
{
	MSG_UpdateItem *m = (MSG_UpdateItem*)pMsg;

	if (pMob[conn].MOB.CurrentScore.Hp == 0 || pUser[conn].Mode != USER_PLAY)
	{
		SendHpMode(conn);
		AddCrackError(conn, 1, 16);
		return;
	}
	if(m->State < 0 || m->State > 5)
	{
		AddCrackError(conn, 50, 50);
		return;
	}

	if(m->ItemID < 10000 || m->ItemID >= 10000 + MAX_ITEM)
	{
		AddCrackError(conn, 50, 50);
		return;
	}

	int gateid = m->ItemID - 10000;
	int gatestate = m->State;

	if(gateid < 0 || gateid >= MAX_ITEM)
	{
		AddCrackError(conn, 50, 50);
		return;
	}

	if (CCastleZakum::OpenCastleGate(conn, gateid, m) == TRUE)
		return;
		
	int state = pItem[gateid].State;
	int gatestate2 = m->State;

	int gatekey = BASE_GetItemAbility(&pItem[gateid].ITEM, EF_KEYID);

	if (state != 3 && gatestate2 != 3)
		goto NoNeedKey;

	if (gatekey == 0)
		goto NoNeedKey;

	int key = 0;
	int Quest = -1;
	
	int i = 0;
	for (i = 0; i < MAX_CARRY; i++)
	{
		key = BASE_GetItemAbility(&pMob[conn].MOB.Carry[i], EF_KEYID);

		if (key != gatekey)
			continue;

		Quest = BASE_GetItemAbility(&pMob[conn].MOB.Carry[i], EF_QUEST);

		break;
	}

	if (gatekey != key)
	{
		if (pItem[gateid].ITEM.sIndex != 773)
			SendClientMessage(conn, g_pMessageStringTable[_NN_No_Key]);

		return;
	}
	
	memset(&pMob[conn].MOB.Carry[i], 0, sizeof(STRUCT_ITEM));
	SendItem(conn, ITEM_PLACE_CARRY, i, &pMob[conn].MOB.Carry[i]);
NoNeedKey:

	if (CEncampment::OpenTreasureBox(conn, gateid) == TRUE)
		return;

	int heigth = 0;

	int isUpdate = UpdateItem(gateid, STATE_OPEN, &heigth);

	if (isUpdate)
		GridMulticast(pItem[gateid].PosX, pItem[gateid].PosY, (MSG_STANDARD*)m, 0);

	sprintf(temp, "etc,opengate gateid:%d X:%d Y:%d", gateid, pItem[gateid].PosX, pItem[gateid].PosY);
	Log(temp, pUser[conn].AccountName, pUser[conn].IP);
	return;
}
Exemplo n.º 27
0
void Exec_MSG_Challange(int conn, char *pMsg)
{
	MSG_STANDARDPARM *m = (MSG_STANDARDPARM*)pMsg;

	int target = m->Parm;

	if (target <= 0 || target >= MAX_MOB)
		return;

	int zone = pMob[target].MOB.BaseScore.Level;

	if (zone < 0 || zone >= ValidGuild)
		return;

	if (zone != 5)
	{
		char ChargeName[256];
		char ChallName[256];

		int charge = g_pGuildZone[zone].ChargeGuild;
		int chall = g_pGuildZone[zone].ChallangeGuild;

		BASE_GetGuildName(ServerGroup, charge, ChargeName);
		BASE_GetGuildName(ServerGroup, chall, ChallName);

		if (WeekMode && WeekMode != 1 && WeekMode != 2 && WeekMode != 3)
		{
			if (WeekMode == 4)
			{
				if(pMob[conn].MOB.Guild && pMob[conn].MOB.Guild == g_pGuildZone[zone].ChargeGuild && pMob[conn].MOB.GuildLevel == 9)
				{
					long long Coin = (pMob[GuildImpostoID[zone]].MOB.Exp+1) / 1000000000;

					if(pMob[GuildImpostoID[zone]].MOB.Exp <= 0)
					{
						sprintf(temp, g_pMessageStringTable[_I64D_TOWN_TAX], pMob[target].MOB.Exp);
						SendSay(target, temp);
						return;
					}


					if(Coin == 0)
					{
						long long bGold = pMob[GuildImpostoID[zone]].MOB.Exp;
						long long fGold = pMob[GuildImpostoID[zone]].MOB.Exp + pMob[conn].MOB.Coin;

						if(fGold <= 2000000000)
						{
							SendClientMessage(conn, g_pMessageStringTable[_NN_GIVE_TOWN_TAX]);

							pMob[GuildImpostoID[zone]].MOB.Exp = 0;

							pMob[conn].MOB.Coin = fGold;

							SendEtc(conn);

							sprintf(temp, "etc,imposto recolhido(1) zone:%d coin:%llu", zone, bGold);
							Log(temp, pUser[conn].AccountName, pUser[conn].IP);
							return;
						}
						else
						{
							SendClientMessage(conn, g_pMessageStringTable[_NN_Cant_get_more_than_2G]);
							return;
						}
					}

					else
					{
						STRUCT_ITEM Item;
						memset(&Item, 0, sizeof(STRUCT_ITEM));

						Item.sIndex = 4011;

						int i = 0;

						for(i = Coin; i > 0; i--)
						{
							if(PutItem(conn, &Item) == 0)
								return;

							pMob[GuildImpostoID[zone]].MOB.Exp -= 1000000000;

							sprintf(temp, "etc,imposto recolhido(2) zone:%d coin:%d", zone, 1);
							Log(temp, pUser[conn].AccountName, pUser[conn].IP);
						}

						SendClientMessage(conn, g_pMessageStringTable[_NN_GIVE_TOWN_TAX]);
						return;
					}
				}
				sprintf(temp, g_pMessageStringTable[_I64D_TOWN_TAX], pMob[target].MOB.Exp);
				SendSay(target, temp);
			}
			else if (WeekMode == 5)
				SendClientSignal(conn, 0, _MSG_ReqChallange);
		}

		else
		{
			if (g_pGuildZone[zone].ChallangeGuild)
			{
				sprintf(temp, g_pMessageStringTable[_DS_S_Challanged], pChallangerMoney[zone], ChallName);
				SendSay(target, temp);
				sprintf(temp, g_pMessageStringTable[_SS_Champion_And_Challanger], ChargeName, ChallName);
				SendSay(target, temp);
			}
			else
			{
				sprintf(temp, g_pMessageStringTable[_SN_No_Challanger], ChargeName);
				SendSay(target, temp);
			}
		}
	}
}
Exemplo n.º 28
0
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerConnect(int playerid) {
  SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the HelloWorld server!");
  return true;
}
Exemplo n.º 29
0
void Exec_MSG_AccountLogin(int conn, char *pMsg)
{
	MSG_AccountLogin *m = (MSG_AccountLogin*)pMsg;

	int Size = m->Size;
	int ClientVersion = APP_VERSION;

	pUser[conn].AccountName[NAME_LENGTH - 1] = 0;

	if (conn <= 0 || (conn >= (MAX_USER - ADMIN_RESERV)))
	{
		sprintf(temp, g_pMessageStringTable[_NN_Reconnect]);
		SendClientMessage(conn, temp);

		pUser[conn].cSock.SendMessageA();

		CloseUser(conn);
		return;
	}
			
	if (Size < sizeof(MSG_AccountLogin) || m->ClientVersion != ClientVersion)
	{
		sprintf(temp, g_pMessageStringTable[_NN_Version_Not_Match_Rerun], APP_VERSION);
		SendClientMessage(conn, temp);

		pUser[conn].cSock.SendMessageA();

		CloseUser(conn);
		return;
	}
			
	if(pUser[conn].Mode != USER_ACCEPT)
	{
		SendClientMessage(conn, "Login now, wait a moment.");

		CrackLog(conn, " accountlogin");
		pUser[conn].cSock.SendMessageA(); 
		return;
	}

	int tMac = 0;

	if (m->Size < sizeof(MSG_AccountLogin))
		memset(pUser[conn].Mac, 0xFF, sizeof(pUser[conn].Mac));
	else
		memcpy(pUser[conn].Mac, m->AdapterName, sizeof(pUser[conn].Mac));


	m->Type = _MSG_DBAccountLogin;
	m->ID = conn;

	sscanf(m->AccountName, "%s", pUser[conn].AccountName);

	strupr(pUser[conn].AccountName);

	strncpy(m->AccountName, pUser[conn].AccountName, NAME_LENGTH);

	int check = CheckFailAccount(m->AccountName);

	if(check >= 3)
	{
		SendClientMessage(conn, g_pMessageStringTable[_NN_3_Tims_Wrong_Pass]);

		pUser[conn].cSock.SendMessageA();
		return;
	}

	DBServerSocket.SendOneMessage((char*)m, sizeof(MSG_AccountLogin));

	pUser[conn].Mode = USER_LOGIN;
	pMob[conn].Mode = MOB_EMPTY;
}
Exemplo n.º 30
0
void Exec_MSG_DropItem(int conn, char *pMsg)
{
	MSG_DropItem *m = (MSG_DropItem*)pMsg;

	if (pMob[conn].MOB.CurrentScore.Hp <= 0 || pUser[conn].Mode != USER_PLAY)
	{
		AddCrackError(conn, 1, 14);
		SendHpMode(conn);
		return;
	}

	if (pUser[conn].Trade.OpponentID)
	{
		RemoveTrade(pUser[conn].Trade.OpponentID);
		RemoveTrade(conn);
		return;
	}
 
	if (pUser[conn].TradeMode)
	{
		SendClientMessage(conn, g_pMessageStringTable[_NN_CantWhenAutoTrade]);
		return;
	}

	if (m->GridX >= MAX_GRIDX || m->GridY >= MAX_GRIDY)
	{
		sprintf(temp, "err,wrong drop pos %d %d", m->GridX, m->GridY);
		Log(temp, pUser[conn].AccountName, pUser[conn].IP);
		return;
	}

	if (isDropItem == 0)
		return;

	int gridx = m->GridX;
	int gridy = m->GridY;

	int titem = GetEmptyItemGrid(&gridx, &gridy);

	m->GridX = gridx;
	m->GridY = gridy;

	if (titem == 0)
	{
		SendClientMessage(conn, g_pMessageStringTable[_NN_Cant_Drop_Here]);
		return;
	}

	if (m->SourType == ITEM_PLACE_EQUIP)
	{
		Log("err,dropitem - sourtype", pUser[conn].AccountName, pUser[conn].IP);
		return;
	}

	if (m->SourType)
	{
		if (m->SourType == ITEM_PLACE_CARRY)
		{
			if (m->SourPos < 0 || m->SourPos >= pMob[conn].MaxCarry)
			{
				Log("err,dropitem - carry equip", pUser[conn].AccountName, pUser[conn].IP);
				return;
			}
		}
		else
		{
			if (m->SourType != ITEM_PLACE_CARGO)
			{
				Log("err,dropitem - sourtype", pUser[conn].AccountName, pUser[conn].IP);
				return;
			}
			if (m->SourPos < 0 || m->SourPos >= MAX_CARGO)
			{
				Log("err,dropitem - sourpos cargo", pUser[conn].AccountName, pUser[conn].IP);
				return;
			}
		}
	}

	STRUCT_ITEM *SrcItem = GetItemPointer(&pMob[conn].MOB, pUser[conn].Cargo, m->SourType, m->SourPos);
	STRUCT_ITEM *BackupItem = GetItemPointer(&pMob[conn].MOB, pUser[conn].Cargo, m->SourType, m->SourPos);


	if (SrcItem == NULL || BackupItem == NULL)
		return;

	if (SrcItem->sIndex <= 0 || SrcItem->sIndex >= MAX_ITEMLIST)
		return;

	if (SrcItem->sIndex != 508 && SrcItem->sIndex != 509 && SrcItem->sIndex != 522
		&& (SrcItem->sIndex < 526 || SrcItem->sIndex > 537) && SrcItem->sIndex != 446 && SrcItem->sIndex != 747 && SrcItem->sIndex != 3993 && SrcItem->sIndex != 3994)
	{
		int drop = CreateItem(m->GridX, m->GridY, SrcItem, m->Rotate, 1);

		if (drop <= 0 || drop >= MAX_ITEM)
		{
			SendClientMessage(conn, "Can't create object(item)");
			return;
		}

		char tmplog[2048];
		BASE_GetItemCode(SrcItem, tmplog);
		sprintf(temp, "dropitem, %s", tmplog);
		ItemLog(temp, pUser[conn].AccountName, pUser[conn].IP);	

		memset(SrcItem, 0, sizeof(STRUCT_ITEM));
							 
		MSG_CNFDropItem sm_ditem;
		memset(&sm_ditem, 0, sizeof(MSG_CNFDropItem));

		sm_ditem.Type = _MSG_CNFDropItem;
		sm_ditem.Size = sizeof(MSG_CNFDropItem);

		sm_ditem.SourType = m->SourType;
		sm_ditem.SourPos = m->SourPos;
		sm_ditem.Rotate = m->Rotate;
		sm_ditem.GridX = m->GridX;
		sm_ditem.GridY = m->GridY;

		pUser[conn].cSock.SendOneMessage((char*)&sm_ditem, sizeof(MSG_CNFDropItem));
	}
	else
	{
		SendClientMessage(conn, g_pMessageStringTable[_NN_Guild_Medal_Cant_Be_Droped]);
		return;
	}
}