/// <summary> /// onEndQuest /// changed: 02.10.05 /// </summary> public void SetQuestDone( BaseQuest bq, Reward[] rewards ) { int num = 0; foreach( ActiveQuest aq in activeQuests ) { if ( aq != null && bq.Id == aq.Id ) { aq.Done = true; if ( bq.Repeatable ) questsDone[ aq.Id ] = null; // repeat quest support else questsDone[ aq.Id ] = true; // normal quest done QuestUpdateComplete( bq ); //int offset = 4; //Converter.ToBytes( (int)aq.Id, tempBuff, ref offset ); //Send( OpCodes.SMSG_QUESTUPDATE_COMPLETE, tempBuff, offset ); // Output: 'Objective Complete.' // Also marks the quest at questlog with (Failed) int offset = 4; Converter.ToBytes( (int)aq.Id, tempBuff, ref offset ); // QuestId Converter.ToBytes( (int)0, tempBuff, ref offset ); // Unknown Converter.ToBytes( (int)bq.RewardXp, tempBuff, ref offset ); // xpReceived Converter.ToBytes( (int)bq.RewardGold, tempBuff, ref offset ); // moneyReceived if ( rewards!= null ) { Converter.ToBytes( (int)rewards.Length, tempBuff, ref offset ); // count rewarded items for ( int i=0; i< rewards.Length; i++ ) { Reward rew = rewards[i]; Converter.ToBytes( (int)rew.Id, tempBuff, ref offset ); // reward Id Converter.ToBytes( (int)rew.Amount, tempBuff, ref offset ); // reward Amount } } else Converter.ToBytes( (int)0, tempBuff, ref offset ); Send( OpCodes.SMSG_QUESTGIVER_QUEST_COMPLETE, tempBuff, offset ); RemoveQuest( (byte)num ); break; } num++; } }
/// <summary> /// Create Reward item /// </summary> public Item RewardItem(int sel) { Reward r = (Reward)_items[sel]; return((r != null) ? r.CreateItem() : null); }
/// <summary> /// get Reward amount /// </summary> public int RewardAmount(int sel) { Reward r = (Reward)_items[sel]; return((r != null) ? r.Amount : 0); }
/// <summary> /// Add new Reward [Item] /// </summary> public void Add( Reward r ) { if ( r.ExistsInWorld ) { if ( CanAdd ) _items.Add( r ); } else BadIdList.AddItemId( r.Id ); }