示例#1
0
 public void OnCommandInvoke(ShPlayer player, string Skin, ShPlayer target = null)
 {
     if (target != player && !player.svPlayer.HasPermission(Core.Instance.Info.GroupNamespace + ".changeothersskin"))
     {
         player.svPlayer.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, "You can only change your skin");
         return;
     }
     target = target ?? player;
     if (player.manager.skinPrefabs.FirstOrDefault(x => x.name.ToLower() == Skin.ToLower()) == null)
     {
         player.svPlayer.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, "Skin not found");
         return;
     }
     target.GetExtendedPlayerPs().Skin = player.manager.skinPrefabs.FirstOrDefault(x => x.name.ToLower() == Skin.ToLower()).name;
     target.svPlayer.Send(SvSendType.Self, Channel.Unsequenced, ClPacket.GameMessage, "Reconnect to apply new skin.");
 }
示例#2
0
        public void OnEvent(ShPlayer player)
        {
            if (player.GetExtendedPlayerPs().Skin != null)
            {
                int skin = MonoBehaviourSingleton <SceneManager> .Instance.entityCollection.FirstOrDefault(x => x.Value.name == player.GetExtendedPlayerPs().Skin).Key;

                Core.Instance.Logger.Log(skin.ToString());
                string accId = player.username;
                Core.Instance.PlayerHandler.Remove(player.ID);
                Core.Instance.SvManager.StartCoroutine(MethodTimer(2, delegate()
                {
                    Core.Instance.SvManager.TryGetUserData(accId, out var user);
                    user.Character.SkinIndex = skin;
                    Core.Instance.SvManager.database.Users.Upsert(user);
                }));
            }
            else
            {
                Core.Instance.PlayerHandler.Remove(player.ID);
            }
        }