Page 1 of 1

Spell Error #defines

Posted: Sat Mar 10, 2012 11:07 am
by John Adams
I think SOE changed some values here. I am expecting a SPELL_ERROR_NO_ELIGIBLE_TARGET (52) and instead getting a SPELL_ERROR_NO_TAUNT_SPELLS (50) in 1096, trying to cast Divine Smite without a target.

Code: Select all

#define SPELL_ERROR_CANNOT_CAST				1
#define SPELL_ERROR_NOT_PREPARED			  3
#define SPELL_ERROR_NOT_ENOUGH_KNOWLEDGE	8
#define SPELL_ERROR_INTERRUPTED				10
#define SPELL_ERROR_TAKE_EFFECT				12
#define SPELL_ERROR_NOT_ALIVE				  19
#define SPELL_ERROR_NOT_DEAD				   20
#define SPELL_ERROR_ALREADY_CASTING	     23
#define SPELL_ERROR_RECOVERING				 24
#define SPELL_ERROR_NON_COMBAT_ONLY		  25
#define SPELL_ERROR_NOT_WHILE_MOUNTED		29
#define SPELL_ERROR_NOT_WHILE_CLIMBING	  30
#define SPELL_ERROR_NOT_READY				  31
#define SPELL_ERROR_CANT_SEE_TARGET		  32
#define SPELL_ERROR_INVENTORY_FULL			35
#define SPELL_ERROR_NOT_ENOUGH_COIN		  36
#define SPELL_ERROR_NOT_ALLOWED_HERE		 37
#define SPELL_ERROR_NOT_WHILE_CRAFTING	  38
#define SPELL_ERROR_ONLY_WHEN_CRAFTING	  39
#define SPELL_ERROR_ITEM_NOT_ATTUNED		 42
#define SPELL_ERROR_ITEM_WORN_OUT			 43
#define SPELL_ERROR_MUST_EQUIP_WEAPON		45
#define SPELL_ERROR_WEAPON_BROKEN			 46
#define SPELL_ERROR_TARGET_IMMUNE			 48
#define SPELL_ERROR_NO_TAUNT_SPELLS		  50
#define SPELL_ERROR_CANNOT_PREPARE			51
#define SPELL_ERROR_NO_ELIGIBLE_TARGET	  52
#define SPELL_ERROR_NO_TARGETS_IN_RANGE	 53
#define SPELL_ERROR_TOO_CLOSE				  54
#define SPELL_ERROR_TOO_FAR_AWAY			  55
#define SPELL_ERROR_TARGET_TOO_WEAK		  56
#define SPELL_ERROR_TARGET_TOO_POWERFUL	 57
#define SPELL_ERROR_WONT_WORK_ON_TARGET	 58
#define SPELL_ERROR_TARGET_INVULNERABLE	 59
#define SPELL_ERROR_TARGET_ENGAGED			61
#define SPELL_ERROR_TARGET_NOT_GROUPED	  62
#define SPELL_ERROR_TARGET_IN_USE			 63
#define SPELL_ERROR_TARGET_ALREADY_ENGAGED 65
#define SPELL_ERROR_CANNOT_ENGAGE			 66
#define SPELL_ERROR_NOT_A_FRIEND			  67
#define SPELL_ERROR_NOT_AN_ENEMY			  68
#define SPELL_ERROR_ILLEGAL_TARGET			71
#define SPELL_ERROR_NOT_WHILE_MENTORING	 72
#define SPELL_ERROR_NOT_ENOUGH_POWER		 75
#define SPELL_ERROR_NOT_ENOUGH_HEALTH		76
#define SPELL_ERROR_NOT_ENOUGH_CONC		  77
#define SPELL_ERROR_MISSING_COMPONENT		78
#define SPELL_ERROR_OUT_OF_CHARGES			79
#define SPELL_ERROR_LACK_AMMO			     80
#define SPELL_ERROR_NO_RANGED_EQUIPPED	  81
#define SPELL_ERROR_RANGED_NEEDS_REPAIR	 82
#define SPELL_ERROR_LACK_WEAPON_TYPE		 83
#define SPELL_ERROR_NO_HOSTILE_SPELLS		92
#define SPELL_ERROR_NO_BENEFICIAL_SPELLS	93
#define SPELL_ERROR_CANNOT_MOUNT_NOW		 94
#define SPELL_ERROR_ALREADY_CAST			 100
#define SPELL_ERROR_LOTTERY_IN_PROGRESS	101
I put the function call "zone->SendSpellFailedPacket(client, atoi(sep->arg[0]));" in /test, so I'll see if I can map these suckers out again.

Re: Spell Error #defines

Posted: Sat Mar 10, 2012 11:43 am
by John Adams
Bummer. Starting at error code 10, the 1096 clients shift +1 (at least) on these values.

Scat, anyone... how can I define #defines based on current client version, since these are at compile time? I'm thinking you cannot. So, this is how I am implementing a change -

Since in Pre 1096:

Code: Select all

#define SPELL_ERROR_INTERRUPTED				10
And in 1096+

Code: Select all

#define SPELL_ERROR_INTERRUPTED				11
I thought I would simply test the client version where these are called, and bump them accordingly SPELL_ERROR_INTERRUPTED + 1 in the call. Will that work?

Or... we set all these values to 1096 and accept that older clients will be incorrect. Not optimal, for our dreams of a Classic server someday... what other options do I have?


Edit:
It gets tricky, because they added SPELL_ERROR_NOT_WHILE_FLYING 31 so everything after 31 is bumped +2.

Edit2:
And, they are +3 at 51 because of a new SPELL_ERROR_NOT_IN_BATTLEGROUND 53 error code. :shock:

Edit3:
SHIT! :D And +4 at 64 (new) with SPELL_ERROR_GROUP_HAS_SPELL 67. :roll:

Edit4:
~cries~ And finally, +5 due to a new SPELL_ERROR_NOTHING_TO_CURE 79 code.


Found a new one at the end, too: SPELL_ERROR_NOT_WHILE_PVP 107

Re: Spell Error #defines

Posted: Sat Mar 10, 2012 12:42 pm
by John Adams
Here's the new values commented next to the old ones.

Code: Select all

// JA: defines changed in 1096. Now calling these as DEFINE + 1 starting at error 10
#define SPELL_ERROR_CANNOT_CAST				1
#define SPELL_ERROR_NOT_PREPARED			  3
#define SPELL_ERROR_NOT_ENOUGH_KNOWLEDGE	8
#define SPELL_ERROR_INTERRUPTED				10	// 11
#define SPELL_ERROR_TAKE_EFFECT				12	// 13
#define SPELL_ERROR_NOT_ALIVE				  19	// 20
#define SPELL_ERROR_NOT_DEAD				   20	// 21
#define SPELL_ERROR_ALREADY_CASTING	     23	// 24
#define SPELL_ERROR_RECOVERING				 24	// 25
#define SPELL_ERROR_NON_COMBAT_ONLY		  25	// 26
#define SPELL_ERROR_NOT_WHILE_MOUNTED		29	// 30
                                           // 31 Not While Flying (new)
// JA: from here they are +2, due to new flying error code
#define SPELL_ERROR_NOT_WHILE_CLIMBING	  30	// 32
#define SPELL_ERROR_NOT_READY				  31	// 33
#define SPELL_ERROR_CANT_SEE_TARGET		  32	// 34
#define SPELL_ERROR_INVENTORY_FULL			35	// 37
#define SPELL_ERROR_NOT_ENOUGH_COIN		  36	// 38
#define SPELL_ERROR_NOT_ALLOWED_HERE		 37	// 39
#define SPELL_ERROR_NOT_WHILE_CRAFTING	  38	// 40
#define SPELL_ERROR_ONLY_WHEN_CRAFTING	  39	// 41
#define SPELL_ERROR_ITEM_NOT_ATTUNED		 42	// 44
#define SPELL_ERROR_ITEM_WORN_OUT			 43	// 45
#define SPELL_ERROR_MUST_EQUIP_WEAPON		45	// 47
#define SPELL_ERROR_WEAPON_BROKEN			 46	// 48
#define SPELL_ERROR_TARGET_IMMUNE			 48	// 50
#define SPELL_ERROR_NO_TAUNT_SPELLS		  50	// 52
                                           // 53 Cannot use in battle ground
// JA: from here they are +3, due to new battleground error code
#define SPELL_ERROR_CANNOT_PREPARE			51	// 54
#define SPELL_ERROR_NO_ELIGIBLE_TARGET	  52	// 55
#define SPELL_ERROR_NO_TARGETS_IN_RANGE	 53	// 56
#define SPELL_ERROR_TOO_CLOSE				  54	// 57
#define SPELL_ERROR_TOO_FAR_AWAY			  55	// 58
#define SPELL_ERROR_TARGET_TOO_WEAK		  56	// 58
#define SPELL_ERROR_TARGET_TOO_POWERFUL	 57	// 60
#define SPELL_ERROR_WONT_WORK_ON_TARGET	 58	// 61
#define SPELL_ERROR_TARGET_INVULNERABLE	 59	// 62 (63 also says IMMUNE)
#define SPELL_ERROR_TARGET_ENGAGED			61	// 64
#define SPELL_ERROR_TARGET_NOT_GROUPED	  62	// 65
#define SPELL_ERROR_TARGET_IN_USE			 63	// 66
                                           // 67 Target's group has spell (new)
// JA: from here they are +4, due to new group error code
#define SPELL_ERROR_TARGET_ALREADY_ENGAGED 65	// 69
#define SPELL_ERROR_CANNOT_ENGAGE			 66	// 70
#define SPELL_ERROR_NOT_A_FRIEND			  67	// 71
#define SPELL_ERROR_NOT_AN_ENEMY			  68	// 72
#define SPELL_ERROR_ILLEGAL_TARGET			71	// 75
#define SPELL_ERROR_NOT_WHILE_MENTORING	 72	// 76
                                           // 79 Nothing to cure (new)
// JA: from here they are +5, due to new cure error code
#define SPELL_ERROR_NOT_ENOUGH_POWER		 75	// 80
#define SPELL_ERROR_NOT_ENOUGH_HEALTH		76	// 81
#define SPELL_ERROR_NOT_ENOUGH_CONC		  77	// 82
#define SPELL_ERROR_MISSING_COMPONENT		78	// 83
#define SPELL_ERROR_OUT_OF_CHARGES			79	// 84
#define SPELL_ERROR_LACK_AMMO			     80	// 85
#define SPELL_ERROR_NO_RANGED_EQUIPPED	  81	// 86
#define SPELL_ERROR_RANGED_NEEDS_REPAIR	 82	// 87
#define SPELL_ERROR_LACK_WEAPON_TYPE		 83	// 88
#define SPELL_ERROR_NO_HOSTILE_SPELLS		92	// 97
#define SPELL_ERROR_NO_BENEFICIAL_SPELLS	93	// 98
#define SPELL_ERROR_CANNOT_MOUNT_NOW		 94	// 99
#define SPELL_ERROR_ALREADY_CAST			 100	// 105
#define SPELL_ERROR_LOTTERY_IN_PROGRESS	101	// 106
                                           // 107 Not in pvp combat (new)
How I have fixed this (for now) is by adding an "error_offset" to the error code, like this:

Code: Select all

	if( version >= 1096 )
		error_offset = 4;
	zone->SendSpellFailedPacket(client, SPELL_ERROR_NOT_AN_ENEMY+error_offset);
There is probably a better way to do this, so I am open to suggestions. This code is committed, minus the cast-through target work (still crashing)