View Single Post
  #18  
Old 12-27-2013, 01:23 AM
haggzor
Fire Beetle
 
Join Date: Nov 2010
Location: Cincinnati, OH
Posts: 27
Default

Alrighty, that fixed it. Basically I added a flag in the existing special SK and Paladin portion of the code to bypass the spell slot evaluation and memorized spell check that was breaking Harm Touch and Lay on Hands.

client_packet.cpp(line 4581)

Code:
		uint16 spell_to_cast = 0;

		// flag to bypass memorized spell check
		bool isKnightAbility = false;

		//current client seems to send LH in slot 8 now...
		if(castspell->slot == ABILITY_SPELL_SLOT &&
			castspell->spell_id == SPELL_LAY_ON_HANDS && GetClass() == PALADIN) {
			if(!p_timers.Expired(&database, pTimerLayHands)) {
				Message(13,"Ability recovery time not yet met.");
				InterruptSpell(castspell->spell_id);
				return;
			}
			spell_to_cast = SPELL_LAY_ON_HANDS;

			isKnightAbility = true;
			
			p_timers.Start(pTimerLayHands, LayOnHandsReuseTime);
		} else if(castspell->slot == ABILITY_SPELL_SLOT &&
			(castspell->spell_id == SPELL_HARM_TOUCH
				|| castspell->spell_id == SPELL_HARM_TOUCH2
			) && GetClass() == SHADOWKNIGHT) {

			if(!p_timers.Expired(&database, pTimerHarmTouch)) {
				Message(13,"Ability recovery time not yet met.");
				InterruptSpell(castspell->spell_id);
				return;
			}

			if(GetLevel() < 40)
				spell_to_cast = SPELL_HARM_TOUCH;
			else
				spell_to_cast = SPELL_HARM_TOUCH2;
				
			LogFile->write(EQEMuLog::Debug, "Harm Touch Spell to Cast: %d (based on lvl [%d])... starting recast timer.", spell_to_cast, GetLevel());
			
			isKnightAbility = true;

			p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime);
		}

		//handle disciplines, OLD, they keep changing this
		if(castspell->slot == DISCIPLINE_SPELL_SLOT) {
			if(!UseDiscipline(castspell->spell_id, castspell->target_id)) {
				printf("Unknown ability being used by %s, spell being cast is: %i\n",GetName(),castspell->spell_id);
				InterruptSpell(castspell->spell_id);
			}
			return;
		}

		if(castspell->slot < MAX_PP_MEMSPELL)
		{
			LogFile->write(EQEMuLog::Debug, "Slot [%d] is less than MAX_PP_MEMSPELL [%d]", castspell->slot, MAX_PP_MEMSPELL);

			spell_to_cast = m_pp.mem_spells[castspell->slot];
			if(spell_to_cast != castspell->spell_id)
			{
				LogFile->write(EQEMuLog::Debug, "Code thinks I'm a cheater because [%d] does not equal [%d]", spell_to_cast, castspell->spell_id);

				InterruptSpell(castspell->spell_id); //CHEATER!!!
				return;
			}
		}
		else if (castspell->slot >= MAX_PP_MEMSPELL && !isKnightAbility) {
			LogFile->write(EQEMuLog::Debug, "Slot [%d] is greater than or equal to MAX_PP_MEMSPELL [%d]", castspell->slot, MAX_PP_MEMSPELL);

			InterruptSpell();
			return;
		}
		
		LogFile->write(EQEMuLog::Debug, "Casting Spell: [%i] on target [%d]", spell_to_cast, castspell->target_id);

		CastSpell(spell_to_cast, castspell->target_id, castspell->slot);
Reply With Quote