Exemplo n.º 1
0
 public NpcBuySellExchange(WorldClient client, NpcActionsRecord action, NpcSpawnRecord npc)
 {
     this.Action = action;
     this.Client = client;
     this.Items  = Action.OptionalValue1.ToSplitedList <short>().ConvertAll <ItemRecord>(
         x => ItemRecord.GetItem(x));
     this.Items.RemoveAll(x => x.IsNull());
     this.Npc     = npc;
     this.TokenId = ushort.Parse(action.OptionalValue2);
 }
Exemplo n.º 2
0
        static void Talk(WorldClient client, NpcSpawnRecord npc, NpcActionsRecord action)
        {
            if (action == null)
            {
                client.Character.Reply("Ce PNJ n'est pas apte a parler.");
                return;
            }
            ushort messageId = ushort.Parse(action.OptionalValue1);

            List <NpcReplyRecord> replies = NpcsRepliesProvider.GetPossibleReply(client, NpcReplyRecord.GetNpcReplies(messageId));

            client.Character.CurrentDialogType = DialogTypeEnum.DIALOG_DIALOG;

            client.Send(new NpcDialogCreationMessage(npc.MapId, -npc.Id));

            client.Send(new NpcDialogQuestionMessage(messageId, new string[] { "0" }, replies.ConvertAll <ushort>(x => (ushort)x.ReplyId)));
        }
Exemplo n.º 3
0
        static void Sell(WorldClient client, NpcSpawnRecord npc, NpcActionsRecord action)
        {
            if (client.Character.BidShopInstance != null)
            {
                client.Character.BidShopInstance.OpenSellPanel();

                return;
            }
            var bidshop = BidShopRecord.GetBidShop(int.Parse(action.OptionalValue1));

            if (bidshop != null)
            {
                client.Character.BidShopInstance = new BidShopExchange(client, bidshop.GetDescriptor(npc.Id), bidshop.Id);
                client.Character.BidShopInstance.OpenSellPanel();
            }
            else
            {
                client.Character.Reply("Cet hotel de vente n'est pas encore disponible!");
            }
        }
Exemplo n.º 4
0
        public static void Handle(WorldClient client, NpcSpawnRecord npc, sbyte clientnpcactionid)
        {
            var actionType = (NpcActionTypeEnum)clientnpcactionid;
            var handler    = NpcActions.FirstOrDefault(x => x.Key == actionType);

            if (handler.Value != null)
            {
                var action = NpcActionsRecord.GetNpcAction(npc.Id, actionType);
                if (action != null)
                {
                    handler.Value(client, npc, action);
                }
                else
                {
                    client.Character.NotificationError("Unable to find npc action record (" + clientnpcactionid + ") for Npc " + npc.Id);
                }
            }
            else
            {
                client.Character.NotificationError("Unable to find npc generic action handler (" + clientnpcactionid + ") for Npc " + npc.Id);
            }
        }
Exemplo n.º 5
0
 static void BuySell(WorldClient client, NpcSpawnRecord npc, NpcActionsRecord action)
 {
     client.Character.NpcShopExchange = new NpcBuySellExchange(client, action, npc);
     client.Character.NpcShopExchange.OpenPanel();
 }