Beispiel #1
0
void CWarTower::MobKilled(int target, int conn, int PosX, int PosY)
{
	int GenerateID = pMob[target].GenerateIndex;

	if (GenerateID == GTORRE && GTorreState)
	{
		if (pMob[conn].MOB.Guild)
		{
			int Group = ServerGroup;
			int Server = pMob[conn].MOB.Guild / MAX_GUILD;
			int usGuild = pMob[conn].MOB.Guild;

			char guildname[256];

			BASE_GetGuildName(Group, usGuild, guildname);

			sprintf(temp, g_pMessageStringTable[_SS_BASEWORKILLTOWER], pMob[conn].MOB.MobName, guildname);
			SendNotice(temp);

			GTorreGuild = pMob[conn].MOB.Guild;
		}

		ClearArea(2445, 1850, 2546, 1920);

		GenerateMob(GTORRE, 0, 0);
	}
}
Beispiel #2
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);
			}
		}
	}
}
Beispiel #3
0
void CWarTower::GuildProcess(tm *timeinfo)
{
	if (NewbieEventServer == 1 && timeinfo->tm_wday != 0 && timeinfo->tm_wday != 6 && timeinfo->tm_hour == GTorreHour)
	{
		if (GTorreState == 0 && timeinfo->tm_min <= 5)
		{
			sprintf(temp, g_pMessageStringTable[_DN_CHANNELWAR_BEGIN], 5);
			SendNotice(temp);
			GTorreState = 1;
			GTorreGuild = 0;
		}

		if (GTorreState == 1 && timeinfo->tm_min >= 6)
		{
			ClearArea(2445, 1850, 2546, 1920);

			GenerateMob(GTORRE, 0, 0);

			SendNotice(g_pMessageStringTable[_DN_BASEWORSTART]);
			GTorreState = 2;
		}

		//A Guerra acabou a guilda que está defendendo a torre recebe 50 de fama.
		if (GTorreState == 2 && timeinfo->tm_min == 59)
		{
			ClearArea(2445, 1850, 2546, 1920);

			for (int i = MAX_USER; i < MAX_MOB; i++)
			{
				if (pMob[i].GenerateIndex == GTORRE)
				{
					if (pMob[i].MOB.Guild)
					{
						int Group = ServerGroup;
						int Server = pMob[i].MOB.Guild / MAX_GUILD;
						int usGuild = pMob[i].MOB.Guild;

						char guildname[256];

						BASE_GetGuildName(Group, usGuild, guildname);

						MSG_GuildInfo sm;

						sm.Type = _MSG_GuildInfo;
						sm.Size = sizeof(MSG_GuildInfo);
						sm.ID = 0;

						sm.Guild = usGuild;
						GuildInfo[usGuild].Fame += 100;

						sm.GuildInfo = GuildInfo[usGuild];

						DBServerSocket.SendOneMessage((char*)&sm, sizeof(MSG_GuildInfo));

						sprintf(temp, "etc,war_tower1 guild:%d guild_fame:%d", usGuild, GuildInfo[usGuild].Fame);
						Log(temp, "-system", 0);
					}

					DeleteMob(i, 1);
				}
			}

			GTorreState = 0;
			GTorreGuild = 0;
		}
	}
}
Beispiel #4
0
void CReadFiles::WriteGuild()
{
	char dir[256];

	sprintf(dir, GUILD_PATH, ServerGroup, ServerIndex);

	FILE *fp = NULL;

	fp = fopen(dir, "wt");

	if (fp == NULL)
		fp = fopen("Guild.txt", "wt");

	if (fp == NULL)
	{
		Log("err,Writting Guild error - can't open Guild.txt", "-system", 0);

		return;
	}

	fprintf(fp, "%d", GuildCounter);

	for (int i = 0; i < 5; i++)
		fprintf(fp, " %d", g_pGuildZone[i].ChargeGuild);

	fprintf(fp, "\n");

	for (int i = 0; i < 5; i++)
		fprintf(fp, " %d", g_pGuildZone[i].ChallangeGuild);

	fprintf(fp, "\n");

	for (int i = 0; i < 5; i++)
		fprintf(fp, " %d", g_pGuildZone[i].CityTax);

	fprintf(fp, "\n");

	for (int i = 0; i < 5; i++)
		fprintf(fp, " %d", g_pGuildZone[i].Clan);

	fprintf(fp, "\n");

	for (int i = 0; i < 5; i++)
		fprintf(fp, " %d", g_pGuildZone[i].Victory);

	fclose(fp);


	memset(dir, 0, sizeof(dir));
	sprintf(dir, GUILDCHAMP_PATH, ServerGroup, ServerIndex);

	fp = fopen(dir, "wt");

	if (fp == NULL)
	{
		Log("err,Writting Guild error - can't open GuildChamp.txt", "-system", 0);

		return;
	}

	char CityName[5][64] = { "Armia", "Arzan", "Erion", "Noatun", "Nipplehein" };

	for (int i = 0; i < 5; i++)
	{
		char GuildName[128];
		char Guildmark[128];

		BASE_GetGuildName(ServerGroup, g_pGuildZone[i].ChargeGuild, GuildName);
		
		sprintf(Guildmark, "b01%06d.bmp", g_pGuildZone[i].ChargeGuild);

		fprintf(fp, "%s %s %s", CityName[i], GuildName, Guildmark);

		fprintf(fp, "\n");
	}

	fclose(fp);
}
Beispiel #5
0
void SendGuildList(int conn)
{
	int Guild = pMob[conn].MOB.Guild;

	if (Guild <= 0)
		return;

	char str[128];

	memset(str, 0, 128);

	int members = 0;
	int max_size = 70;

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

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

		members++;

		int len = strlen(str);

		if (len >= max_size)
		{
			SendClientMessage(conn, str);

			memset(str, 0, len);
		}

		pMob[i].MOB.MobName[NAME_LENGTH - 1] = 0;
		pMob[i].MOB.MobName[NAME_LENGTH - 2] = 0;

		strcat(str, pMob[i].MOB.MobName);
		strcat(str, " ");
	}

	if (str[0])
		SendClientMessage(conn, str);

	if (members == 0)
		SendClientMessage(conn, g_pMessageStringTable[_NN_No_Guild_Members]);

	int max_guild = 65536;

	if (pMob[conn].MOB.Guild <= 0 || pMob[conn].MOB.Guild >= max_guild)
		return;

	int gwar = g_pGuildWar[Guild];
	char GuildName[256];

	BASE_GetGuildName(ServerGroup, gwar, GuildName);

	int FoundWar = -1;

	if (gwar > 0 && gwar < max_guild)
	{
		if (Guild == g_pGuildWar[gwar])
		{
			sprintf(str, g_pMessageStringTable[_SN_Your_are_at_war], GuildName);
			SendClientMessage(conn, str);

			FoundWar = g_pGuildWar[gwar];
		}
		else
		{
			sprintf(str, g_pMessageStringTable[_SN_War_to_S], GuildName);
			SendClientMessage(conn, str);
		}
	}

	for (int j = 1; j < max_guild; j++)
	{
		if (g_pGuildWar[j] == Guild || g_pGuildWar[j] == 0)
			continue;

		if (j == FoundWar)
			continue;

		BASE_GetGuildName(ServerGroup, j, GuildName);

		sprintf(str, g_pMessageStringTable[_SN_War_from_S], GuildName);
		SendClientMessage(conn, str);
	}

	int ally = g_pGuildAlly[Guild];

	BASE_GetGuildName(ServerGroup, ally, GuildName);

	if (ally > 0 && ally < max_guild)
	{
		sprintf(str, g_pMessageStringTable[_SN_Ally_to_S], GuildName);
		SendClientMessage(conn, str);
	}

	for (int j = 1; j < max_guild; j++)
	{
		if (g_pGuildAlly[j] == Guild || g_pGuildAlly[j] == 0)
			continue;

		BASE_GetGuildName(ServerGroup, j, GuildName);

		sprintf(str, g_pMessageStringTable[_SN_Ally_from_S], GuildName);
		SendClientMessage(conn, str);
	}
}