public override void OnTalk(PlayerMobile player, bool contextMenu) { //Look at the player this.Direction = GetDirectionTo(player); //New quest proposal //Create the quest QuestSystem newQuest = new BrianQuest(player); //First we check if we have done Bobs Quest LoggedQuestState state = LoggedQuestSystem.getQuestState(player, "Alfred's Quest"); switch (state) { case LoggedQuestState.FINISHED: //Look for this quest's state LoggedQuestState Brianstate = LoggedQuestSystem.getQuestState(player, "Brian's Quest"); //Switch on the state switch (Brianstate) { case LoggedQuestState.NOTINVOLVED: //Are we already doing a quest ? if (!(player.Quest == null && QuestSystem.CanOfferQuest(player, typeof(BrianQuest)))) { newQuest.AddConversation( new GenericConversation( "I'm sorry but you are already occupied, come back later<br><br>" + "And I'll have a quest for you" ) ); return; } newQuest.SendOffer(); break; case LoggedQuestState.ACCEPTED: BrianQuest bq = player.Quest as BrianQuest; //Being paranoiac, normally bq can't be null be let's be sure if (bq != null) { //Ok we know we have a quest, are we in progress killing bunnies ? if (bq.IsObjectiveInProgress(typeof(BriansKillsObjective))) { bq.AddConversation(new GenericConversation("You have not finished your quest")); } //No then we are wanting the reward else { QuestObjective lastObj = bq.FindObjective(typeof(BriansReturnAfterKillsObjective)); //Ok normally it's got to be non null and it shouldn't be completed //Yet another paranoiac test if (lastObj != null && !lastObj.Completed) { //Send the player to Brian this.Say("I told you to go see Charlie when you were finished..."); } } } else { //Write to console, if you see this, you made a mistake in the quest name... Console.WriteLine("Quest should not be null, what happenned?"); } break; case LoggedQuestState.CANCELED: this.Say("You canceled your quest, move along"); break; case LoggedQuestState.FINISHED: this.Say("You have already finished this quest, move along"); break; case LoggedQuestState.DECLINED: this.Say("You have refused this quest, move along"); break; default: break; } break; case LoggedQuestState.ACCEPTED: this.Say("Finish Alfred's quest and come and see me"); break; case LoggedQuestState.CANCELED: this.Say("You canceled Alfred's quest, move along"); break; case LoggedQuestState.DECLINED: this.Say("You declined Alfred's quest, move along"); break; case LoggedQuestState.NOTINVOLVED: this.Say("Ahhh, you must prove yourself first to Alfred"); break; default: break; } }
public override void OnTalk(PlayerMobile player, bool contextMenu) { //Look at the player this.Direction = GetDirectionTo(player); //Look for the quest state LoggedQuestState state = LoggedQuestSystem.getQuestState(player, "Brian's Quest"); //Switch on the state switch (state) { case LoggedQuestState.ACCEPTED: BrianQuest bq = player.Quest as BrianQuest; //Being paranoiac, normally bq can't be null be let's be sure if (bq != null) { QuestObjective lastObj = bq.FindObjective(typeof(BriansReturnAfterKillsObjective)); //Ok normally it's got to be non null and it shouldn't be completed //Yet another paranoiac test if (lastObj != null && !lastObj.Completed) { //Give some gold bool gold = true; BrianQuest.GiveRewardTo(player, ref gold); //Check if we gave it all if (!gold) { //Last check, has the player done the Bob's quest ? state = LoggedQuestSystem.getQuestState(player, "Bob's Quest"); if (state == LoggedQuestState.FINISHED) { bq.AddConversation(new GenericConversation( "Charlie gives you your gold, at last this is over... <br><br>" + "He looks up at you and says : <br>" + "\"Ahhhh, I see you have also helped Bob! <br><br>" + "Why don't you go see David, he'll have a special compensation for you\"")); } else { bq.AddConversation(new GenericConversation( "Charlie gives you your gold, at last this is over..." ) ); } lastObj.Complete(); } else //If not { bq.AddConversation(new GenericConversation("Your backpack is full, make room!")); } } } else { //Write to console, if you see this, you made a mistake in the quest name... Console.WriteLine("Quest should not be null, what happenned?"); } break; default: this.Say("I have nothing to say to you..."); break; } }