mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Post PR blocked spells formatting
This commit is contained in:
parent
206b769731
commit
b8624d0488
@ -459,4 +459,9 @@ enum ChatChannelNames : uint16
|
|||||||
ChatChannel_Emotes = 22
|
ChatChannel_Emotes = 22
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace ZoneBlockedSpellTypes {
|
||||||
|
const uint8 ZoneWide = 1;
|
||||||
|
const uint8 Region = 2;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||||
|
|||||||
@ -803,7 +803,7 @@ Json::Value ApiGetZoneAttributes(EQ::Net::WebsocketServerConnection *connection,
|
|||||||
row["mobs_aggro_count"] = zone->MobsAggroCount();
|
row["mobs_aggro_count"] = zone->MobsAggroCount();
|
||||||
row["save_zone_cfg"] = zone->SaveZoneCFG();
|
row["save_zone_cfg"] = zone->SaveZoneCFG();
|
||||||
row["short_name"] = zone->GetShortName();
|
row["short_name"] = zone->GetShortName();
|
||||||
row["total_blocked_spells"] = zone->GetTotalBlockedSpells();
|
row["total_blocked_spells"] = zone->GetZoneTotalBlockedSpells();
|
||||||
row["zone_id"] = zone->GetZoneID();
|
row["zone_id"] = zone->GetZoneID();
|
||||||
row["zone_type"] = zone->GetZoneType();
|
row["zone_type"] = zone->GetZoneType();
|
||||||
|
|
||||||
|
|||||||
112
zone/zone.cpp
112
zone/zone.cpp
@ -825,7 +825,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
|||||||
zone_weather = 0;
|
zone_weather = 0;
|
||||||
weather_intensity = 0;
|
weather_intensity = 0;
|
||||||
blocked_spells = nullptr;
|
blocked_spells = nullptr;
|
||||||
totalBS = 0;
|
zone_total_blocked_spells = 0;
|
||||||
zone_has_current_time = false;
|
zone_has_current_time = false;
|
||||||
|
|
||||||
Instance_Shutdown_Timer = nullptr;
|
Instance_Shutdown_Timer = nullptr;
|
||||||
@ -972,7 +972,7 @@ bool Zone::Init(bool iStaticZone) {
|
|||||||
|
|
||||||
//load up the zone's doors (prints inside)
|
//load up the zone's doors (prints inside)
|
||||||
zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion());
|
zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion());
|
||||||
zone->LoadBlockedSpells(zone->GetZoneID());
|
zone->LoadZoneBlockedSpells(zone->GetZoneID());
|
||||||
|
|
||||||
//clear trader items if we are loading the bazaar
|
//clear trader items if we are loading the bazaar
|
||||||
if(strncasecmp(short_name,"bazaar",6)==0) {
|
if(strncasecmp(short_name,"bazaar",6)==0) {
|
||||||
@ -1880,17 +1880,21 @@ bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct *npcCorpseDecayTimes)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zone::weatherSend(Client* client)
|
void Zone::weatherSend(Client *client)
|
||||||
{
|
{
|
||||||
auto outapp = new EQApplicationPacket(OP_Weather, 8);
|
auto outapp = new EQApplicationPacket(OP_Weather, 8);
|
||||||
if(zone_weather>0)
|
if (zone_weather > 0) {
|
||||||
outapp->pBuffer[0] = zone_weather-1;
|
outapp->pBuffer[0] = zone_weather - 1;
|
||||||
if(zone_weather>0)
|
}
|
||||||
|
if (zone_weather > 0) {
|
||||||
outapp->pBuffer[4] = zone->weather_intensity;
|
outapp->pBuffer[4] = zone->weather_intensity;
|
||||||
if (client)
|
}
|
||||||
|
if (client) {
|
||||||
client->QueuePacket(outapp);
|
client->QueuePacket(outapp);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
entity_list.QueueClients(0, outapp);
|
entity_list.QueueClients(0, outapp);
|
||||||
|
}
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1908,15 +1912,13 @@ void Zone::SetGraveyard(uint32 zoneid, const glm::vec4& graveyardPosition) {
|
|||||||
m_Graveyard = graveyardPosition;
|
m_Graveyard = graveyardPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zone::LoadBlockedSpells(uint32 zoneid)
|
void Zone::LoadZoneBlockedSpells(uint32 zone_id)
|
||||||
{
|
{
|
||||||
if(!blocked_spells)
|
if (!blocked_spells) {
|
||||||
{
|
zone_total_blocked_spells = database.GetBlockedSpellsCount(zone_id);
|
||||||
totalBS = database.GetBlockedSpellsCount(zoneid);
|
if (zone_total_blocked_spells > 0) {
|
||||||
if(totalBS > 0){
|
blocked_spells = new ZoneSpellsBlocked[zone_total_blocked_spells];
|
||||||
blocked_spells = new ZoneSpellsBlocked[totalBS];
|
if (!database.LoadBlockedSpells(zone_total_blocked_spells, blocked_spells, zone_id)) {
|
||||||
if(!database.LoadBlockedSpells(totalBS, blocked_spells, zoneid))
|
|
||||||
{
|
|
||||||
Log(Logs::General, Logs::Error, "... Failed to load blocked spells.");
|
Log(Logs::General, Logs::Error, "... Failed to load blocked spells.");
|
||||||
ClearBlockedSpells();
|
ClearBlockedSpells();
|
||||||
}
|
}
|
||||||
@ -1926,93 +1928,89 @@ void Zone::LoadBlockedSpells(uint32 zoneid)
|
|||||||
|
|
||||||
void Zone::ClearBlockedSpells()
|
void Zone::ClearBlockedSpells()
|
||||||
{
|
{
|
||||||
if(blocked_spells){
|
if (blocked_spells) {
|
||||||
safe_delete_array(blocked_spells);
|
safe_delete_array(blocked_spells);
|
||||||
totalBS = 0;
|
zone_total_blocked_spells = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Zone::IsSpellBlocked(uint32 spell_id, const glm::vec3& location)
|
bool Zone::IsSpellBlocked(uint32 spell_id, const glm::vec3 &location)
|
||||||
{
|
{
|
||||||
if (blocked_spells)
|
if (blocked_spells) {
|
||||||
{
|
|
||||||
bool exception = false;
|
bool exception = false;
|
||||||
bool block_all = false;
|
bool block_all = false;
|
||||||
for (int x = 0; x < totalBS; x++)
|
|
||||||
{
|
for (int x = 0; x < GetZoneTotalBlockedSpells(); x++) {
|
||||||
if (blocked_spells[x].spellid == spell_id)
|
if (blocked_spells[x].spellid == spell_id) {
|
||||||
{
|
|
||||||
exception = true;
|
exception = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blocked_spells[x].spellid == 0)
|
if (blocked_spells[x].spellid == 0) {
|
||||||
{
|
|
||||||
block_all = true;
|
block_all = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all spells are blocked and this is an exception, it is not blocked
|
// If all spells are blocked and this is an exception, it is not blocked
|
||||||
if (block_all && exception)
|
if (block_all && exception) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < totalBS; x++)
|
for (int x = 0; x < GetZoneTotalBlockedSpells(); x++) {
|
||||||
{
|
|
||||||
// Spellid of 0 matches all spells
|
// Spellid of 0 matches all spells
|
||||||
if (0 != blocked_spells[x].spellid && spell_id != blocked_spells[x].spellid)
|
if (0 != blocked_spells[x].spellid && spell_id != blocked_spells[x].spellid) {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (blocked_spells[x].type)
|
switch (blocked_spells[x].type) {
|
||||||
{
|
case ZoneBlockedSpellTypes::ZoneWide: {
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case ZoneBlockedSpellTypes::Region: {
|
||||||
{
|
if (IsWithinAxisAlignedBox(
|
||||||
if (IsWithinAxisAlignedBox(location, blocked_spells[x].m_Location - blocked_spells[x].m_Difference, blocked_spells[x].m_Location + blocked_spells[x].m_Difference))
|
location,
|
||||||
|
blocked_spells[x].m_Location - blocked_spells[x].m_Difference,
|
||||||
|
blocked_spells[x].m_Location + blocked_spells[x].m_Difference
|
||||||
|
)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* Zone::GetSpellBlockedMessage(uint32 spell_id, const glm::vec3& location)
|
const char *Zone::GetSpellBlockedMessage(uint32 spell_id, const glm::vec3 &location)
|
||||||
{
|
{
|
||||||
if(blocked_spells)
|
if (blocked_spells) {
|
||||||
{
|
for (int x = 0; x < GetZoneTotalBlockedSpells(); x++) {
|
||||||
for(int x = 0; x < totalBS; x++)
|
if (spell_id != blocked_spells[x].spellid && blocked_spells[x].spellid != 0) {
|
||||||
{
|
|
||||||
if(spell_id != blocked_spells[x].spellid && blocked_spells[x].spellid != 0)
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch(blocked_spells[x].type)
|
switch (blocked_spells[x].type) {
|
||||||
{
|
case ZoneBlockedSpellTypes::ZoneWide: {
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
return blocked_spells[x].message;
|
return blocked_spells[x].message;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case ZoneBlockedSpellTypes::Region: {
|
||||||
{
|
if (IsWithinAxisAlignedBox(
|
||||||
if(IsWithinAxisAlignedBox(location, blocked_spells[x].m_Location - blocked_spells[x].m_Difference, blocked_spells[x].m_Location + blocked_spells[x].m_Difference))
|
location,
|
||||||
|
blocked_spells[x].m_Location - blocked_spells[x].m_Difference,
|
||||||
|
blocked_spells[x].m_Location + blocked_spells[x].m_Difference
|
||||||
|
)) {
|
||||||
return blocked_spells[x].message;
|
return blocked_spells[x].message;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -162,7 +162,7 @@ public:
|
|||||||
inline void SetZoneHasCurrentTime(bool time) { zone_has_current_time = time; }
|
inline void SetZoneHasCurrentTime(bool time) { zone_has_current_time = time; }
|
||||||
inline void ShowNPCGlobalLoot(Client *to, NPC *who) { m_global_loot.ShowNPCGlobalLoot(to, who); }
|
inline void ShowNPCGlobalLoot(Client *to, NPC *who) { m_global_loot.ShowNPCGlobalLoot(to, who); }
|
||||||
inline void ShowZoneGlobalLoot(Client *to) { m_global_loot.ShowZoneGlobalLoot(to); }
|
inline void ShowZoneGlobalLoot(Client *to) { m_global_loot.ShowZoneGlobalLoot(to); }
|
||||||
int GetTotalBlockedSpells() { return totalBS; }
|
int GetZoneTotalBlockedSpells() { return zone_total_blocked_spells; }
|
||||||
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
|
int SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charges, bool sold = false);
|
||||||
int32 MobsAggroCount() { return aggroedmobs; }
|
int32 MobsAggroCount() { return aggroedmobs; }
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ public:
|
|||||||
void LoadAdventureFlavor();
|
void LoadAdventureFlavor();
|
||||||
void LoadAlternateAdvancement();
|
void LoadAlternateAdvancement();
|
||||||
void LoadAlternateCurrencies();
|
void LoadAlternateCurrencies();
|
||||||
void LoadBlockedSpells(uint32 zoneid);
|
void LoadZoneBlockedSpells(uint32 zone_id);
|
||||||
void LoadLDoNTrapEntries();
|
void LoadLDoNTrapEntries();
|
||||||
void LoadLDoNTraps();
|
void LoadLDoNTraps();
|
||||||
void LoadLevelEXPMods();
|
void LoadLevelEXPMods();
|
||||||
@ -348,7 +348,7 @@ private:
|
|||||||
glm::vec3 m_SafePoint;
|
glm::vec3 m_SafePoint;
|
||||||
glm::vec4 m_Graveyard;
|
glm::vec4 m_Graveyard;
|
||||||
int default_ruleset;
|
int default_ruleset;
|
||||||
int totalBS;
|
int zone_total_blocked_spells;
|
||||||
int npc_position_update_distance;
|
int npc_position_update_distance;
|
||||||
int32 aggroedmobs;
|
int32 aggroedmobs;
|
||||||
uint8 zone_type;
|
uint8 zone_type;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user