mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-27 14:42:25 +00:00
Added random graveyard corpse placement within +/- 20 units on X/Y axis to help spread corpses out.
This commit is contained in:
parent
96d146f73c
commit
508a731181
@ -97,6 +97,33 @@ namespace EQEmu {
|
|||||||
Reseed();
|
Reseed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//generates a psuedo-random float between 0.0 and 0.999...
|
||||||
|
float randfloat()
|
||||||
|
{
|
||||||
|
return rand()/(float(RAND_MAX)+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//generates a psuedo-random float between 0.0 and max
|
||||||
|
float randfloat(float max)
|
||||||
|
{
|
||||||
|
return randfloat()*max;
|
||||||
|
}
|
||||||
|
|
||||||
|
//generates a psuedo-random float between min and max
|
||||||
|
float randfloat(float min, float max)
|
||||||
|
{
|
||||||
|
if (min>max)
|
||||||
|
return randfloat()*(min-max)+max;
|
||||||
|
else
|
||||||
|
return randfloat()*(max-min)+min;
|
||||||
|
}
|
||||||
|
|
||||||
|
//generates a psuedo-random double between 0.0 and 0.999...
|
||||||
|
double randdouble()
|
||||||
|
{
|
||||||
|
return rand()/(double(RAND_MAX)+1);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::uniform_int_distribution<int>::param_type int_param_t;
|
typedef std::uniform_int_distribution<int>::param_type int_param_t;
|
||||||
typedef std::uniform_real_distribution<double>::param_type real_param_t;
|
typedef std::uniform_real_distribution<double>::param_type real_param_t;
|
||||||
|
|||||||
@ -3842,12 +3842,16 @@ uint32 ZoneDatabase::CreateGraveyardRecord(uint32 graveyard_zone_id, const glm::
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, uint16 instance_id, const glm::vec4& position) {
|
uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, uint16 instance_id, const glm::vec4& position) {
|
||||||
|
|
||||||
|
float xcorpse = (position.x + zone->random.randfloat(-20,20));
|
||||||
|
float ycorpse = (position.y + zone->random.randfloat(-20,20));
|
||||||
|
|
||||||
std::string query = StringFormat("UPDATE `character_corpses` "
|
std::string query = StringFormat("UPDATE `character_corpses` "
|
||||||
"SET `zone_id` = %u, `instance_id` = 0, "
|
"SET `zone_id` = %u, `instance_id` = 0, "
|
||||||
"`x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f, "
|
"`x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f, "
|
||||||
"`was_at_graveyard` = 1 "
|
"`was_at_graveyard` = 1 "
|
||||||
"WHERE `id` = %d",
|
"WHERE `id` = %d",
|
||||||
zone_id, position.x, position.y, position.z, position.w, dbid);
|
zone_id, xcorpse, ycorpse, position.z, position.w, dbid);
|
||||||
QueryDatabase(query);
|
QueryDatabase(query);
|
||||||
return dbid;
|
return dbid;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user