View Single Post
  #5  
Old 01-15-2012, 09:44 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

So, there are two issues.

First, that code is never called because the nonspell_action is 0 on that AA. It also has a spell_id set, which as you found is 4521-4523, the barbarian spells.

In order to make that code execute the database needs to be fixed like this:

Code:
UPDATE `aa_actions` SET `spell_id` = 0, `nonspell_action` = 13 WHERE `aaid` = 718;
The second issue is that the code is not correct in several ways:
1) The case value is wrong, instead of aaBeastialAlignment it should be aaActionBeastialAlignment.

2) The AA_Choose3 macro is expecting 1,2,3 but what's passed in is 0,1,2 because 1 is subtracted from the value higher up in the code to use it as an array index.

3) There's no break at the end, so it falls through and you harm touch yourself. It looks like this was copy/pasted from some commented out code in aa.cpp that was used before they were handled in the database, and the break was left out along with the "not working yet" message.

This fixes those issues. The macro was defined in two places, so I commented out the one in ptimer.h since it seems like aa.h was the better place to have it. This is the only non commented out code in the project to use the macro, so it really should be in aa.cpp.

Code:
Index: trunk/EQEmuServer/common/ptimer.h
===================================================================
--- trunk/EQEmuServer/common/ptimer.h	(revision 2097)
+++ trunk/EQEmuServer/common/ptimer.h	(working copy)
@@ -138,7 +138,7 @@
 };
 
 //code prettying macros
-#define AA_Choose3(val, v1, v2, v3) (val==1?v1:(val==2?v2:v3))
-#define AA_Choose5(val, v1, v2, v3, v4, v5) (val==1?v1:(val==2?v2:(val==3?v3:(val==4?v4:v5))))
+//#define AA_Choose3(val, v1, v2, v3) (val==1?v1:(val==2?v2:v3))
+//#define AA_Choose5(val, v1, v2, v3, v4, v5) (val==1?v1:(val==2?v2:(val==3?v3:(val==4?v4:v5))))
 
 #endif
Index: trunk/EQEmuServer/zone/AA.cpp
===================================================================
--- trunk/EQEmuServer/zone/AA.cpp	(revision 2097)
+++ trunk/EQEmuServer/zone/AA.cpp	(working copy)
@@ -454,7 +454,7 @@
 			Escape();
 			break;
 			
-		case aaBeastialAlignment:
+		case aaActionBeastialAlignment:
 			switch(GetBaseRace()) {
 				case BARBARIAN:
 					spell_id = AA_Choose3(activate_val, 4521, 4522, 4523);
@@ -463,7 +463,7 @@
 					spell_id = AA_Choose3(activate_val, 4524, 4525, 4526);
 					break;
 				case OGRE:
-					spell_id = AA_Choose3(activate_val, 4527, 4527, 4529);
+					spell_id = AA_Choose3(activate_val, 4527, 4528, 4529);
 					break;
 				case IKSAR:
 					spell_id = AA_Choose3(activate_val, 4530, 4531, 4532);
@@ -472,6 +472,7 @@
 					spell_id = AA_Choose3(activate_val, 4533, 4534, 4535);
 					break;
 			}
+			break;
 			
 		case aaActionLeechTouch:
 			target = aaTargetCurrent;
Index: trunk/EQEmuServer/zone/AA.h
===================================================================
--- trunk/EQEmuServer/zone/AA.h	(revision 2097)
+++ trunk/EQEmuServer/zone/AA.h	(working copy)
@@ -728,7 +728,7 @@
 extern AA_DBAction AA_Actions[aaHighestID][MAX_AA_ACTION_RANKS];	//[aaid][rank]
 extern map<int16, AA_SwarmPet> AA_SwarmPets;	//key=spell_id
 
-#define AA_Choose3(val, v1, v2, v3) (val==1?v1:(val==2?v2:v3))
+#define AA_Choose3(val, v1, v2, v3) (val==0?v1:(val==1?v2:v3))
 
 extern map<int32,SendAA_Struct*>aas_send;
 extern std::map<uint32, std::map<uint32, AA_Ability> > aa_effects;
Reply With Quote