public override void Run(Game_Server.Player _client, ushort _linkback) { Responses = new List <NpcDialogPacket>(); AddAvatar(); switch (_linkback) { case 0: AddText("I can help you to divorce your spouse. You just will have to agree to a divorce. I will also need a MeteorTear. If you have this item and you really want to get divorced, we will do it soon."); AddOption("Yes, I want a divorce.", 1); AddOption("Just passing by.", 255); break; case 1: if (_client.Spouse == Constants.DEFAULT_MATE) { AddText("You really sure you want to divorce your spouse now? You will not regret later?"); AddOption("No I'll not. Let's do this.", 2); AddOption("I prefer to remain married.", 255); } else { AddText("Sorry, I can not divorce you if you are not married."); AddOption("Okay.", 255); } break; case 2: AddText("Are you ready? Be sure you're with MeteorTear, I really need it."); AddOption("Yeah. I am ready.", 3); AddOption("Let me think it over.", 255); break; case 3: if (_client.Spouse == Constants.DEFAULT_MATE && _client.HasItem(Constants.METEOR_TEAR_ID)) { var dbSpouse = Database.ServerDatabase.Context.Characters.GetByName(_client.Spouse); if (dbSpouse != null) { dbSpouse.Spouse = Constants.DEFAULT_MATE; Database.ServerDatabase.Context.Characters.AddOrUpdate(dbSpouse); var meteorTear = _client.GetItemByID(Constants.METEOR_TEAR_ID); _client.RemoveItem(meteorTear); meteorTear.DbItem.Owner = dbSpouse.UID; meteorTear.Save(); var spouse = Managers.PlayerManager.GetUser(_client.Spouse); if (spouse != null) { spouse.AddItem(meteorTear); spouse.Send(ItemInformationPacket.Create(meteorTear)); //sanity check incase they log out while it's being saved above or something weird spouse.Spouse = Constants.DEFAULT_MATE; spouse.Send((StringsPacket.Create(spouse.UID, StringAction.Mate, Constants.DEFAULT_MATE))); } Managers.PlayerManager.SendToServer(new TalkPacket(ChatType.GM, "Unfortunately! " + _client.Name + " and " + _client.Spouse + " got divorced.")); _client.Spouse = Constants.DEFAULT_MATE; _client.Save(); AddText("Done, you are now divorced. You are free to find another passion around. Be happy my friend."); AddOption("Thank you.", 255); } } else { AddText("Sorry, I can not divorce you if you don't have a MeteorTear."); AddOption("Okay.", 255); } break; } AddFinish(); Send(); }
public override void Run(Game_Server.Player _client, ushort _linkback) { ushort Max1; Responses = new List <NpcDialogPacket>(); AddAvatar(); switch (_linkback) { case 0: AddText("Hello, i can help you gain experience to level up easier"); AddOption("This is great..", 1); AddOption("Just passing by.", 255); break; case 1: var Jar = _client.GetItemByID(750000); Max1 = 100; if (Jar == null) { AddText("To level up faster you need to collect the souls of 100 pheasants inside this Jar "); AddOption("Looks easy, give me..", 2); AddOption("Just passing by.", 255); } else if (Jar != null && Jar.MaximumDurability == 1) { AddText("You have not completed collection of the souls of the previous Jar please complete it then come back"); AddOption("I see..", 255); } else if (Jar != null && Jar.MaximumDurability != 1) { AddText("You already have a Jar (from another captain) but i will give you another one and thats it.."); AddOption("thank you alot", 2); AddOption("I see..", 255); } else if (Jar != null && Jar.Durability == Max1) { AddText("You have finished collecting souls and here is your reward"); AddOption("thank you alot", 2); AddOption("I see..", 255); } break; case 2: Max1 = 100; DbTask task = new DbTask(); task = Database.ServerDatabase.Context.Tasks.GetTasksByPlayerUID(_client.UID, 1); if (task == null) { _client.CreateJar(Max1, 1, 750000); _client.Save(); AddText("I gave you the item now go hunt pheasant"); } else { AddText("I'm sorry"); } AddOption("Thanks", 255); break; } AddFinish(); Send(); }