/// <summary> /// Called from ArtifactScholar when he is interacted on /// </summary> /// <param name="source"></param> /// <param name="target"></param> /// <returns></returns> public bool Interact(GameLiving source, GameLiving target) { GamePlayer player = source as GamePlayer; ArtifactScholar scholar = target as ArtifactScholar; if (player == null || scholar == null) { return(false); } //If the player is already doing the quest, we look if he has the items: if (Step == 0) { scholar.SayTo(player, "Since you are still interested, simply hand me your Artifact and I shall begin."); } else { string options = ""; foreach (string str in m_curTypes) { options += "[" + str + "] "; } scholar.SayTo(player, "Choose your options I mentioned earlier and I shall begin.\n\nYour options are: " + options); } return(true); }
/// <summary> /// Called from ArtifactScholar when he receives a whisper /// </summary> /// <param name="source"></param> /// <param name="target"></param> /// <param name="text"></param> /// <returns></returns> public override bool WhisperReceive(GameLiving source, GameLiving target, string text) { GamePlayer player = source as GamePlayer; ArtifactScholar scholar = target as ArtifactScholar; if (player == null || scholar == null) { return(false); } //Did they send a valid string? if (m_curTypes.Contains(text)) { //Apend their choice to the chosen types m_chosenTypes = string.Format("{0}{1};", m_chosenTypes, text); //Lets get the next set of options //Get the versions of this art Dictionary <String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtifactID, (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm); //If we still have more options, give it to them if (GetNextOptions(versions) && virtualStep < MAXNUMOFSTEPS) { SaveProperties(); scholar.TurnTo(player); scholar.SayTo(player, string.Format("Would you prefer {0} of {1}?", GetOptions(), ArtifactID)); Step++; } //Else lets hand them their finished artifact! else { scholar.TurnTo(player); //Attempt to get the right version of the artifact m_chosenTypes = m_chosenTypes.Replace(";;", ";"); if (!versions.ContainsKey(m_chosenTypes)) { log.Warn(String.Format("Artifact version {0} not found", m_chosenTypes)); scholar.SayTo(player, eChatLoc.CL_PopupWindow, "I can't find your chosen replacement, it may not be available for your class. Please try again."); ReturnArtifact(player); return(true); } ItemTemplate template = versions[m_chosenTypes] as ItemTemplate; if (GiveItem(player, template)) { FinishQuest(); scholar.SayTo(player, eChatLoc.CL_PopupWindow, string.Format("Here is your {0}, {1}. May it serve you well!", ArtifactID, player.CharacterClass.Name)); return(true); } return(false); } } return(base.WhisperReceive(source, target, text)); }
/// <summary> /// Handle an item given to the scholar. /// </summary> /// <param name="source"></param> /// <param name="item"></param> /// <param name="target"></param> /// <returns></returns> public override bool ReceiveItem(GameLiving source, GameLiving target, InventoryItem item) { GamePlayer player = source as GamePlayer; ArtifactScholar scholar = target as ArtifactScholar; if (player == null || scholar == null) { return(false); } //If the player is on the right step (the give me an art step) if (Step == 0) { //Lets see if they gave us a valid artifact string ArtID = ArtifactMgr.GetArtifactIDFromItemID(item.Id_nb); Dictionary <String, ItemTemplate> versions = ArtifactMgr.GetArtifactVersions(ArtID, (eCharacterClass)player.CharacterClass.ID, (eRealm)player.Realm); //If this artifact has more than one option for them, give them the quest if (versions != null && item != null && versions.Count > 1 && RemoveItem(player, item)) { m_artifactID = ArtID; SetCustomProperty("Art", ArtifactID); SetCustomProperty("Id_nb", item.Id_nb); SetCustomProperty("AXP", (item as InventoryArtifact).Experience.ToString()); SetCustomProperty("ALevel", (item as InventoryArtifact).ArtifactLevel.ToString()); GetNextOptions(versions); SaveProperties(); scholar.TurnTo(player); scholar.SayTo(player, string.Format("Would you prefer {0} of {1}?", GetOptions(), ArtifactID)); Step = 1; return(true); } } else { //Why are they giving this to us! player.Out.SendMessage(string.Format("{0} doesn't want that item.", scholar.Name), eChatType.CT_Say, eChatLoc.CL_SystemWindow); } return(base.ReceiveItem(source, target, item)); }
public static void Init() { if (!ServerProperties.Properties.LOAD_QUESTS) return; if (log.IsInfoEnabled) log.Info("Quest \"" + QuestTitle + "\" initializing ..."); #region defineNPCs GameNPC[] npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarFemale") + " Alaria", eRealm.Midgard); if (npcs.Length == 0) { m_scholarAlaria = new ArtifactScholar(); m_scholarAlaria.Model = 226; m_scholarAlaria.Name = "Artifact Scholar Alaria"; if (log.IsWarnEnabled) log.Warn("Could not find " + m_scholarAlaria.Name + ", creating her ..."); m_scholarAlaria.Realm = eRealm.Midgard; m_scholarAlaria.CurrentRegionID = 71; m_scholarAlaria.Size = 50; m_scholarAlaria.Level = 45; m_scholarAlaria.X = 565733; m_scholarAlaria.Y = 569502; m_scholarAlaria.Z = 7255; m_scholarAlaria.Heading = 708; m_scholarAlaria.MaxSpeedBase = 200; m_scholarAlaria.SaveIntoDatabase(); m_scholarAlaria.AddToWorld(); } else m_scholarAlaria = npcs[0] as ArtifactScholar; npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarMale") + " Jarron", eRealm.Albion); if (npcs.Length == 0) { m_scholarJarron = new ArtifactScholar(); m_scholarJarron.Model = 50; m_scholarJarron.Name = "Artifact Scholar Jarron"; if (log.IsWarnEnabled) log.Warn("Could not find " + m_scholarJarron.Name + ", creating him ..."); m_scholarJarron.Realm = eRealm.Albion; m_scholarJarron.CurrentRegionID = 70; m_scholarJarron.Size = 50; m_scholarJarron.Level = 45; m_scholarJarron.X = 577936; m_scholarJarron.Y = 533228; m_scholarJarron.Z = 7295; m_scholarJarron.Heading = 3731; m_scholarJarron.MaxSpeedBase = 200; m_scholarJarron.SaveIntoDatabase(); m_scholarJarron.AddToWorld(); } else m_scholarJarron = npcs[0] as ArtifactScholar; npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarMale") + " Elmer", eRealm.Hibernia); if (npcs.Length == 0) { m_scholarElmer = new ArtifactScholar(); m_scholarElmer.Model = 374; m_scholarElmer.Name = "Artifact Scholar Elmer"; if (log.IsWarnEnabled) log.Warn("Could not find " + m_scholarElmer.Name + ", creating him ..."); m_scholarElmer.Realm = eRealm.Hibernia; m_scholarElmer.CurrentRegionID = 72; m_scholarElmer.Size = 50; m_scholarElmer.Level = 45; m_scholarElmer.X = 552291; m_scholarElmer.Y = 576366; m_scholarElmer.Z = 6767; m_scholarElmer.Heading = 1074; m_scholarElmer.MaxSpeedBase = 200; m_scholarElmer.SaveIntoDatabase(); m_scholarElmer.AddToWorld(); } else m_scholarElmer = npcs[0] as ArtifactScholar; #endregion m_scholarAlaria.AddQuestToGive(typeof(ArtifactTurnInQuest)); m_scholarJarron.AddQuestToGive(typeof(ArtifactTurnInQuest)); m_scholarElmer.AddQuestToGive(typeof(ArtifactTurnInQuest)); if (log.IsInfoEnabled) log.Info("Quest \"" + QuestTitle + "\" initialized"); }
public static void Init() { if (!ServerProperties.Properties.LOAD_QUESTS) { return; } if (log.IsInfoEnabled) { log.Info("Quest \"" + QuestTitle + "\" initializing ..."); } #region defineNPCs GameNPC[] npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarFemale") + " Alaria", eRealm.Midgard); if (npcs.Length == 0) { m_scholarAlaria = new ArtifactScholar(); m_scholarAlaria.Model = 226; m_scholarAlaria.Name = "Artifact Scholar Alaria"; if (log.IsWarnEnabled) { log.Warn("Could not find " + m_scholarAlaria.Name + ", creating her ..."); } m_scholarAlaria.Realm = eRealm.Midgard; m_scholarAlaria.CurrentRegionID = 71; m_scholarAlaria.Size = 50; m_scholarAlaria.Level = 45; m_scholarAlaria.X = 565733; m_scholarAlaria.Y = 569502; m_scholarAlaria.Z = 7255; m_scholarAlaria.Heading = 708; m_scholarAlaria.MaxSpeedBase = 200; m_scholarAlaria.SaveIntoDatabase(); m_scholarAlaria.AddToWorld(); } else { m_scholarAlaria = npcs[0] as ArtifactScholar; } npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarMale") + " Jarron", eRealm.Albion); if (npcs.Length == 0) { m_scholarJarron = new ArtifactScholar(); m_scholarJarron.Model = 50; m_scholarJarron.Name = "Artifact Scholar Jarron"; if (log.IsWarnEnabled) { log.Warn("Could not find " + m_scholarJarron.Name + ", creating him ..."); } m_scholarJarron.Realm = eRealm.Albion; m_scholarJarron.CurrentRegionID = 70; m_scholarJarron.Size = 50; m_scholarJarron.Level = 45; m_scholarJarron.X = 577936; m_scholarJarron.Y = 533228; m_scholarJarron.Z = 7295; m_scholarJarron.Heading = 3731; m_scholarJarron.MaxSpeedBase = 200; m_scholarJarron.SaveIntoDatabase(); m_scholarJarron.AddToWorld(); } else { m_scholarJarron = npcs[0] as ArtifactScholar; } npcs = WorldMgr.GetNPCsByName(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarMale") + " Elmer", eRealm.Hibernia); if (npcs.Length == 0) { m_scholarElmer = new ArtifactScholar(); m_scholarElmer.Model = 374; m_scholarElmer.Name = "Artifact Scholar Elmer"; if (log.IsWarnEnabled) { log.Warn("Could not find " + m_scholarElmer.Name + ", creating him ..."); } m_scholarElmer.Realm = eRealm.Hibernia; m_scholarElmer.CurrentRegionID = 72; m_scholarElmer.Size = 50; m_scholarElmer.Level = 45; m_scholarElmer.X = 552291; m_scholarElmer.Y = 576366; m_scholarElmer.Z = 6767; m_scholarElmer.Heading = 1074; m_scholarElmer.MaxSpeedBase = 200; m_scholarElmer.SaveIntoDatabase(); m_scholarElmer.AddToWorld(); } else { m_scholarElmer = npcs[0] as ArtifactScholar; } #endregion m_scholarAlaria.AddQuestToGive(typeof(ArtifactTurnInQuest)); m_scholarJarron.AddQuestToGive(typeof(ArtifactTurnInQuest)); m_scholarElmer.AddQuestToGive(typeof(ArtifactTurnInQuest)); if (log.IsInfoEnabled) { log.Info("Quest \"" + QuestTitle + "\" initialized"); } }
public static void Init() { if (!ServerProperties.Properties.LOAD_QUESTS) { return; } if (Log.IsInfoEnabled) { Log.Info("Quest \"" + QuestTitle + "\" initializing ..."); } GameNPC[] npcs = WorldMgr.GetObjectsByName <GameNPC>($"{LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarFemale")} Alaria", eRealm.Midgard); if (npcs.Length == 0) { _scholarAlaria = new ArtifactScholar { Model = 226, Name = "Artifact Scholar Alaria", Realm = eRealm.Midgard, CurrentRegionID = 71, Size = 50, Level = 45, X = 565733, Y = 569502, Z = 7255, Heading = 708, MaxSpeedBase = 200 }; if (Log.IsWarnEnabled) { Log.Warn($"Could not find {_scholarAlaria.Name}, creating her ..."); } _scholarAlaria.SaveIntoDatabase(); _scholarAlaria.AddToWorld(); } else { _scholarAlaria = npcs[0] as ArtifactScholar; } npcs = WorldMgr.GetObjectsByName <GameNPC>($"{LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarMale")} Jarron", eRealm.Albion); if (npcs.Length == 0) { _scholarJarron = new ArtifactScholar { Model = 50, Name = "Artifact Scholar Jarron", Realm = eRealm.Albion, CurrentRegionID = 70, Size = 50, Level = 45, X = 577936, Y = 533228, Z = 7295, Heading = 3731, MaxSpeedBase = 200 }; if (Log.IsWarnEnabled) { Log.Warn("Could not find " + _scholarJarron.Name + ", creating him ..."); } _scholarJarron.SaveIntoDatabase(); _scholarJarron.AddToWorld(); } else { _scholarJarron = npcs[0] as ArtifactScholar; } npcs = WorldMgr.GetObjectsByName <GameNPC>( $"{LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "ArtifactTurnInQuest.Init.ArtifactScholarMale")} Elmer", eRealm.Hibernia); if (npcs.Length == 0) { _scholarElmer = new ArtifactScholar { Model = 374, Name = "Artifact Scholar Elmer", Realm = eRealm.Hibernia, CurrentRegionID = 72, Size = 50, Level = 45, X = 552291, Y = 576366, Z = 6767, Heading = 1074, MaxSpeedBase = 200 }; if (Log.IsWarnEnabled) { Log.Warn("Could not find " + _scholarElmer.Name + ", creating him ..."); } _scholarElmer.SaveIntoDatabase(); _scholarElmer.AddToWorld(); } else { _scholarElmer = npcs[0] as ArtifactScholar; } _scholarAlaria?.AddQuestToGive(typeof(ArtifactTurnInQuest)); _scholarJarron?.AddQuestToGive(typeof(ArtifactTurnInQuest)); _scholarElmer?.AddQuestToGive(typeof(ArtifactTurnInQuest)); if (Log.IsInfoEnabled) { Log.Info($"Quest \"{QuestTitle}\" initialized"); } }