Пример #1
0
 bool InitPlayerData(BasePlayer player)
 {
     if (CanPoofHammer(player))
     {
         PoofHammerInfo p = null;
         if (hammerUserData.Users.TryGetValue(player.userID, out p) == false)
         {
             var info = new PoofHammerInfo();
             info.Enabled          = false;
             info.UserId           = player.userID;
             info.Messages_Enabled = true;
             hammerUserData.Users.Add(player.userID, info);
             Interface.GetMod().DataFileSystem.WriteObject(this.Title + "_users", hammerUserData);
             Puts("Adding entry " + player.userID.ToString());
         }
     }
     else
     {
         PoofHammerInfo p = null;
         if (hammerUserData.Users.TryGetValue(player.userID, out p))
         {
             Puts("Removing " + player.userID + " from magic hammer data, cleaning up...");
             hammerUserData.Users.Remove(player.userID);
         }
     }
     return(false);
 }
Пример #2
0
        void cmdMH(BasePlayer player, string cmd, string[] args)
        {
            if (CanPoofHammer(player))
            {
                PoofHammerInfo p = null;

                if (hammerUserData.Users.TryGetValue(player.userID, out p) == false)
                {
                    InitPlayerData(player);
                }

                if (PoofHammerEnabled(player))
                {
                    string parsed_config = Config["tHammerEnabled"].ToString();
                    parsed_config = parsed_config.Replace("{hammer_status}", "<color=#FF4000>disabled</color>");
                    PrintToChatEx(player, parsed_config);
                    SetPlayerHammerStatus(player, false);
                }
                else
                {
                    string parsed_config = Config["tHammerEnabled"].ToString();
                    parsed_config = parsed_config.Replace("{hammer_status}", "<color=#2EFE64>enabled</color>");
                    PrintToChatEx(player, parsed_config);
                    SetPlayerHammerStatus(player, true);
                }
            }
        }
Пример #3
0
        bool PoofHammerEnabled(BasePlayer player)
        {
            PoofHammerInfo p = null;

            if (hammerUserData.Users.TryGetValue(player.userID, out p))
            {
                return(p.Enabled);
            }
            return(false);
        }
Пример #4
0
        bool SetPlayerHammerStatus(BasePlayer player, bool enabled)
        {
            PoofHammerInfo p = null;

            if (hammerUserData.Users.TryGetValue(player.userID, out p))
            {
                p.Enabled = enabled;
                return(true);
            }
            return(false);
        }