Disable CotH on a Per-Zone Basis
After seeing a request by Kingmort to have a CotH version of the canlevitate and castoutdoor code for the Zone table, I thought that I could maybe handle writing this code. I work pretty well by example, so I looked at the code written by Magoth78 and by Qadar and it looked pretty straight forward.
I just changed what they had already done to add in a coth version. The only part that took any thinking on my end was figuring out how to get it to use a spell ID instead of the things they had it check for levitate and outdoor spells. The rest was pretty simple. So, here is the code to allow you to restrict Call of the Hero from being used in any zone you desire: In /zone/spells.cpp After: Code:
if(IsEffectInSpell(spell_id, SE_Levitate) && !zone->CanLevitate()){ Code:
if(spell_id == 1771 && !zone->CanCotH()){ Code:
After - bool CanCastOutdoor() const {return(can_castoutdoor);} //qadar Code:
- if(!database.GetZoneCFG(database.GetZoneID(filename), &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor, is_city)) { /zone/zonedb.h Code:
-bool GetZoneCFG(int32 zoneid, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city); In /zone/zonedb.cpp Remove: Code:
bool ZoneDatabase::GetZoneCFG(int32 zoneid, NewZone_Struct *zone_data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city) { Code:
bool ZoneDatabase::GetZoneCFG(int32 zoneid, NewZone_Struct *zone_data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city, bool &can_coth) { Required SQL: Code:
alter table `zone` add column `cancoth` tinyint (4) DEFAULT '1' NOT NULL after `castoutdoor`; I have tested this quickly just now after adding it and it seems to work as intended. I will keep an eye out for any further issues with this code. If anyone else wishes to try it, feel free, and post your results. |
I think we need a solution that works for areas of zones instead of just entire zones.
|
Ya, that would be nice. That would go well beyond my coding skill level lol. IMO, disabling per zone should work well in most cases. I can't really think of many cases where I would like to have CotH available in a zone, but not in 1 section of it. In most cases, I think disabling for the entire zone would be just fine. Just my opinion though.
I am not really sure how you would disable it for a certain area. It seems like it would be very complex to add in a defined area to limit CotH. IMO, the best way to remove CotH from a certain area would probably be to use quests instead of code. Then, just use a quest with a proximity that encompasses the entire area you want to remove coth from and use some kind of check for players casting spell 1771 within that proximity and have it duck the player or cancel the spell in another way. |
I was thinking a bit more about it and maybe the cancoth field could be set to allow more input. If it could be set so that 0 disables coth for the entire zone, and 1 enables it for the entire zone, and then have another option of setting which could be option 2,x,y,z,xr,yr,zr. If this option 2 could then have more information included with it, maybe you could set this up as a proximity to define areas.
It could pull the values from a comma separated input something like: Code:
cancoth I think the code I have posted here would do part of what is needed to get this set, but you would have to change the input type in the field to accept the additional input. There would also have to be some code added that will allow you to define the proximity. Maybe looking into the code for setting quest proximities would help to figure out what needs to be added to get it working to do this. |
Quote:
Then again, I think this could be taken a step further: why just CotH, Lev, & SoW manually blocked in the code? Why not make it apply to any spell you want? Just thinking out loud, you could define a table, maybe blocked_spells, with the spell id, type of block (using 1 & 2 like you suggested), zone id, and coordinates/sizes. Here would be an example: Code:
| id | spellid | type | zoneid | x | y | z | l | w | h | In the code, you could then just run a check when the spell is cast to see if the spell is restricted in the table, and then if you are standing in the coordinates if they are defined. If you are, return false (causing the spell not to be cast) w/ an client that you can use that spell there. Hell, you could just define a message to the client in the same table. Thoughts? |
Ya, another table would probably be best. I was just trying to avoid having to add another table to do this. Though, it would be nice to have the option to block any spell in any area.
From what I can tell, it looks like this is where set_proximity is defined for quests: questmgr.cpp Code:
void QuestManager::set_proximity(float minx, float maxx, float miny, float maxy, float minz, float maxz) { This is definitely getting beyond my level of code understanding though, lol. I can normally find where the code is or examples to work from, but as far as figuring out exactly what needs to be changed to get something working, I am not very good at that. |
Quote:
I'd like to try & tackle this, but unfortunately I don't know if I have the time available right now to do so :-\ If I do get some extra time, I'll see what I can come up with :-) |
http://www.eqemulator.net/forums/showthread.php?t=24208
This never got added in, but roamboxes use a similar method for specifying a section of zone. Perhaps you can take a look at Ailia's code in there and see if you can adapt it to the zone part of the database, instead of roamboxes? PS: off topic, but can we have advnpcspawn added? I'm tired of people using #npcspawn and not knowing how the schema works. It's more good as a learning tool than anything. It also adds roamboxes, which are a good replacement for grids. |
trevius;
Are you still using the original version of this fix, or have you changed it any? Also, would an SQL of zones that use this be possible? Thanks |
Ya, I am still using the original code change that I posted. I think it works just fine and I am pretty sure it was done on a per zone basis for EQLive. I wouldn't mind having a way to define proximities that stop certain spells from being casted. But, I think that the per zone limits meets any needs I would have for disabling CotH. I don't really need to be too specific about limiting it.
I don't have a list of which zones didn't allow it. The only one I can think of off the top of my head that I am pretty sure didn't allow CotH is Ssra Temple, but then again, that might have only been for the emperor area lol... Been too long. |
Quote:
In zone/zonedb.h, after Code:
47 struct PetRecord { Code:
// Spell Blocking by AndMetal Code:
277 /* Code:
// Spell Blocking by AndMetal Code:
1268 /* Code:
/* Spell Blocking by AndMetal Code:
1254 // angelox start Code:
// Spell Blocking by AndMetal Code:
DROP TABLE IF EXISTS `blocked_spells`; Code:
INSERT INTO blocked_spells (spellid, type, zoneid, description) VALUES (1771, 1, 71, 'Prevent CoH in airplane') |
Quote:
|
Quote:
|
Just a quick note in case you want to use the same text as on live when CoH isn't working instead of a generic can't use message. It said:
A voice whispers in your mind: "There are no heroes here..." |
All times are GMT -4. The time now is 01:56 PM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.