Esempio n. 1
0
 public void ServerSendMail(ServerPlayer target, string title, string content, List <Item> items, int gucoin = 0)
 {
     if (Main.netMode == 2)
     {
         Mail mail = new Mail
         {
             MailHead = MailHead.GenerateHead(title, "<系统>", target.Name),
             Content  = content
         };
         foreach (var item in items)
         {
             var info = ItemInfo.Create();
             info.FromItem(item);
             mail.AttachedItems.Add(info);
         }
         mail.AttachedGuCoin = gucoin;
         lock (target.MailList)
         {
             MailList.Add(mail.MailHead.MailID, mail);
             target.MailList.Add(mail);
             if (target.MailList.Count > ServerSideCharacter2.Config.MaxMailsPerPlayer)
             {
                 MailList.Remove(target.MailList.ElementAt(0).MailHead.MailID);
                 target.MailList.RemoveAt(0);
             }
         }
         target.SendMailList();
     }
 }
Esempio n. 2
0
        public static MailHead GenerateHead(string title, string sender, string recevier)
        {
            MailHead head = new MailHead(title)
            {
                MailID   = ServerSideCharacter2.MailManager.MainCurrentID++,
                Sender   = sender,
                Recevier = recevier
            };

            return(head);
        }