Beispiel #1
0
        /// <summary>
        /// Occurs when a character selects a supply menu
        /// </summary>
        /// <param name="cpkt"></param>
        private void CM_SELECTSUPPPLYMENU(CMSG_SUPPLYSELECT cpkt)
        {
            try
            {
                //Try get dependecies
                MapObject  regionoject = null;
                Regiontree tree        = this.character.currentzone.Regiontree;
                Regiontree.TryFind(cpkt.ActorId, this.character, out regionoject);

                //Implicit casts
                BaseNPC            npc       = this.character.Target as BaseNPC;
                TradelistContainer container = this.character.Tag as TradelistContainer;

                if (npc != null && container != null)
                {
                    //Regossip the npc
                    npc.OnGossip(this.character);

                    //Find the tradelist
                    BaseTradelist utradelist;
                    if (container.dict.TryGetValue(cpkt.ButtonId, out utradelist))
                    {
                        utradelist.Open(this.character, npc, cpkt.ButtonId);
                    }
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
            }
        }
Beispiel #2
0
 /// <summary>
 /// Is invoked when you greet the npc.
 /// </summary>
 /// <param name="cpkt"></param>
 private void CM_NPCCHAT(CMSG_NPCCHAT cpkt)
 {
     if (Regiontree.TryFind(cpkt.ActorID, this.character, out this.character._target))
     {
         if (character.Target is BaseNPC)
         {
             BaseNPC current = character.Target as BaseNPC;
             current.OnGossip(this.character);
         }
     }
 }