mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
Replaced GetX(), GetY(), GetZ(), and GetHeading() in Doors with GetPosition()
This commit is contained in:
parent
40d26b5bcf
commit
a70eadecf4
42
zone/bot.cpp
42
zone/bot.cpp
@ -15854,19 +15854,19 @@ std::list<Bot*> EntityList::GetBotsByBotOwnerCharacterID(uint32 botOwnerCharacte
|
|||||||
|
|
||||||
void EntityList::BotPickLock(Bot* rogue)
|
void EntityList::BotPickLock(Bot* rogue)
|
||||||
{
|
{
|
||||||
auto it = door_list.begin();
|
|
||||||
for (auto it = door_list.begin(); it != door_list.end(); ++it) {
|
for (auto it = door_list.begin(); it != door_list.end(); ++it) {
|
||||||
Doors *cdoor = it->second;
|
Doors *cdoor = it->second;
|
||||||
if(cdoor && !cdoor->IsDoorOpen()) {
|
if(!cdoor || cdoor->IsDoorOpen())
|
||||||
float zdiff = rogue->GetZ() - cdoor->GetZ();
|
continue;
|
||||||
if(zdiff < 0)
|
|
||||||
zdiff = 0 - zdiff;
|
auto diff = rogue->GetPosition() - cdoor->GetPosition();
|
||||||
float curdist = 0;
|
diff.ABS_XYZ();
|
||||||
float tmp = rogue->GetX() - cdoor->GetX();
|
|
||||||
curdist += (tmp * tmp);
|
float curdist = diff.m_X * diff.m_X + diff.m_Y * diff.m_Y;
|
||||||
tmp = rogue->GetY() - cdoor->GetY();
|
|
||||||
curdist += (tmp * tmp);
|
if((diff.m_Z * diff.m_Z >= 10) || (curdist > 130))
|
||||||
if((zdiff < 10) && (curdist <= 130)) {
|
continue;
|
||||||
|
|
||||||
// All rogue items with lock pick bonuses are hands or primary
|
// All rogue items with lock pick bonuses are hands or primary
|
||||||
const ItemInst* item1 = rogue->GetBotItem(MainHands);
|
const ItemInst* item1 = rogue->GetBotItem(MainHands);
|
||||||
const ItemInst* item2 = rogue->GetBotItem(MainPrimary);
|
const ItemInst* item2 = rogue->GetBotItem(MainPrimary);
|
||||||
@ -15875,27 +15875,19 @@ void EntityList::BotPickLock(Bot* rogue)
|
|||||||
float bonus2 = 0.0f;
|
float bonus2 = 0.0f;
|
||||||
float skill = rogue->GetSkill(SkillPickLock);
|
float skill = rogue->GetSkill(SkillPickLock);
|
||||||
|
|
||||||
if(item1) { // Hand slot item
|
if(item1) // Hand slot item
|
||||||
if(item1->GetItem()->SkillModType == SkillPickLock) {
|
if(item1->GetItem()->SkillModType == SkillPickLock)
|
||||||
bonus1 = skill * (((float)item1->GetItem()->SkillModValue) / 100.0f);
|
bonus1 = skill * (((float)item1->GetItem()->SkillModValue) / 100.0f);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(item2) { // Primary slot item
|
if(item2) // Primary slot item
|
||||||
if(item2->GetItem()->SkillModType == SkillPickLock) {
|
if(item2->GetItem()->SkillModType == SkillPickLock)
|
||||||
bonus2 = skill * (((float)item2->GetItem()->SkillModValue) / 100.0f);
|
bonus2 = skill * (((float)item2->GetItem()->SkillModValue) / 100.0f);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((skill+bonus1+bonus2) >= cdoor->GetLockpick()) {
|
if((skill+bonus1+bonus2) >= cdoor->GetLockpick())
|
||||||
cdoor->ForceOpen(rogue);
|
cdoor->ForceOpen(rogue);
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
rogue->Say("I am not skilled enough for this lock.");
|
rogue->Say("I am not skilled enough for this lock.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityList::RemoveBot(uint16 entityID) {
|
bool EntityList::RemoveBot(uint16 entityID) {
|
||||||
|
|||||||
@ -750,6 +750,6 @@ void Doors::CreateDatabaseEntry()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), GetX(), GetY(), GetZ(), GetHeading(), GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize());
|
database.InsertDoor(GetDoorDBID(), GetDoorID(), GetDoorName(), m_Position.m_X, m_Position.m_Y, m_Position.m_Z, m_Position.m_Heading, GetOpenType(), GetGuildID(), GetLockpick(), GetKeyItem(), GetDoorParam(), GetInvertState(), GetIncline(), GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,10 +25,7 @@ public:
|
|||||||
char* GetDoorName() { return door_name; }
|
char* GetDoorName() { return door_name; }
|
||||||
uint32 GetDoorParam() { return door_param; }
|
uint32 GetDoorParam() { return door_param; }
|
||||||
int GetInvertState() { return invert_state; }
|
int GetInvertState() { return invert_state; }
|
||||||
float GetX() { return m_Position.m_X; }
|
const xyz_heading GetPosition() const{ return m_Position; }
|
||||||
float GetY() { return m_Position.m_Y; }
|
|
||||||
float GetZ() { return m_Position.m_Z; }
|
|
||||||
float GetHeading() { return m_Position.m_Heading; }
|
|
||||||
int GetIncline() { return incline; }
|
int GetIncline() { return incline; }
|
||||||
bool triggered;
|
bool triggered;
|
||||||
void SetOpenState(bool st) { isopen = st; }
|
void SetOpenState(bool st) { isopen = st; }
|
||||||
|
|||||||
@ -855,10 +855,11 @@ bool EntityList::MakeDoorSpawnPacket(EQApplicationPacket *app, Client *client)
|
|||||||
strlen(door->GetDoorName()) > 3) {
|
strlen(door->GetDoorName()) > 3) {
|
||||||
memset(&nd, 0, sizeof(nd));
|
memset(&nd, 0, sizeof(nd));
|
||||||
memcpy(nd.name, door->GetDoorName(), 32);
|
memcpy(nd.name, door->GetDoorName(), 32);
|
||||||
nd.xPos = door->GetX();
|
auto position = door->GetPosition();
|
||||||
nd.yPos = door->GetY();
|
nd.xPos = position.m_X;
|
||||||
nd.zPos = door->GetZ();
|
nd.yPos = position.m_Y;
|
||||||
nd.heading = door->GetHeading();
|
nd.zPos = position.m_Z;
|
||||||
|
nd.heading = position.m_Heading;
|
||||||
nd.incline = door->GetIncline();
|
nd.incline = door->GetIncline();
|
||||||
nd.size = door->GetSize();
|
nd.size = door->GetSize();
|
||||||
nd.doorId = door->GetDoorID();
|
nd.doorId = door->GetDoorID();
|
||||||
@ -3085,23 +3086,20 @@ void EntityList::AddHealAggro(Mob *target, Mob *caster, uint16 thedam)
|
|||||||
|
|
||||||
void EntityList::OpenDoorsNear(NPC *who)
|
void EntityList::OpenDoorsNear(NPC *who)
|
||||||
{
|
{
|
||||||
auto it = door_list.begin();
|
|
||||||
while (it != door_list.end()) {
|
for (auto it = door_list.begin();it != door_list.end(); ++it) {
|
||||||
Doors *cdoor = it->second;
|
Doors *cdoor = it->second;
|
||||||
if (cdoor && !cdoor->IsDoorOpen()) {
|
if (!cdoor || cdoor->IsDoorOpen())
|
||||||
float zdiff = who->GetZ() - cdoor->GetZ();
|
continue;
|
||||||
if (zdiff < 0)
|
|
||||||
zdiff = 0 - zdiff;
|
auto diff = who->GetPosition() - cdoor->GetPosition();
|
||||||
float curdist = 0;
|
diff.ABS_XYZ();
|
||||||
float tmp = who->GetX() - cdoor->GetX();
|
|
||||||
curdist += tmp * tmp;
|
float curdist = diff.m_X * diff.m_X + diff.m_Y * diff.m_Y;
|
||||||
tmp = who->GetY() - cdoor->GetY();
|
|
||||||
curdist += tmp * tmp;
|
if (diff.m_Z * diff.m_Z < 10 && curdist <= 100)
|
||||||
if (zdiff < 10 && curdist <= 100)
|
|
||||||
cdoor->NPCOpen(who);
|
cdoor->NPCOpen(who);
|
||||||
}
|
}
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityList::SendAlarm(Trap *trap, Mob *currenttarget, uint8 kos)
|
void EntityList::SendAlarm(Trap *trap, Mob *currenttarget, uint8 kos)
|
||||||
|
|||||||
@ -20,22 +20,22 @@ const char *Lua_Door::GetDoorName() {
|
|||||||
|
|
||||||
float Lua_Door::GetX() {
|
float Lua_Door::GetX() {
|
||||||
Lua_Safe_Call_Real();
|
Lua_Safe_Call_Real();
|
||||||
return self->GetX();
|
return self->GetPosition().m_X;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Lua_Door::GetY() {
|
float Lua_Door::GetY() {
|
||||||
Lua_Safe_Call_Real();
|
Lua_Safe_Call_Real();
|
||||||
return self->GetY();
|
return self->GetPosition().m_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Lua_Door::GetZ() {
|
float Lua_Door::GetZ() {
|
||||||
Lua_Safe_Call_Real();
|
Lua_Safe_Call_Real();
|
||||||
return self->GetZ();
|
return self->GetPosition().m_Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Lua_Door::GetHeading() {
|
float Lua_Door::GetHeading() {
|
||||||
Lua_Safe_Call_Real();
|
Lua_Safe_Call_Real();
|
||||||
return self->GetHeading();
|
return self->GetPosition().m_Heading;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lua_Door::SetX(float x) {
|
void Lua_Door::SetX(float x) {
|
||||||
|
|||||||
@ -138,7 +138,7 @@ XS(XS_Doors_GetX)
|
|||||||
if(THIS == nullptr)
|
if(THIS == nullptr)
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||||
|
|
||||||
RETVAL = THIS->GetX();
|
RETVAL = THIS->GetPosition().m_X;
|
||||||
XSprePUSH; PUSHn((double)RETVAL);
|
XSprePUSH; PUSHn((double)RETVAL);
|
||||||
}
|
}
|
||||||
XSRETURN(1);
|
XSRETURN(1);
|
||||||
@ -164,7 +164,7 @@ XS(XS_Doors_GetY)
|
|||||||
if(THIS == nullptr)
|
if(THIS == nullptr)
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||||
|
|
||||||
RETVAL = THIS->GetY();
|
RETVAL = THIS->GetPosition().m_Y;
|
||||||
XSprePUSH; PUSHn((double)RETVAL);
|
XSprePUSH; PUSHn((double)RETVAL);
|
||||||
}
|
}
|
||||||
XSRETURN(1);
|
XSRETURN(1);
|
||||||
@ -190,7 +190,7 @@ XS(XS_Doors_GetZ)
|
|||||||
if(THIS == nullptr)
|
if(THIS == nullptr)
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||||
|
|
||||||
RETVAL = THIS->GetZ();
|
RETVAL = THIS->GetPosition().m_Z;
|
||||||
XSprePUSH; PUSHn((double)RETVAL);
|
XSprePUSH; PUSHn((double)RETVAL);
|
||||||
}
|
}
|
||||||
XSRETURN(1);
|
XSRETURN(1);
|
||||||
@ -216,7 +216,7 @@ XS(XS_Doors_GetHeading)
|
|||||||
if(THIS == nullptr)
|
if(THIS == nullptr)
|
||||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||||
|
|
||||||
RETVAL = THIS->GetHeading();
|
RETVAL = THIS->GetPosition().m_Heading;
|
||||||
XSprePUSH; PUSHn((double)RETVAL);
|
XSprePUSH; PUSHn((double)RETVAL);
|
||||||
}
|
}
|
||||||
XSRETURN(1);
|
XSRETURN(1);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user