/// <summary> /// on Accept quest /// </summary> public void AcceptQuest( UInt64 guid, int id ) { #if VOLHV if ( deAcceptQuest!=null ) if( deAcceptQuest( this, guid, id ) ) return; #endif Mobile m = this.account.FindMobileByGuid( guid ); // Console.WriteLine("{0} accept quest from {1}, id = {2}", this.Name, m.Name, id ); BaseQuest b = null; ActiveQuest bq = new ActiveQuest( b = World.CreateQuestById( id ) ); int pos = AddQuest( bq ); if ( pos == -1 ) return; int start = pos * 3 + (int)UpdateFields.PLAYER_QUEST_LOG_1_1; this.SendSmallUpdate( new int[]{ start, start + 1, start + 2 }, new object[] { id, 0, 0 } ); b.OnAcceptQuest( this ); ( m as BaseCreature ).OnAcceptQuest( this, id ); if ( b.HaveDeliveryObj ) { foreach( Item it in Items ) { if ( it != null ) this.CheckDeliveries( it ); } } }
public override void Deserialize( GenericReader gr ) { base.Deserialize( gr ); int version = gr.ReadInt(); if ( version > 6 ) { int nreput = gr.ReadInt(); for(int t = 0;t < nreput;t++ ) { int krep = gr.ReadInt(); int vrep = gr.ReadInt(); reputationAdjustments[ krep ] = vrep; } } if ( version > 5 ) { int nact = gr.ReadInt(); for(int t = 0;t < nact;t++ ) actionBar.Add( new Action( gr ) ); } if ( version > 4 ) { int nf = gr.ReadInt(); for(int t = 0;t < nf;t++ ) { UInt64 gu = (UInt64)gr.ReadInt64(); friends.Add( gu ); string user = gr.ReadString(); friends.Add( user ); } } if ( version > 2 ) { BindingPointX = gr.ReadFloat(); BindingPointY = gr.ReadFloat(); BindingPointZ = gr.ReadFloat(); BindingPointMapId = (UInt16)gr.ReadInt(); } if ( version > 1 ) { bool pa = gr.ReadBool(); if ( pa ) { petActions = new int[ 11 ]; for(int t = 0;t < 11;t++ ) petActions[ t ] = gr.ReadInt(); } } int sum = gr.ReadInt(); if ( sum != 0 ) { UInt64 g = gr.ReadInt64(); if ( version > 7 ) { int sid = gr.ReadInt(); Summon = new BaseCreature( gr ); Summon.Id = sid; } // Summon = (Mobile)MobileList.TempSummon[ g ]; Summon.SummonedBy = this; ( Summon as BaseCreature ).AIEngine = new SummonedAI( this, Summon as BaseCreature ); } sum = gr.ReadInt(); if ( sum != 0 ) { Charm = (Mobile)MobileList.TempSummon[ gr.ReadInt64() ]; Charm.CharmedBy = this; ( Charm as BaseCreature ).AIEngine = new SummonedAI( this, Charm as BaseCreature ); } CorpseLocationX = gr.ReadFloat(); CorpseLocationY = gr.ReadFloat(); CorpseLocationZ = gr.ReadFloat(); if ( version > 3 ) CorpseMapId = (ushort)gr.ReadShort(); corpsGuid = gr.ReadInt64(); zones = new uint[ 32 ]; for(int t = 0;t < 32;t++ ) zones[ t ] = (uint)gr.ReadInt(); int exi = gr.ReadInt(); if ( exi == 1 ) { mark = new Position( gr.ReadFloat(), gr.ReadFloat(), gr.ReadFloat(), gr.ReadInt() ); } ammoType = gr.ReadInt(); race = (Races)gr.ReadByte(); if ( version == 0 ) Classe = (Classes)gr.ReadByte(); gender = gr.ReadByte(); skin = gr.ReadByte(); face = gr.ReadByte(); hairStyle = gr.ReadByte(); hairColour = gr.ReadByte(); facialHair = gr.ReadByte(); copper = (uint)gr.ReadInt(); int nactq = 20; for(int t = 0;t < nactq;t++ ) { int vv = gr.ReadInt(); if ( vv == 1 ) { ActiveQuest aq = new ActiveQuest( gr ); if ( aq.Id > 0 ) AddQuest( aq ); } } int nq = gr.ReadInt(); for(int t = 0;t < nq;t++ ) { int id = gr.ReadInt(); questsDone[ id ] = true; } for(int g = 0;g < 8;g++ ) { int field = gr.ReadInt(); TaxiField[ g ] = (uint)field; } // RunSpeed = 11f; }
/// <summary> /// Internal Add Quest to ActiveQuest list /// </summary> public int AddQuest( ActiveQuest bq ) { for(int t = 0; t<20; t++ ) { if ( activeQuests[ t ] == null ) { activeQuests[ t ] = bq; return t; } } return -1; }