public static void HandleQuestGiverAcceptQuest(IRealmClient client, RealmPacketIn packet) { var guid = packet.ReadEntityId(); var chr = client.ActiveCharacter; var qGiver = chr.QuestLog.GetQuestGiver(guid); var questid = packet.ReadUInt32(); var qt = QuestMgr.GetTemplate(questid); //if it's item then check if has associated //character - has the quest and it is shareable //gameobject - has the quest, has all the requirements if (qt != null && qGiver != null) { if (qGiver.QuestHolderInfo.QuestStarts.Contains(qt)) { chr.QuestLog.TryAddQuest(qt, qGiver); } } }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { var target = trigger.Args.Target; if (!(target is Character)) { trigger.Reply("Invalid target: {0} - Character-target required.", target); } else { var chr = (Character)target; var id = trigger.Text.NextUInt(0); QuestTemplate quest = null; if (id > 0) { quest = QuestMgr.GetTemplate(id); } if (quest == null) { trigger.Reply("Invalid QuestId: {0}", id); } else { if (!chr.QuestLog.RemoveFinishedQuest(id)) { // if its not already been finished, maybe it's still in progress? chr.QuestLog.Cancel(id); trigger.Reply("Removed active quest: {0}", quest); } else { trigger.Reply("Removed finished quest: {0}", quest); } } } }
/* * /// <summary> * /// Converts the log-file in the given file (within the <c>LogFolder</c>) * /// to a human-readable file within the <c>LogOutputFolder</c>. * /// </summary> * /// <param name="filename">The name of the file within the LogFolder to be converter</param> * /// <param name="converter">The Converter-method, either <c>KSnifferLogConverter.ConvertLog</c> or <c>SniffzitLogConverter.ConvertLog</c></param> * public static void ConvertLog(string filename, Action<string, string> converter) * { * Directory.CreateDirectory(ToolConfig.LogFolder); * Directory.CreateDirectory(ToolConfig.LogOutputFolder); * * var inputFile = Path.Combine(ToolConfig.LogFolder, filename); * Console.WriteLine("Converting log-file: " + new FileInfo(inputFile).FullName); * * DebugUtil.Init(); * * var outFile = Path.Combine(ToolConfig.LogOutputFolder, filename); * if (!outFile.EndsWith(".txt")) * { * outFile += ".txt"; * } * converter(inputFile, outFile); * } * * [Tool] * public static void ConvertKSnifferLogSingleLine(string filename) * { * Directory.CreateDirectory(ToolConfig.LogFolder); * Directory.CreateDirectory(ToolConfig.LogOutputFolder); * * var inputFile = Path.Combine(ToolConfig.LogFolder, filename); * Console.Write("Converting log-file: " + new FileInfo(inputFile).FullName + " ..."); * * DebugUtil.Init(); * * var outFile = Path.Combine(ToolConfig.LogOutputFolder, filename); * if (!outFile.EndsWith(".txt")) * { * outFile += ".txt"; * } * * KSnifferLogConverter.ConvertLog(inputFile, outFile, true); * Console.WriteLine("Done. - Output has been written to: " + new FileInfo(outFile).FullName); * //Console.WriteLine(); * }*/ public static void Startup() { Utility.Measure("Load all", 1, () => { ItemMgr.LoadAll(); NPCMgr.LoadNPCDefs(); GOMgr.LoadAll(); QuestMgr.LoadAll(); }); Utility.Measure("Basic startup sequence", 1, () => { RealmServ.Instance.Start(); Utility.Measure("Load all", 1, () => { ItemMgr.LoadAll(); NPCMgr.LoadNPCDefs(); GOMgr.LoadAll(); QuestMgr.LoadAll(); }); Map.AutoSpawnMaps = true; var easternKD = World.GetNonInstancedMap(MapId.EasternKingdoms); var kalimdor = World.GetNonInstancedMap(MapId.Kalimdor); var outlands = World.GetNonInstancedMap(MapId.Outland); Utility.Measure("Spawning Main Maps", 1, () => { //easternKD.Start(); //kalimdor.Start(); }); GC.Collect(); Console.WriteLine("Total memory usage with fully spawned world: {0}", GC.GetTotalMemory(true)); }); }
public override void Process(CmdTrigger <RealmServerCmdArgs> trigger) { Unit target = trigger.Args.Target; if (!(target is Character)) { trigger.Reply("Invalid target: {0} - Character-target required.", (object)target); } else { Character character = (Character)target; uint id = trigger.Text.NextUInt(0U); QuestTemplate qt = null; if (id > 0U) { qt = QuestMgr.GetTemplate(id); } if (qt == null) { trigger.Reply("Invalid QuestId: {0}", (object)id); } else { if (!character.QuestLog.RemoveFinishedQuest(id)) { character.QuestLog.Cancel(id); } if (character.QuestLog.AddQuest(qt) == null) { trigger.Reply("Could not add Quest: " + qt); } else { trigger.Reply("Quest added: " + qt); } } } }
protected static void SubscribeQuest(DOLEvent e, object sender, EventArgs args) { QuestEventArgs qargs = args as QuestEventArgs; if (qargs == null) { return; } if (qargs.QuestID != QuestMgr.GetIDForQuestType(typeof(TraitorInMularn))) { return; } if (e == GamePlayerEvent.AcceptQuest) { CheckPlayerAcceptQuest(qargs.Player, 0x01); } else if (e == GamePlayerEvent.DeclineQuest) { CheckPlayerAcceptQuest(qargs.Player, 0x00); } }
public static void FixIt() { //The Emblazoned Runeblade var quest = QuestMgr.GetTemplate(12619); quest.QuestFinished += EmblazonRuneBladeQuestFinished; //The Endless Hunger quest = QuestMgr.GetTemplate(12848); var index = quest.GetInteractionTemplateFor(NPCId.UnworthyInitiate).Index; quest.AddLinkedNPCInteractions(index, NPCId.UnworthyInitiate_2, NPCId.UnworthyInitiate_3, NPCId.UnworthyInitiate_4, NPCId.UnworthyInitiate_5); //Death Comes From On High quest = QuestMgr.GetTemplate(12641); quest.QuestCancelled += DeathComesFromOnHighCancelled; //make the go sparkle, we dont click the eye //we must click the holder under it! quest.AddGOInteraction(GOEntryId.EyeOfAcherusControlMechanism, 0); }
/// <summary> /// 初始化用户任务记录 [操作:加载有效用户任务列表;加载监听事件] /// </summary> /// <param name="playerId"></param> public void LoadFromDatabase(int playerId) { lock (m_lock) { m_states = m_player.PlayerCharacter.QuestSite.Count() == 0 ? InitQuest() : m_player.PlayerCharacter.QuestSite; using (PlayerBussiness db = new PlayerBussiness()) { QuestDataInfo[] datas = db.GetUserQuest(playerId); BeginChanges(); foreach (QuestDataInfo dt in datas) { QuestInfo info = QuestMgr.GetSingleQuest(dt.QuestID); if (info != null) { AddQuest(new BaseQuest(info, dt)); } } CommitChanges(); } if (m_list != null) { } } }
public static void DoCommand(string CommandName, string[] CommandArgs) { PlayerBussiness bussiness; PlayerInfo userSingleByNickName; Exception exception; string str3; string str4; string str5; ManageBussiness bussiness2; switch (CommandName) { case "exit": GameServer.KeepRunning = false; break; case "cp": { GameClient[] allClients = GameServer.Instance.GetAllClients(); int num = (allClients == null) ? 0 : allClients.Length; GamePlayer[] allPlayers = WorldMgr.GetAllPlayers(); int num2 = (allPlayers == null) ? 0 : allPlayers.Length; List <BaseRoom> allUsingRoom = RoomMgr.GetAllUsingRoom(); int num3 = 0; int num4 = 0; foreach (BaseRoom room in allUsingRoom) { if (!room.IsEmpty) { num3++; if (room.IsPlaying) { num4++; } } } double totalMemory = GC.GetTotalMemory(false); Console.WriteLine(string.Format("Total Clients/Players:{0}/{1}", num, num2)); Console.WriteLine(string.Format("Total Rooms/Games:{0}/{1}", num3, num4)); Console.WriteLine(string.Format("Total Momey Used:{0} MB", (totalMemory / 1024.0) / 1024.0)); break; } case "setlevel": try { string path = Path.Combine(Environment.CurrentDirectory, "LevelList.xml"); if (!File.Exists(path)) { log.Error("LevelList.xml not found!"); } else { int num6; Console.Write("Please enter the level: "); string s = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!int.TryParse(s, out num6)) { log.Error("Level is not valid int!"); } else { using (bussiness = new PlayerBussiness()) { userSingleByNickName = bussiness.GetUserSingleByNickName((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); if (userSingleByNickName == null) { log.Error(string.Format("Player not found in db!", new object[0])); break; } if (!IsValidGZip(File.ReadAllBytes(path))) { log.Error("LevelList.xml is not valid!"); } else if (!IsValidXML(GZip.gzuncompress(File.ReadAllBytes(path)))) { log.Error("LevelList.xml is not valid!"); } if (WorldMgr.GetPlayerById(userSingleByNickName.ID) != null) { WorldMgr.GetPlayerById(userSingleByNickName.ID).SaveIntoDatabase(); WorldMgr.GetPlayerById(userSingleByNickName.ID).Disconnect(); } XmlDocument document = new XmlDocument(); document.LoadXml(GZip.gzuncompress(File.ReadAllBytes(path))); int num7 = -1; int num8 = -1; foreach (XmlNode node in document.SelectNodes("/Result/*")) { if (node.Attributes["Grade"].Value == s) { num7 = int.Parse(s); num8 = int.Parse(node.Attributes["GP"].Value) + 5; break; } } if ((num7 != -1) && (num8 != -1)) { userSingleByNickName.GP = num8; userSingleByNickName.Grade = num7; bussiness.UpdatePlayer(userSingleByNickName); log.Info(string.Format("Player {0} updated successfully!", userSingleByNickName.NickName)); } else { log.Error(string.Format("Level {0} not found!", new object[0])); } } } } } catch (Exception exception1) { exception = exception1; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "addmoney": try { using (bussiness = new PlayerBussiness()) { userSingleByNickName = bussiness.GetUserSingleByNickName((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); if (userSingleByNickName != null) { if (WorldMgr.GetPlayerById(userSingleByNickName.ID) != null) { WorldMgr.GetPlayerById(userSingleByNickName.ID).SaveIntoDatabase(); WorldMgr.GetPlayerById(userSingleByNickName.ID).Disconnect(); } Console.Write("Please enter the amount of money: "); str3 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!IsValidInt(str3)) { log.Error("Money is not valid!"); } else { userSingleByNickName.Money += int.Parse(str3); bussiness.UpdatePlayer(userSingleByNickName); log.Info(string.Format("Player {0} updated successfully!", userSingleByNickName.NickName)); } } else { log.Error(string.Format("Player not found in db!", new object[0])); } } } catch (Exception exception3) { exception = exception3; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "addgold": try { using (bussiness = new PlayerBussiness()) { userSingleByNickName = bussiness.GetUserSingleByNickName((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); if (userSingleByNickName != null) { if (WorldMgr.GetPlayerById(userSingleByNickName.ID) != null) { WorldMgr.GetPlayerById(userSingleByNickName.ID).SaveIntoDatabase(); WorldMgr.GetPlayerById(userSingleByNickName.ID).Disconnect(); } Console.Write("Please enter the amount of gold: "); str4 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!IsValidInt(str4)) { log.Error("Gold is not valid!"); } else { userSingleByNickName.Gold += int.Parse(str4); bussiness.UpdatePlayer(userSingleByNickName); log.Info(string.Format("Player {0} updated successfully!", userSingleByNickName.NickName)); } } else { log.Error(string.Format("Player not found in db!", new object[0])); } } } catch (Exception exception4) { exception = exception4; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "addgift": try { using (bussiness = new PlayerBussiness()) { userSingleByNickName = bussiness.GetUserSingleByNickName((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); if (userSingleByNickName != null) { Console.Write("Please enter the amount of gift token: "); str5 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!IsValidInt(str5)) { log.Error("Gold is not valid!"); } else { if (WorldMgr.GetPlayerById(userSingleByNickName.ID) != null) { WorldMgr.GetPlayerById(userSingleByNickName.ID).SaveIntoDatabase(); WorldMgr.GetPlayerById(userSingleByNickName.ID).Disconnect(); } userSingleByNickName.GiftToken += int.Parse(str5); bussiness.UpdatePlayer(userSingleByNickName); log.Info(string.Format("Player {0} updated successfully!", userSingleByNickName.NickName)); } } else { log.Error(string.Format("Player not found in db!", new object[0])); } } } catch (Exception exception5) { exception = exception5; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "removemoney": try { using (bussiness = new PlayerBussiness()) { userSingleByNickName = bussiness.GetUserSingleByNickName((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); if (userSingleByNickName != null) { if (WorldMgr.GetPlayerById(userSingleByNickName.ID) != null) { WorldMgr.GetPlayerById(userSingleByNickName.ID).SaveIntoDatabase(); WorldMgr.GetPlayerById(userSingleByNickName.ID).Disconnect(); } Console.Write("Please enter the amount of money: "); str3 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!IsValidInt(str3)) { log.Error("Money is not valid!"); } else { userSingleByNickName.Money -= int.Parse(str3); bussiness.UpdatePlayer(userSingleByNickName); log.Info(string.Format("Player {0} updated successfully!", userSingleByNickName.NickName)); } } else { log.Error(string.Format("Player not found in db!", new object[0])); } } } catch (Exception exception6) { exception = exception6; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "removegold": try { using (bussiness = new PlayerBussiness()) { userSingleByNickName = bussiness.GetUserSingleByNickName((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); if (userSingleByNickName != null) { if (WorldMgr.GetPlayerById(userSingleByNickName.ID) != null) { WorldMgr.GetPlayerById(userSingleByNickName.ID).SaveIntoDatabase(); WorldMgr.GetPlayerById(userSingleByNickName.ID).Disconnect(); } Console.Write("Please enter the amount of gold: "); str4 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!IsValidInt(str4)) { log.Error("Gold is not valid!"); } else { userSingleByNickName.Gold -= int.Parse(str4); bussiness.UpdatePlayer(userSingleByNickName); log.Info(string.Format("Player {0} updated successfully!", userSingleByNickName.NickName)); } } else { log.Error(string.Format("Player not found in db!", new object[0])); } } } catch (Exception exception7) { exception = exception7; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "removegift": try { using (bussiness = new PlayerBussiness()) { userSingleByNickName = bussiness.GetUserSingleByNickName((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); if (userSingleByNickName != null) { if (WorldMgr.GetPlayerById(userSingleByNickName.ID) != null) { WorldMgr.GetPlayerById(userSingleByNickName.ID).SaveIntoDatabase(); WorldMgr.GetPlayerById(userSingleByNickName.ID).Disconnect(); } Console.Write("Please enter the amount of gift token: "); str5 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!IsValidInt(str5)) { log.Error("Gold is not valid!"); } else { userSingleByNickName.GiftToken -= int.Parse(str5); bussiness.UpdatePlayer(userSingleByNickName); log.Info(string.Format("Player {0} updated successfully!", userSingleByNickName.NickName)); } } else { log.Error(string.Format("Player not found in db!", new object[0])); } } } catch (Exception exception8) { exception = exception8; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "shutdown": _count = 6; _timer = new System.Threading.Timer(new TimerCallback(ConsoleStart.ShutDownCallBack), null, 0, 0xea60); break; case "addcps": try { Console.Write("Insira o valor dos Cupons:"); int num9 = int.Parse((CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine()); foreach (GamePlayer player in WorldMgr.GetAllPlayers()) { player.AddMoney(num9); player.SendMessage("Parab\x00e9ns, voc\x00ea recebeu " + num9 + " cupons do evento, bom jogo !"); } } catch (Exception exception9) { exception = exception9; log.Error("Error on AddCps", exception); } break; case "bnick": { Console.Clear(); Console.WriteLine("Digite o NickName do personagem: "); string nickName = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); Console.WriteLine("Motivo para banir: "); string msg = (CommandArgs.Length > 1) ? CommandArgs[1] : Console.ReadLine(); DateTime date = new DateTime(0x7e1, 7, 2); using (bussiness2 = new ManageBussiness()) { bussiness2.ForbidPlayerByNickName(nickName, date, false); bussiness2.KitoffUserByNickName(nickName, msg); } Console.WriteLine("O Usu\x00e1rio " + nickName + " Foi Banido do servidor."); foreach (GamePlayer player2 in WorldMgr.GetAllPlayers()) { player2.SendMessage("O Usu\x00e1rio " + nickName + " foi banido do servidor, motivo do BAN: " + msg + "."); } break; } case "buser": { Console.Clear(); Console.WriteLine("Digite o UserName do personagem: "); string userName = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); Console.WriteLine("Motivo para banir: "); string str9 = (CommandArgs.Length > 1) ? CommandArgs[1] : Console.ReadLine(); DateTime time2 = new DateTime(0x7e1, 7, 2); using (bussiness2 = new ManageBussiness()) { bussiness2.ForbidPlayerByUserName(userName, time2, false); bussiness2.KitoffUserByUserName(userName, str9); } Console.WriteLine("O Usu\x00e1rio " + userName + " Foi Banido do servidor."); foreach (GamePlayer player2 in WorldMgr.GetAllPlayers()) { player2.SendMessage("O Usu\x00e1rio " + userName + " foi banido do servidor, motivo do BAN: " + str9 + "."); } break; } case "nkick": { Console.Clear(); Console.WriteLine("Digite o NickName do personagem: "); string name = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); Console.WriteLine("Motivo para kikar: "); string str11 = (CommandArgs.Length > 1) ? CommandArgs[1] : Console.ReadLine(); using (bussiness2 = new ManageBussiness()) { bussiness2.KitoffUserByNickName(name, str11); } foreach (GamePlayer player2 in WorldMgr.GetAllPlayers()) { player2.SendMessage("O Usu\x00e1rio " + name + " foi kikado do servidor, motivo do KICK: " + str11 + "."); } break; } case "ukick": { Console.Clear(); Console.WriteLine("Digite o NickName do personagem: "); string str12 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); Console.WriteLine("Motivo para kikar: "); string str13 = (CommandArgs.Length > 1) ? CommandArgs[1] : Console.ReadLine(); using (bussiness2 = new ManageBussiness()) { bussiness2.KitoffUserByUserName(str12, str13); } foreach (GamePlayer player2 in WorldMgr.GetAllPlayers()) { player2.SendMessage("O Usu\x00e1rio " + str12 + " foi kikado do servidor, motivo do KICK: " + str13 + "."); } break; } case "maint": try { int num10; Console.Write("Enter time in minutes to start maintenance: "); string str14 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); if (!int.TryParse(str14, out num10)) { log.Error("Invalid MainTime!"); } else { new Thread(delegate(object mt) { if (mt is string) { Action <string, string> Sys = delegate(string nick, string Text) { Console.WriteLine(Text); foreach (GamePlayer player in WorldMgr.GetAllPlayers()) { player.SendMessage(string.Format("[{0}] {1}", nick, Text)); } }; Action DisconnectAll = delegate { foreach (GamePlayer player in WorldMgr.GetAllPlayers()) { log.Info(string.Format("Saving Player {0} into Database!", player.PlayerCharacter.NickName)); player.SaveIntoDatabase(); log.Info(string.Format("Disconnecting Player {0}!", player.PlayerCharacter.NickName)); player.Disconnect(); } log.Info("Shutdown Server!"); GameServer.Instance.Shutdown(); LogManager.Shutdown(); }; Sys("Auto Maintenance", "Manuten\x00e7\x00e3o agendada, fiquem atentos aos aviso!"); System.Timers.Timer MainTimer = new System.Timers.Timer { Interval = 1000.0 }; DateTime MainTime = DateTime.Parse(string.Format("{0} 00:00:00", "01/27/2011"), CultureInfo.GetCultureInfo("en-US")); MainTime = MainTime.AddMinutes(double.Parse(mt as string)); string CurrentTime = MainTime.ToString("HH:mm:ss"); MainTimer.Elapsed += delegate(object s, ElapsedEventArgs e) { if (CurrentTime != "00:00:00") { if ((MainTime.Minute != 0) && (MainTime.Second == 0)) { Sys("Auto Maintenance", string.Format("Falta {0} {1} para a manuten\x00e7\x00e3o!", MainTime.Minute, (MainTime.Minute == 1) ? "Minuto" : "Minutos")); } else if (MainTime.Second < 11) { Sys("Auto Maintenance", string.Format("Fechando o servidor em {0}", MainTime.Second)); } CurrentTime = MainTime.AddSeconds(-1.0).ToString("HH:mm:ss"); } else { Sys("Auto Maintenance", "Estamos desconectando todos os usu\x00e1rios para a manuten\x00e7\x00e3o, voltamos daqui a alguns minutos, saiam do servidor para evitar perca de itens!"); log.Info("End!"); DisconnectAll(); MainTimer.Stop(); } }; MainTimer.Start(); } }).Start(str14); } } catch (Exception exception10) { exception = exception10; log.Error("There was an error in command!"); log.Error(exception.Message + Environment.NewLine + exception.StackTrace); } break; case "savemap": break; case "clear": Console.Clear(); break; case "ball&reload": if (BallMgr.ReLoad()) { Console.WriteLine("Ball info is Reload!"); } else { Console.WriteLine("Ball info is Error!"); } break; case "map&reload": if (!MapMgr.ReLoadMap()) { Console.WriteLine("Map info is Error!"); break; } Console.WriteLine("Map info is Reload!"); break; case "mapserver&reload": if (!MapMgr.ReLoadMapServer()) { Console.WriteLine("mapserver info is Error!"); break; } Console.WriteLine("mapserver info is Reload!"); break; case "prop&reload": if (!PropItemMgr.Reload()) { Console.WriteLine("prop info is Error!"); break; } Console.WriteLine("prop info is Reload!"); break; case "item&reload": if (!ItemMgr.ReLoad()) { Console.WriteLine("item info is Error!"); break; } Console.WriteLine("item info is Reload!"); break; case "shop&reload": if (!ShopMgr.ReLoad()) { Console.WriteLine("shop info is Error!"); break; } Console.WriteLine("shop info is Reload!"); break; case "quest&reload": if (!QuestMgr.ReLoad()) { Console.WriteLine("quest info is Error!"); break; } Console.WriteLine("quest info is Reload!"); break; case "fusion&reload": if (!FusionMgr.ReLoad()) { Console.WriteLine("fusion info is Error!"); break; } Console.WriteLine("fusion info is Reload!"); break; case "consortia&reload": if (!ConsortiaMgr.ReLoad()) { Console.WriteLine("consortiaMgr info is Error!"); break; } Console.WriteLine("consortiaMgr info is Reload!"); break; case "rate&reload": if (!RateMgr.ReLoad()) { Console.WriteLine("Rate Rate is Error!"); break; } Console.WriteLine("Rate Rate is Reload!"); break; case "fight&reload": if (!FightRateMgr.ReLoad()) { Console.WriteLine("FightRateMgr is Error!"); break; } Console.WriteLine("FightRateMgr is Reload!"); break; case "dailyaward&reload": if (!AwardMgr.ReLoad()) { Console.WriteLine("dailyaward is Error!"); break; } Console.WriteLine("dailyaward is Reload!"); break; case "language&reload": if (!LanguageMgr.Reload("")) { Console.WriteLine("language is Error!"); break; } Console.WriteLine("language is Reload!"); break; case "treasure&reload": if (!TreasureAwardMgr.ReLoad()) { Console.WriteLine("TreasureAward is Error!"); break; } Console.WriteLine("TreasureAward is Reload!"); break; case "nickname": { Console.WriteLine("Please enter the nickname"); string str15 = (CommandArgs.Length > 0) ? CommandArgs[0] : Console.ReadLine(); Console.WriteLine(WorldMgr.GetPlayerStringByPlayerNickName(str15)); break; } default: { string cmdLine = CommandName + string.Join(" ", CommandArgs); if (cmdLine.Length > 0) { if (cmdLine[0] == '/') { cmdLine = cmdLine.Remove(0, 1).Insert(0, "&"); } try { if (!CommandMgr.HandleCommandNoPlvl(client, cmdLine)) { Console.WriteLine("Unknown command: " + cmdLine); } } catch (Exception exception2) { Console.WriteLine(exception2.ToString()); } } break; } } }
/// <summary> /// 用户领奖 /// </summary> /// <param name="quest"></param> /// <param name="rewardItemID"></param> /// <returns></returns> public bool Finish(BaseQuest baseQuest, int selectedItem) { //if (baseQuest.CanCompleted(m_player) == false) // return false; #region 定义变量 //提示用户 string msg = ""; //奖励Buff string RewardBuffName = string.Empty; int RewardBuffTime = 0; QuestInfo qinfo = baseQuest.Info; QuestDataInfo qdata = baseQuest.Data; #endregion #region 从游戏中领取奖品 m_player.BeginAllChanges(); try { if (baseQuest.Finish(m_player)) { RemoveQuest(baseQuest); //固定奖励&选择奖励 List <QuestAwardInfo> awards = QuestMgr.GetQuestGoods(qinfo); List <ItemInfo> mainBg = new List <ItemInfo>(); List <ItemInfo> propBg = new List <ItemInfo>(); foreach (QuestAwardInfo award in awards) { //获取固定奖励 或者 已经选取的可选奖励 if (award.IsSelect == false || award.RewardItemID == selectedItem) { ItemTemplateInfo temp = Bussiness.Managers.ItemMgr.FindItemTemplate(award.RewardItemID); if (temp != null) { msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardProp", temp.Name, award.RewardItemCount) + " "; Int32 tempCount = award.RewardItemCount; if (award.IsCount == true) { tempCount = tempCount * qdata.RandDobule; } for (int len = 0; len < tempCount; len += temp.MaxCount) { int count = len + temp.MaxCount > award.RewardItemCount ? award.RewardItemCount - len : temp.MaxCount; ItemInfo item = ItemInfo.CreateFromTemplate(temp, count, (int)ItemAddType.Quest); if (item == null) { continue; } item.ValidDate = award.RewardItemValid; item.IsBinds = true; item.StrengthenLevel = award.StrengthenLevel; //等级 item.AttackCompose = award.AttackCompose; //攻击加成 item.DefendCompose = award.DefendCompose; //防御加成 item.AgilityCompose = award.AgilityCompose; //敏捷加成 item.LuckCompose = award.LuckCompose; //幸运加成 if (temp.BagType == eBageType.PropBag) { propBg.Add(item); } else { mainBg.Add(item); } } } } } //判断背包的空位是否足够 if (mainBg.Count > 0 && m_player.MainBag.GetEmptyCount() < mainBg.Count) { baseQuest.CancelFinish(m_player); m_player.Out.SendMessage(eMessageType.ERROR, m_player.GetInventoryName(eBageType.MainBag) + LanguageMgr.GetTranslation("Game.Server.Quests.BagFull") + " "); return(false); } if (propBg.Count > 0 && m_player.PropBag.GetEmptyCount() < propBg.Count) { baseQuest.CancelFinish(m_player); m_player.Out.SendMessage(eMessageType.ERROR, m_player.GetInventoryName(eBageType.PropBag) + LanguageMgr.GetTranslation("Game.Server.Quests.BagFull") + " "); return(false); } //把物品放入背包 foreach (ItemInfo item in mainBg) { m_player.AddTemplate(item, eBageType.MainBag, 1); } foreach (ItemInfo item in propBg) { m_player.AddTemplate(item, eBageType.PropBag, 1); } msg = LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.Reward") + msg; //发放Buff if ((qinfo.RewardBuffID > 0) && (qinfo.RewardBuffDate > 0)) { ItemTemplateInfo temp = Bussiness.Managers.ItemMgr.FindItemTemplate(qinfo.RewardBuffID); if (temp != null) { RewardBuffTime = qinfo.RewardBuffDate * qdata.RandDobule; AbstractBuffer buffer = BufferList.CreateBufferHour(temp, RewardBuffTime); buffer.Start(m_player); msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardBuff", temp.Name, RewardBuffTime) + " "; } } //奖励金币 if (qinfo.RewardGold != 0) { int rewardGold = qinfo.RewardGold * qdata.RandDobule; m_player.AddGold(rewardGold); msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardGold", rewardGold) + " "; } //奖励点卷 if (qinfo.RewardMoney != 0) { int rewardMoney = qinfo.RewardMoney * qdata.RandDobule; m_player.AddMoney(qinfo.RewardMoney * qdata.RandDobule); LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Quest, m_player.PlayerCharacter.ID, rewardMoney, m_player.PlayerCharacter.Money, 0, 0, 0, "", "", "");//添加日志 msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardMoney", rewardMoney) + " "; } //奖励GP if (qinfo.RewardGP != 0) { int rewardGp = qinfo.RewardGP * qdata.RandDobule; m_player.AddGP(rewardGp); msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardGB1", rewardGp) + " "; } //有公会则奖励财富 if ((qinfo.RewardRiches != 0) && (m_player.PlayerCharacter.ConsortiaID != 0)) { int riches = qinfo.RewardRiches * qdata.RandDobule; m_player.AddRichesOffer(riches); using (ConsortiaBussiness db = new ConsortiaBussiness()) { db.ConsortiaRichAdd(m_player.PlayerCharacter.ConsortiaID, ref riches); } msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardRiches", riches) + " "; } //奖励功勋 if (qinfo.RewardOffer != 0) { int rewardOffer = qinfo.RewardOffer * qdata.RandDobule; m_player.AddOffer(rewardOffer, false); msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardOffer", rewardOffer) + " "; } //奖励礼劵 if (qinfo.RewardGiftToken != 0) { int rewardGiftToken = qinfo.RewardGiftToken * qdata.RandDobule; m_player.AddGiftToken(rewardGiftToken); msg = msg + LanguageMgr.GetTranslation("Game.Server.Quests.FinishQuest.RewardGiftToken", rewardGiftToken + " "); } m_player.Out.SendMessage(eMessageType.Normal, msg); SetQuestFinish(baseQuest.Info.ID); m_player.PlayerCharacter.QuestSite = m_states; } OnQuestsChanged(baseQuest); } catch (Exception ex) { if (log.IsErrorEnabled) { log.Error("Quest Finish:" + ex); } return(false); } finally { m_player.CommitAllChanges(); } #endregion return(true); }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToDalikor(DOLEvent e, object sender, EventArgs args) { // We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (dalikor.CanGiveQuest(typeof(TraitorInMularn), player) <= 0) { return; } // We also check if the player is already doing the quest TraitorInMularn quest = player.IsDoingQuest(typeof(TraitorInMularn)) as TraitorInMularn; dalikor.TurnTo(player); // Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { // Player is not doing the quest... dalikor.SayTo(player, "Recruit Eeinken. It seems as though we have caught a traitor within the walls of Mularn! A man by the name of Njarmir has been conspiring with the Askefruer. He has recently told us of a [meeting] he was to have with them."); return; } else { switch (quest.Step) { case 1: dalikor.SayTo(player, "Thank you recruit. Now, listen. The traitor has a necklace that allows him to change into the shape of an Askefruer. He says it makes them more comfortable with him. I [have] the necklace with me."); break; case 2: case 3: dalikor.SayTo(player, "The traitor described the location as a place between to the north-northeast from the griffin handler, near some small pine trees. I'm sorry there isn't more to go on, but that is all I have. Hurry now Eeinken."); break; case 4: dalikor.SayTo(player, "Welcome back recruit. Have you met with success? Were you able to secure any information from the Askefruer?"); break; case 5: dalikor.SayTo(player, "Ah! The plans of the Askefruer. Ah, but they are in a language I do not understand. I will have to take this to the elders of Mularn for further study. Before I do that, though, I have [something] here for you."); break; } return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { // Do some small talk :) switch (wArgs.Text) { case "meeting": dalikor.SayTo(player, "He was to get further instructions from the Askefruer about his mission to help their queen. Now that he is in custody, we need to be sure we do not tip our hand to the Askefruer too quickly. I am asking you to go in his [stead]."); break; case "stead": dalikor.SayTo(player, "Will you do this for Mularn Eeinken? Will you go in this traitor's place and get the [information] we need to stop the Askefruer from continuing to make trouble for us?"); break; // If the player offered his "help", we send the quest dialog now! case "information": player.Out.SendQuestSubscribeCommand(dalikor, QuestMgr.GetIDForQuestType(typeof(TraitorInMularn)), "Will you help Mularn by taking on this vital mission?"); break; } } else { switch (wArgs.Text) { case "have": dalikor.SayTo(player, "The traitor described the location as a place between to the north-northeast from the griffin handler, near some small pine trees. I'm sorry there isn't more to go on, but that is all I have. Hurry now Eeinken."); if (quest.Step == 1) { quest.Step = 2; } break; // step 5 case "something": dalikor.SayTo(player, "You did such an excellent job going to the meeting and posing as an Askefruer that I have this for you. It isn't much, but it will help to protect you from the elements. Now, if you'll excuse me, I must be off to speak with the elders."); if (quest.Step == 5) { quest.FinishQuest(); } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
/* This is the method we declared as callback for the hooks we set to * Sir Quait. It will be called whenever a player right clicks on Sir Quait * or when he whispers something to him. */ protected static void TalkToArgusBowman(DOLEvent e, object sender, EventArgs args) { // We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (argusBowman.CanGiveQuest(typeof(ArgussArrows), player) <= 0) { return; } // We also check if the player is already doing the quest ArgussArrows quest = player.IsDoingQuest(typeof(ArgussArrows)) as ArgussArrows; argusBowman.TurnTo(player); // Did the player rightclick on argusBowman? if (e == GameObjectEvent.Interact) { // We check if the player is already doing the quest if (quest != null) { if (quest.Step == 3) { argusBowman.SayTo(player, "Welcome back. Did you have any luck?"); } else if (quest.Step == 4) { argusBowman.SayTo(player, "Excellent! Did you get anymore wood?"); } else if (quest.Step == 5) { argusBowman.SayTo(player, "Excellent! This will do nicely. Now wait, I have a [reward] for you somewhere around here."); } return; } else { // Player hasn't the quest: argusBowman.SayTo(player, "Welcome to my shop friend. I don't suppose you're here about the [job], are you?"); return; } } // The player whispered to Sir Jerem (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; // We also check if the player is already doing the quest if (quest == null) { switch (wArgs.Text) { case "job": argusBowman.SayTo(player, "Oh, I thought maybe all the money I paid to the criers had paid off. Anyhow, let me [tell] you about the job I have."); break; case "tell": argusBowman.SayTo(player, "I am on the verge of making a new type of arrow, lighter, faster and more deadly than any other arrow ever made. The only problem is that I can't get a hold of anymore of the wood I need. You see, it's [magical]."); break; case "magical": argusBowman.SayTo(player, "The young cutpurses on the south-east hill are cutting down the last of the magical trees that reside around these parts. Ludlow didn't even know they were magical until a [sample] was brought in by another adventurer."); break; case "sample": argusBowman.SayTo(player, "I whittled on it for a while and made it into an arrow. I shot it and it went so far, I was, frankly, astonished. I ran towards where I had lost sight of it and finally found it. Normally, you can't recover arrows, but this one was [perfect]."); break; case "perfect": argusBowman.SayTo(player, "It wasn't bent or cracked or anything! I guess now you know why I want more of that wood! So, if you go and kill a few of those cutpurses and get me a good solid stack of the wood, I'll reward you. You [up] for it?"); break; case "up": player.Out.SendQuestSubscribeCommand(argusBowman, QuestMgr.GetIDForQuestType(typeof(ArgussArrows)), "Will you help Argus in his quest to make a new type of arrow? [Level 4]"); break; } } else { switch (wArgs.Text) { case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; case "reward": if (quest.Step == 5) { argusBowman.SayTo(player, "Ah yes. For the brave adventurer, I have this jewel I got in trade one time. I have never had a use for it, so I think you'll find it more useful than I. Good luck my friend. I'll be sure to let you know when my arrows are available."); quest.FinishQuest(); } break; } } } }
/* This is the method we declared as callback for the hooks we set to * Sir Quait. It will be called whenever a player right clicks on Sir Quait * or when he whispers something to him. */ protected static void TalkTosentinelMaitias(DOLEvent e, object sender, EventArgs args) { //We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (sentinelMaitias.CanGiveQuest(typeof(TheDevilsintheDetails), player) <= 0) { return; } //We also check if the player is already doing the quest TheDevilsintheDetails quest = player.IsDoingQuest(typeof(TheDevilsintheDetails)) as TheDevilsintheDetails; sentinelMaitias.TurnTo(player); //Did the player rightclick on Sir Quait? if (e == GameObjectEvent.Interact) { //We check if the player is already doing the quest if (quest != null) { //If the player is already doing the quest, we ask if he found the fur! if (player.Inventory.GetFirstItemByID(boxTrain.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) != null) { sentinelMaitias.SayTo(player, "Excellent. This crate of supplies must be delivered to my counterpart in Ardee, Sentinel Moya. The town is just a bit to the north, along the road. Without these new training swords, Moya would have difficulty drilling her recruits."); } else { sentinelMaitias.SayTo(player, "I see that you've returned. Did Sentinel Moya receive the supplies in [time]?"); } return; } else { sentinelMaitias.SayTo(player, "Good day to you, Guardian. Forgive me if I appear distracted, but my duties are many these days, and my staff keeps shrinking. In times past, Mag Mell formed the center of a vibrant elven community in Hibernia. Fagan dreams of [recreating] those days."); return; } } // The player whispered to Sir Quait (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; //We also check if the player is already doing the quest if (quest == null) { switch (wArgs.Text) { case "recreating": sentinelMaitias.SayTo(player, "I don't blame him for being ambitious. Fagan has lived through tumultuous times and wants the best for his people, but I think that sometimes he focuses too much on the big picture. As a result, it falls to me to keep Mag Mell running on a daily [basis]."); break; case "basis": sentinelMaitias.SayTo(player, "There should be some around the area of this village, take a look near the road to Camelot. Kill any wolf pups you can find, and bring me its fur."); player.Out.SendQuestSubscribeCommand(sentinelMaitias, QuestMgr.GetIDForQuestType(typeof(TheDevilsintheDetails)), "Do you accept The Devil's in the Details quest?"); break; } } else { switch (wArgs.Text) { case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; case "time": sentinelMaitias.SayTo(player, "Thank you for taking care of that so quickly. Please take this coin as a reward for your efforts and perhaps we can work together again in the future. Be well."); quest.FinishQuest(); break; } } } }
/* This is the method we declared as callback for the hooks we set to * masterGerol. It will be called whenever a player right clicks on Sir Quait * or when he whispers something to him. */ protected static void TalkToMasterGerol(DOLEvent e, object sender, EventArgs args) { // We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (masterGerol.CanGiveQuest(typeof(BoarStew), player) <= 0) { return; } // We also check if the player is already doing the quest BoarStew quest = player.IsDoingQuest(typeof(BoarStew)) as BoarStew; masterGerol.TurnTo(player); // Did the player rightclick on masterGerol? if (e == GameObjectEvent.Interact) { if (quest == null) { // Player hasn't the quest: masterGerol.SayTo(player, "Good day, my friend. I am Gerol, Master and Healer of horses. The guards stop here frequently for my services. I'm no miracle worker, but I suppose if you're hurt, I could patch you up a bit, as well."); masterGerol.SayTo(player, "Goodness, more new faces in town. Are you here to help me with my wonderful [stew]?"); return; } } // The player whispered to Sir Quait (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; // We also check if the player is already doing the quest if (quest == null) { switch (wArgs.Text) { case "stew": masterGerol.SayTo(player, "Oh yes! It is my speciality and one of the key components to helping people out when they are sick. Everyone knows that my wonderful stew brings along a speedy recovery. I am running low on the main [ingredient], do you think you could help me out?"); break; case "ingredient": player.Out.SendQuestSubscribeCommand(masterGerol, QuestMgr.GetIDForQuestType(typeof(BoarStew)), "Will you help Master Gerol? [Levels 19-22]"); break; } } else { switch (wArgs.Text) { case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToEowylnAstos(DOLEvent e, object sender, EventArgs args) { // We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (eowylnAstos.CanGiveQuest(typeof(HeartOfSephucoth), player) <= 0) { return; } // We also check if the player is already doing the quest HeartOfSephucoth quest = player.IsDoingQuest(typeof(HeartOfSephucoth)) as HeartOfSephucoth; eowylnAstos.TurnTo(player); // Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { // Player is not doing the quest... eowylnAstos.SayTo(player, "Hail traveler! I may have a bit of [profitable information] for you!"); return; } else { switch (quest.Step) { case 1: eowylnAstos.SayTo(player, "You must seek out the monster Sephucoth! Slay it and bring me its heart!"); break; case 2: eowylnAstos.SayTo(player, "Hand to me the heart needed for this construct."); break; case 4: eowylnAstos.SayTo(player, "Hand to me the polished bone needed for this construct."); break; } } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { // Do some small talk :) switch (wArgs.Text) { case "profitable information": eowylnAstos.SayTo(player, "I have learned how to [fashion a pendant] of immense value."); break; case "fashion a pendant": eowylnAstos.SayTo(player, "I can do so, but I would require the heart from a [terrible beast]."); break; // If the player offered his help, we send the quest dialog now! case "terrible beast": player.Out.SendQuestSubscribeCommand(eowylnAstos, QuestMgr.GetIDForQuestType(typeof(HeartOfSephucoth)), "Do you accept the \nHeart of Sephucoth quest? \n[Levels 7-10]"); break; } } else { switch (wArgs.Text) { case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
protected override void SendQuestWindow(GameNPC questNPC, GamePlayer player, RewardQuest quest, bool offer) { using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog))) { ushort QuestID = QuestMgr.GetIDForQuestType(quest.GetType()); pak.WriteShort((offer) ? (byte)0x22 : (byte)0x21); // Dialog pak.WriteShort(QuestID); pak.WriteShort((ushort)questNPC.ObjectID); pak.WriteByte(0x00); // unknown pak.WriteByte(0x00); // unknown pak.WriteByte(0x00); // unknown pak.WriteByte(0x00); // unknown pak.WriteByte((offer) ? (byte)0x02 : (byte)0x01); // Accept/Decline or Finish/Not Yet pak.WriteByte(0x01); // Wrap pak.WritePascalString(quest.Name); String personalizedSummary = BehaviourUtils.GetPersonalizedMessage(quest.Summary, player); if (personalizedSummary.Length > 255) { pak.WritePascalString(personalizedSummary.Substring(0, 255)); // Summary is max 255 bytes ! } else { pak.WritePascalString(personalizedSummary); } if (offer) { String personalizedStory = BehaviourUtils.GetPersonalizedMessage(quest.Story, player); if (personalizedStory.Length > ServerProperties.Properties.MAX_REWARDQUEST_DESCRIPTION_LENGTH) { pak.WriteShort((ushort)ServerProperties.Properties.MAX_REWARDQUEST_DESCRIPTION_LENGTH); pak.WriteStringBytes(personalizedStory.Substring(0, ServerProperties.Properties.MAX_REWARDQUEST_DESCRIPTION_LENGTH)); } else { pak.WriteShort((ushort)personalizedStory.Length); pak.WriteStringBytes(personalizedStory); } } else { if (quest.Conclusion.Length > (ushort)ServerProperties.Properties.MAX_REWARDQUEST_DESCRIPTION_LENGTH) { pak.WriteShort((ushort)ServerProperties.Properties.MAX_REWARDQUEST_DESCRIPTION_LENGTH); pak.WriteStringBytes(quest.Conclusion.Substring(0, (ushort)ServerProperties.Properties.MAX_REWARDQUEST_DESCRIPTION_LENGTH)); } else { pak.WriteShort((ushort)quest.Conclusion.Length); pak.WriteStringBytes(quest.Conclusion); } } pak.WriteShort(QuestID); pak.WriteByte((byte)quest.Goals.Count); // #goals count foreach (RewardQuest.QuestGoal goal in quest.Goals) { pak.WritePascalString(String.Format("{0}\r", goal.Description)); } pak.WriteInt((uint)(quest.Rewards.Money)); // unknown, new in 1.94 pak.WriteByte((byte)quest.Rewards.ExperiencePercent(player)); pak.WriteByte((byte)quest.Rewards.BasicItems.Count); foreach (ItemTemplate reward in quest.Rewards.BasicItems) { WriteItemData(pak, GameInventoryItem.Create <ItemTemplate>(reward)); } pak.WriteByte((byte)quest.Rewards.ChoiceOf); pak.WriteByte((byte)quest.Rewards.OptionalItems.Count); foreach (ItemTemplate reward in quest.Rewards.OptionalItems) { WriteItemData(pak, GameInventoryItem.Create <ItemTemplate>(reward)); } SendTCP(pak); } }
public virtual void LoadAll(CmdTrigger <RealmServerCmdArgs> trigger, bool force) { DateTime now = DateTime.Now; try { if (ItemMgr.Loaded) { trigger.Reply("Item definitions have already been loaded."); } else { trigger.Reply("Loading Items..."); ItemMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (NPCMgr.Loaded) { trigger.Reply("NPC definitions have already been loaded."); } else { trigger.Reply("Loading NPCs..."); NPCMgr.LoadNPCDefs(force); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (GOMgr.Loaded) { trigger.Reply("GO definitions have already been loaded."); } else { trigger.Reply("Loading GOs..."); GOMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (QuestMgr.Loaded) { trigger.Reply("Quest definitions have already been loaded."); } else { trigger.Reply("Loading Quests..."); QuestMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } try { if (Asda2LootMgr.Loaded) { trigger.Reply("Loot has already been loaded."); } else { trigger.Reply("Loading Loot..."); Asda2LootMgr.LoadAll(); trigger.Reply("Done."); } } catch (Exception ex) { this.FailNotify(trigger, ex); } trigger.Reply("All done - Loading took: " + (object)(DateTime.Now - now)); GC.Collect(2, GCCollectionMode.Optimized); if (!Map.AutoSpawnMaps) { return; } MapCommand.MapSpawnCommand.SpawnAllMaps(trigger); }
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args) { if (!ServerProperties.Properties.LOAD_QUESTS) { return; } if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initializing ..."); } GameNPC[] npcs; npcs = WorldMgr.GetObjectsByName <GameNPC>("Aegan", (eRealm)2); if (npcs.Length == 0) { Aegan = new DOL.GS.GameNPC(); Aegan.Model = 232; Aegan.Name = "Aegan"; if (log.IsWarnEnabled) { log.Warn("Could not find " + Aegan.Name + ", creating ..."); } Aegan.GuildName = "Part of " + questTitle + " Quest"; Aegan.Realm = eRealm.Midgard; Aegan.CurrentRegionID = 100; Aegan.Size = 51; Aegan.Level = 41; Aegan.MaxSpeedBase = 191; Aegan.Faction = FactionMgr.GetFactionByID(0); Aegan.X = 805398; Aegan.Y = 725829; Aegan.Z = 4700; Aegan.Heading = 3595; Aegan.RespawnInterval = -1; Aegan.BodyType = 0; StandardMobBrain brain = new StandardMobBrain(); brain.AggroLevel = 0; brain.AggroRange = 500; Aegan.SetOwnBrain(brain); // You don't have to store the created mob in the db if you don't want, // it will be recreated each time it is not found, just comment the following // line if you rather not modify your database if (SAVE_INTO_DATABASE) { Aegan.SaveIntoDatabase(); } Aegan.AddToWorld(); } else { Aegan = npcs[0]; } clawofblackmauler = GameServer.Database.FindObjectByKey <ItemTemplate>("clawofblackmauler"); if (clawofblackmauler == null) { clawofblackmauler = new ItemTemplate(); clawofblackmauler.Name = "Claw of Black Mauler"; if (log.IsWarnEnabled) { log.Warn("Could not find " + clawofblackmauler.Name + ", creating it ..."); } clawofblackmauler.Level = 50; clawofblackmauler.Weight = 5; clawofblackmauler.Model = 1; clawofblackmauler.Object_Type = 0; clawofblackmauler.Item_Type = 40; clawofblackmauler.Id_nb = "clawofblackmauler"; clawofblackmauler.Hand = 0; clawofblackmauler.Price = 0; clawofblackmauler.IsPickable = true; clawofblackmauler.IsDropable = true; clawofblackmauler.IsTradable = true; clawofblackmauler.CanDropAsLoot = false; clawofblackmauler.Color = 0; clawofblackmauler.Bonus = 35; // default bonus clawofblackmauler.Bonus1 = 0; clawofblackmauler.Bonus1Type = (int)0; clawofblackmauler.Bonus2 = 0; clawofblackmauler.Bonus2Type = (int)0; clawofblackmauler.Bonus3 = 0; clawofblackmauler.Bonus3Type = (int)0; clawofblackmauler.Bonus4 = 0; clawofblackmauler.Bonus4Type = (int)0; clawofblackmauler.Bonus5 = 0; clawofblackmauler.Bonus5Type = (int)0; clawofblackmauler.Bonus6 = 0; clawofblackmauler.Bonus6Type = (int)0; clawofblackmauler.Bonus7 = 0; clawofblackmauler.Bonus7Type = (int)0; clawofblackmauler.Bonus8 = 0; clawofblackmauler.Bonus8Type = (int)0; clawofblackmauler.Bonus9 = 0; clawofblackmauler.Bonus9Type = (int)0; clawofblackmauler.Bonus10 = 0; clawofblackmauler.Bonus10Type = (int)0; clawofblackmauler.ExtraBonus = 0; clawofblackmauler.ExtraBonusType = (int)0; clawofblackmauler.Effect = 0; clawofblackmauler.Emblem = 0; clawofblackmauler.Charges = 0; clawofblackmauler.MaxCharges = 0; clawofblackmauler.SpellID = 0; clawofblackmauler.ProcSpellID = 0; clawofblackmauler.Type_Damage = 0; clawofblackmauler.Realm = 0; clawofblackmauler.MaxCount = 1; clawofblackmauler.PackSize = 1; clawofblackmauler.Extension = 0; clawofblackmauler.Quality = 99; clawofblackmauler.Condition = 100; clawofblackmauler.MaxCondition = 100; clawofblackmauler.Durability = 100; clawofblackmauler.MaxDurability = 100; clawofblackmauler.PoisonCharges = 0; clawofblackmauler.PoisonMaxCharges = 0; clawofblackmauler.PoisonSpellID = 0; clawofblackmauler.ProcSpellID1 = 0; clawofblackmauler.SpellID1 = 0; clawofblackmauler.MaxCharges1 = 0; clawofblackmauler.Charges1 = 0; // You don't have to store the created item in the db if you don't want, // it will be recreated each time it is not found, just comment the following // line if you rather not modify your database if (SAVE_INTO_DATABASE) { GameServer.Database.AddObject(clawofblackmauler); } } QuestBuilder builder = QuestMgr.GetBuilder(typeof(Learnthehunt)); QuestBehaviour a; a = builder.CreateBehaviour(Aegan, -1); a.AddTrigger(eTriggerType.Interact, null, Aegan); a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan); a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null, (eComparator)5); a.AddAction(eActionType.Talk, "Greetings, are you [worthy of the hunt]?", Aegan); AddBehaviour(a); a = builder.CreateBehaviour(Aegan, -1); a.AddTrigger(eTriggerType.Whisper, "worthy of the hunt", Aegan); a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan); a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null, (eComparator)5); a.AddAction(eActionType.Talk, "Oh ho! Another bright young come to help Midgard fend off her enemies, eh? Wonderful, that's what I say! Wonderful! With the rise of the Albion and Hibernia armies,Midgard will need all the she can get!", Aegan); a.AddAction(eActionType.Talk, "I have spent a great deal of my life hunting the [maulers] of this region", Aegan); AddBehaviour(a); a = builder.CreateBehaviour(Aegan, -1); a.AddTrigger(eTriggerType.Whisper, "maulers", Aegan); a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan); a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null, (eComparator)5); a.AddAction(eActionType.Talk, "Bring me the claws of a mauler cub and I shall reward you", Aegan); a.AddAction(eActionType.OfferQuest, typeof(DOL.GS.Quests.Midgard.Learnthehunt), "Accept Learn the Hunt quest?"); AddBehaviour(a); a = builder.CreateBehaviour(Aegan, -1); a.AddTrigger(eTriggerType.DeclineQuest, null, typeof(DOL.GS.Quests.Midgard.Learnthehunt)); a.AddAction(eActionType.Talk, "No problem. See you.", Aegan); AddBehaviour(a); a = builder.CreateBehaviour(Aegan, -1); a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(DOL.GS.Quests.Midgard.Learnthehunt)); a.AddAction(eActionType.GiveQuest, typeof(DOL.GS.Quests.Midgard.Learnthehunt), Aegan); a.AddAction(eActionType.SetQuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 2); AddBehaviour(a); a = builder.CreateBehaviour(Aegan, -1); a.AddTrigger(eTriggerType.EnemyKilled, "black mauler cub", null); a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 1, (eComparator)2); a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 7, (eComparator)1); a.AddAction(eActionType.GiveItem, clawofblackmauler, null); a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null); AddBehaviour(a); a = builder.CreateBehaviour(Aegan, -1); a.AddTrigger(eTriggerType.Interact, null, Aegan); a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.Learnthehunt), 7, (eComparator)3); a.AddAction(eActionType.Talk, "You are doing well! Continue to pass me the bear claws!", Aegan); a.AddAction(eActionType.Talk, "You have proven yourself well youngster! I hope the coin serves you well.", Aegan); a.AddAction(eActionType.GiveXP, 20, null); a.AddAction(eActionType.GiveGold, 100, null); a.AddAction(eActionType.FinishQuest, typeof(DOL.GS.Quests.Midgard.Learnthehunt), null); a.AddAction(eActionType.TakeItem, clawofblackmauler, 5); AddBehaviour(a); // Custom Scriptloaded Code Begin // Custom Scriptloaded Code End Aegan.AddQuestToGive(typeof(Learnthehunt)); if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initialized"); } }
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args) { if (!ServerProperties.Properties.LOAD_QUESTS) { return; } if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initializing ..."); } #region defineNPCS GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Albion); if (npcs.Length == 0) { questGiver = new GameNPC(); questGiver.Model = 1960; questGiver.Name = questGiverName; if (log.IsWarnEnabled) { log.Warn("Could not find " + questGiver.Name + ", creating him ..."); } questGiver.Realm = eRealm.Albion; questGiver.CurrentRegionID = 27; GameNpcInventoryTemplate template = new GameNpcInventoryTemplate(); template.AddNPCEquipment(eInventorySlot.HandsArmor, 691, 0); //Slot 22 template.AddNPCEquipment(eInventorySlot.FeetArmor, 692, 0); //Slot 23 template.AddNPCEquipment(eInventorySlot.TorsoArmor, 688, 0); //Slot 25 template.AddNPCEquipment(eInventorySlot.Cloak, 676, 0); //Slot 26 template.AddNPCEquipment(eInventorySlot.LegsArmor, 689, 0); //Slot 27 template.AddNPCEquipment(eInventorySlot.ArmsArmor, 690, 0); //Slot 28 questGiver.Inventory = template.CloseTemplate(); questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard); questGiver.Size = 55; questGiver.Level = 70; questGiver.X = 95510; questGiver.Y = 101313; questGiver.Z = 5340; questGiver.Heading = 3060; if (SAVE_INTO_DATABASE) { questGiver.SaveIntoDatabase(); } questGiver.AddToWorld(); } else { questGiver = npcs[0]; } npcs = WorldMgr.GetNPCsByName(questTargetName, eRealm.Albion); if (npcs.Length == 0) { questTarget = new GameNPC(); questTarget.Model = 73; questTarget.Name = questTargetName; if (log.IsWarnEnabled) { log.Warn("Could not find " + questTarget.Name + ", creating him ..."); } questTarget.Realm = eRealm.Albion; questTarget.CurrentRegionID = 27; GameNpcInventoryTemplate template = new GameNpcInventoryTemplate(); template.AddNPCEquipment(eInventorySlot.HandsArmor, 665, 0); //Slot 22 template.AddNPCEquipment(eInventorySlot.FeetArmor, 666, 0); //Slot 23 template.AddNPCEquipment(eInventorySlot.TorsoArmor, 662, 0); //Slot 25 template.AddNPCEquipment(eInventorySlot.Cloak, 676, 0); //Slot 26 template.AddNPCEquipment(eInventorySlot.LegsArmor, 663, 0); //Slot 27 template.AddNPCEquipment(eInventorySlot.ArmsArmor, 664, 0); //Slot 28 questTarget.Inventory = template.CloseTemplate(); questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard); questTarget.Size = 50; questTarget.Level = 38; questTarget.X = 94789; questTarget.Y = 101439; questTarget.Z = 5248; questTarget.Heading = 2878; if (SAVE_INTO_DATABASE) { questTarget.SaveIntoDatabase(); } questTarget.AddToWorld(); } else { questTarget = npcs[0]; } #endregion #region defineAreas targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle("", targetLocation.X, targetLocation.Y, targetLocation.Z, 200)); #endregion #region defineBehaviours QuestBuilder builder = QuestMgr.getBuilder(typeof(MovementAndInteraction)); QuestBehaviour a = null; string message1 = "Welcome to " + zoneName + ", <Class>. Here you will learn the basic skills needed to defend yourself as you explore our realm and grow in power and wisdom. Now, without further delay, let's get you started on your [training]."; string message2 = "If you exit through the doors behind me, you will enter the courtyard. In the courtyard, you will find Master Gethin, who will be your training instructor. Go now and speak to Master Gethin."; a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Interact, null, questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(MovementAndInteraction), null, (eComparator)5); a.AddAction(eActionType.GiveQuest, typeof(MovementAndInteraction), questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Interact, null, questGiver); a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 1, (eComparator)3); a.AddAction(eActionType.Talk, message1, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "training", questGiver); a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 1, (eComparator)3); a.AddAction(eActionType.IncQuestStep, typeof(MovementAndInteraction), null); a.AddAction(eActionType.Talk, message2, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Interact, null, questGiver); a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 2, (eComparator)3); a.AddAction(eActionType.Talk, message2, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.EnterArea, null, targetArea); a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 2, (eComparator)3); a.AddAction(eActionType.IncQuestStep, typeof(MovementAndInteraction), null); AddBehaviour(a); a = builder.CreateBehaviour(questTarget, -1); a.AddTrigger(eTriggerType.Interact, null, questTarget); a.AddRequirement(eRequirementType.QuestStep, typeof(MovementAndInteraction), 3, (eComparator)3); a.AddAction(eActionType.FinishQuest, typeof(MovementAndInteraction), null); AddBehaviour(a); #endregion questGiver.AddQuestToGive(typeof(MovementAndInteraction)); if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initialized"); } }
internal static void EnsureItemQuestRelations() { foreach (QuestTemplate template1 in QuestMgr.Templates) { if (template1 != null && template1.CollectableItems != null) { foreach (Asda2ItemStackDescription collectableItem in template1.CollectableItems) { ItemTemplate template2 = GetTemplate(collectableItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne(ref template2.CollectQuests, template1); } } foreach (Asda2ItemStackDescription collectableSourceItem in template1.CollectableSourceItems) { ItemTemplate template2 = GetTemplate(collectableSourceItem.ItemId); if (template2 == null) { ContentMgr.OnInvalidDBData("QuestTemplate \"{0}\" refered to non-existing Item: {1}", (object)template1, (object)collectableSourceItem); } else if (template2.CollectQuests == null) { template2.CollectQuests = new QuestTemplate[1] { template1 }; } else { int num = (int)ArrayUtil.AddOnlyOne(ref template2.CollectQuests, template1); } } } } foreach (ItemTemplate template1 in Templates) { if (template1 != null && template1.QuestId != 0U) { QuestTemplate template2 = QuestMgr.GetTemplate(template1.QuestId); if (template2 == null) { ContentMgr.OnInvalidDBData("Item {0} had invalid QuestId: {1}", (object)template1, (object)template1.QuestId); } else { template2.Starters.Add(template1); } } } }
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args) { if (!ServerProperties.Properties.LOAD_QUESTS) { return; } if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initializing ..."); } #region defineNPCs GameNPC[] npcs; npcs = WorldMgr.GetNPCsByName("Audun", (eRealm)2); if (npcs.Length == 0) { if (!WorldMgr.GetRegion(101).IsDisabled) { Audun = new DOL.GS.GameNPC(); Audun.Model = 232; Audun.Name = "Audun"; if (log.IsWarnEnabled) { log.Warn("Could not find " + Audun.Name + ", creating ..."); } Audun.GuildName = "Part of " + questTitle + " Quest"; Audun.Realm = eRealm.Midgard; Audun.CurrentRegionID = 101; Audun.Size = 48; Audun.Level = 49; Audun.MaxSpeedBase = 191; Audun.Faction = FactionMgr.GetFactionByID(0); Audun.X = 33283; Audun.Y = 35305; Audun.Z = 8027; Audun.Heading = 1763; Audun.RespawnInterval = -1; Audun.BodyType = 0; StandardMobBrain brain = new StandardMobBrain(); brain.AggroLevel = 0; brain.AggroRange = 500; Audun.SetOwnBrain(brain); //You don't have to store the created mob in the db if you don't want, //it will be recreated each time it is not found, just comment the following //line if you rather not modify your database if (SAVE_INTO_DATABASE) { Audun.SaveIntoDatabase(); } Audun.AddToWorld(); } } else { Audun = npcs[0]; } npcs = WorldMgr.GetNPCsByName("Guard Olja", (eRealm)2); if (npcs.Length == 0) { if (!WorldMgr.GetRegion(229).IsDisabled) { GuardOlja = new DOL.GS.GameNPC(); GuardOlja.Model = 180; GuardOlja.Name = "Guard Olja"; if (log.IsWarnEnabled) { log.Warn("Could not find " + GuardOlja.Name + ", creating ..."); } GuardOlja.GuildName = "Part of " + questTitle + " Quest"; GuardOlja.Realm = eRealm.Midgard; GuardOlja.CurrentRegionID = 229; GuardOlja.Size = 50; GuardOlja.Level = 50; GuardOlja.MaxSpeedBase = 191; GuardOlja.Faction = FactionMgr.GetFactionByID(0); GuardOlja.X = 47994; GuardOlja.Y = 37341; GuardOlja.Z = 21812; GuardOlja.Heading = 204; GuardOlja.RespawnInterval = -1; GuardOlja.BodyType = 0; StandardMobBrain brain = new StandardMobBrain(); brain.AggroLevel = 0; brain.AggroRange = 500; GuardOlja.SetOwnBrain(brain); //You don't have to store the created mob in the db if you don't want, //it will be recreated each time it is not found, just comment the following //line if you rather not modify your database if (SAVE_INTO_DATABASE) { GuardOlja.SaveIntoDatabase(); } GuardOlja.AddToWorld(); } } else { GuardOlja = npcs[0]; } #endregion #region defineItems emptybottle = GameServer.Database.FindObjectByKey <ItemTemplate>("emptybottle"); if (emptybottle == null) { emptybottle = new ItemTemplate(); emptybottle.Name = "Empty Bottle"; if (log.IsWarnEnabled) { log.Warn("Could not find " + emptybottle.Name + ", creating it ..."); } emptybottle.Level = 50; emptybottle.Weight = 5; emptybottle.Model = 554; emptybottle.Object_Type = 0; emptybottle.Item_Type = 40; emptybottle.Id_nb = "emptybottle"; emptybottle.Hand = 0; emptybottle.Price = 0; emptybottle.IsPickable = true; emptybottle.IsDropable = true; emptybottle.IsTradable = true; emptybottle.CanDropAsLoot = false; emptybottle.Color = 0; emptybottle.Bonus = 35; // default bonus emptybottle.Bonus1 = 0; emptybottle.Bonus1Type = (int)0; emptybottle.Bonus2 = 0; emptybottle.Bonus2Type = (int)0; emptybottle.Bonus3 = 0; emptybottle.Bonus3Type = (int)0; emptybottle.Bonus4 = 0; emptybottle.Bonus4Type = (int)0; emptybottle.Bonus5 = 0; emptybottle.Bonus5Type = (int)0; emptybottle.Bonus6 = 0; emptybottle.Bonus6Type = (int)0; emptybottle.Bonus7 = 0; emptybottle.Bonus7Type = (int)0; emptybottle.Bonus8 = 0; emptybottle.Bonus8Type = (int)0; emptybottle.Bonus9 = 0; emptybottle.Bonus9Type = (int)0; emptybottle.Bonus10 = 0; emptybottle.Bonus10Type = (int)0; emptybottle.ExtraBonus = 0; emptybottle.ExtraBonusType = (int)0; emptybottle.Effect = 0; emptybottle.Emblem = 0; emptybottle.Charges = 0; emptybottle.MaxCharges = 0; emptybottle.SpellID = 0; emptybottle.ProcSpellID = 0; emptybottle.Type_Damage = 0; emptybottle.Realm = 0; emptybottle.MaxCount = 1; emptybottle.PackSize = 1; emptybottle.Extension = 0; emptybottle.Quality = 99; emptybottle.Condition = 100; emptybottle.MaxCondition = 100; emptybottle.Durability = 100; emptybottle.MaxDurability = 100; emptybottle.PoisonCharges = 0; emptybottle.PoisonMaxCharges = 0; emptybottle.PoisonSpellID = 0; emptybottle.ProcSpellID1 = 0; emptybottle.SpellID1 = 0; emptybottle.MaxCharges1 = 0; emptybottle.Charges1 = 0; //You don't have to store the created item in the db if you don't want, //it will be recreated each time it is not found, just comment the following //line if you rather not modify your database if (SAVE_INTO_DATABASE) { GameServer.Database.AddObject(emptybottle); } } bottleofmead = GameServer.Database.FindObjectByKey <ItemTemplate>("bottleofmead"); if (bottleofmead == null) { bottleofmead = new ItemTemplate(); bottleofmead.Name = "Bottle of Mead"; if (log.IsWarnEnabled) { log.Warn("Could not find " + bottleofmead.Name + ", creating it ..."); } bottleofmead.Level = 50; bottleofmead.Weight = 5; bottleofmead.Model = 554; bottleofmead.Object_Type = 0; bottleofmead.Item_Type = 40; bottleofmead.Id_nb = "bottleofmead"; bottleofmead.Hand = 0; bottleofmead.Price = 0; bottleofmead.IsPickable = true; bottleofmead.IsDropable = true; bottleofmead.IsTradable = true; bottleofmead.CanDropAsLoot = false; bottleofmead.Color = 0; bottleofmead.Bonus = 35; // default bonus bottleofmead.Bonus1 = 0; bottleofmead.Bonus1Type = (int)0; bottleofmead.Bonus2 = 0; bottleofmead.Bonus2Type = (int)0; bottleofmead.Bonus3 = 0; bottleofmead.Bonus3Type = (int)0; bottleofmead.Bonus4 = 0; bottleofmead.Bonus4Type = (int)0; bottleofmead.Bonus5 = 0; bottleofmead.Bonus5Type = (int)0; bottleofmead.Bonus6 = 0; bottleofmead.Bonus6Type = (int)0; bottleofmead.Bonus7 = 0; bottleofmead.Bonus7Type = (int)0; bottleofmead.Bonus8 = 0; bottleofmead.Bonus8Type = (int)0; bottleofmead.Bonus9 = 0; bottleofmead.Bonus9Type = (int)0; bottleofmead.Bonus10 = 0; bottleofmead.Bonus10Type = (int)0; bottleofmead.ExtraBonus = 0; bottleofmead.ExtraBonusType = (int)0; bottleofmead.Effect = 0; bottleofmead.Emblem = 0; bottleofmead.Charges = 0; bottleofmead.MaxCharges = 0; bottleofmead.SpellID = 0; bottleofmead.ProcSpellID = 0; bottleofmead.Type_Damage = 0; bottleofmead.Realm = 0; bottleofmead.MaxCount = 1; bottleofmead.PackSize = 1; bottleofmead.Extension = 0; bottleofmead.Quality = 99; bottleofmead.Condition = 100; bottleofmead.MaxCondition = 100; bottleofmead.Durability = 100; bottleofmead.MaxDurability = 100; bottleofmead.PoisonCharges = 0; bottleofmead.PoisonMaxCharges = 0; bottleofmead.PoisonSpellID = 0; bottleofmead.ProcSpellID1 = 0; bottleofmead.SpellID1 = 0; bottleofmead.MaxCharges1 = 0; bottleofmead.Charges1 = 0; //You don't have to store the created item in the db if you don't want, //it will be recreated each time it is not found, just comment the following //line if you rather not modify your database if (SAVE_INTO_DATABASE) { GameServer.Database.AddObject(bottleofmead); } } #endregion #region defineAreas #endregion #region defineQuestParts QuestBuilder builder = QuestMgr.getBuilder(typeof(meadrun)); QuestBehaviour a; a = builder.CreateBehaviour(Audun, -1); a.AddTrigger(eTriggerType.Interact, null, Audun); a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.meadrun), Audun); a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.meadrun), null, (eComparator)5); a.AddAction(eActionType.Talk, "Greetings. You appear to be down on your luck. I have a [proposition] for you if you're interested.", null); AddBehaviour(a); a = builder.CreateBehaviour(Audun, -1); a.AddTrigger(eTriggerType.Whisper, "proposition", Audun); a.AddRequirement(eRequirementType.QuestGivable, typeof(DOL.GS.Quests.Midgard.meadrun), Audun); a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.meadrun), null, (eComparator)5); a.AddAction(eActionType.Talk, "I need to deliver some mead to the guards just inside the Burial Grounds. There is a bit of coin to be had if you would deliver the mead for me.", Audun); a.AddAction(eActionType.OfferQuest, typeof(DOL.GS.Quests.Midgard.meadrun), "Will you deliver the mead for Audun? [Levels 1-4]"); AddBehaviour(a); a = builder.CreateBehaviour(Audun, -1); a.AddTrigger(eTriggerType.DeclineQuest, null, typeof(DOL.GS.Quests.Midgard.meadrun)); a.AddAction(eActionType.Talk, "No problem. See you", Audun); AddBehaviour(a); a = builder.CreateBehaviour(Audun, -1); a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(DOL.GS.Quests.Midgard.meadrun)); a.AddAction(eActionType.Talk, "Here take the mead to Guard Olja inside the entrance of the Burial Grounds.", Audun); a.AddAction(eActionType.GiveItem, bottleofmead, Audun); a.AddAction(eActionType.GiveQuest, typeof(DOL.GS.Quests.Midgard.meadrun), Audun); AddBehaviour(a); a = builder.CreateBehaviour(GuardOlja, -1); a.AddTrigger(eTriggerType.GiveItem, GuardOlja, bottleofmead); a.AddRequirement(eRequirementType.QuestPending, typeof(DOL.GS.Quests.Midgard.meadrun), null); a.AddAction(eActionType.Talk, "Thanks. Here, take this empty bottle back to Auduan.", GuardOlja); a.AddAction(eActionType.GiveItem, emptybottle, GuardOlja); a.AddAction(eActionType.TakeItem, bottleofmead, null); a.AddAction(eActionType.IncQuestStep, typeof(DOL.GS.Quests.Midgard.meadrun), null); AddBehaviour(a); a = builder.CreateBehaviour(Audun, -1); a.AddTrigger(eTriggerType.GiveItem, Audun, emptybottle); a.AddRequirement(eRequirementType.QuestStep, typeof(DOL.GS.Quests.Midgard.meadrun), 2, (eComparator)3); a.AddAction(eActionType.Talk, "Good work. Here is that bit of coin I was talking about. Check back with me later, and I may have more work for you.", Audun); a.AddAction(eActionType.GiveXP, 5, null); a.AddAction(eActionType.GiveGold, 27, null); a.AddAction(eActionType.FinishQuest, typeof(DOL.GS.Quests.Midgard.meadrun), null); AddBehaviour(a); #endregion // Custom Scriptloaded Code Begin // Custom Scriptloaded Code End if (Audun != null) { Audun.AddQuestToGive(typeof(meadrun)); } if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initialized"); } }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToFarmerAsma(DOLEvent e, object sender, EventArgs args) { //We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (farmerAsma.CanGiveQuest(typeof(RevengeTheOtherWhiteMeat), player) <= 0) { return; } //We also check if the player is already doing the quest RevengeTheOtherWhiteMeat quest = player.IsDoingQuest(typeof(RevengeTheOtherWhiteMeat)) as RevengeTheOtherWhiteMeat; farmerAsma.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { //Player is not doing the quest... farmerAsma.SayTo(player, "Greetings, " + player.CharacterClass.Name + ". You wouldn't believe how expensive it is to lease land here in the Camelot Hills area. Just the other day, I went to check out some fields, and the asking price is just too high. Things were better in the Black [Mountains]."); return; } else { if (quest.Step == 3) { farmerAsma.SayTo(player, "Did you really kill [Wilbur]?"); } return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { //Do some small talk :) switch (wArgs.Text) { case "Mountains": farmerAsma.SayTo(player, "It seemed like an ideal place for a farm. It's shame those pig herders had to select it as the site for their new 'sport.' I still get angry just thinking about it. I mean, who do they think they are, tossing me out [like that]?."); break; case "like that": farmerAsma.SayTo(player, "I wish I could give them a taste of their own medicine. If someone took something important away from them... Hey, that gives me an idea! Are you willing to help me get a little revenge on those pig herders?"); //If the player offered his help, we send the quest dialog now! player.Out.SendQuestSubscribeCommand(farmerAsma, QuestMgr.GetIDForQuestType(typeof(RevengeTheOtherWhiteMeat)), "Will you help Farmer Asma get \nrevenge on the pig herders?\n[Level 5-8]"); break; } } else { switch (wArgs.Text) { case "mind": if (quest.Step == 1) { farmerAsma.SayTo(player, "Just as a farmer's land is the source of her livelihood, the pig herders' prize pig must be the center of their game. If a little accident should befall their precious pig, they will know exactly how I felt when my farm was [taken away]."); } break; case "taken away": if (quest.Step == 1) { farmerAsma.SayTo(player, "When the game isn't in session, they keep the pig in an area adjacent to the field. To get there, travel through the city of Camelot and exit through the North Gate, near the main Church building. After exiting the city, you'll need to travel [west]."); } break; case "west": if (quest.Step == 1) { farmerAsma.SayTo(player, "You'll see Vetusta Abbey in the distance. Keep running toward it, and you'll see a field and some stables. The pigs should be in that area. The pig you're looking for is one they've nicknamed Wilbur."); quest.Step = 2; } break; case "Wilbur": if (quest.Step == 3) { SendMessage(player, "You tell Farmer Asma that you succeeded in killing Wilbur, but that one of the pig herders discovered you and chased you away.", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); farmerAsma.SayTo(player, "They saw you? Oh, no...what have I done? I feel terrible, Gwonn. I shouldn't have asked you to kill Wilbur, but we can't undo what's been done. If the guards come looking for you, I'll tell them that I'm the one who did [the deed]."); } break; case "the deed": if (quest.Step == 3) { farmerAsma.SayTo(player, "You don't think they'll come after me, do you? I mean, pigs die all the time. We make food out of them, and they turn into pork and bacon and all kinds of good [things]..."); } break; case "things": if (quest.Step == 3) { SendMessage(player, "Farmer Asma begins to ramble and soon becomes incoherent. When she realizes what's happened, she takes a deep breath and tries to compose herself.", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); farmerAsma.SayTo(player, "Oh, my. I'm so sorry, I just...well, I don't know what to do. I need a break from farming and pigs, and rural life. Maybe I'll take up something completely different...like brewing. Yes, brewing! Please take these coins and never speak of this again."); quest.FinishQuest(); } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
public override bool Start() { if (m_isRunning) { return(false); } try { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Thread.CurrentThread.Priority = ThreadPriority.Normal; GameProperties.Refresh(); if (!InitComponent(RecompileScripts(), "Recompile Scripts")) { return(false); } if (!InitComponent(StartScriptComponents(), "Script components")) { return(false); } if (!InitComponent((GameProperties.EDITION == Edition), "Edition:" + Edition)) { return(false); } if (!InitComponent(InitSocket(IPAddress.Parse(Configuration.Ip), Configuration.Port), "InitSocket Port:" + Configuration.Port)) { return(false); } if (!InitComponent(AllocatePacketBuffers(), "AllocatePacketBuffers()")) { return(false); } if (!InitComponent(LogMgr.Setup(Configuration.GAME_TYPE, Configuration.ServerID, Configuration.AreaID), "LogMgr Init")) { return(false); } if (!InitComponent(WorldMgr.Init(), "WorldMgr Init")) { return(false); } if (!InitComponent(MapMgr.Init(), "MapMgr Init")) { return(false); } if (!InitComponent(ItemMgr.Init(), "ItemMgr Init")) { return(false); } if (!InitComponent(ItemBoxMgr.Init(), "ItemBox Init")) { return(false); } if (!InitComponent(BallMgr.Init(), "BallMgr Init")) { return(false); } if (!InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init")) { return(false); } if (!InitComponent(FusionMgr.Init(), "FusionMgr Init")) { return(false); } if (!InitComponent(AwardMgr.Init(), "AwardMgr Init")) { return(false); } if (!InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init")) { return(false); } if (!InitComponent(MissionInfoMgr.Init(), "MissionInfoMgr Init")) { return(false); } if (!InitComponent(PveInfoMgr.Init(), "PveInfoMgr Init")) { return(false); } if (!InitComponent(DropMgr.Init(), "Drop Init")) { return(false); } if (!InitComponent(FightRateMgr.Init(), "FightRateMgr Init")) { return(false); } if (!InitComponent(ConsortiaLevelMgr.Init(), "ConsortiaLevelMgr Init")) { return(false); } if (!InitComponent(RefineryMgr.Init(), "RefineryMgr Init")) { return(false); } if (!InitComponent(StrengthenMgr.Init(), "StrengthenMgr Init")) { return(false); } if (!InitComponent(PropItemMgr.Init(), "PropItemMgr Init")) { return(false); } if (!InitComponent(ShopMgr.Init(), "ShopMgr Init")) { return(false); } if (!InitComponent(QuestMgr.Init(), "QuestMgr Init")) { return(false); } if (!InitComponent(RoomMgr.Setup(Configuration.MaxRoomCount), "RoomMgr.Setup")) { return(false); } if (!InitComponent(GameMgr.Setup(Configuration.ServerID, GameProperties.BOX_APPEAR_CONDITION), "GameMgr.Start()")) { return(false); } if (!InitComponent(ConsortiaMgr.Init(), "ConsortiaMgr Init")) { return(false); } if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init")) { return(false); } if (!InitComponent(RateMgr.Init(Configuration), "ExperienceRateMgr Init")) { return(false); } if (!InitComponent(MacroDropMgr.Init(), "MacroDropMgr Init")) { return(false); } if (!InitComponent(BattleMgr.Setup(), "BattleMgr Setup")) { return(false); } if (!InitComponent(InitGlobalTimer(), "Init Global Timers")) { return(false); } if (!InitComponent(MarryRoomMgr.Init(), "MarryRoomMgr Init")) { return(false); } if (!InitComponent(LogMgr.Setup(1, 4, 4), "LogMgr Setup")) { return(false); } GameEventMgr.Notify(ScriptEvent.Loaded); if (!InitComponent(InitLoginServer(), "Login To CenterServer")) { return(false); } RoomMgr.Start(); GameMgr.Start(); BattleMgr.Start(); MacroDropMgr.Start(); if (!InitComponent(base.Start(), "base.Start()")) { return(false); } GameEventMgr.Notify(GameServerEvent.Started, this); GC.Collect(GC.MaxGeneration); if (log.IsInfoEnabled) { log.Info("GameServer is now open for connections!"); } m_isRunning = true; return(true); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("Failed to start the server", e); } return(false); } }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToDalikor(DOLEvent e, object sender, EventArgs args) { //We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (dalikor.CanGiveQuest(typeof(Collection), player) <= 0) { return; } //We also check if the player is already doing the quest Collection quest = player.IsDoingQuest(typeof(Collection)) as Collection; dalikor.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { //Player is not doing the quest... dalikor.SayTo(player, "Recruit, we have received further intelligence that the Askefruer are trying to [make a move] on Mularn."); return; } else { switch (quest.Step) { case 1: dalikor.SayTo(player, "Alright recruit, we haven't much time. Njarmir was unsure of exactly when the Askefruer would be sending their troops to these locations. I have a [map] that will assist you in finding these areas."); break; case 5: dalikor.SayTo(player, "Eeinken, you've returned safely. If you have successfully defeated the Askefruer, please, hand their wings to me."); quest.Step = 6; break; case 9: dalikor.SayTo(player, "These sleeves will come in handy while you're out fighting. A Viking is always in need of sturdy armor to protect his somewhat fragile hide as he battles the enemies of his realm. Thank you again for your assistance in this matter. Be safe."); quest.FinishQuest(); break; } return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { //Do some small talk :) switch (wArgs.Text) { case "make a move": dalikor.SayTo(player, "There are three prominent Askefruer generals, so to speak, within the Askefruer community. Their names are Mitan, Ostadi and Seiki. They are rumored to be very successful [military leaders] within the Askefruer."); break; case "military leaders": dalikor.SayTo(player, "We got all of this information from the traitor we caught a few days ago. We have been leaning on him for more information, and he finally cracked and told us all he knew. But we can't allow the Askefruer to make a multi-frontal [attack]."); break; case "attack": dalikor.SayTo(player, "Njarmir has said these three Askefruer have not yet received their troops. They have scouted out their locations and are awaiting for others to come to them. I believe this is the perfect time to [strike]."); break; case "strike": dalikor.SayTo(player, "If we can take down these leaders, the Askefruer will be signifigantly weakened. Perhaps it will stave off any future attacks. I'm asking you, Eeinken, to find these three Askefruer and destroy them. Will you [do it]?"); break; //If the player offered his "help", we send the quest dialog now! case "do it": player.Out.SendQuestSubscribeCommand(dalikor, QuestMgr.GetIDForQuestType(typeof(Collection)), "Will you find and slay these three Fallen Askefruer and return their wings to Dalikor?"); break; } } else { switch (wArgs.Text) { case "map": dalikor.SayTo(player, "Njarmir has provided us with a rough location of where he thinks the Askefruer are. He is not one hundred percent certain though, so you will need to do most of the searching on your own. USE the map from time to time to help you find these hidden camps. Remember, slay the Askefruer there. If you can, get their wings as proof of their demise. Be swift Eeinken. There isn't much time."); if (quest.Step == 1) { GiveItem(dalikor, player, dustyOldMap); quest.Step = 2; } break; case "reward": dalikor.SayTo(player, "These sleeves will come in handy while you're out fighting. A Viking is always in need of sturdy armor to protect his somewhat fragile hide as he battles the enemies of his realm. Thank you again for your assistance in this matter. Be safe."); if (quest.Step == 9) { quest.FinishQuest(); } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToSirJerem(DOLEvent e, object sender, EventArgs args) { //We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (sirJerem.CanGiveQuest(typeof(ShakenSquire), player) <= 0) { return; } //We also check if the player is already doing the quest ShakenSquire quest = player.IsDoingQuest(typeof(ShakenSquire)) as ShakenSquire; sirJerem.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { //Player is not doing the quest... sirJerem.SayTo(player, "Good day, " + player.CharacterClass.Name + ". I'm sorry that I can't spare much time for idle chatter, but I've got a number of things on my mind right now. Keeping track of a keep full of squires certainly isn't easy [work]."); return; } else { if (quest.Step == 4) { sirJerem.SayTo(player, "Ah, you've returned. Were you able to track down Squire [Galune]?"); } return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { //Do some small talk :) switch (wArgs.Text) { case "work": sirJerem.SayTo(player, "They're good lads, mostly, but they tend to get a little overeager at times. In fact, one of my youngest squires has gone missing. I suspect he heard rumors from the locals and went to [investigate] them."); break; //If the player offered his help, we send the quest dialog now! case "investigate": sirJerem.SayTo(player, "This happens every time we get a new squire. The merchants fill his head with nonsense about becoming a hero and then the boy goes off exploring and gets himself into trouble. Will you help me locate my missing squire?"); player.Out.SendQuestSubscribeCommand(sirJerem, QuestMgr.GetIDForQuestType(typeof(ShakenSquire)), "Will you help Sir Jerem find \nthe missing squire? \n[Levels 6-9]"); break; } } else { switch (wArgs.Text) { case "once": if (quest.Step == 1) { sirJerem.SayTo(player, "I think Graent envies them, in a way. The squires are still young enough to have a bright-eyed enthusiasm for exploration and danger, and he feeds that with his stories. I think the Tomb of Mithra is probably the best place to start your [search]."); } break; case "search": if (quest.Step == 1) { sirJerem.SayTo(player, "The Tomb can be found to the east of here, past the bridge, and across the road. If you need help finding it, don't forget that you can always consult your map. The name of the squire you're looking for is Galune. Good luck."); quest.Step = 2; } break; case "Galune": if (quest.Step == 4) { SendMessage(player, "You tell Sir Jerem that you found Squire Galune in the Tomb, and that he is making his way back to the keep. You decide not to mention the spider, but you get the sense that Sir Jerem will find out anyway.", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); sirJerem.SayTo(player, "I'm glad to hear that you found the squire before he got himself into too much trouble. Most likely, he fainted at the sight of some rat or spider, and decided to wait for someone to [rescue him]."); } break; case "rescue him": if (quest.Step == 4) { sirJerem.SayTo(player, "I won't give him too much trouble over it. I have a feeling that he's learned a good lesson from all of this and won't be nearly so adventurous in the future. Here's a bit of money for your efforts."); quest.FinishQuest(); } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToDalikor(DOLEvent e, object sender, EventArgs args) { //We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (dalikor.CanGiveQuest(typeof(Nuisances), player) <= 0) { return; } //We also check if the player is already doing the quest Nuisances quest = player.IsDoingQuest(typeof(Nuisances)) as Nuisances; dalikor.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { //Player is not doing the quest... dalikor.SayTo(player, "Recruit Eeinken. I'm afraid we have a [serious problem] on our hands."); return; } else { if (quest.Step == 2) { dalikor.SayTo(player, "Welcome back recruit. Did you find out what was making all that racket?"); } else if (quest.Step == 3) { dalikor.SayTo(player, "Hrm...Fallen Askefruer. This is what has been causing us our problems? Interesting. I want to thank you recruit for your hard work in helping us solve this problem. A [reward] is in store for you I think."); } return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { //Do some small talk :) switch (wArgs.Text) { case "serious problem": dalikor.SayTo(player, "There has been this noise that has been keeping the residents of Mularn up at night. I haven't been able to locate the source of the noise, neither have any of the guards. I was hoping you could try to [find] the noise."); break; //If the player offered his "help", we send the quest dialog now! case "find": player.Out.SendQuestSubscribeCommand(dalikor, QuestMgr.GetIDForQuestType(typeof(Nuisances)), "Will you help out Mularn and discover who or what is making this noise?"); break; } } else { switch (wArgs.Text) { case "reward": dalikor.SayTo(player, "Yes, I think this will do quite nicely. Here you are Eeinken. Use it well, and I'm sure it will last you your first few seasons anyhow. Be sure to come and speak with me when you are ready for more adventure."); if (quest.Step == 3) { quest.FinishQuest(); dalikor.SayTo(player, "Don't go far, I have need of your services again Eeinken."); } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
protected static void TalkToInaksha(DOLEvent e, object sender, EventArgs args) { //We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (Inaksha.CanGiveQuest(typeof(Seer_50), player) <= 0) { return; } //We also check if the player is already doing the quest Seer_50 quest = player.IsDoingQuest(typeof(Seer_50)) as Seer_50; if (e == GameObjectEvent.Interact) { // Nag to finish quest if (quest != null) { Inaksha.SayTo(player, "Check your Journal for instructions!"); } else { Inaksha.SayTo(player, "Midgard needs your [services]"); } } // The player whispered to the NPC else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; //Check player is already doing quest if (quest == null) { switch (wArgs.Text) { case "services": player.Out.SendQuestSubscribeCommand(Inaksha, QuestMgr.GetIDForQuestType(typeof(Seer_50)), "Will you help Inaksha [Seer Level 50 Epic]?"); break; } } else { switch (wArgs.Text) { case "dead": if (quest.Step == 3) { Inaksha.SayTo(player, "Take this sealed pouch to Miri in Jordheim for your reward!"); GiveItem(Inaksha, player, sealed_pouch); quest.Step = 4; } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToFarmerAsma(DOLEvent e, object sender, EventArgs args) { //We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (farmerAsma.CanGiveQuest(typeof(GreenerPastures), player) <= 0) { return; } //We also check if the player is already doing the quest GreenerPastures quest = player.IsDoingQuest(typeof(GreenerPastures)) as GreenerPastures; farmerAsma.TurnTo(player); //Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { //Player is not doing the quest... farmerAsma.SayTo(player, "Good night. I wish I had time to talk, " + player.CharacterClass.Name + ", but I'm in the process of trying to find a new field to lease. I'd like to return to my life as a farmer. It's not that Cotswold isn't a nice village, but I feel more at home in the [field]."); return; } else { if (quest.Step == 4) { farmerAsma.SayTo(player, "Ah, you've returned. I hope you were able to find the fields without too much difficulty. I'm still learning my way around the area. Which field would you recommend renting?"); SendMessage(player, "[I'd recommend the first field.]", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); SendMessage(player, "[The second field is best.]", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); SendMessage(player, "[You should rent the third one.]", 0, eChatType.CT_Say, eChatLoc.CL_PopupWindow); } return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { //Do some small talk :) switch (wArgs.Text) { case "field": farmerAsma.SayTo(player, "Ah, yes, Camelot Hills, where the wind comes sweepin' down the plain, and the wavin' barley can sure smell sweet when the wind comes right behind the rain. I have a lead on some fields that are up for lease, but I don't have time to [check them out]."); break; case "check them out": farmerAsma.SayTo(player, "Would you be willing to take a look at these fields for me and let me know if you think they are worth leasing?"); //If the player offered his help, we send the quest dialog now! player.Out.SendQuestSubscribeCommand(farmerAsma, QuestMgr.GetIDForQuestType(typeof(GreenerPastures)), "Will you help Farmer Asma \nsearch for new farmland?\n[Level 2-5]"); break; } } else { switch (wArgs.Text) { case "them": if (quest.Step < 4) { farmerAsma.SayTo(player, "When you're done taking a look at the fields, please return to me and let me know what you saw."); } break; case "I'd recommend the first field.": case "The second field is best.": case "You should rent the third one.": if (quest.Step == 4) { farmerAsma.SayTo(player, "Excellent. I'll speak to the owner tomorrow. May I have the map back?"); } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
/* This is the method we declared as callback for the hooks we set to * NPC. It will be called whenever a player right clicks on NPC * or when he whispers something to him. */ protected static void TalkToAddrir(DOLEvent e, object sender, EventArgs args) { // We get the player from the event arguments and check if he qualifies GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (addrir.CanGiveQuest(typeof(TraitorInMagMell), player) <= 0) { return; } // We also check if the player is already doing the quest TraitorInMagMell quest = player.IsDoingQuest(typeof(TraitorInMagMell)) as TraitorInMagMell; addrir.TurnTo(player); // Did the player rightclick on NPC? if (e == GameObjectEvent.Interact) { if (quest == null) { // Player is not doing the quest... addrir.SayTo(player, "Lirone, this Sluagh problem has its roots deeper into Mag Mell than I originally thought! We have apprehended a [traitor]!"); return; } else { switch (quest.Step) { case 1: addrir.SayTo(player, "Go west from Mag Mell towards Tir na Nog. You will come to the base of the foot hills. Head southwest-south along the base of the hills. The necklace will alert you when you are in the correct place. Hurry now. Time is wasting."); break; case 4: addrir.SayTo(player, "Vinde, you've returned. I'm sure you were successful with your mission. Come come my friend. Hand over the information."); break; case 5: addrir.SayTo(player, "For you, a nice pair of boots to help keep your feet dry and clean. Thank you again for the help you've given me in this matter Lirone. I shall report this to Fagan at once."); if (quest.Step == 5) { quest.FinishQuest(); } break; } return; } } // The player whispered to NPC (clicked on the text inside the []) else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { // Do some small talk :) switch (wArgs.Text) { // case "ire fairies": SendReply(player,"I managed to have a little chat with some of the guardsmen, and it turns out there is a [traitor] here in Cotswold!"); break; case "traitor": addrir.SayTo(player, "Aye Lirone. I could scarcely believe my ears when I heard the news. A man by the name of Samyr has been in [league] with the Sluagh for a while now."); break; case "league": addrir.SayTo(player, "Samyr has given up some information, but not nearly as much as we hoped for. Fagan has asked me to recruit anyone I could to help deal with this problem. Are you up for the [challenge] Lirone?"); break; // If the player offered his "help", we send the quest dialog now! case "challenge": player.Out.SendQuestSubscribeCommand(addrir, QuestMgr.GetIDForQuestType(typeof(TraitorInMagMell)), "Will you help Mag Mell by taking on this vital mission?"); break; } } else { switch (wArgs.Text) { case "necklace": addrir.SayTo(player, "Aye. I am giving it to you to use for this meeting. You will not have to say anything, or so Samyr says. Just go to the [meeting location], use the necklace and wait for the Sluagh."); break; case "meeting location": addrir.SayTo(player, "Go west from Mag Mell towards Tir na Nog. You will come to the base of the foot hills. Head southwest-south along the base of the hills. Hurry now. Time is wasting."); if (quest.Step == 1) { quest.Step = 2; } break; // step 5 case "reward": addrir.SayTo(player, "For you, a nice pair of boots to help keep your feet dry and clean. Thank you again for the help you've given me in this matter Lirone. I shall report this to Fagan at once."); if (quest.Step == 5) { quest.FinishQuest(); } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args) { if (!ServerProperties.Properties.LOAD_QUESTS) { return; } if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initializing ..."); } #region defineNPCS GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Hibernia); if (npcs.Length == 0) { if (log.IsWarnEnabled) { log.Warn("Could not find " + questGiverName + ", creating her ..."); } questGiver = new GameNPC(); questGiver.Name = questGiverName; questGiver.Realm = eRealm.Hibernia; questGiver.CurrentRegionID = 200; // select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?) GameNpcInventoryTemplate template = new GameNpcInventoryTemplate(); template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 448, 0); // Slot 12 template.AddNPCEquipment(eInventorySlot.FeetArmor, 427, 0); // Slot 23 template.AddNPCEquipment(eInventorySlot.TorsoArmor, 423, 0); // Slot 25 template.AddNPCEquipment(eInventorySlot.LegsArmor, 424, 0); // Slot 27 template.AddNPCEquipment(eInventorySlot.ArmsArmor, 425, 0); // Slot 28 questGiver.Inventory = template.CloseTemplate(); questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard); questGiver.Model = 388; questGiver.Size = 51; questGiver.Level = 35; questGiver.X = 346768; questGiver.Y = 489521; questGiver.Z = 5200; questGiver.Heading = 2594; if (SAVE_INTO_DATABASE) { questGiver.SaveIntoDatabase(); } questGiver.AddToWorld(); } else { questGiver = npcs[0]; } npcs = WorldMgr.GetNPCsByName(questTargetName, eRealm.Hibernia); if (npcs.Length == 0) { questTarget = new GameNPC(); questTarget.Name = questTargetName; if (log.IsWarnEnabled) { log.Warn("Could not find " + questTarget.Name + ", creating him ..."); } questTarget.Realm = eRealm.Hibernia; questTarget.CurrentRegionID = 200; // select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?) GameNpcInventoryTemplate template = new GameNpcInventoryTemplate(); template.AddNPCEquipment(eInventorySlot.HandsArmor, 411, 0); // Slot 22 template.AddNPCEquipment(eInventorySlot.FeetArmor, 412, 0); // Slot 23 template.AddNPCEquipment(eInventorySlot.TorsoArmor, 408, 0); // Slot 25 template.AddNPCEquipment(eInventorySlot.Cloak, 57, 34); // Slot 26 template.AddNPCEquipment(eInventorySlot.LegsArmor, 409, 0); // Slot 27 template.AddNPCEquipment(eInventorySlot.ArmsArmor, 410, 0); // Slot 28 questTarget.Inventory = template.CloseTemplate(); questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard); questTarget.Model = 381; questTarget.Size = 50; questTarget.Level = 12; questTarget.X = 347327; questTarget.Y = 492700; questTarget.Z = 5199; questTarget.Heading = 2468; if (SAVE_INTO_DATABASE) { questTarget.SaveIntoDatabase(); } questTarget.AddToWorld(); } else { questTarget = npcs[0]; } #endregion /* #region defineAreas * targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle("", targetLocation.X, targetLocation.Y, targetLocation.Z, 200)); #endregion */ #region defineItems armBone = GameServer.Database.FindObjectByKey <ItemTemplate>("BonesToBlades-armbone"); if (armBone == null) { armBone = new ItemTemplate(); armBone.Name = "Arm Bone"; if (log.IsWarnEnabled) { log.Warn("Could not find " + armBone.Name + ", creating it ..."); } armBone.Level = 1; armBone.Weight = 1; armBone.Model = 497; armBone.Object_Type = (int)eObjectType.GenericItem; armBone.Item_Type = -1; armBone.Id_nb = "BonesToBlades-armbone"; armBone.Hand = 0; armBone.Price = 0; armBone.IsTradable = false; armBone.Color = 0; armBone.Bonus = 0; // default bonus armBone.Bonus1 = 0; armBone.Bonus1Type = (int)0; armBone.Bonus2 = 0; armBone.Bonus2Type = (int)0; armBone.Bonus3 = 0; armBone.Bonus3Type = (int)0; armBone.Bonus4 = 0; armBone.Bonus4Type = (int)0; armBone.Bonus5 = 0; armBone.Bonus5Type = (int)0; armBone.Bonus6 = 0; armBone.Bonus6Type = (int)0; armBone.Bonus7 = 0; armBone.Bonus7Type = (int)0; armBone.Bonus8 = 0; armBone.Bonus8Type = (int)0; armBone.Bonus9 = 0; armBone.Bonus9Type = (int)0; armBone.Bonus10 = 0; armBone.Bonus10Type = (int)0; armBone.ExtraBonus = 0; armBone.ExtraBonusType = (int)0; armBone.Effect = 0; armBone.Emblem = 0; armBone.Charges = 0; armBone.MaxCharges = 0; armBone.SpellID = 0; armBone.ProcSpellID = 0; armBone.Type_Damage = 0; armBone.Realm = 0; armBone.MaxCount = 1; armBone.PackSize = 1; armBone.Extension = 0; armBone.Quality = 100; armBone.Condition = 100; armBone.MaxCondition = 100; armBone.Durability = 100; armBone.MaxDurability = 100; armBone.PoisonCharges = 0; armBone.PoisonMaxCharges = 0; armBone.PoisonSpellID = 0; armBone.ProcSpellID1 = 0; armBone.SpellID1 = 0; armBone.MaxCharges1 = 0; armBone.Charges1 = 0; //You don't have to store the created item in the db if you don't want, //it will be recreated each time it is not found, just comment the following //line if you rather not modify your database if (SAVE_INTO_DATABASE) { GameServer.Database.AddObject(armBone); } } carvedBoneHilt = GameServer.Database.FindObjectByKey <ItemTemplate>("BonesToBlades-carvedBoneHilts"); if (carvedBoneHilt == null) { carvedBoneHilt = new ItemTemplate(); carvedBoneHilt.Name = "Two Carved Bone Hilts"; if (log.IsWarnEnabled) { log.Warn("Could not find " + carvedBoneHilt.Name + ", creating it ..."); } carvedBoneHilt.Level = 1; carvedBoneHilt.Weight = 1; carvedBoneHilt.Model = 497; carvedBoneHilt.Object_Type = (int)eObjectType.GenericItem; carvedBoneHilt.Item_Type = -1; carvedBoneHilt.Id_nb = "BonesToBlades-carvedBoneHilts"; carvedBoneHilt.Hand = 0; carvedBoneHilt.Price = 0; carvedBoneHilt.IsTradable = false; carvedBoneHilt.Color = 0; carvedBoneHilt.Bonus = 0; // default bonus carvedBoneHilt.Bonus1 = 0; carvedBoneHilt.Bonus1Type = (int)0; carvedBoneHilt.Bonus2 = 0; carvedBoneHilt.Bonus2Type = (int)0; carvedBoneHilt.Bonus3 = 0; carvedBoneHilt.Bonus3Type = (int)0; carvedBoneHilt.Bonus4 = 0; carvedBoneHilt.Bonus4Type = (int)0; carvedBoneHilt.Bonus5 = 0; carvedBoneHilt.Bonus5Type = (int)0; carvedBoneHilt.Bonus6 = 0; carvedBoneHilt.Bonus6Type = (int)0; carvedBoneHilt.Bonus7 = 0; carvedBoneHilt.Bonus7Type = (int)0; carvedBoneHilt.Bonus8 = 0; carvedBoneHilt.Bonus8Type = (int)0; carvedBoneHilt.Bonus9 = 0; carvedBoneHilt.Bonus9Type = (int)0; carvedBoneHilt.Bonus10 = 0; carvedBoneHilt.Bonus10Type = (int)0; carvedBoneHilt.ExtraBonus = 0; carvedBoneHilt.ExtraBonusType = (int)0; carvedBoneHilt.Effect = 0; carvedBoneHilt.Emblem = 0; carvedBoneHilt.Charges = 0; carvedBoneHilt.MaxCharges = 0; carvedBoneHilt.SpellID = 0; carvedBoneHilt.ProcSpellID = 0; carvedBoneHilt.Type_Damage = 0; carvedBoneHilt.Realm = 0; carvedBoneHilt.MaxCount = 1; carvedBoneHilt.PackSize = 1; carvedBoneHilt.Extension = 0; carvedBoneHilt.Quality = 100; carvedBoneHilt.Condition = 100; carvedBoneHilt.MaxCondition = 100; carvedBoneHilt.Durability = 100; carvedBoneHilt.MaxDurability = 100; carvedBoneHilt.PoisonCharges = 0; carvedBoneHilt.PoisonMaxCharges = 0; carvedBoneHilt.PoisonSpellID = 0; carvedBoneHilt.ProcSpellID1 = 0; carvedBoneHilt.SpellID1 = 0; carvedBoneHilt.MaxCharges1 = 0; carvedBoneHilt.Charges1 = 0; //You don't have to store the created item in the db if you don't want, //it will be recreated each time it is not found, just comment the following //line if you rather not modify your database if (SAVE_INTO_DATABASE) { GameServer.Database.AddObject(carvedBoneHilt); } } #endregion #region defineBehaviours QuestBuilder builder = QuestMgr.getBuilder(typeof(BonesToBlades)); QuestBehaviour a = null; string message1 = "Oh, have you been standing there long, <Class>? If you have, I apologize for ignoring you. I find my mind is quite distracted these days after the meeting I had yesterday with a [new client]."; string message2 = "Ah, I would love to tell you the name of the client, but I promised to keep their identity a secret. I keep the identity of all my clients secret because I don't want the other merchants in this area to try to steal them away from me! See, there I go again, getting distracted when I should be thinking about [those blades]."; string message3 = "Day in and day out I sell these plain, everyday blades. But from time to time clients do approach me to commission special blades to be made. My newest client came to me and requested that I make a set of matched falcatas to be given as [a gift] to this client's daughter upon her next birthday."; string message4 = "The daughter is a highly skilled blademaster who is preparing to venture into the Frontiers. My client wants the daughter to be as well armed as possible and I seemed to have developed a reputation as a maker of some of the best custom blades out there. I hope I can [live up to] that reputation."; string message5 = "I fear I have agreed to make these falcatas before I checked to see if I have all the supplies I need. It turns out I'm missing a few things, and I need to have the blades done within a few days. Making the blades alone will take me all that time without having to gather the materials for [the hilt] of each blade."; string message6 = "My client has asked that the hilts of these falcatas be carved from bone. I would be happy to do that, but I don't have the bones I need. I need to get them and send them over to Jahan so he can carve them for me. Say, if you're not busy, perhaps [you can go] get the bones I need. I can pay you for your time."; string message7 = "I cannot thank you enough for agreeing to help me. I've found that when people ask for carved bone hilts that the best bones come from the skeletal pawns and minions that roam the lands [just outside] of Mag Mell."; string message8 = "You'll find the skeletal pawns and minions across the road on the hill northwest of here. I've also seen them in the field and by the standing stone in the woods east-southeast of Rumdor the Stable Master here in Mag Mell. Get two arm bones from either the pawns or the minions. When you have them, take them to Jahan here in Mag Mell. He will carve them for me. Good luck, <Class>!"; string message9 = "Ah, you must be the young <Class> that Wony told me about. She said you would have two arm bones that needed carving for hilts. Wony thinks it will take me a few days to get those bones carved but I have [a surprise] for her."; string message10 = "I already had some bones among my supplies. I went ahead and carved them while you were out obtaining more bones. I'll give you the carved ones and I'll take the ones you have so I can keep my supplies well stocked. Why don't you hand me those two arm bones now?"; string message11 = "There you go, <Class>. Take those two carved bones to Wony right now. It will put her mind at ease having those hilts already taken care of. Don't worry about payment for my work; Wony has taken care of that already."; string message12 = "<Class>, what are you doing back here already? I told you to take the arm bones to Jahan so he can carve them! You should have listened to me! Now what am I going to do?"; string message13 = "What is this? These hilts are already carved! Jahan played a trick on me, didn't he? He already had these done. I guess the arm bones I had you collect will get used the next time I need bone hilts. I am sorry for yelling at you when I should have been offering you [the payment] I promised you."; string message14 = "There we go, <Class>. Thank you so much for helping me get these bone hilts. I shall be able to get the matching falcatas done on time and keep my new client. Perhaps one day you will have enough platinum to hire me to make custom blades for you. Until then, be well!"; a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Interact, null, questGiver); a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5); a.AddAction(eActionType.Talk, message1, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "new client", questGiver); a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5); a.AddAction(eActionType.Talk, message2, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "those blades", questGiver); a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5); a.AddAction(eActionType.Talk, message3, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "a gift", questGiver); a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5); a.AddAction(eActionType.Talk, message4, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "live up to", questGiver); a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5); a.AddAction(eActionType.Talk, message5, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "the hilt", questGiver); a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5); a.AddAction(new MessageAction(questGiver, questGiverName + " blushes a deep red.", eTextType.Emote)); a.AddAction(eActionType.Talk, message6, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "you can go", questGiver); a.AddRequirement(eRequirementType.QuestGivable, typeof(BonesToBlades), questGiver); a.AddRequirement(eRequirementType.QuestPending, typeof(BonesToBlades), null, (eComparator)5); a.AddAction(eActionType.OfferQuest, typeof(BonesToBlades), "Do you want to help Wony?"); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, 1); a.AddTrigger(eTriggerType.AcceptQuest, null, typeof(BonesToBlades)); a.AddAction(eActionType.Talk, message7, questGiver); a.AddAction(eActionType.GiveQuest, typeof(BonesToBlades), questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "just outside", questGiver); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 1, eComparator.Equal); a.AddAction(eActionType.Talk, message8, questGiver); AddBehaviour(a); //a = builder.CreateBehaviour(questGiver, -1); //a.AddTrigger(eTriggerType.EnemyKilled, "skeletal pawn", null); //a.AddTrigger(eTriggerType.EnemyKilled, "skeletal minion", null); //a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 0, eComparator.Greater); //a.AddRequirement(eRequirementType.InventoryItem, armBone, 2, eComparator.Less); //a.AddAction(eActionType.GiveItem, armBone, null); //AddBehaviour(a); //a = builder.CreateBehaviour(questGiver, -1); //a.AddTrigger(eTriggerType.EnemyKilled, mobTypes[0], null); //a.AddTrigger(eTriggerType.EnemyKilled, mobTypes[1], null); //a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 1, eComparator.Equal); //a.AddRequirement(eRequirementType.InventoryItem, armBone, 1, eComparator.Greater); //a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 2); //AddBehaviour(a); a = builder.CreateBehaviour(questTarget, -1); a.AddTrigger(eTriggerType.Interact, null, questTarget); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 2, eComparator.Equal); a.AddAction(eActionType.Talk, message9, questTarget); AddBehaviour(a); a = builder.CreateBehaviour(questTarget, -1); a.AddTrigger(eTriggerType.Whisper, "a surprise", questTarget); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 2, eComparator.Equal); a.AddAction(eActionType.Talk, message10, questTarget); a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 3); AddBehaviour(a); a = builder.CreateBehaviour(questTarget, -1); a.AddTrigger(eTriggerType.GiveItem, questTarget, armBone); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 4, eComparator.Equal); a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 5); a.AddAction(eActionType.TakeItem, armBone, null); a.AddAction(eActionType.GiveItem, carvedBoneHilt, null); a.AddAction(eActionType.Talk, message11, questTarget); AddBehaviour(a); a = builder.CreateBehaviour(questTarget, -1); a.AddTrigger(eTriggerType.GiveItem, questTarget, armBone); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 3, eComparator.Equal); a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 4); a.AddAction(eActionType.TakeItem, armBone, null); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Interact, null, questGiver); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 5, eComparator.Equal); a.AddAction(eActionType.Talk, message12, questGiver); a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 6); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.GiveItem, questGiver, carvedBoneHilt); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 6, eComparator.Equal); a.AddAction(eActionType.SetQuestStep, typeof(BonesToBlades), 7); a.AddAction(eActionType.TakeItem, carvedBoneHilt, null); a.AddAction(eActionType.Talk, message13, questGiver); AddBehaviour(a); a = builder.CreateBehaviour(questGiver, -1); a.AddTrigger(eTriggerType.Whisper, "the payment", questGiver); a.AddRequirement(eRequirementType.QuestStep, typeof(BonesToBlades), 7, eComparator.Equal); a.AddAction(eActionType.Talk, message14, questGiver); a.AddAction(eActionType.GiveXP, 20, null); a.AddAction(eActionType.GiveGold, 37, null); a.AddAction(eActionType.FinishQuest, typeof(BonesToBlades), null); AddBehaviour(a); #endregion questGiver.AddQuestToGive(typeof(BonesToBlades)); if (log.IsInfoEnabled) { log.Info("Quest \"" + questTitle + "\" initialized"); } }
protected static void TalkToGuardAlakyrr(DOLEvent e, object sender, EventArgs args) { GamePlayer player = ((SourceEventArgs)args).Source as GamePlayer; if (player == null) { return; } if (GuardAlakyrr.CanGiveQuest(typeof(AidingGuardAlakyrr), player) <= 0) { return; } AidingGuardAlakyrr quest = player.IsDoingQuest(typeof(AidingGuardAlakyrr)) as AidingGuardAlakyrr; GuardAlakyrr.TurnTo(player); if (e == GameObjectEvent.Interact) { if (quest == null) { GuardAlakyrr.SayTo(player, "You are new to this area aren't you? Yes, you look to be one of those from upper Albion. You will find that this lower realm is not as [familiar] as upper Albion and your Camelot."); return; } else { if (quest.Step == 1) { if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; switch (wArgs.Text) { case "study": GuardAlakyrr.SayTo(player, "You will need to slay tenebrae and then use an enchanted Tenebrous Flask, while inside the Tenebrous Quarter, to capture their essence. I need you to obtain a full flask of Tenebrous Essence. Return to me once you complete this duty and I will reward you for your efforts."); quest.Step = 2; break; } } } if (quest.Step == 10) { GuardAlakyrr.SayTo(player, "It was Arawn's will to allow your return. I am grateful that you made it back. Please give me the Full Flask of Tenebrous Essence."); quest.Step = 11; } return; } } else if (e == GameLivingEvent.WhisperReceive) { WhisperReceiveEventArgs wArgs = (WhisperReceiveEventArgs)args; if (quest == null) { switch (wArgs.Text) { case "familiar": GuardAlakyrr.SayTo(player, "Everything here is quite unlike upper Albion, from the surroundings to the creatures. We, the chosen of Arawn, are not even familiar with some of the [creatures] which lurk in the Aqueducts."); break; case "creatures": GuardAlakyrr.SayTo(player, "We have been trying to study some of these creatures so that we can learn more of their origins to better defend ourselves. Our forces are spread thin with the war against the evil army being [waged] below."); break; case "waged": GuardAlakyrr.SayTo(player, "We have not had enough troops to spare to help us combat some of these hostile beings. The [tenebrae] are some of these creatures."); break; case "tenebrae": GuardAlakyrr.SayTo(player, "They seem to hate all that is living, and it is an intense hate, indeed. Their origins are shrouded in mystery, but we do know that they were created out of [darkness]."); break; case "darkness": GuardAlakyrr.SayTo(player, "The attacks by the tenebrae have been numerous, and we need to cease some of these attacks. I am authorized to provide money to any who can slay these tenebrae and bring me proof of their deed. Will you [aid] us in this time of need?"); break; case "aid": player.Out.SendQuestSubscribeCommand(GuardAlakyrr, QuestMgr.GetIDForQuestType(typeof(AidingGuardAlakyrr)), "Will you slay the tenebrae for Guard Alakyrr? [Levels 1-4]"); break; } } else { switch (wArgs.Text) { case "study": if (quest.Step == 1) { GuardAlakyrr.SayTo(player, "You will need to slay tenebrae and then use an enchanted Tenebrous Flask, while inside the Tenebrous Quarter, to capture their essence. I need you to obtain a full flask of Tenebrous Essence. Return to me once you complete this duty and I will reward you for your efforts."); quest.Step = 2; } break; case "abort": player.Out.SendCustomDialog("Do you really want to abort this quest, \nall items gained during quest will be lost?", new CustomDialogResponse(CheckPlayerAbortQuest)); break; } } } }
void Awake() { instance = this; }