예제 #1
0
void AlertarFaccionarios(int UserIndex) {
	/* '************************************************************** */
	/* 'Author: ZaMa */
	/* 'Last Modify Date: 17/11/2009 */
	/* 'Alerta a los faccionarios, dandoles una orientacion */
	/* '************************************************************** */
	int LoopC;
	int tempIndex;
	int Map;
	FontTypeNames Font;

	if (esCaos(UserIndex)) {
		Font = FontTypeNames_FONTTYPE_CONSEJOCAOS;
	} else {
		Font = FontTypeNames_FONTTYPE_CONSEJO;
	}

	Map = UserList[UserIndex].Pos.Map;

	if (!MapaValido(Map)) {
		return;
	}

	for (LoopC = (1); LoopC <= (ConnGroups[Map].CountEntrys); LoopC++) {
		tempIndex = ConnGroups[Map].UserEntrys[LoopC];

		if (UserList[tempIndex].ConnIDValida) {
			if (tempIndex != UserIndex) {
				/* ' Solo se envia a los de la misma faccion */
				if (SameFaccion(UserIndex, tempIndex)) {
					EnviarDatosASlot(tempIndex,
							PrepareMessageConsoleMsg(
									"Escuchas el llamado de un companero que proviene del "
											+ GetDireccion(UserIndex, tempIndex), Font));
				}
			}
		}
	}

}
예제 #2
0
void MuereNpc(int NpcIndex, int UserIndex) {
	/* '******************************************************** */
	/* 'Author: Unknown */
	/* 'Llamado cuando la vida de un NPC llega a cero. */
	/* 'Last Modify Date: 13/07/2010 */
	/* '22/06/06: (Nacho) Chequeamos si es pretoriano */
	/* '24/01/2007: Pablo (ToxicWaste): Agrego para actualización de tag si cambia de status. */
	/* '22/05/2010: ZaMa - Los caos ya no suben nobleza ni plebe al atacar npcs. */
	/* '23/05/2010: ZaMa - El usuario pierde la pertenencia del npc. */
	/* '13/07/2010: ZaMa - Optimizaciones de logica en la seleccion de pretoriano, y el posible cambio de alencion del usuario. */
	/* '******************************************************** */

	struct npc MiNPC;
	MiNPC = Npclist[NpcIndex];
	bool EraCriminal;

	/* ' Es pretoriano? */
	if (MiNPC.NPCtype == eNPCType_Pretoriano) {
		// ClanPretoriano[MiNPC.ClanIndex].MuerePretoriano(NpcIndex);
	}

	/* 'Quitamos el npc */
	QuitarNPC(NpcIndex);

	/* ' Lo mato un usuario? */
	if (UserIndex > 0) {

		if (MiNPC.flags.Snd3 > 0) {
			SendData(SendTarget_ToPCArea, UserIndex,
					dakara::protocol::server::BuildPlayWave(MiNPC.flags.Snd3, MiNPC.Pos.X, MiNPC.Pos.Y));
		}
		UserList[UserIndex].flags.TargetNPC = 0;
		UserList[UserIndex].flags.TargetNpcTipo = eNPCType_Comun;

		/* 'El user que lo mato tiene mascotas? */
		if (UserList[UserIndex].NroMascotas > 0) {
			int T;
			for (T = (1); T <= (MAXMASCOTAS); T++) {
				if (UserList[UserIndex].MascotasIndex[T] > 0) {
					if (Npclist[UserList[UserIndex].MascotasIndex[T]].TargetNPC == NpcIndex) {
						FollowAmo(UserList[UserIndex].MascotasIndex[T]);
					}
				}
			}
		}

		/* '[KEVIN] */
		if (MiNPC.flags.ExpCount > 0) {
			if (UserList[UserIndex].PartyIndex > 0) {
				ObtenerExito(UserIndex, MiNPC.flags.ExpCount, MiNPC.Pos.Map, MiNPC.Pos.X, MiNPC.Pos.Y);
			} else {
				UserList[UserIndex].Stats.Exp = UserList[UserIndex].Stats.Exp + MiNPC.flags.ExpCount;
				if (UserList[UserIndex].Stats.Exp > MAXEXP) {
					UserList[UserIndex].Stats.Exp = MAXEXP;
				}
				WriteConsoleMsg(UserIndex, "Has ganado " + vb6::CStr(MiNPC.flags.ExpCount) + " puntos de experiencia.",
						FontTypeNames_FONTTYPE_FIGHT);
			}
			MiNPC.flags.ExpCount = 0;
		}

		/* '[/KEVIN] */
		WriteConsoleMsg(UserIndex, "¡Has matado a la criatura!", FontTypeNames_FONTTYPE_FIGHT);
		if (UserList[UserIndex].Stats.NPCsMuertos < 32000) {
			UserList[UserIndex].Stats.NPCsMuertos = UserList[UserIndex].Stats.NPCsMuertos + 1;
		}

		EraCriminal = criminal(UserIndex);

		if (MiNPC.Stats.Alineacion == 0) {

			if (MiNPC.Numero == Guardias) {
				UserList[UserIndex].Reputacion.NobleRep = 0;
				UserList[UserIndex].Reputacion.PlebeRep = 0;
				UserList[UserIndex].Reputacion.AsesinoRep = UserList[UserIndex].Reputacion.AsesinoRep + 500;
				if (UserList[UserIndex].Reputacion.AsesinoRep > MAXREP) {
					UserList[UserIndex].Reputacion.AsesinoRep = MAXREP;
				}
			}

			if (MiNPC.MaestroUser == 0) {
				UserList[UserIndex].Reputacion.AsesinoRep = UserList[UserIndex].Reputacion.AsesinoRep
						+ vlASESINO;
				if (UserList[UserIndex].Reputacion.AsesinoRep > MAXREP) {
					UserList[UserIndex].Reputacion.AsesinoRep = MAXREP;
				}
			}

		} else if (!esCaos(UserIndex)) {
			if (MiNPC.Stats.Alineacion == 1) {
				UserList[UserIndex].Reputacion.PlebeRep = UserList[UserIndex].Reputacion.PlebeRep + vlCAZADOR;
				if (UserList[UserIndex].Reputacion.PlebeRep > MAXREP) {
					UserList[UserIndex].Reputacion.PlebeRep = MAXREP;
				}

			} else if (MiNPC.Stats.Alineacion == 2) {
				UserList[UserIndex].Reputacion.NobleRep = UserList[UserIndex].Reputacion.NobleRep
						+ vlASESINO / 2;
				if (UserList[UserIndex].Reputacion.NobleRep > MAXREP) {
					UserList[UserIndex].Reputacion.NobleRep = MAXREP;
				}

			} else if (MiNPC.Stats.Alineacion == 4) {
				UserList[UserIndex].Reputacion.PlebeRep = UserList[UserIndex].Reputacion.PlebeRep + vlCAZADOR;
				if (UserList[UserIndex].Reputacion.PlebeRep > MAXREP) {
					UserList[UserIndex].Reputacion.PlebeRep = MAXREP;
				}

			}
		}

		bool EsCriminal;
		EsCriminal = criminal(UserIndex);

		/* ' Cambio de alienacion? */
		if (EraCriminal != EsCriminal) {

			/* ' Se volvio pk? */
			if (EsCriminal) {
				if (esArmada(UserIndex)) {
					ExpulsarFaccionReal(UserIndex);
				}

				/* ' Se volvio ciuda */
			} else {
				if (esCaos(UserIndex)) {
					ExpulsarFaccionCaos(UserIndex);
				}
			}

			RefreshCharStatus(UserIndex);
		}

		CheckUserLevel(UserIndex);

		if (NpcIndex == UserList[UserIndex].flags.ParalizedByNpcIndex) {
			RemoveParalisis(UserIndex);
		}

		/* ' Userindex > 0 */
	}

	if (MiNPC.MaestroUser == 0) {
		/* 'Tiramos el inventario */
		NPC_TIRAR_ITEMS(MiNPC, MiNPC.NPCtype == eNPCType_Pretoriano);
		/* 'ReSpawn o no */
		ReSpawnNpc(MiNPC);
	}
}