Beispiel #1
0
		public void PrepareTrainerListTeach( int t, ref int offset, Teach teach )
		{			
			if ( teach == null )
				return;

			if ( Abilities.abilities[ teach.TeachId ] is Profession )
				PrepareTrainerListTeachProfession( t, ref offset, teach );
			else
				if ( Abilities.abilities[ teach.TeachId ] is CraftTemplate )
				PrepareTrainerListTeachCraftTemplate( t, ref offset, teach );
			else					
				if (  Abilities.abilities[ teach.TeachId ] is SpellTemplate )
				PrepareTrainerListTeachSpellTemplate( t, ref offset, teach );
		}
Beispiel #2
0
		public void PrepareTrainerListTeachCraftTemplate( int t, ref int offset, Teach teach )
		{
			int price = 0;
			if ( onSpellPrice != null )
				price = onSpellPrice( this, teach.Id );
			if ( price == 0 )
				price = CustomSpellHandlers.SpellCost( teach.TeachId );
			int regSpell = CustomSpellHandlers.SpellPrerequisites( teach.TeachId );

			if ( Abilities.abilities[ teach.TeachId ] is CraftTemplate )
			{
				Converter.ToBytes( (int)t, tempBuff, ref offset );
				CraftTemplate ability = (CraftTemplate)Abilities.abilities[ teach.TeachId ];
				if ( ability == null )
					return;								
				if ( !HaveSpell( ability ) )
				{
					if ( HaveSkill( regSpell ) )
					{
						if ( Copper >= price )
							Converter.ToBytes( (byte)0x00, tempBuff, ref offset );
						else
							Converter.ToBytes( (byte)0x01, tempBuff, ref offset );
					}		
					else
						Converter.ToBytes( (byte)0x01, tempBuff, ref offset );			
				}
				else
					Converter.ToBytes( (byte)0x02, tempBuff, ref offset );
			}

			Converter.ToBytes( price, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( (byte)0, tempBuff, ref offset );						
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );// learn spell
			Converter.ToBytes( regSpell, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
		}
Beispiel #3
0
		public void PrepareTrainerListTeachSpellTemplate( int t, ref int offset, Teach teach )
		{			
			SpellTemplate ability = (SpellTemplate)Abilities.abilities[ teach.TeachId ];
			if ( ability == null )
				return;			
			Converter.ToBytes( (int)t, tempBuff, ref offset );
			
			int reqLevel = ability.RequieredLevel;
			int price = 0;
			if ( onSpellPrice != null )
				price = onSpellPrice( this, teach.TeachId );
			if ( price == 0 )
				price = CustomSpellHandlers.SpellCost( teach.TeachId );

			if ( !HaveSpell( teach.TeachId ) )
			{				
				if ( Level >= reqLevel )
				{
					if ( Copper >= price )
						Converter.ToBytes( (byte)0x00, tempBuff, ref offset );
					else
						Converter.ToBytes( (byte)0x01, tempBuff, ref offset );
				}
				else
					Converter.ToBytes( (byte)0x01, tempBuff, ref offset );
			}
			else
				Converter.ToBytes( (byte)0x02, tempBuff, ref offset );//	already known

			Converter.ToBytes( price, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( (byte)reqLevel, tempBuff, ref offset );						
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );// learn spell
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
		}
Beispiel #4
0
		/*public bool HaveAbility( BaseAbility ba )
		{
			if ( AllSkills[ (ushort)ba.Id ] != null )
				return true;
			return false;
		}*/


		/*
		 * 
		 2D 00 00 00 00 00 00 00 00 00 00 00 
		 0E 00 00 00 
		 15 0A 00 00 00 E8 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		 16 0A 00 00 01 94 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 0A 00 00 00 00 00 00 00 00 00 00 
		 F1 0C 00 00 01 14 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 0A 00 00 00 00 00 00 00 00 00 00 
		 F2 0C 00 00 01 20 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 0A 00 00 00 00 00 00 00 00 00 00 
		 F3 0C 00 00 01 B8 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 0A 00 00 00 00 00 00 00 00 00 00 
		 F4 0C 00 00 01 D6 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 0A 00 00 00 00 00 00 00 00 00 00 
		 F5 0C 00 00 01 D0 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 0A 00 00 00 00 00 00 00 00 00 00 
		 F0 0D 00 00 01 E0 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 0A 00 00 00 00 00 00 00 00 00 00 
		 0C 0E 00 00 01 B2 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 0A 00 00 00 00 00 00 00 00 00 00 
		 73 27 00 00 01 77 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 28 00 00 00 00 00 00 00 00 00 00 
		 74 27 00 00 01 64 19 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EC 0D 00 00 00 00 00 00 00 00 00 00 
		 09 28 00 00 01 A0 8C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 EC 0D 00 00 00 00 00 00 00 00 00 00 
		 30 3A 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		 1A 3F 00 00 01 E0 2E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 28 00 00 00 00 00 00 00 00 00 00 
		 48 65 6C 6C 6F 21 20 52 65 61 64 79 20 66 6F 72 20 73 6F 6D 65 20 74 72 61 69 6E 69 6E 67 3F 00
		 
		*/

		public void PrepareTrainerListTeachProfession( int t, ref int offset, Teach teach )
		{
			Profession prof = (Profession)Abilities.abilities[ teach.TeachId ];
			int price = 0;
			if ( onSpellPrice != null )
				price = onSpellPrice( this, teach.Id );
			if ( price == 0 )
				price = CustomSpellHandlers.SpellCost( teach.TeachId );

			int regSpell = CustomSpellHandlers.SpellPrerequisites( teach.TeachId );
			Converter.ToBytes( (int)t, tempBuff, ref offset );	
			if ( nProfessions == 0 && prof.Level == ProfessionLevels.Apprentice )
				Converter.ToBytes( (byte)0x00, tempBuff, ref offset );
			else
			{
				if ( regSpell != 0 && !HaveSpell( regSpell ) )
					Converter.ToBytes( (byte)0x01, tempBuff, ref offset );
				else
				if ( nProfessions == 0 && prof.Level == ProfessionLevels.Apprentice && AllSkills[ (ushort)prof.Id ] == null )//	 si il a une profession mais pas celle du skill
					Converter.ToBytes( (byte)0x00, tempBuff, ref offset );
				else
				{
					if ( AllSkills[ (ushort)prof.Id ] != null )//	si il possede ce skill il faut verifier a quel niveau
					{
						Profession sk = (Profession)AllSkills[ (ushort)prof.Id ];
						if ( (int)sk.Level >= (int)prof.Level )
							Converter.ToBytes( (byte)0x02, tempBuff, ref offset );
						else
							if ( (int)sk.Level + 1 == (int)prof.Level )
							Converter.ToBytes( (byte)0x00, tempBuff, ref offset );
						else
							Converter.ToBytes( (byte)0x01, tempBuff, ref offset );
					}
					else
						if ( nProfessions == 2 )//	deja deux profession, pas possible d'en prendre 3
						Converter.ToBytes( (byte)0x00, tempBuff, ref offset );
					else
					{//	Il n'a pas la profession et il lui reste un slot, il ne peut acceder qu'a apprentit
						if ( nProfessions == 1 && prof.Level == ProfessionLevels.Apprentice )
							Converter.ToBytes( (byte)0x00, tempBuff, ref offset );
						else
							Converter.ToBytes( (byte)0x01, tempBuff, ref offset );
					}

				}
			}
			Converter.ToBytes( price, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( (byte)0/*reqLevel*/, tempBuff, ref offset );						
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );// learn spell
			Converter.ToBytes( regSpell, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
		}