Exemplo n.º 1
0
 public void OnPostLogin(PlayerPostLoginEventArgs args)
 {
     if (!DB.PlayerBuffs.ContainsKey(args.Player.Account.ID))
     {
         if (DB.LoadUserBuffs(args.Player.Account.ID))
         {
             if (DB.PlayerBuffs[args.Player.Account.ID].bufflist.Count > 0)
             {
                 args.Player.SendInfoMessage("Your permabuffs from your previous session ({0}) are still active!", string.Join(", ", DB.PlayerBuffs[args.Player.Account.ID].bufflist.Select(p => TShock.Utils.GetBuffName(p))));
             }
         }
         else
         {
             DB.AddNewUser(args.Player.Account.ID);
         }
     }
     else
     {
         DB.PlayerBuffs.Remove(args.Player.Account.ID);
         DB.LoadUserBuffs(args.Player.Account.ID);
         if (DB.PlayerBuffs[args.Player.Account.ID].bufflist.Count > 0)
         {
             args.Player.SendInfoMessage("Your permabuffs from your previous session ({0}) are still active!", string.Join(", ", DB.PlayerBuffs[args.Player.Account.ID].bufflist.Select(p => TShock.Utils.GetBuffName(p))));
         }
     }
 }
Exemplo n.º 2
0
        public void OnGreet(GreetPlayerEventArgs args)
        {
            if (TShock.Players[args.Who] == null)
            {
                return;
            }

            if (globalbuffs.Count > 0)
            {
                TShock.Players[args.Who].SendInfoMessage("This server has the following global permabuffs active: {0}", string.Join(", ", globalbuffs.Select(p => TShock.Utils.GetBuffName(p))));
            }

            if (!hasAnnounced.ContainsKey(args.Who))
            {
                hasAnnounced.Add(args.Who, new List <string>());
            }

            if (!TShock.Players[args.Who].IsLoggedIn)
            {
                return;
            }

            int id = TShock.Players[args.Who].Account.ID;

            if (!DB.PlayerBuffs.ContainsKey(id))
            {
                if (DB.LoadUserBuffs(id))
                {
                    if (DB.PlayerBuffs[id].bufflist.Count > 0)
                    {
                        TShock.Players[args.Who].SendInfoMessage("Your permabuffs from your previous session ({0}) are still active!", string.Join(", ", DB.PlayerBuffs[id].bufflist.Select(p => TShock.Utils.GetBuffName(p))));
                    }
                }
                else
                {
                    DB.AddNewUser(TShock.Players[args.Who].Account.ID);
                }
            }
            else
            {
                //loadDBInfo(args.Who);
                if (DB.PlayerBuffs[id].bufflist.Count > 0)
                {
                    TShock.Players[args.Who].SendInfoMessage("Your permabuffs from your previous session ({0}) are still active!", string.Join(", ", DB.PlayerBuffs[id].bufflist.Select(p => TShock.Utils.GetBuffName(p))));
                }
            }
        }