コード例 #1
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
void TransformarEnLider(int OldLeader, int NewLeader) {
    /* '*************************************************** */
    /* 'Author: Unknown */
    /* 'Last Modification: - */
    /* ' */
    /* '*************************************************** */

    int PI;

    if (OldLeader == NewLeader) {
        return;
    }

    PI = UserList[OldLeader].PartyIndex;

    if (PI == UserList[NewLeader].PartyIndex) {
        if (UserList[NewLeader].flags.Muerto == 0) {
            if (Parties[PI]->HacerLeader(NewLeader)) {
                Parties[PI]->MandarMensajeAConsola(
                    "El nuevo líder de la party es " + UserList[NewLeader].Name,
                    UserList[OldLeader].Name);
            } else {
                WriteConsoleMsg(OldLeader, "¡No se ha hecho el cambio de mando!",
                                FontTypeNames_FONTTYPE_PARTY);
            }
        } else {
            WriteConsoleMsg(OldLeader, "¡Está muerto!", FontTypeNames_FONTTYPE_INFO);
        }
    } else {
        WriteConsoleMsg(OldLeader, vb6::LCase(UserList[NewLeader].Name) + " no pertenece a tu party.",
                        FontTypeNames_FONTTYPE_INFO);
    }

}
コード例 #2
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
bool PuedeCrearParty(int UserIndex) {
    bool retval;
    /* '*************************************************** */
    /* 'Author: Unknown */
    /* 'Last Modification: 05/22/2010 (Marco) */
    /* ' - 05/22/2010 : staff members aren't allowed to party anyone. (Marco) */
    /* '*************************************************** */

    retval = true;

    if (!UserTienePrivilegio(UserIndex, PlayerType_User)) {
        /* 'staff members aren't allowed to party anyone. */
        WriteConsoleMsg(UserIndex, "¡Los miembros del staff no pueden crear partys!",
                        FontTypeNames_FONTTYPE_PARTY);
        retval = false;
    } else if (vb6::CInt(UserList[UserIndex].Stats.UserAtributos[eAtributos_Carisma])
               * UserList[UserIndex].Stats.UserSkills[eSkill_Liderazgo] < 100) {
        WriteConsoleMsg(UserIndex, "Tu carisma y liderazgo no son suficientes para liderar una party.",
                        FontTypeNames_FONTTYPE_PARTY);
        retval = false;
    } else if (UserList[UserIndex].flags.Muerto == 1) {
        WriteConsoleMsg(UserIndex, "¡¡Estás muerto!!", FontTypeNames_FONTTYPE_PARTY);
        retval = false;
    }
    return retval;
}
コード例 #3
0
ファイル: Timers.cpp プロジェクト: Chaitooler/dakara-server
void tPiqueteC_Timer() {
	bool NuevaA;
	/* ' Dim NuevoL As Boolean */
	int GI;
	int i;

	for (i = (1); i <= (LastUser); i++) {
		if (UserList[i].flags.UserLogged) {
			if (MapData[UserList[i].Pos.Map][UserList[i].Pos.X][UserList[i].Pos.Y].trigger
					== eTrigger_ANTIPIQUETE) {
				if (UserList[i].flags.Muerto == 0) {
					UserList[i].Counters.PiqueteC = UserList[i].Counters.PiqueteC + 1;
					WriteConsoleMsg(i, "¡¡¡Estás obstruyendo la vía pública, muévete o serás encarcelado!!!",
							FontTypeNames_FONTTYPE_INFO);

					if (UserList[i].Counters.PiqueteC > 23) {
						UserList[i].Counters.PiqueteC = 0;
						Encarcelar(i, TIEMPO_CARCEL_PIQUETE);
					}
				} else {
					UserList[i].Counters.PiqueteC = 0;
				}
			} else {
				UserList[i].Counters.PiqueteC = 0;
			}

			/* 'ustedes se preguntaran que hace esto aca? */
			/* 'bueno la respuesta es simple: el codigo de AO es una mierda y encontrar */
			/* 'todos los puntos en los cuales la alineacion puede cambiar es un dolor de */
			/* 'huevos, asi que lo controlo aca, cada 6 segundos, lo cual es razonable */

			GI = UserList[i].GuildIndex;
			if (GI > 0) {
				NuevaA = false;
				/* ' NuevoL = False */
				if (!m_ValidarPermanencia(i, true, NuevaA)) {
					WriteConsoleMsg(i,
							"Has sido expulsado del clan. ¡El clan ha sumado un punto de antifacción!",
							FontTypeNames_FONTTYPE_GUILD);
				}
				if (NuevaA) {
					SendData(SendTarget_ToGuildMembers, GI,
							dakara::protocol::server::BuildConsoleMsg(
									"¡El clan ha pasado a tener alineación " + GuildAlignment(GI) + "!",
									FontTypeNames_FONTTYPE_GUILD));
					LogClanes("¡El clan cambio de alineación!");
				}
				/* '                    If NuevoL Then */
				/* '                        Call SendData(SendTarget.ToGuildMembers, GI, PrepareMessageConsoleMsg("¡El clan tiene un nuevo líder!", FontTypeNames.FONTTYPE_GUILD)) */
				/* '                        Call LogClanes("¡El clan tiene nuevo lider!") */
				/* '                    End If */
			}

			FlushBuffer(i);
		}
	}
}
コード例 #4
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
void OnlineParty(int UserIndex) {
    /* '************************************************* */
    /* 'Author: Unknown */
    /* 'Last modified: 11/27/09 (Budi) */
    /* 'Adapte la función a los nuevos métodos de clsParty */
    /* '************************************************* */
    int i;
    int PI;
    std::string Text;
    std::vector<int> MembersOnline;

    PI = UserList[UserIndex].PartyIndex;

    if (PI > 0) {
        Parties[PI]->ObtenerMiembrosOnline(MembersOnline);
        Text = "Nombre(Exp): ";
        for (i = (0); i < (int) MembersOnline.size(); i++) {
            if (MembersOnline[i] > 0) {
                Text = Text + " - " + UserList[MembersOnline[i]].Name + " ("
                       + vb6::CStr(vb6::Fix(Parties[PI]->MiExperiencia(MembersOnline[i]))) + ")";
            }
        }
        Text = Text + ". Experiencia total: " + vb6::CStr(Parties[PI]->ObtenerExperienciaTotal());
        WriteConsoleMsg(UserIndex, Text, FontTypeNames_FONTTYPE_PARTY);
    }

}
コード例 #5
0
void CentinelaSendClave(int UserIndex, int CentinelaIndex) {
	/* '************************************************* */
	/* 'Author: Unknown */
	/* 'Last modified: 02/10/2010 */
	/* 'Enviamos al usuario la clave vía el personaje centinela */
	/* '02/10/2010: ZaMa - Adaptado para que funcione mas de un centinela en paralelo. */
	/* '************************************************* */

	if (Centinela[CentinelaIndex].NpcIndex == 0) {
		return;
	}

	if (Centinela[CentinelaIndex].RevisandoUserIndex == UserIndex) {

		if (!UserList[UserIndex].flags.CentinelaOK) {
			WriteChatOverHead(UserIndex,
					"¡La clave que te he dicho es /CENTINELA " + vb6::CStr(Centinela[CentinelaIndex].clave)
							+ ", escríbelo rápido!",
					Npclist[Centinela[CentinelaIndex].NpcIndex].Char.CharIndex, vbGreen);
			WriteConsoleMsg(UserIndex, "El centinela intenta llamar tu atención. ¡Respondele rápido!",
					FontTypeNames_FONTTYPE_CENTINELA);
		} else {
			WriteChatOverHead(UserIndex, "Te agradezco, pero ya me has respondido. Me retiraré pronto.",
					(Npclist[Centinela[CentinelaIndex].NpcIndex].Char.CharIndex), vbGreen);
		}

	} else {
		WriteChatOverHead(UserIndex, "No es a ti a quien estoy hablando, ¿No ves?",
				Npclist[Centinela[CentinelaIndex].NpcIndex].Char.CharIndex, vbWhite);
	}

}
コード例 #6
0
ファイル: Timers.cpp プロジェクト: Chaitooler/dakara-server
void CheckIdleUser() {
	int iUserIndex;

	for (iUserIndex = (1); iUserIndex <= (MaxUsers); iUserIndex++) {
		/* 'Conexion activa? y es un usuario loggeado? */
		if (UserIndexSocketValido(iUserIndex) && UserList[iUserIndex].flags.UserLogged) {
			/* 'Actualiza el contador de inactividad */
			if (UserList[iUserIndex].flags.Traveling == 0) {
				UserList[iUserIndex].Counters.IdleCount = UserList[iUserIndex].Counters.IdleCount + 1;
			}

			if (UserList[iUserIndex].Counters.IdleCount >= IdleLimit) {
				WriteShowMessageBox(iUserIndex, "Demasiado tiempo inactivo. Has sido desconectado.");
				/* 'mato los comercios seguros */
				if (UserList[iUserIndex].ComUsu.DestUsu > 0) {
					if (UserList[UserList[iUserIndex].ComUsu.DestUsu].flags.UserLogged) {
						if (UserList[UserList[iUserIndex].ComUsu.DestUsu].ComUsu.DestUsu == iUserIndex) {
							WriteConsoleMsg(UserList[iUserIndex].ComUsu.DestUsu,
									"Comercio cancelado por el otro usuario.", FontTypeNames_FONTTYPE_TALK);
							FinComerciarUsu(UserList[iUserIndex].ComUsu.DestUsu);
							/* 'flush the buffer to send the message right away */
							FlushBuffer(UserList[iUserIndex].ComUsu.DestUsu);
						}
					}
					FinComerciarUsu(iUserIndex);
				}
				CerrarUserIndexIniciar(iUserIndex);
			}
		}
	}
}
コード例 #7
0
void ExpulsarFaccionCaos(int UserIndex, bool Expulsado) {
	/* '*************************************************** */
	/* 'Author: Unknown */
	/* 'Last Modification: - */
	/* ' 09/28/2010 C4b3z0n - Arreglado RT6 Overflow, el Desequipar() del escudo, ponía de parametro el ObjIndex del escudo en vez del EqpSlot. */
	/* '*************************************************** */

	UserList[UserIndex].Faccion.FuerzasCaos = 0;
	/* 'Call PerderItemsFaccionarios(UserIndex) */
	if (Expulsado) {
		WriteConsoleMsg(UserIndex, "¡¡¡Has sido expulsado de la Legión Oscura!!!",
				FontTypeNames_FONTTYPE_FIGHT);
	} else {
		WriteConsoleMsg(UserIndex, "¡¡¡Te has retirado de la Legión Oscura!!!", FontTypeNames_FONTTYPE_FIGHT);
	}

	bool bRefresh = false;

	if (UserList[UserIndex].Invent.ArmourEqpObjIndex != 0) {
		/* 'Desequipamos la armadura de caos si está equipada */
		if (ObjData[UserList[UserIndex].Invent.ArmourEqpObjIndex].Caos == 1) {
			Desequipar(UserIndex, UserList[UserIndex].Invent.ArmourEqpSlot, false);
			bRefresh = true;
		}
	}

	if (UserList[UserIndex].Invent.EscudoEqpObjIndex != 0) {
		/* 'Desequipamos el escudo de caos si está equipado */
		if (ObjData[UserList[UserIndex].Invent.EscudoEqpObjIndex].Caos == 1) {
			Desequipar(UserIndex, UserList[UserIndex].Invent.EscudoEqpSlot, false);
			bRefresh = true;
		}
	}

	if (bRefresh) {
		ChangeUserChar(UserIndex, UserList[UserIndex].Char.body, UserList[UserIndex].Char.Head,
				UserList[UserIndex].Char.heading, UserList[UserIndex].Char.WeaponAnim,
				UserList[UserIndex].Char.ShieldAnim, UserList[UserIndex].Char.CascoAnim);
		WriteUpdateUserStats(UserIndex);
	}

	/* 'Actualizamos la barca si esta navegando (NicoNZ) */
	if (UserList[UserIndex].flags.Navegando) {
		RefreshCharStatus(UserIndex);
	}

}
コード例 #8
0
ファイル: Party.cpp プロジェクト: irongete/dakara-server
void clsParty::MandarMensajeAConsola(std::string texto, std::string Sender) {
	/* 'feo feo, muy feo acceder a senddata desde aca, pero BUEEEEEEEEEEE... */
	int i;

	for (i = (1); i <= (PARTY_MAXMEMBERS); i++) {
		if (p_members[i].UserIndex > 0) {
			WriteConsoleMsg(p_members[i].UserIndex, " [" + Sender + "] " + texto,
					FontTypeNames_FONTTYPE_PARTY);
		}
	}

}
コード例 #9
0
/* 'destino: receptor de la transaccion */
void IniciarComercioConUsuario(int Origen, int Destino) {
	/* '*************************************************** */
	/* 'Autor: Unkown */
	/* 'Last Modification: 25/11/2009 */
	/* ' */
	/* '*************************************************** */

	/* 'Si ambos pusieron /comerciar entonces */
	if (UserList[Origen].ComUsu.DestUsu == Destino && UserList[Destino].ComUsu.DestUsu == Origen) {

		if (UserList[Origen].flags.Comerciando || UserList[Destino].flags.Comerciando) {
			WriteConsoleMsg(Origen, "No puedes comerciar en este momento", FontTypeNames_FONTTYPE_TALK);
			WriteConsoleMsg(Destino, "No puedes comerciar en este momento", FontTypeNames_FONTTYPE_TALK);
			return;
		}

		/* 'Actualiza el inventario del usuario */
		UpdateUserInv(true, Origen, 0);
		/* 'Decirle al origen que abra la ventanita. */
		WriteUserCommerceInit(Origen);
		UserList[Origen].flags.Comerciando = true;

		/* 'Actualiza el inventario del usuario */
		UpdateUserInv(true, Destino, 0);
		/* 'Decirle al origen que abra la ventanita. */
		WriteUserCommerceInit(Destino);
		UserList[Destino].flags.Comerciando = true;

		/* 'Call EnviarObjetoTransaccion(Origen) */
	} else {
		/* 'Es el primero que comercia ? */
		WriteConsoleMsg(Destino,
				UserList[Origen].Name + " desea comerciar. Si deseas aceptar, escribe /COMERCIAR.",
				FontTypeNames_FONTTYPE_TALK);
		UserList[Destino].flags.TargetUser = Origen;

	}

	FlushBuffer(Destino);
}
コード例 #10
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
void CrearParty(int UserIndex) {
    /* '*************************************************** */
    /* 'Author: Unknown */
    /* 'Last Modification: - */
    /* ' */
    /* '*************************************************** */

    int tInt;

    if (UserList[UserIndex].PartyIndex == 0) {
        if (UserList[UserIndex].flags.Muerto == 0) {
            if (UserList[UserIndex].Stats.UserSkills[eSkill_Liderazgo] >= 5) {
                tInt = NextParty();
                if (tInt == -1) {
                    WriteConsoleMsg(UserIndex, "Por el momento no se pueden crear más parties.",
                                    FontTypeNames_FONTTYPE_PARTY);
                    return;
                } else {
                    Parties[tInt].reset(new clsParty());
                    if (!Parties[tInt]->NuevoMiembro(UserIndex)) {
                        WriteConsoleMsg(UserIndex, "La party está llena, no puedes entrar.",
                                        FontTypeNames_FONTTYPE_PARTY);
                        Parties[tInt].reset();
                        return;
                    } else {
                        WriteConsoleMsg(UserIndex, "¡Has formado una party!", FontTypeNames_FONTTYPE_PARTY);
                        UserList[UserIndex].PartyIndex = tInt;
                        UserList[UserIndex].PartySolicitud = 0;
                        if (!Parties[tInt]->HacerLeader(UserIndex)) {
                            WriteConsoleMsg(UserIndex, "No puedes hacerte líder.",
                                            FontTypeNames_FONTTYPE_PARTY);
                        } else {
                            WriteConsoleMsg(UserIndex, "¡Te has convertido en líder de la party!",
                                            FontTypeNames_FONTTYPE_PARTY);
                        }
                    }
                }
            } else {
                WriteConsoleMsg(UserIndex,
                                "No tienes suficientes puntos de liderazgo para liderar una party.",
                                FontTypeNames_FONTTYPE_PARTY);
            }
        } else {
            WriteConsoleMsg(UserIndex, "¡¡Estás muerto!!", FontTypeNames_FONTTYPE_PARTY);
        }
    } else {
        WriteConsoleMsg(UserIndex, "Ya perteneces a una party.", FontTypeNames_FONTTYPE_PARTY);
    }
}
コード例 #11
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
/* ' @return  True if the user can use party commands, false if not. */
bool UserPuedeEjecutarComandos(int User) {
    bool retval = false;
    /* '************************************************* */
    /* 'Author: Marco Vanotti(Marco) */
    /* 'Last modified: 05/05/09 */
    /* ' */
    /* '************************************************* */
    int PI;

    PI = UserList[User].PartyIndex;

    if (PI > 0) {
        if (Parties[PI]->EsPartyLeader(User)) {
            retval = true;
        } else {
            WriteConsoleMsg(User, "¡No eres el líder de tu party!", FontTypeNames_FONTTYPE_PARTY);
            return retval;
        }
    } else {
        WriteConsoleMsg(User, "No eres miembro de ninguna party.", FontTypeNames_FONTTYPE_INFO);
        return retval;
    }
    return retval;
}
コード例 #12
0
ファイル: Npcs.cpp プロジェクト: irongete/dakara-server
void NpcEnvenenarUser(int UserIndex) {
	/* '*************************************************** */
	/* 'Author: Unknown */
	/* 'Last Modification: 10/07/2010 */
	/* '10/07/2010: ZaMa - Now npcs can't poison dead users. */
	/* '*************************************************** */

	int N;

	if (UserList[UserIndex].flags.Muerto == 1) {
		return;
	}

	N = RandomNumber(1, 100);
	if (N < 30) {
		UserList[UserIndex].flags.Envenenado = 1;
		WriteConsoleMsg(UserIndex, "¡¡La criatura te ha envenenado!!", FontTypeNames_FONTTYPE_FIGHT);
	}

}
コード例 #13
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
void SalirDeParty(int UserIndex) {
    /* '*************************************************** */
    /* 'Author: Unknown */
    /* 'Last Modification: - */
    /* ' */
    /* '*************************************************** */

    int PI;
    PI = UserList[UserIndex].PartyIndex;
    if (PI > 0) {
        if (Parties[PI]->SaleMiembro(UserIndex)) {
            /* 'sale el leader */
            Parties[PI].reset();
        } else {
            UserList[UserIndex].PartyIndex = 0;
        }
    } else {
        WriteConsoleMsg(UserIndex, "No eres miembro de ninguna party.", FontTypeNames_FONTTYPE_INFO);
    }

}
コード例 #14
0
void GiveExpReward(int UserIndex, int Rango) {
	/* '*************************************************** */
	/* 'Autor: ZaMa */
	/* 'Last Modification: 15/04/2010 */
	/* 'Gives reward exp to user */
	/* '*************************************************** */

	int GivenExp;

	GivenExp = RecompensaFacciones[Rango];

	UserList[UserIndex].Stats.Exp = UserList[UserIndex].Stats.Exp + GivenExp;

	if (UserList[UserIndex].Stats.Exp > MAXEXP) {
		UserList[UserIndex].Stats.Exp = MAXEXP;
	}

	WriteConsoleMsg(UserIndex, "Has sido recompensado con " + vb6::CStr(GivenExp) + " puntos de experiencia.",
			FontTypeNames_FONTTYPE_FIGHT);

	CheckUserLevel(UserIndex);

}
コード例 #15
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
void ExpulsarDeParty(int leader, int OldMember) {
    /* '*************************************************** */
    /* 'Author: Unknown */
    /* 'Last Modification: - */
    /* ' */
    /* '*************************************************** */

    int PI;
    PI = UserList[leader].PartyIndex;

    if (PI == UserList[OldMember].PartyIndex) {
        if (Parties[PI]->SaleMiembro(OldMember)) {
            /* 'si la funcion me da true, entonces la party se disolvio */
            /* 'y los partyindex fueron reseteados a 0 */
            Parties[PI].reset();
        } else {
            UserList[OldMember].PartyIndex = 0;
        }
    } else {
        WriteConsoleMsg(leader, vb6::LCase(UserList[OldMember].Name) + " no pertenece a tu party.",
                        FontTypeNames_FONTTYPE_INFO);
    }

}
コード例 #16
0
ファイル: NpcsAI.cpp プロジェクト: Elekaene/dakara-server
/* ' @param NpcIndex Specifies reference to the npc */
void SeguirAgresor(int NpcIndex) {
	/* '************************************************************** */
	/* 'Author: Unknown */
	/* 'Last Modify by: Marco Vanotti (MarKoxX) */
	/* 'Last Modify Date: 08/16/2008 */
	/* '08/16/2008: MarKoxX - Now pets that do mel� attacks have to be near the enemy to attack. */
	/* '************************************************************** */
	int tHeading;
	int UI;

	int i;

	int SignoNS;
	int SignoEO;

	if (Npclist[NpcIndex].flags.Paralizado == 1
			|| Npclist[NpcIndex].flags.Inmovilizado == 1) {
		switch (Npclist[NpcIndex].Char.heading) {
		case eHeading_NORTH:
			SignoNS = -1;
			SignoEO = 0;

			break;

		case eHeading_EAST:
			SignoNS = 0;
			SignoEO = 1;

			break;

		case eHeading_SOUTH:
			SignoNS = 1;
			SignoEO = 0;

			break;

		case eHeading_WEST:
			SignoEO = -1;
			SignoNS = 0;
			break;

		default:
			SignoEO = SignoNS = 0;
			break;
		}

		for (i = (1); i <= (ConnGroups[Npclist[NpcIndex].Pos.Map].CountEntrys);
				i++) {
			UI = ConnGroups[Npclist[NpcIndex].Pos.Map].UserEntrys[i];

			/* 'Is it in it's range of vision?? */
			if (vb6::Abs(UserList[UI].Pos.X - Npclist[NpcIndex].Pos.X)
					<= RANGO_VISION_X
					&& vb6::Sgn(UserList[UI].Pos.X - Npclist[NpcIndex].Pos.X)
							== SignoEO) {
				if (vb6::Abs(UserList[UI].Pos.Y - Npclist[NpcIndex].Pos.Y)
						<= RANGO_VISION_Y
						&& vb6::Sgn(UserList[UI].Pos.Y - Npclist[NpcIndex].Pos.Y)
								== SignoNS) {

					if (UserList[UI].Name
							== Npclist[NpcIndex].flags.AttackedBy) {
						if (Npclist[NpcIndex].MaestroUser > 0) {
							if (!criminal(Npclist[NpcIndex].MaestroUser)
									&& !criminal(UI)
									&& (UserList[Npclist[NpcIndex].MaestroUser].flags.Seguro
											|| UserList[Npclist[NpcIndex].MaestroUser].Faccion.ArmadaReal
													== 1)) {
								WriteConsoleMsg(Npclist[NpcIndex].MaestroUser,
										"La mascota no atacará a ciudadanos si eres miembro del ejército real o tienes el seguro activado.",
										FontTypeNames_FONTTYPE_INFO);
								FlushBuffer(Npclist[NpcIndex].MaestroUser);
								Npclist[NpcIndex].flags.AttackedBy = "";
								return;
							}
						}

						if (UserList[UI].flags.Muerto == 0
								&& UserList[UI].flags.invisible == 0
								&& UserList[UI].flags.Oculto == 0) {
							if (Npclist[NpcIndex].flags.LanzaSpells > 0) {
								NpcLanzaUnSpell(NpcIndex, UI);
							} else {
								if (Distancia(UserList[UI].Pos,
										Npclist[NpcIndex].Pos) <= 1) {
									/* ' TODO : Set this a separate AI for Elementals and Druid's pets */
									if (Npclist[NpcIndex].Numero != 92) {
										NpcAtacaUser(NpcIndex, UI);
									}
								}
							}
							return;
						}
					}

				}
			}

		}
	} else {
		for (i = (1); i <= (ConnGroups[Npclist[NpcIndex].Pos.Map].CountEntrys);
				i++) {
			UI = ConnGroups[Npclist[NpcIndex].Pos.Map].UserEntrys[i];

			/* 'Is it in it's range of vision?? */
			if (vb6::Abs(UserList[UI].Pos.X - Npclist[NpcIndex].Pos.X)
					<= RANGO_VISION_X) {
				if (vb6::Abs(UserList[UI].Pos.Y - Npclist[NpcIndex].Pos.Y)
						<= RANGO_VISION_Y) {

					if (UserList[UI].Name
							== Npclist[NpcIndex].flags.AttackedBy) {
						if (Npclist[NpcIndex].MaestroUser > 0) {
							if (!criminal(Npclist[NpcIndex].MaestroUser)
									&& !criminal(UI)
									&& (UserList[Npclist[NpcIndex].MaestroUser].flags.Seguro
											|| UserList[Npclist[NpcIndex].MaestroUser].Faccion.ArmadaReal
													== 1)) {
								WriteConsoleMsg(Npclist[NpcIndex].MaestroUser,
										"La mascota no atacará a ciudadanos si eres miembro del ejército real o tienes el seguro activado.",
										FontTypeNames_FONTTYPE_INFO);
								FlushBuffer(Npclist[NpcIndex].MaestroUser);
								Npclist[NpcIndex].flags.AttackedBy = "";
								FollowAmo(NpcIndex);
								return;
							}
						}

						if (UserList[UI].flags.Muerto == 0
								&& UserList[UI].flags.invisible == 0
								&& UserList[UI].flags.Oculto == 0) {
							if (Npclist[NpcIndex].flags.LanzaSpells > 0) {
								NpcLanzaUnSpell(NpcIndex, UI);
							} else {
								if (Distancia(UserList[UI].Pos,
										Npclist[NpcIndex].Pos) <= 1) {
									/* ' TODO : Set this a separate AI for Elementals and Druid's pets */
									if (Npclist[NpcIndex].Numero != 92) {
										NpcAtacaUser(NpcIndex, UI);
									}
								}
							}

							tHeading = FindDirection(Npclist[NpcIndex].Pos,
									UserList[UI].Pos);
							MoveNPCChar(NpcIndex, tHeading);

							return;
						}
					}

				}
			}

		}
	}

	RestoreOldMovement(NpcIndex);
}
コード例 #17
0
ファイル: Party.cpp プロジェクト: irongete/dakara-server
bool clsParty::SaleMiembro(int UserIndex) {
	bool retval;
	/* '*************************************************** */
	/* 'Author: Unknown */
	/* 'Last Modification: 07/04/08 */
	/* 'Last Modification By: Marco Vanotti (MarKoxX) */
	/* ' - 09/29/07 Experience is round to the biggest number less than that number */
	/* ' - 09/29/07 Now experience is a real-number (Tavo) */
	/* ' - 07/04/08 Added const ExponenteNivelParty. (MarKoxX) */
	/* '11/03/2010: ZaMa - Ahora no le dice al lider que salio de su propia party, y optimice con with. */
	/* '*************************************************** */
	/* 'el valor de retorno representa si se disuelve la party */
	int i;
	int j;
	int MemberIndex;

	i = 1;
	retval = false;
	while (i <= PARTY_MAXMEMBERS && p_members[i].UserIndex != UserIndex) {
		i = i + 1;
	}

	if (i == 1) {
		/* 'sale el founder, la party se disuelve */
		retval = true;
		MandarMensajeAConsola("El líder disuelve la party.", "Servidor");

		for (j = (PARTY_MAXMEMBERS); ((-1) > 0) ? (j <= (1)) : (j >= (1)); j = j + (-1)) {

			if (p_members[j].UserIndex > 0) {

				/* ' No envia el mensaje al lider */
				if (j != 1) {
					WriteConsoleMsg(p_members[j].UserIndex,
							"Abandonas la party liderada por " + UserList[p_members[1].UserIndex].Name + ".",
							FontTypeNames_FONTTYPE_PARTY);
				}

				WriteConsoleMsg(p_members[j].UserIndex,
						"Durante la misma has conseguido " + vb6::CStr(vb6::Fix(p_members[j].Experiencia))
								+ " puntos de experiencia.", FontTypeNames_FONTTYPE_PARTY);

				if (!PARTY_EXPERIENCIAPORGOLPE) {
					UserList[p_members[j].UserIndex].Stats.Exp = UserList[p_members[j].UserIndex].Stats.Exp
							+ vb6::Fix(p_members[j].Experiencia);
					if (UserList[p_members[j].UserIndex].Stats.Exp > MAXEXP) {
						UserList[p_members[j].UserIndex].Stats.Exp = MAXEXP;
					}
					CheckUserLevel(p_members[j].UserIndex);
					WriteUpdateUserStats(p_members[j].UserIndex);
				}

				MandarMensajeAConsola(UserList[p_members[j].UserIndex].Name + " abandona la party.",
						"Servidor");

				UserList[p_members[j].UserIndex].PartyIndex = 0;
				p_CantMiembros = p_CantMiembros - 1;
				p_SumaNivelesElevados = p_SumaNivelesElevados
						- std::pow(UserList[UserIndex].Stats.ELV, ExponenteNivelParty);
				p_members[j].UserIndex = 0;
				p_members[j].Experiencia = 0;

			}

		}
	} else {
		if (i <= PARTY_MAXMEMBERS) {

			MemberIndex = p_members[i].UserIndex;

			if (!PARTY_EXPERIENCIAPORGOLPE) {
				UserList[MemberIndex].Stats.Exp = UserList[MemberIndex].Stats.Exp
						+ vb6::Fix(p_members[i].Experiencia);
				if (UserList[MemberIndex].Stats.Exp > MAXEXP) {
					UserList[MemberIndex].Stats.Exp = MAXEXP;
				}

				CheckUserLevel(MemberIndex);
				WriteUpdateUserStats(MemberIndex);
			}

			MandarMensajeAConsola(UserList[MemberIndex].Name + " abandona la party.", "Servidor");
			/* 'TODO: Revisar que esto este bien, y no este faltando/sobrando un mensaje, ahora solo los estoy corrigiendo */
			WriteConsoleMsg(MemberIndex,
					"Durante la misma has conseguido " + vb6::CStr(vb6::Fix(p_members[i].Experiencia))
							+ " puntos de experiencia.", FontTypeNames_FONTTYPE_PARTY);

			p_CantMiembros = p_CantMiembros - 1;
			p_SumaNivelesElevados = p_SumaNivelesElevados
					- std::pow(UserList[UserIndex].Stats.ELV, ExponenteNivelParty);
			MemberIndex = 0;
			p_members[i].Experiencia = 0;
			p_members[i].UserIndex = 0;
			CompactMemberList();
		}
	}

	return retval;
}
コード例 #18
0
ファイル: Timers.cpp プロジェクト: Chaitooler/dakara-server
void GameTimer_Timer() {
	int iUserIndex;
	bool bEnviarStats;
	bool bEnviarAyS;

	/* '<<<<<< Procesa eventos de los usuarios >>>>>> */
	/* 'LastUser */
	for (iUserIndex = (1); iUserIndex <= (MaxUsers); iUserIndex++) {
		/* 'Conexion activa? */
		if (UserIndexSocketValido(iUserIndex)) {
			/* '¿User valido? */

			if (UserList[iUserIndex].flags.UserLogged) {

				/* '[Alejo-18-5] */
				bEnviarStats = false;
				bEnviarAyS = false;

				if (UserList[iUserIndex].flags.Paralizado == 1) {
					EfectoParalisisUser(iUserIndex);
				}
				if (UserList[iUserIndex].flags.Ceguera == 1 || UserList[iUserIndex].flags.Estupidez) {
					EfectoCegueEstu(iUserIndex);
				}

				if (UserList[iUserIndex].flags.Muerto == 0) {

					/* '[Consejeros] */
					if (UserTieneAlgunPrivilegios(iUserIndex, PlayerType_User)) {
						EfectoLava(iUserIndex);
					}

					if (UserList[iUserIndex].flags.Desnudo != 0
							&& UserTieneAlgunPrivilegios(iUserIndex, PlayerType_User)) {
						EfectoFrio(iUserIndex);
					}

					if (UserList[iUserIndex].flags.Meditando) {
						DoMeditar(iUserIndex);
					}

					if (UserList[iUserIndex].flags.Envenenado != 0
							&& UserTieneAlgunPrivilegios(iUserIndex, PlayerType_User)) {
						EfectoVeneno(iUserIndex);
					}

					if (UserList[iUserIndex].flags.AdminInvisible != 1) {
						if (UserList[iUserIndex].flags.invisible == 1) {
							EfectoInvisibilidad(iUserIndex);
						}
						if (UserList[iUserIndex].flags.Oculto == 1) {
							DoPermanecerOculto(iUserIndex);
						}
					}

					if (UserList[iUserIndex].flags.Mimetizado == 1) {
						EfectoMimetismo(iUserIndex);
					}

					if (UserList[iUserIndex].flags.AtacablePor != 0) {
						EfectoEstadoAtacable(iUserIndex);
					}

					DuracionPociones(iUserIndex);

					HambreYSed(iUserIndex, bEnviarAyS);

					if (UserList[iUserIndex].flags.Hambre == 0 && UserList[iUserIndex].flags.Sed == 0) {
						if (Lloviendo) {
							if (!Intemperie(iUserIndex)) {
								if (!UserList[iUserIndex].flags.Descansar) {
									/* 'No esta descansando */
									Sanar(iUserIndex, bEnviarStats, SanaIntervaloSinDescansar);
									if (bEnviarStats) {
										WriteUpdateHP(iUserIndex);
										bEnviarStats = false;
									}
									RecStamina(iUserIndex, bEnviarStats, StaminaIntervaloSinDescansar);
									if (bEnviarStats) {
										WriteUpdateSta(iUserIndex);
										bEnviarStats = false;
									}
								} else {
									/* 'esta descansando */
									Sanar(iUserIndex, bEnviarStats, SanaIntervaloDescansar);
									if (bEnviarStats) {
										WriteUpdateHP(iUserIndex);
										bEnviarStats = false;
									}
									RecStamina(iUserIndex, bEnviarStats, StaminaIntervaloDescansar);
									if (bEnviarStats) {
										WriteUpdateSta(iUserIndex);
										bEnviarStats = false;
									}
									/* 'termina de descansar automaticamente */
									if (UserList[iUserIndex].Stats.MaxHp == UserList[iUserIndex].Stats.MinHp
											&& UserList[iUserIndex].Stats.MaxSta
													== UserList[iUserIndex].Stats.MinSta) {
										WriteRestOK(iUserIndex);
										WriteConsoleMsg(iUserIndex, "Has terminado de descansar.",
												FontTypeNames_FONTTYPE_INFO);
										UserList[iUserIndex].flags.Descansar = false;
									}

								}
							}
						} else {
							if (!UserList[iUserIndex].flags.Descansar) {
								/* 'No esta descansando */

								Sanar(iUserIndex, bEnviarStats, SanaIntervaloSinDescansar);
								if (bEnviarStats) {
									WriteUpdateHP(iUserIndex);
									bEnviarStats = false;
								}
								RecStamina(iUserIndex, bEnviarStats, StaminaIntervaloSinDescansar);
								if (bEnviarStats) {
									WriteUpdateSta(iUserIndex);
									bEnviarStats = false;
								}

							} else {
								/* 'esta descansando */

								Sanar(iUserIndex, bEnviarStats, SanaIntervaloDescansar);
								if (bEnviarStats) {
									WriteUpdateHP(iUserIndex);
									bEnviarStats = false;
								}
								RecStamina(iUserIndex, bEnviarStats, StaminaIntervaloDescansar);
								if (bEnviarStats) {
									WriteUpdateSta(iUserIndex);
									bEnviarStats = false;
								}
								/* 'termina de descansar automaticamente */
								if (UserList[iUserIndex].Stats.MaxHp == UserList[iUserIndex].Stats.MinHp
										&& UserList[iUserIndex].Stats.MaxSta
												== UserList[iUserIndex].Stats.MinSta) {
									WriteRestOK(iUserIndex);
									WriteConsoleMsg(iUserIndex, "Has terminado de descansar.",
											FontTypeNames_FONTTYPE_INFO);
									UserList[iUserIndex].flags.Descansar = false;
								}

							}
						}
					}

					if (bEnviarAyS) {
						WriteUpdateHungerAndThirst(iUserIndex);
					}

					if (UserList[iUserIndex].NroMascotas > 0) {
						TiempoInvocacion(iUserIndex);
					}
				} else {
					if (UserList[iUserIndex].flags.Traveling != 0) {
						TravelingEffect(iUserIndex);
					}
					/* 'Muerto */
				}
				/* 'no esta logeado? */
			} else {
				/* 'Inactive players will be removed! */
				UserList[iUserIndex].Counters.IdleCount = UserList[iUserIndex].Counters.IdleCount + 1;
				if (UserList[iUserIndex].Counters.IdleCount > IntervaloParaConexion) {
					UserList[iUserIndex].Counters.IdleCount = 0;
					CloseSocket(iUserIndex);
				}
				/* 'UserLogged */
			}

		}

		if (UserIndexSocketValido(iUserIndex)) {
			/* 'If there is anything to be sent, we send it */
			FlushBuffer(iUserIndex);
		}
	}
}
コード例 #19
0
void GoToNextWorkingChar() {
	/* '************************************************* */
	/* 'Author: Unknown */
	/* 'Last modified: 03/10/2010 */
	/* 'Va al siguiente usuario que se encuentre trabajando */
	/* '09/27/2010: C4b3z0n - Ahora una vez que termina la lista de usuarios, si se cumplio el tiempo de reset, resetea la info y asigna un nuevo tiempo. */
	/* '03/10/2010: ZaMa - Adaptado para que funcione mas de un centinela en paralelo. */
	/* '************************************************* */

	int LoopC;
	int CentinelaIndex;

	CentinelaIndex = GetIdleCentinela(1);

	for (LoopC = (1); LoopC <= (LastUser); LoopC++) {

		/* ' Usuario trabajando y no revisado? */
		if (UserList[LoopC].flags.UserLogged && UserList[LoopC].Counters.Trabajando > 0
				&& UserTienePrivilegio(LoopC, PlayerType_User)) {
			if (!UserList[LoopC].flags.CentinelaOK && UserList[LoopC].flags.CentinelaIndex == 0) {
				/* 'Inicializamos */
				Centinela[CentinelaIndex].RevisandoUserIndex = LoopC;
				Centinela[CentinelaIndex].TiempoRestante = TIEMPO_INICIAL;
				Centinela[CentinelaIndex].clave = RandomNumber(1, 32000);
				Centinela[CentinelaIndex].SpawnTime = vb6::GetTickCount();
				Centinela[CentinelaIndex].Activo = true;

				/* 'Ponemos al centinela en posición */
				WarpCentinela(LoopC, CentinelaIndex);

				/* ' Spawneo? */
				if (Centinela[CentinelaIndex].NpcIndex != 0) {
					/* 'Mandamos el mensaje (el centinela habla y aparece en consola para que no haya dudas) */
					WriteChatOverHead(LoopC,
							"Saludos " + UserList[LoopC].Name
									+ ", soy el Centinela de estas tierras. Me gustaría que escribas /CENTINELA "
									+ vb6::CStr(Centinela[CentinelaIndex].clave)
									+ " en no más de dos minutos.",
							(Npclist[Centinela[CentinelaIndex].NpcIndex].Char.CharIndex), vbGreen);
					WriteConsoleMsg(LoopC, "El centinela intenta llamar tu atención. ¡Respóndele rápido!",
							FontTypeNames_FONTTYPE_CENTINELA);
					FlushBuffer(LoopC);

					/* ' Guardo el indice del centinela */
					UserList[LoopC].flags.CentinelaIndex = CentinelaIndex;
				}

				/* ' Si ya se asigno un usuario a cada centinela, me voy */
				CentinelaIndex = CentinelaIndex + 1;
				if (CentinelaIndex > NRO_CENTINELA) {
					return;
				}

				/* ' Si no queda nadie inactivo, me voy */
				CentinelaIndex = GetIdleCentinela(CentinelaIndex);
				if (CentinelaIndex == 0) {
					return;
				}

			}
		}

	}

}
コード例 #20
0
void PasarMinutoCentinela() {
	/* '************************************************* */
	/* 'Author: Unknown */
	/* 'Last modified: 02/10/2010 */
	/* 'Control del timer. Llamado cada un minuto. */
	/* '03/10/2010: ZaMa - Adaptado para que funcione mas de un centinela en paralelo. */
	/* '************************************************* */

	int index;
	int UserIndex;
	int IdleCount = 0;

	if (!centinelaActivado) {
		return;
	}

	/* ' Primero reviso los que estan chequeando usuarios */
	for (index = (1); index <= (NRO_CENTINELA); index++) {

		/* ' Esta activo? */
		if (Centinela[index].Activo) {
			Centinela[index].TiempoRestante = Centinela[index].TiempoRestante - 1;

			/* ' Temrino el tiempo de chequeo? */
			if (Centinela[index].TiempoRestante == 0) {
				CentinelaFinalCheck(index);
			} else {

				UserIndex = Centinela[index].RevisandoUserIndex;

				/* 'RECORDamos al user que debe escribir */
				if (Distancia(Npclist[Centinela[index].NpcIndex].Pos, UserList[UserIndex].Pos) > 5) {
					WarpCentinela(UserIndex, index);
				}

				/* 'El centinela habla y se manda a consola para que no quepan dudas */
				WriteChatOverHead(UserIndex,
						"¡" + UserList[UserIndex].Name
								+ ", tienes un minuto más para responder! Debes escribir /CENTINELA "
								+ vb6::CStr(Centinela[index].clave) + ".",
						(Npclist[Centinela[index].NpcIndex].Char.CharIndex), vbRed);
				WriteConsoleMsg(UserIndex,
						"¡" + UserList[UserIndex].Name + ", tienes un minuto más para responder!",
						FontTypeNames_FONTTYPE_CENTINELA);
				FlushBuffer(UserIndex);
			}
		} else {

			/* ' Lo reseteo aca, para que pueda hablarle al usuario chequeado aunque haya respondido bien. */
			if (Centinela[index].NpcIndex != 0) {
				if (Centinela[index].RevisandoUserIndex != 0) {
					UserList[Centinela[index].RevisandoUserIndex].flags.CentinelaIndex = 0;
					Centinela[index].RevisandoUserIndex = 0;
				}
				QuitarNPC(Centinela[index].NpcIndex);
				Centinela[index].NpcIndex = 0;
			}

			IdleCount = IdleCount + 1;
		}

	}

	/* 'Verificamos si ya debemos resetear la lista */
	int TActual;
	TActual = vb6::GetTickCount();

	if (checkInterval(centinelaStartTime, TActual, centinelaInterval)) {
		/* ' Espero a que terminen de controlar todos los centinelas */
		DetenerAsignacion = true;
	}

	/* ' Si hay algun centinela libre, se fija si no hay trabajadores disponibles para chequear */
	if (IdleCount != 0) {

		/* ' Si es tiempo de resetear flags, chequeo que no quede nadie activo */
		if (DetenerAsignacion) {

			/* ' No se completaron los ultimos chequeos */
			if (IdleCount < NRO_CENTINELA) {
				return;
			}

			/* ' Resetea todos los flags */
			ResetCentinelaInfo();
			DetenerAsignacion = false;

			/* ' Renuevo el contador de reseteo */
			RenovarResetTimer();

		}

		GoToNextWorkingChar();

	}
}
コード例 #21
0
ファイル: Comercio.cpp プロジェクト: irongete/dakara-server
/* ' @param Cantidad Specifies how many items in that slot are you trying to sell / buy */
void Comercio(eModoComercio Modo, int UserIndex, int NpcIndex, int Slot, int Cantidad) {
	/* '************************************************* */
	/* 'Author: Nacho (Integer) */
	/* 'Last modified: 07/06/2010 */
	/* '27/07/08 (MarKoxX) | New changes in the way of trading (now when you buy it rounds to ceil and when you sell it rounds to floor) */
	/* '  - 06/13/08 (NicoNZ) */
	/* '07/06/2010: ZaMa - Los objetos se loguean si superan la cantidad de 1k (antes era solo si eran 1k). */
	/* '************************************************* */
	int Precio;
	struct Obj Objeto;

	if (Cantidad < 1 || Slot < 1) {
		return;
	}

	if (Modo == eModoComercio_Compra) {
		if (Slot > MAX_INVENTORY_SLOTS) {
			return;
		} else if (Cantidad > MAX_INVENTORY_OBJS) {
			SendData(SendTarget_ToAll, 0,
					dakara::protocol::server::BuildConsoleMsg(
							UserList[UserIndex].Name + " ha sido baneado por el sistema anti-cheats.",
							FontTypeNames_FONTTYPE_FIGHT));
			Ban(UserList[UserIndex].Name, "Sistema Anti Cheats",
					"Intentar hackear el sistema de comercio. Quiso comprar demasiados ítems:" + vb6::CStr(Cantidad));
			UserList[UserIndex].flags.Ban = 1;
			WriteErrorMsg(UserIndex, "Has sido baneado por el Sistema AntiCheat.");
			FlushBuffer(UserIndex);
			CloseSocket(UserIndex);
			return;
		} else if (!(Npclist[NpcIndex].Invent.Object[Slot].Amount > 0)) {
			return;
		}

		if (Cantidad > Npclist[NpcIndex].Invent.Object[Slot].Amount) {
			Cantidad = Npclist[UserList[UserIndex].flags.TargetNPC].Invent.Object[Slot].Amount;
		}

		Objeto.Amount = Cantidad;
		Objeto.ObjIndex = Npclist[NpcIndex].Invent.Object[Slot].ObjIndex;

		/* 'El precio, cuando nos venden algo, lo tenemos que redondear para arriba. */
		/* 'Es decir, 1.1 = 2, por lo cual se hace de la siguiente forma Precio = Clng(PrecioFinal + 0.5) Siempre va a darte el proximo numero. O el "Techo" (MarKoxX) */

		Precio = vb6::CLng(
				(ObjData[Npclist[NpcIndex].Invent.Object[Slot].ObjIndex].Valor / Descuento(UserIndex)
						* Cantidad) + 0.5);

		if (UserList[UserIndex].Stats.GLD < Precio) {
			WriteConsoleMsg(UserIndex, "No tienes suficiente dinero.", FontTypeNames_FONTTYPE_INFO);
			return;
		}

		if (MeterItemEnInventario(UserIndex, Objeto) == false) {
			/* 'Call WriteConsoleMsg(UserIndex, "No puedes cargar mas objetos.", FontTypeNames.FONTTYPE_INFO) */
			EnviarNpcInv(UserIndex, UserList[UserIndex].flags.TargetNPC);
			WriteTradeOK(UserIndex);
			return;
		}

		UserList[UserIndex].Stats.GLD = UserList[UserIndex].Stats.GLD - Precio;

		QuitarNpcInvItem(UserList[UserIndex].flags.TargetNPC, vb6::CByte(Slot), Cantidad);

		/* 'Bien, ahora logueo de ser necesario. Pablo (ToxicWaste) 07/09/07 */
		/* 'Es un Objeto que tenemos que loguear? */
		if (ObjData[Objeto.ObjIndex].Log == 1) {
			LogDesarrollo(
					UserList[UserIndex].Name + " compró del NPC " + std::to_string(Objeto.Amount) + " "
							+ ObjData[Objeto.ObjIndex].Name);
			/* 'Es mucha cantidad? */
		} else if (Objeto.Amount >= 1000) {
			/* 'Si no es de los prohibidos de loguear, lo logueamos. */
			if (ObjData[Objeto.ObjIndex].NoLog != 1) {
				LogDesarrollo(
						UserList[UserIndex].Name + " compró del NPC " + std::to_string(Objeto.Amount) + " "
								+ ObjData[Objeto.ObjIndex].Name);
			}
		}

		/* 'Agregado para que no se vuelvan a vender las llaves si se recargan los .dat. */
		if (ObjData[Objeto.ObjIndex].OBJType == eOBJType_otLlaves) {
			WriteVar(GetDatPath(DATPATH::NPCs),
					"NPC" + vb6::CStr(Npclist[NpcIndex].Numero),
					"obj" + vb6::CStr(Slot),
					vb6::CStr(Objeto.ObjIndex) + "-0");
			logVentaCasa(UserList[UserIndex].Name + " compró " + ObjData[Objeto.ObjIndex].Name);
		}

	} else if (Modo == eModoComercio_Venta) {

		if (Cantidad > UserList[UserIndex].Invent.Object[Slot].Amount) {
			Cantidad = UserList[UserIndex].Invent.Object[Slot].Amount;
		}

		Objeto.Amount = Cantidad;
		Objeto.ObjIndex = UserList[UserIndex].Invent.Object[Slot].ObjIndex;

		if (Objeto.ObjIndex == 0) {
			return;

		} else if (ObjData[Objeto.ObjIndex].Intransferible == 1
				|| ObjData[Objeto.ObjIndex].NoComerciable == 1) {
			WriteConsoleMsg(UserIndex, "No puedes vender este tipo de objeto.", FontTypeNames_FONTTYPE_INFO);
			return;
		} else if ((Npclist[NpcIndex].TipoItems != ObjData[Objeto.ObjIndex].OBJType
				&& Npclist[NpcIndex].TipoItems != eOBJType_otCualquiera) || Objeto.ObjIndex == iORO) {
			WriteConsoleMsg(UserIndex, "Lo siento, no estoy interesado en este tipo de objetos.",
					FontTypeNames_FONTTYPE_INFO);
			EnviarNpcInv(UserIndex, UserList[UserIndex].flags.TargetNPC);
			WriteTradeOK(UserIndex);
			return;
		} else if (ObjData[Objeto.ObjIndex].Real == 1) {
			if (Npclist[NpcIndex].Name != "SR") {
				WriteConsoleMsg(UserIndex,
						"Las armaduras del ejército real sólo pueden ser vendidas a los sastres reales.",
						FontTypeNames_FONTTYPE_INFO);
				EnviarNpcInv(UserIndex, UserList[UserIndex].flags.TargetNPC);
				WriteTradeOK(UserIndex);
				return;
			}
		} else if (ObjData[Objeto.ObjIndex].Caos == 1) {
			if (Npclist[NpcIndex].Name != "SC") {
				WriteConsoleMsg(UserIndex,
						"Las armaduras de la legión oscura sólo pueden ser vendidas a los sastres del demonio.",
						FontTypeNames_FONTTYPE_INFO);
				EnviarNpcInv(UserIndex, UserList[UserIndex].flags.TargetNPC);
				WriteTradeOK(UserIndex);
				return;
			}
		} else if (UserList[UserIndex].Invent.Object[Slot].Amount < 0 || Cantidad == 0) {
			return;
		} else if (Slot<vb6::LBound(UserList[UserIndex].Invent.Object) || Slot>vb6::UBound(UserList[UserIndex].Invent.Object)) {
			EnviarNpcInv(UserIndex, UserList[UserIndex].flags.TargetNPC);
			return;
		} else if (UserTienePrivilegio(UserIndex, PlayerType_Consejero)) {
			WriteConsoleMsg(UserIndex, "No puedes vender ítems.", FontTypeNames_FONTTYPE_WARNING);
			EnviarNpcInv(UserIndex, UserList[UserIndex].flags.TargetNPC);
			WriteTradeOK(UserIndex);
			return;
		}

		QuitarUserInvItem(UserIndex, Slot, Cantidad);

		/* 'Precio = Round(ObjData(Objeto.ObjIndex).valor / REDUCTOR_PRECIOVENTA * Cantidad, 0) */
		Precio = vb6::Fix(SalePrice(Objeto.ObjIndex) * Cantidad);
		UserList[UserIndex].Stats.GLD = UserList[UserIndex].Stats.GLD + Precio;

		if (UserList[UserIndex].Stats.GLD > MAXORO) {
			UserList[UserIndex].Stats.GLD = MAXORO;
		}

		int NpcSlot;
		NpcSlot = SlotEnNPCInv(NpcIndex, Objeto.ObjIndex, Objeto.Amount);

		/* 'Slot valido */
		if (NpcSlot <= MAX_INVENTORY_SLOTS) {
			/* 'Mete el obj en el slot */
			Npclist[NpcIndex].Invent.Object[NpcSlot].ObjIndex = Objeto.ObjIndex;
			Npclist[NpcIndex].Invent.Object[NpcSlot].Amount = Npclist[NpcIndex].Invent.Object[NpcSlot].Amount
					+ Objeto.Amount;
			if (Npclist[NpcIndex].Invent.Object[NpcSlot].Amount > MAX_INVENTORY_OBJS) {
				Npclist[NpcIndex].Invent.Object[NpcSlot].Amount = MAX_INVENTORY_OBJS;
			}
		}

		/* 'Bien, ahora logueo de ser necesario. Pablo (ToxicWaste) 07/09/07 */
		/* 'Es un Objeto que tenemos que loguear? */
		if (ObjData[Objeto.ObjIndex].Log == 1) {
			LogDesarrollo(
					UserList[UserIndex].Name + " vendió al NPC " + std::to_string(Objeto.Amount) + " "
							+ ObjData[Objeto.ObjIndex].Name);
			/* 'Es mucha cantidad? */
		} else if (Objeto.Amount >= 1000) {
			/* 'Si no es de los prohibidos de loguear, lo logueamos. */
			if (ObjData[Objeto.ObjIndex].NoLog != 1) {
				LogDesarrollo(
						UserList[UserIndex].Name + " vendió al NPC " + std::to_string(Objeto.Amount) + " "
								+ ObjData[Objeto.ObjIndex].Name);
			}
		}

	}

	UpdateUserInv(true, UserIndex, 0);
	WriteUpdateUserStats(UserIndex);
	EnviarNpcInv(UserIndex, UserList[UserIndex].flags.TargetNPC);
	WriteTradeOK(UserIndex);

	SubirSkill(UserIndex, eSkill_Comerciar, true);
}
コード例 #22
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
void AprobarIngresoAParty(int leader, int NewMember) {
    /* '*************************************************** */
    /* 'Author: Unknown */
    /* 'Last Modification: 11/03/2010 */
    /* '11/03/2010: ZaMa - Le avisa al lider si intenta aceptar a alguien que sea mimebro de su propia party. */
    /* '*************************************************** */

    /* 'el UI es el leader */
    int PI;
    std::string razon;

    PI = UserList[leader].PartyIndex;

    if (UserList[NewMember].PartySolicitud == PI) {
        if (UserList[NewMember].flags.Muerto != 1) {
            if (UserList[NewMember].PartyIndex == 0) {
                if (Parties[PI]->PuedeEntrar(NewMember, razon)) {
                    if (Parties[PI]->NuevoMiembro(NewMember)) {
                        Parties[PI]->MandarMensajeAConsola(
                            UserList[leader].Name + " ha aceptado a " + UserList[NewMember].Name
                            + " en la party.", "Servidor");
                        UserList[NewMember].PartyIndex = PI;
                        UserList[NewMember].PartySolicitud = 0;
                    } else {
                        /* 'no pudo entrar */
                        /* 'ACA UNO PUEDE CODIFICAR OTRO TIPO DE ERRORES... */
                        SendData(SendTarget_ToAdmins, leader,
                                 dakara::protocol::server::BuildConsoleMsg(
                                     " Servidor> CATÁSTROFE EN PARTIES, NUEVOMIEMBRO DIO FALSE! :S ",
                                     FontTypeNames_FONTTYPE_PARTY));
                    }
                } else {
                    /* 'no debe entrar */
                    WriteConsoleMsg(leader, razon, FontTypeNames_FONTTYPE_PARTY);
                }
            } else {
                if (UserList[NewMember].PartyIndex == PI) {
                    WriteConsoleMsg(leader,
                                    vb6::LCase(UserList[NewMember].Name) + " ya es miembro de la party.",
                                    FontTypeNames_FONTTYPE_PARTY);
                } else {
                    WriteConsoleMsg(leader, UserList[NewMember].Name + " ya es miembro de otra party.",
                                    FontTypeNames_FONTTYPE_PARTY);
                }

                return;
            }
        } else {
            WriteConsoleMsg(leader, "¡Está muerto, no puedes aceptar miembros en ese estado!",
                            FontTypeNames_FONTTYPE_PARTY);
            return;
        }
    } else {
        if (UserList[NewMember].PartyIndex == PI) {
            WriteConsoleMsg(leader, vb6::LCase(UserList[NewMember].Name) + " ya es miembro de la party.",
                            FontTypeNames_FONTTYPE_PARTY);
        } else {
            WriteConsoleMsg(leader,
                            vb6::LCase(UserList[NewMember].Name) + " no ha solicitado ingresar a tu party.",
                            FontTypeNames_FONTTYPE_PARTY);
        }

        return;
    }

}
コード例 #23
0
void AceptarComercioUsu(int UserIndex) {
	/* '*************************************************** */
	/* 'Autor: Unkown */
	/* 'Last Modification: 06/05/2010 */
	/* '25/11/2009: ZaMa - Ahora se traspasan hasta 5 items + oro al comerciar */
	/* '06/05/2010: ZaMa - Ahora valida si los usuarios tienen los items que ofertan. */
	/* '*************************************************** */
	struct Obj TradingObj;
	int OtroUserIndex;
	int OfferSlot;

	UserList[UserIndex].ComUsu.Acepto = true;

	OtroUserIndex = UserList[UserIndex].ComUsu.DestUsu;

	/* ' User valido? */
	if (OtroUserIndex <= 0 || OtroUserIndex > MaxUsers) {
		FinComerciarUsu(UserIndex);
		return;
	}

	/* ' Acepto el otro? */
	if (UserList[OtroUserIndex].ComUsu.Acepto == false) {
		return;
	}

	/* ' Aceptaron ambos, chequeo que tengan los items que ofertaron */
	if (!HasOfferedItems(UserIndex)) {

		WriteConsoleMsg(UserIndex, "¡¡¡El comercio se canceló porque no posees los ítems que ofertaste!!!",
				FontTypeNames_FONTTYPE_FIGHT);
		WriteConsoleMsg(OtroUserIndex,
				"¡¡¡El comercio se canceló porque " + UserList[UserIndex].Name
						+ " no posee los ítems que ofertó!!!", FontTypeNames_FONTTYPE_FIGHT);

		FinComerciarUsu(UserIndex);
		FinComerciarUsu(OtroUserIndex);
		FlushBuffer(OtroUserIndex);

		return;

	} else if (!HasOfferedItems(OtroUserIndex)) {

		WriteConsoleMsg(UserIndex,
				"¡¡¡El comercio se canceló porque " + UserList[OtroUserIndex].Name
						+ " no posee los ítems que ofertó!!!", FontTypeNames_FONTTYPE_FIGHT);
		WriteConsoleMsg(OtroUserIndex,
				"¡¡¡El comercio se canceló porque no posees los ítems que ofertaste!!!",
				FontTypeNames_FONTTYPE_FIGHT);

		FinComerciarUsu(UserIndex);
		FinComerciarUsu(OtroUserIndex);
		FlushBuffer(OtroUserIndex);

		return;

	}

	/* ' Envio los items a quien corresponde */
	for (OfferSlot = (1); OfferSlot <= (MAX_OFFER_SLOTS + 1); OfferSlot++) {

		/* ' Items del 1er usuario */
		/* ' Le pasa el oro */
		if (OfferSlot == GOLD_OFFER_SLOT) {
			/* ' Quito la cantidad de oro ofrecida */
			UserList[UserIndex].Stats.GLD = UserList[UserIndex].Stats.GLD
					- UserList[UserIndex].ComUsu.GoldAmount;
			/* ' Log */
			if (UserList[UserIndex].ComUsu.GoldAmount >= MIN_GOLD_AMOUNT_LOG) {
				LogDesarrollo(
						UserList[UserIndex].Name + " soltó oro en comercio seguro con "
								+ UserList[OtroUserIndex].Name + ". Cantidad: "
								+ vb6::CStr(UserList[UserIndex].ComUsu.GoldAmount));
			}
			/* ' Update Usuario */
			WriteUpdateGold(UserIndex);
			/* ' Se la doy al otro */
			UserList[OtroUserIndex].Stats.GLD = UserList[OtroUserIndex].Stats.GLD
					+ UserList[UserIndex].ComUsu.GoldAmount;
			/* ' Update Otro Usuario */
			WriteUpdateGold(OtroUserIndex);

			/* ' Le pasa lo ofertado de los slots con items */
		} else if (UserList[UserIndex].ComUsu.Objeto[OfferSlot] > 0) {
			TradingObj.ObjIndex = UserList[UserIndex].ComUsu.Objeto[OfferSlot];
			TradingObj.Amount = UserList[UserIndex].ComUsu.cant[OfferSlot];

			/* 'Quita el objeto y se lo da al otro */
			if (!MeterItemEnInventario(OtroUserIndex, TradingObj)) {
				TirarItemAlPiso(UserList[OtroUserIndex].Pos, TradingObj);
			}

			QuitarObjetos(TradingObj.ObjIndex, TradingObj.Amount, UserIndex);

			/* 'Es un Objeto que tenemos que loguear? Pablo (ToxicWaste) 07/09/07 */
			if (((ObjData[TradingObj.ObjIndex].Log == 1)
					|| (ObjData[TradingObj.ObjIndex].OBJType == eOBJType_otLlaves))) {
				LogDesarrollo(
						UserList[UserIndex].Name + " le pasó en comercio seguro a "
								+ UserList[OtroUserIndex].Name + " " + vb6::CStr(TradingObj.Amount) + " "
								+ ObjData[TradingObj.ObjIndex].Name);
				/* 'Es mucha cantidad? */
			} else if (TradingObj.Amount >= MIN_AMOUNT_LOG) {
				/* 'Si no es de los prohibidos de loguear, lo logueamos. */
				if (ObjData[TradingObj.ObjIndex].NoLog != 1) {
					LogDesarrollo(
							UserList[UserIndex].Name + " le pasó en comercio seguro a "
									+ UserList[OtroUserIndex].Name + " " + vb6::CStr(TradingObj.Amount) + " "
									+ ObjData[TradingObj.ObjIndex].Name);
				}
			} else if ((TradingObj.Amount * ObjData[TradingObj.ObjIndex].Valor) >= MIN_VALUE_LOG) {
				/* 'Si no es de los prohibidos de loguear, lo logueamos. */
				if (ObjData[TradingObj.ObjIndex].NoLog != 1) {
					LogDesarrollo(
							UserList[UserIndex].Name + " le pasó en comercio seguro a "
									+ UserList[OtroUserIndex].Name + " " + vb6::CStr(TradingObj.Amount) + " "
									+ ObjData[TradingObj.ObjIndex].Name);
				}
			}
		}

		/* ' Items del 2do usuario */
		/* ' Le pasa el oro */
		if (OfferSlot == GOLD_OFFER_SLOT) {
			/* ' Quito la cantidad de oro ofrecida */
			UserList[OtroUserIndex].Stats.GLD = UserList[OtroUserIndex].Stats.GLD
					- UserList[OtroUserIndex].ComUsu.GoldAmount;
			/* ' Log */
			if (UserList[OtroUserIndex].ComUsu.GoldAmount >= MIN_GOLD_AMOUNT_LOG) {
				LogDesarrollo(
						UserList[OtroUserIndex].Name + " soltó oro en comercio seguro con "
								+ UserList[UserIndex].Name + ". Cantidad: "
								+ vb6::CStr(UserList[OtroUserIndex].ComUsu.GoldAmount));
			}
			/* ' Update Usuario */
			WriteUpdateGold(OtroUserIndex);
			/* 'y se la doy al otro */
			UserList[UserIndex].Stats.GLD = UserList[UserIndex].Stats.GLD
					+ UserList[OtroUserIndex].ComUsu.GoldAmount;

			/* ' Update Otro Usuario */
			WriteUpdateGold(UserIndex);

			/* ' Le pasa la oferta de los slots con items */
		} else if (UserList[OtroUserIndex].ComUsu.Objeto[OfferSlot] > 0) {
			TradingObj.ObjIndex = UserList[OtroUserIndex].ComUsu.Objeto[OfferSlot];
			TradingObj.Amount = UserList[OtroUserIndex].ComUsu.cant[OfferSlot];

			/* 'Quita el objeto y se lo da al otro */
			if (!MeterItemEnInventario(UserIndex, TradingObj)) {
				TirarItemAlPiso(UserList[UserIndex].Pos, TradingObj);
			}

			QuitarObjetos(TradingObj.ObjIndex, TradingObj.Amount, OtroUserIndex);

			/* 'Es un Objeto que tenemos que loguear? Pablo (ToxicWaste) 07/09/07 */
			if (((ObjData[TradingObj.ObjIndex].Log == 1)
					|| (ObjData[TradingObj.ObjIndex].OBJType == eOBJType_otLlaves))) {
				LogDesarrollo(
						UserList[OtroUserIndex].Name + " le pasó en comercio seguro a "
								+ UserList[UserIndex].Name + " " + vb6::CStr(TradingObj.Amount) + " "
								+ ObjData[TradingObj.ObjIndex].Name);
				/* 'Es mucha cantidad? */
			} else if (TradingObj.Amount >= MIN_AMOUNT_LOG) {
				/* 'Si no es de los prohibidos de loguear, lo logueamos. */
				if (ObjData[TradingObj.ObjIndex].NoLog != 1) {
					LogDesarrollo(
							UserList[OtroUserIndex].Name + " le pasó en comercio seguro a "
									+ UserList[UserIndex].Name + " " + vb6::CStr(TradingObj.Amount) + " "
									+ ObjData[TradingObj.ObjIndex].Name);
				}
			} else if ((TradingObj.Amount * ObjData[TradingObj.ObjIndex].Valor) >= MIN_VALUE_LOG) {
				/* 'Si no es de los prohibidos de loguear, lo logueamos. */
				if (ObjData[TradingObj.ObjIndex].NoLog != 1) {
					LogDesarrollo(
							UserList[OtroUserIndex].Name + " le pasó en comercio seguro a "
									+ UserList[UserIndex].Name + " " + vb6::CStr(TradingObj.Amount) + " "
									+ ObjData[TradingObj.ObjIndex].Name);
				}
			}
		}

	}

	/* ' End Trade */
	FinComerciarUsu(UserIndex);
	FinComerciarUsu(OtroUserIndex);
	FlushBuffer(OtroUserIndex);

}
コード例 #24
0
ファイル: Parties.cpp プロジェクト: irongete/dakara-server
void SolicitarIngresoAParty(int UserIndex) {
    /* '*************************************************** */
    /* 'Author: Unknown */
    /* 'Last Modification: 05/22/2010 (Marco) */
    /* ' - 05/22/2010 : staff members aren't allowed to party anyone. (Marco) */
    /* '18/09/2010: ZaMa - Ahora le avisa al funda de la party cuando alguien quiere ingresar a la misma. */
    /* '18/09/2010: ZaMa - Contemple mas ecepciones (solo se le puede mandar party al lider) */
    /* '*************************************************** */

    /* 'ESTO ES enviado por el PJ para solicitar el ingreso a la party */
    int TargetUserIndex;
    int PartyIndex;

    /* 'staff members aren't allowed to party anyone */
    if (!UserTienePrivilegio(UserIndex, PlayerType_User)) {
        WriteConsoleMsg(UserIndex, "¡Los miembros del staff no pueden unirse a partys!",
                        FontTypeNames_FONTTYPE_PARTY);
        return;
    }

    if (UserList[UserIndex].PartyIndex > 0) {
        /* 'si ya esta en una party */
        WriteConsoleMsg(UserIndex, "Ya perteneces a una party, escribe /SALIRPARTY para abandonarla",
                        FontTypeNames_FONTTYPE_PARTY);
        UserList[UserIndex].PartySolicitud = 0;
        return;
    }

    /* ' Muerto? */
    if (UserList[UserIndex].flags.Muerto == 1) {
        WriteConsoleMsg(UserIndex, "¡¡Estás muerto!!", FontTypeNames_FONTTYPE_INFO);
        UserList[UserIndex].PartySolicitud = 0;
        return;
    }

    TargetUserIndex = UserList[UserIndex].flags.TargetUser;
    /* ' Target valido? */
    if (TargetUserIndex > 0) {

        PartyIndex = UserList[TargetUserIndex].PartyIndex;
        /* ' Tiene party? */
        if (PartyIndex > 0) {

            /* ' Es el lider? */
            if (Parties[PartyIndex]->EsPartyLeader(TargetUserIndex)) {
                UserList[UserIndex].PartySolicitud = PartyIndex;
                WriteConsoleMsg(UserIndex, "El lider decidirá si te acepta en la party.",
                                FontTypeNames_FONTTYPE_PARTY);
                WriteConsoleMsg(TargetUserIndex, UserList[UserIndex].Name + " solicita ingresar a tu party.",
                                FontTypeNames_FONTTYPE_PARTY);

                /* ' No es lider */
            } else {
                WriteConsoleMsg(UserIndex, UserList[TargetUserIndex].Name + " no es lider de la party.",
                                FontTypeNames_FONTTYPE_PARTY);
            }

            /* ' No tiene party */
        } else {
            WriteConsoleMsg(UserIndex, UserList[TargetUserIndex].Name + " no pertenece a ninguna party.",
                            FontTypeNames_FONTTYPE_PARTY);
            UserList[UserIndex].PartySolicitud = 0;
            return;
        }

        /* ' Target inválido */
    } else {
        WriteConsoleMsg(UserIndex,
                        "Para ingresar a una party debes hacer click sobre el fundador y luego escribir /PARTY",
                        FontTypeNames_FONTTYPE_PARTY);
        UserList[UserIndex].PartySolicitud = 0;
    }

}
コード例 #25
0
ファイル: Npcs.cpp プロジェクト: irongete/dakara-server
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);
	}
}