View Single Post
  #12  
Old 04-16-2008, 09:06 AM
TheLieka
Developer
 
Join Date: Oct 2004
Location: THE ATL (wut wut)
Posts: 325
Default

I know it's not 100% perfect, but this is how we did it (same type of approach that Angelox was talking about). I hardcoded a list of city zones, and if you're not a caster, you cannot bind or be bound outside of those zones (note: this list only goes up to luclin - but since our server is Old World only, it's overkill for us ).

Anyway, it could be easily expanded upon if anyone was interested in using it.

Currently, it says:
If the zone is not listed as "CanBind" in the zones table, then you cannot bind (unless you're a GM).
If the zone isn't in the hardcoded list of cities, and you're not a caster, then you cannot bind (unless you're a GM).
Otherwise, you can bind.

It's not beautiful, and I would like to clean it up and put it into the database, but honestly, it gets its job done, so I haven't messed with it. If anyone else wants to use it, be my guest.

Dax

./zone/zone.h
Code:
void	SetGraveyard(int32 zoneid, int32 x, int32 y, int32 z, int32 heading);
	bool	IsCity(int32 zoneid); //Lieka Edit:  Put in for melee binding rules
./zone/zone.cpp
Code:
	void Zone::SetGraveyard(int32 zoneid, int32 x, int32 y, int32 z, int32 heading) {
	pgraveyard_zoneid = zoneid;
	pgraveyard_x = x;
	pgraveyard_y = y;
	pgraveyard_z = z;
	pgraveyard_heading = heading;
}
	bool Zone::IsCity(int32 zoneid) {
	if ((zoneid == 1) || //South Qeynos
		(zoneid == 2) || //North Qeynos
		(zoneid == 3) || //Surefall Glade
		(zoneid == 8) || //North Freeport
		(zoneid == 9) || //West Freeport
		(zoneid == 10) || //East Freeport
		(zoneid == 19) || //Rivervale
		(zoneid == 23) || //Erudin Palace
		(zoneid == 24) || //Erudin
		(zoneid == 29) || //Halas
		(zoneid == 40) || //Neriak Foreign Quarter
		(zoneid == 41) || //Neriak Commons
		(zoneid == 42) || //Neriak Third Gate
		(zoneid == 45) || //Qeynos Aqueduct Systems
		(zoneid == 49) || //Oggok
		(zoneid == 52) || //Grobb
		(zoneid == 54) || //Greateer Faydark
		(zoneid == 55) || //Ak`Anon
		(zoneid == 60) || //South Kaladim
		(zoneid == 61) || //Northern Felwithe
		(zoneid == 62) || //Southern Felwithe
		(zoneid == 67) || //Northern Kaladim
		(zoneid == 75) || //Paineel
		(zoneid == 82) || //Cabilis West
		(zoneid == 83) || //Swamp of No Hope
		(zoneid == 106) || //Cabilis East
		(zoneid == 155)) { //The City of Shar Vahl
			return true;
	} else {
			return false;
	}
}

./zone/spell_effects.cpp
Code:
			case SE_BindAffinity:
			{
#ifdef SPELL_EFFECT_SPAM
				snprintf(effect_desc, _EDLEN, "Bind Affinity");
#endif
				if (IsClient())
				{
					if((!zone->CanBind() && !CastToClient()->GetGM())){
						Message(13, "It would be very difficult for anyone to form an affinity with this area.");
						break;
				} else if ( ((!zone->IsCity(zone->GetZoneID())) && ((GetClass() != DRUID) && (GetClass() != CLERIC) && (GetClass() != SHAMAN) && (GetClass() != WIZARD) && (GetClass() != ENCHANTER) && (GetClass() != MAGICIAN) && (GetClass() != NECROMANCER)) && !CastToClient()->GetGM())){
						Message(13, "You cannot form an affinity with this area.  Try a city.");
						break;
					} else {
						CastToClient()->SetBindPoint();
						Save();
					}
				}
				break;
			}
__________________
Daxum



Former ServerOp - Vallon Zek / Tallon Zek Emu Server - Legit / Guild PvP - (2007 - 2011 RIP)
Reply With Quote