Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2008, 08:47 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default Indoor/Outdoor fix

Well, I'm dieing to get this one out, I know Qadar's at work and won't be back tell tonight, so he can correct me if I screw up - In a nutshell, this should make all outdoor spells work only outdoor, Sow and levitate included ;
First of all, you need a new column;
Code:
alter table `zone` add column `castoutdoor` tinyint (4) DEFAULT '1' NOT NULL  after `canlevitate`;
This is done with the newest code, 1106;
Note: I was just looking at them, not sure if levitate works when left out, as it is also in this code (Qadar must have thought he left it out when he ported it over to 1106, or I can't find it).
The changes in the source files are tagged with "//Qadar", all works fine, tested at my local test server.

you need to have "#GM OFF" when you test this
If anyone wants to make the fixes into something more presentable to the DEVS, please do!

Download files here, use 1106, overwrite with these (/zone), and compile.
Any credit for this goes to Qadar.

In case you're wondering - Qadar is what inspired my buff character behind the bank at PoK - only the real Qadar has an eyepatch (nothing a little surgery couldn't fix) , and the real Qadar would have never made you pay for buffs (I added that so players would have something to spend their plat on).

Last edited by Angelox; 04-15-2008 at 05:00 PM..
Reply With Quote
  #2  
Old 04-15-2008, 09:23 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

Almost forgot;
Reply With Quote
  #3  
Old 04-15-2008, 09:36 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Diff for those interested:

Code:
Index: zone.h
===================================================================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/zone.h,v
retrieving revision 1.22
diff -u -r1.22 zone.h
--- zone.h	21 Feb 2008 10:01:42 -0000	1.22
+++ zone.h	15 Apr 2008 11:53:44 -0000
@@ -171,6 +171,8 @@
 	void	weatherSend();
 	bool	CanBind() const { return(can_bind); }
 	bool	CanDoCombat() const { return(can_combat); }
+	bool	CanLevitate() const {return(can_levitate); } // Magoth78
+	bool    CanCastOutdoor() const {return(can_castoutdoor);} //qadar
 	
 	time_t	weather_timer;
 	int8	weather_type;
@@ -206,6 +208,8 @@
 	int32	pMaxClients;
 	bool	can_bind;
 	bool	can_combat;
+	bool    can_castoutdoor; //qadar
+	bool	can_levitate; //Magoth78
 	int32	pgraveyard_id, pgraveyard_zoneid;
 	float	pgraveyard_x, pgraveyard_y, pgraveyard_z, pgraveyard_heading;
 	
Index: zonedb.h
===================================================================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/zonedb.h,v
retrieving revision 1.10
diff -u -r1.10 zonedb.h
--- zonedb.h	3 Nov 2007 10:01:39 -0000	1.10
+++ zonedb.h	15 Apr 2008 11:52:54 -0000
@@ -159,7 +159,7 @@
 	/*
 	 * Zone related
 	 */
-	bool GetZoneCFG(int32 zoneid, NewZone_Struct *data, bool &can_bind, bool &can_combat);
+	bool GetZoneCFG(int32 zoneid, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor);; //Magoth78 - qadar
 	bool	SaveZoneCFG(int32 zoneid,NewZone_Struct* zd);
 	bool	DumpZoneState();
 	sint8	LoadZoneState(const char* zonename, LinkedList<Spawn2*>& spawn2_list);
Index: spells.cpp
===================================================================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/spells.cpp,v
retrieving revision 1.54
diff -u -r1.54 spells.cpp
--- spells.cpp	26 Feb 2008 05:01:41 -0000	1.54
+++ spells.cpp	15 Apr 2008 16:49:52 -0000
@@ -1221,6 +1221,38 @@
 	if(!IsValidSpell(spell_id))
 		return false;
 
+// qadar start
+
+if( spells[spell_id].zonetype == 1 && !zone->CanCastOutdoor())
+    {
+       if( IsClient() )
+        {
+            if(!CastToClient()->GetGM())
+            {
+                Message(13, "You can't cast this spell indoors.");
+			    return false;
+            }
+        }
+    }
+
+// qadar end
+
+// angelox start
+
+if( IsEffectInSpell(spell_id, SE_Levitate) && !zone->CanLevitate() )
+    {
+        if( IsClient() )
+        {
+            if(!CastToClient()->GetGM())
+            {
+                Message(13, "You can't levitate in this zone.");
+			    return false;
+            }
+        }
+    }
+
+//angelox end
+
 	if
 	(
 		this->IsClient() && 
Index: zone.cpp
===================================================================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/zone.cpp,v
retrieving revision 1.27
diff -u -r1.27 zone.cpp
--- zone.cpp	21 Feb 2008 10:01:42 -0000	1.27
+++ zone.cpp	15 Apr 2008 11:51:40 -0000
@@ -902,9 +902,10 @@
 	LogFile->write(EQEMuLog::Status, "Zone Static Data Reloaded.");
 }
 
+
 bool Zone::LoadZoneCFG(const char* filename, bool DontLoadDefault) {
 	memset(&newzone_data, 0, sizeof(NewZone_Struct));
-	if(!database.GetZoneCFG(database.GetZoneID(filename), &newzone_data, can_bind, can_combat)) {
+	if(!database.GetZoneCFG(database.GetZoneID(filename), &newzone_data, can_bind, can_combat, can_levitate, can_castoutdoor)) {  // Magoth78 - qadar
 		cout << "Error while loading Zone Config!\n";
 		cout << "IF YOU HAVENT DONE SO, SOURCE THE ZONECFG.SQL FILE!!!!!!\n";
 		return false;
Index: zonedb.cpp
===================================================================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/zonedb.cpp,v
retrieving revision 1.9
diff -u -r1.9 zonedb.cpp
--- zonedb.cpp	9 Apr 2008 09:01:55 -0000	1.9
+++ zonedb.cpp	15 Apr 2008 11:52:26 -0000
@@ -74,8 +74,9 @@
 	safe_delete_array(query);
 	return true;
 }
-
-bool ZoneDatabase::GetZoneCFG(int32 zoneid, NewZone_Struct *zone_data, bool &can_bind, bool &can_combat) {
+// Magoth78 start
+// qadar start
+bool ZoneDatabase::GetZoneCFG(int32 zoneid, NewZone_Struct *zone_data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor) {
 	char errbuf[MYSQL_ERRMSG_SIZE];
 	char *query = 0;
 	MYSQL_RES *result;
@@ -88,7 +89,7 @@
 		"fog_red3,fog_green3,fog_blue3,fog_minclip3,fog_maxclip3,"
 		"fog_red4,fog_green4,fog_blue4,fog_minclip4,fog_maxclip4,"
 		"sky,zone_exp_multiplier,safe_x,safe_y,safe_z,underworld,"
-		"minclip,maxclip,time_type,canbind,cancombat"
+		"minclip,maxclip,time_type,canbind,cancombat,canlevitate,castoutdoor"
 		" from zone where zoneidnumber=%i",zoneid), errbuf, &result)) {
 		safe_delete_array(query);
 		while((row = mysql_fetch_row(result))) {
@@ -119,6 +120,8 @@
 			
 			can_bind = atoi(row[r++])==0?false:true;
 			can_combat = atoi(row[r++])==0?false:true;
+            can_levitate = atoi(row[r++])==0?false:true;
+		can_castoutdoor = atoi(row[r++])==0?false:true;
 			
 			good = true;
 		}
@@ -132,7 +135,8 @@
 	
 	return(good);
 }
-
+// Magoth78 end
+// qadar end
 void ZoneDatabase::UpdateSpawn2Timeleft(int32 id, int32 timeleft)
 {
 	char errbuf[MYSQL_ERRMSG_SIZE];

Last edited by cavedude; 04-15-2008 at 09:09 PM..
Reply With Quote
  #4  
Old 04-15-2008, 09:38 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Oh, levitate does not have indoor/outdoor cast restrictions. At least, not according to the spell data. Here is a list of spells this *should* effect, based on their spell data:

Code:
143    Sunbeam
169    Pack Spirit
220    Spirit of Cheetah
247    Camouflage
250    Harmony
252    Invoke Lightning
253    Whirling Wind
257    Starshine
258    Treeform
278    Spirit of Wolf
418    Lightning Strike
420    Lightning Blast
424    Scale of Wolf
425    Wolf Form
426    Greater Wolf Form
427    Form of the Great Wolf
428    Share Wolf Form
520    Dizzying Wind
600    Illusion: Spirit Wolf
601    Illusion: Tree
717    Selo`s Accelerando
793    Fist of Air
874    JourneymanBoots
895    Ink jet
987    Spiroc Thunder
988    Greater Spiroc Thunder
1286    Expedience
1330    Selo`s Song of Travel
1340    TravelerBoots
1554    Spirit of Scale
1562    Form of the Howler
1563    Form of the Hunter
1564    Spirit of Oak
1565    Mask of the Hunter
1604    Breath of Karana
1606    Fist of Karana
1670    Velocity
1750    Selo`s Song of Travel
1776    Spirit of Wolf
1821    Bolt of Karana
1921    Acting Spirit I
2002    Grease Injection
2007    Selo`s Song of Travel
2157    Word of Command
2517    Spirit of Eagle
2524    Spirit of Bih`Li
2605    Selo`s Accelerating Chorus
2733    Summon Horse
2782    Holy Steed
2783    Unholy Steed
2862    Summon Horse
2863    Summon Horse
2864    Summon Horse
2865    Summon Horse
2866    Summon Horse
2867    Summon Horse
2868    Summon Horse
2869    Summon Horse
2870    Summon Horse
2871    Summon Horse
2872    Summon Horse
2873    Summon Horse
2874    Summon Holy Steed
2875    Summon Death Charger
2916    Summon Horse
2917    Summon Horse
2918    Summon Horse
2919    Summon Horse
2920    Summon Horse
2921    Summon Horse
2922    Summon Horse
2923    Summon Horse
3185    Flight of Eagles
3438    Karana's Rage
3579    Share Form of the Great Wolf
3580    Spirit of Ash
3586    Illusion: Scaled Wolf
3601    Harmony of Nature
3813    Summon Drogmor
3814    Summon Drogmor
3815    Summon Drogmor
3816    Summon Drogmor
3817    Summon Drogmor
3818    Summon Drogmor
3819    Summon Drogmor
3820    Summon Drogmor
3821    Summon Drogmor
3822    Summon Drogmor
3823    Summon Drogmor
3824    Summon Drogmor
3825    Summon Drogmor
3826    Summon Drogmor
3827    Summon Drogmor
3828    Summon Drogmor
3829    Summon Drogmor
3830    Summon Drogmor
3831    Summon Drogmor
3832    Summon Drogmor
4242    Mist of the Wolf
5146    Bootstrutter's Blessing
5316    Tranquility of the Glade
5347    Nature's Serenity
5597    Squid's Ink
6584    Mass Illusion: Spirit Wolf
6588    Mass Illusion: Scaled Wolf
8355    Activate Roboboar
8442    Immortal Bolt
Reply With Quote
  #5  
Old 04-15-2008, 09:47 AM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

I'm thinking since Lev works in some places where Sow doesn't- it's on a different agenda, not to mention Lev will drop you on Zin to a no lev zone, and Sow will stay tell it drops.

Last edited by Angelox; 04-15-2008 at 05:50 PM..
Reply With Quote
  #6  
Old 04-15-2008, 10:29 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Aye, PEQ has several zones as no lev. We take it on a one by one basis, until the environmenttype field in the spell data can be deciphered/implemented.
Reply With Quote
  #7  
Old 04-15-2008, 07:00 PM
Qadar
Fire Beetle
 
Join Date: May 2006
Posts: 12
Default

The code I wrote for the indoor/outdoor restrictions borrowed a lot from the code Magoth78 submitted here: ( thanks Magoth78 )

http://eqemulator.net/forums/showthr...779#post146779

I followed his example and just modified it a bit, as well as adding a few lines to spells.cpp to check if there was a indoor restriction on the spell. All the lev work is still 100% his, but I just included in mine. As his modifications are included, if the previous levitation restriction was not done already, it also depends on running the sql code he posted to add "canlevitate" to the zone db before adding the "castoutdoor" one.

As this is the first time I have touched C code in about 10 years, I am a little rusty. It works, but cleanup or better naming of functions may be in order by someone more experienced than I.

I just hope its a positive addition everyone can use.
Reply With Quote
  #8  
Old 04-19-2008, 11:25 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I'll be putting this and the lev thing in the official code soon enough with some other changes.
Reply With Quote
  #9  
Old 04-20-2008, 02:03 AM
gernblan
Discordant
 
Join Date: Aug 2006
Posts: 394
Default

OMG YAY!!!

THANK YOU!

Been wanting to be able to lev restrict and stuff for AGES!
__________________
--
Keelyeh
Owner, ServerOp and Developer
Jest 4 Server
Linux (Jest3 runs on Fedora, our Dev servers usually run on Ubuntu and/or Gentoo), OC-12 Connection = Hella Fast
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:07 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3