[Bug Fix] Add locations where melee can be bound outside of a city. (#3887)

* [Bug Fix] Add locations where melee can be bound outside of a city.

* new line
This commit is contained in:
Fryguy 2024-01-07 15:01:54 -05:00 committed by GitHub
parent 9d5d13fbd0
commit 9b72c07a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 68 additions and 26 deletions

View File

@ -938,10 +938,8 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
#ifdef SPELL_EFFECT_SPAM #ifdef SPELL_EFFECT_SPAM
snprintf(effect_desc, _EDLEN, "Bind Affinity"); snprintf(effect_desc, _EDLEN, "Bind Affinity");
#endif #endif
if (IsClient()) if (IsClient()) {
{ if (CastToClient()->GetGM() || RuleB(Character, BindAnywhere)) {
if(CastToClient()->GetGM() || RuleB(Character, BindAnywhere))
{
auto action_packet = auto action_packet =
new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); new EQApplicationPacket(OP_Action, sizeof(Action_Struct));
Action_Struct* action = (Action_Struct*) action_packet->pBuffer; Action_Struct* action = (Action_Struct*) action_packet->pBuffer;
@ -965,34 +963,32 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
cd->hit_heading = action->hit_heading; cd->hit_heading = action->hit_heading;
CastToClient()->QueuePacket(action_packet); CastToClient()->QueuePacket(action_packet);
if(caster && caster->IsClient() && caster != this)
if (caster && caster->IsClient() && caster != this) {
caster->CastToClient()->QueuePacket(action_packet); caster->CastToClient()->QueuePacket(action_packet);
}
CastToClient()->QueuePacket(message_packet); CastToClient()->QueuePacket(message_packet);
if(caster && caster->IsClient() && caster != this)
if (caster && caster->IsClient() && caster != this) {
caster->CastToClient()->QueuePacket(message_packet); caster->CastToClient()->QueuePacket(message_packet);
}
CastToClient()->SetBindPoint(spells[spell_id].base_value[i] - 1); CastToClient()->SetBindPoint(spells[spell_id].base_value[i] - 1);
Save(); Save();
safe_delete(action_packet); safe_delete(action_packet);
safe_delete(message_packet); safe_delete(message_packet);
} } else {
else if (!zone->CanBind()) {
{
if(!zone->CanBind())
{
MessageString(Chat::SpellFailure, CANNOT_BIND); MessageString(Chat::SpellFailure, CANNOT_BIND);
break; break;
} }
if(!zone->IsCity())
{ if (!zone->IsCity()) {
if(caster != this) if (caster != this && !zone->IsSpecialBindLocation(GetPosition())) {
{
MessageString(Chat::SpellFailure, CANNOT_BIND); MessageString(Chat::SpellFailure, CANNOT_BIND);
break; break;
} } else {
else
{
auto action_packet = new EQApplicationPacket( auto action_packet = new EQApplicationPacket(
OP_Action, sizeof(Action_Struct)); OP_Action, sizeof(Action_Struct));
Action_Struct* action = (Action_Struct*) action_packet->pBuffer; Action_Struct* action = (Action_Struct*) action_packet->pBuffer;
@ -1016,21 +1012,23 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
cd->hit_heading = action->hit_heading; cd->hit_heading = action->hit_heading;
CastToClient()->QueuePacket(action_packet); CastToClient()->QueuePacket(action_packet);
if(caster->IsClient() && caster != this)
if (caster->IsClient() && caster != this) {
caster->CastToClient()->QueuePacket(action_packet); caster->CastToClient()->QueuePacket(action_packet);
}
CastToClient()->QueuePacket(message_packet); CastToClient()->QueuePacket(message_packet);
if(caster->IsClient() && caster != this)
if (caster->IsClient() && caster != this) {
caster->CastToClient()->QueuePacket(message_packet); caster->CastToClient()->QueuePacket(message_packet);
}
CastToClient()->SetBindPoint(spells[spell_id].base_value[i] - 1); CastToClient()->SetBindPoint(spells[spell_id].base_value[i] - 1);
Save(); Save();
safe_delete(action_packet); safe_delete(action_packet);
safe_delete(message_packet); safe_delete(message_packet);
} }
} } else {
else
{
auto action_packet = auto action_packet =
new EQApplicationPacket(OP_Action, sizeof(Action_Struct)); new EQApplicationPacket(OP_Action, sizeof(Action_Struct));
Action_Struct* action = (Action_Struct*) action_packet->pBuffer; Action_Struct* action = (Action_Struct*) action_packet->pBuffer;
@ -1054,13 +1052,17 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
cd->hit_heading = action->hit_heading; cd->hit_heading = action->hit_heading;
CastToClient()->QueuePacket(action_packet); CastToClient()->QueuePacket(action_packet);
if(caster->IsClient() && caster != this)
if (caster->IsClient() && caster != this) {
caster->CastToClient()->QueuePacket(action_packet); caster->CastToClient()->QueuePacket(action_packet);
}
CastToClient()->QueuePacket(message_packet); CastToClient()->QueuePacket(message_packet);
if(caster->IsClient() && caster != this)
caster->CastToClient()->QueuePacket(message_packet);
if (caster->IsClient() && caster != this) {
caster->CastToClient()->QueuePacket(message_packet);
}
CastToClient()->SetBindPoint(spells[spell_id].base_value[i] - 1); CastToClient()->SetBindPoint(spells[spell_id].base_value[i] - 1);
Save(); Save();
safe_delete(action_packet); safe_delete(action_packet);

View File

@ -304,6 +304,45 @@ bool Zone::LoadZoneObjects()
return true; return true;
} }
bool Zone::IsSpecialBindLocation(const glm::vec4& location)
{
glm::vec2 corner1;
glm::vec2 corner2;
switch (GetZoneID()) {
case Zones::NORTHKARANA:
corner1 = glm::vec2(-234, -741);
corner2 = glm::vec2(-127, -525);
break;
case Zones::OASIS:
corner1 = glm::vec2(90, 656);
corner2 = glm::vec2(-58, 471);
break;
case Zones::FIELDOFBONE:
corner1 = glm::vec2(265, -2213);
corner2 = glm::vec2(-506, -1255);
break;
case Zones::FIRIONA:
corner1 = glm::vec2(1065, -2609);
corner2 = glm::vec2(3511, -4534);
break;
case Zones::FRONTIERMTNS:
corner1 = glm::vec2(1554, -2106);
corner2 = glm::vec2(1206, -2333);
break;
case Zones::OVERTHERE:
corner1 = glm::vec2(3937, 3614);
corner2 = glm::vec2(2034, 2324);
break;
case Zones::ICECLAD:
corner1 = glm::vec2(3937, 3614);
corner2 = glm::vec2(510, 5365);
break;
default:
return false;
}
return IsWithinAxisAlignedBox(glm::vec2(location.x, location.y), corner1, corner2);
}
//this also just loads into entity_list, not really into zone //this also just loads into entity_list, not really into zone
bool Zone::LoadGroundSpawns() { bool Zone::LoadGroundSpawns() {
Ground_Spawns groundspawn; Ground_Spawns groundspawn;

View File

@ -139,6 +139,7 @@ public:
bool LoadGroundSpawns(); bool LoadGroundSpawns();
bool LoadZoneCFG(const char *filename, uint16 instance_version); bool LoadZoneCFG(const char *filename, uint16 instance_version);
bool LoadZoneObjects(); bool LoadZoneObjects();
bool IsSpecialBindLocation(const glm::vec4& location);
bool Process(); bool Process();
bool SaveZoneCFG(); bool SaveZoneCFG();