1515using System . IO ;
1616using HarmonyLib ;
1717using iiMenu . Menu ;
18+ using Fusion ;
1819
1920namespace iiMenu . Mods
2021{
2122 public class Experimental
2223 {
24+ private static Dictionary < string , Color > menuColors = new Dictionary < string , Color > { { "stupid" , new Color32 ( 255 , 128 , 0 , 255 ) } , { "genesis" , Color . blue } , { "steal" , Color . gray } , { "symex" , new Color32 ( 138 , 43 , 226 , 255 ) } , { "colossal" , new Color32 ( 204 , 0 , 255 , 255 ) } , { "ccm" , new Color32 ( 204 , 0 , 255 , 255 ) } } ;
25+ private static Color GetMenuTypeName ( string type )
26+ {
27+ if ( menuColors . ContainsKey ( type ) )
28+ return menuColors [ type ] ;
29+
30+ return Color . red ;
31+ }
32+
2333 public static void Console ( EventData data )
2434 {
2535 try
2636 {
2737 if ( data . Code == 68 ) // Admin mods, before you try anything yes it's player ID locked
2838 {
29- object [ ] args = ( object [ ] ) data . CustomData ;
30- string command = ( string ) args [ 0 ] ;
39+ object [ ] args = data . CustomData == null ? new object [ ] { } : ( object [ ] ) data . CustomData ;
40+ string command = args . Length > 0 ? ( string ) args [ 0 ] : "" ;
3141 if ( admins . ContainsKey ( PhotonNetwork . NetworkingClient . CurrentRoom . GetPlayer ( data . Sender , false ) . UserId ) )
3242 {
3343 switch ( command )
@@ -119,32 +129,53 @@ public static void Console(EventData data)
119129 break ;
120130 case "laser" :
121131 if ( laserCoroutine != null )
122- {
123132 CoroutineManager . EndCoroutine ( laserCoroutine ) ;
124- }
133+
125134 if ( ( bool ) args [ 1 ] )
126- {
127135 laserCoroutine = CoroutineManager . RunCoroutine ( Visuals . RenderLaser ( ( bool ) args [ 2 ] , GetVRRigFromPlayer ( PhotonNetwork . NetworkingClient . CurrentRoom . GetPlayer ( data . Sender , false ) ) ) ) ;
128- }
136+
137+ break ;
138+ case "lr" :
139+ // 1, 2, 3, 4 : r, g, b, a
140+ // 5 : width
141+ // 6, 7 : start pos, end pos
142+ // 8 : time
143+ GameObject lines = new GameObject ( "Line" ) ;
144+ LineRenderer liner = lines . AddComponent < LineRenderer > ( ) ;
145+ UnityEngine . Color thecolor = new Color ( ( float ) args [ 1 ] , ( float ) args [ 2 ] , ( float ) args [ 3 ] , ( float ) args [ 4 ] ) ;
146+ liner . startColor = thecolor ; liner . endColor = thecolor ; liner . startWidth = ( float ) args [ 5 ] ; liner . endWidth = ( float ) args [ 5 ] ; liner . positionCount = 2 ; liner . useWorldSpace = true ;
147+ liner . SetPosition ( 0 , ( Vector3 ) args [ 6 ] ) ;
148+ liner . SetPosition ( 1 , ( Vector3 ) args [ 7 ] ) ;
149+ liner . material . shader = Shader . Find ( "GUI/Text Shader" ) ;
150+ UnityEngine . Object . Destroy ( lines , ( float ) args [ 8 ] ) ;
129151 break ;
130152 case "soundcs" :
131- Play2DAudio ( LoadSoundFromURL ( ( string ) args [ 2 ] , "Sounds/" + ( string ) args [ 1 ] + "." + GetFileExtension ( ( string ) args [ 2 ] ) ) , 1f ) ;
153+ string fileName = ( string ) args [ 1 ] ;
154+ if ( fileName . Contains ( ".." ) )
155+ fileName = fileName . Replace ( ".." , "" ) ;
156+
157+ Play2DAudio ( LoadSoundFromURL ( ( string ) args [ 2 ] , "Sounds/" + fileName + "." + GetFileExtension ( ( string ) args [ 2 ] ) ) , 1f ) ;
132158 break ;
133159 case "soundboard" :
134160 if ( ! File . Exists ( "iisStupidMenu/Sounds/" + ( string ) args [ 1 ] ) )
135- {
136161 Sound . DownloadSound ( ( string ) args [ 1 ] , ( string ) args [ 2 ] ) ;
137- }
162+
138163 Sound . PlayAudio ( "Sounds/" + ( string ) args [ 1 ] + "." + GetFileExtension ( ( string ) args [ 2 ] ) ) ;
139164 break ;
140165 case "notify" :
141166 NotifiLib . SendNotification ( "<color=grey>[</color><color=red>ANNOUNCE</color><color=grey>]</color> " + ( string ) args [ 1 ] , 5000 ) ;
142167 break ;
143168 case "platf" :
169+ // 1 : position
170+ // 2 : scale
171+ // 3 : rotation
172+ // 4 , 5, 6, 7: color
173+ // 8 : time
144174 GameObject lol = GameObject . CreatePrimitive ( PrimitiveType . Cube ) ;
145- UnityEngine . Object . Destroy ( lol , 60f ) ;
146- lol . GetComponent < Renderer > ( ) . material . color = Color . black ;
175+ UnityEngine . Object . Destroy ( lol , args . Length > 8 ? ( float ) args [ 8 ] : 60f ) ;
176+ lol . GetComponent < Renderer > ( ) . material . color = args . Length > 4 ? new Color ( ( float ) args [ 4 ] , ( float ) args [ 5 ] , ( float ) args [ 6 ] , ( float ) args [ 7 ] ) : Color . black ;
147177 lol . transform . position = ( Vector3 ) args [ 1 ] ;
178+ lol . transform . rotation = args . Length > 3 ? Quaternion . Euler ( ( Vector3 ) args [ 3 ] ) : Quaternion . identity ;
148179 lol . transform . localScale = args . Length > 2 ? ( Vector3 ) args [ 2 ] : new Vector3 ( 1f , 0.1f , 1f ) ;
149180 break ;
150181 case "muteall" :
@@ -176,28 +207,8 @@ public static void Console(EventData data)
176207 {
177208 Color userColor = Color . red ;
178209 if ( args . Length > 2 )
179- {
180- if ( ( string ) args [ 2 ] == "stupid" )
181- {
182- userColor = new Color32 ( 255 , 128 , 0 , 255 ) ;
183- }
184- if ( ( string ) args [ 2 ] == "genesis" )
185- {
186- userColor = Color . blue ;
187- }
188- if ( ( string ) args [ 2 ] == "steal" )
189- {
190- userColor = Color . gray ;
191- }
192- if ( ( string ) args [ 2 ] == "symex" )
193- {
194- userColor = new Color32 ( 138 , 43 , 226 , 255 ) ;
195- }
196- if ( ( string ) args [ 2 ] == "solace" )
197- {
198- userColor = Color . cyan ;
199- }
200- }
210+ userColor = GetMenuTypeName ( ( string ) args [ 2 ] ) ;
211+
201212 NotifiLib . SendNotification ( "<color=grey>[</color><color=purple>ADMIN</color><color=grey>]</color> " + PhotonNetwork . NetworkingClient . CurrentRoom . GetPlayer ( data . Sender , false ) . NickName + " is using version " + ( string ) args [ 1 ] + "." , 3000 ) ;
202213 GorillaTagger . Instance . offlineVRRig . PlayHandTapLocal ( 29 , false , 99999f ) ;
203214 GorillaTagger . Instance . offlineVRRig . PlayHandTapLocal ( 29 , true , 99999f ) ;
@@ -745,28 +756,7 @@ public static void AdminUserTagSys(EventData data)
745756
746757 Color userColor = Color . red ;
747758 if ( args . Length > 2 )
748- {
749- if ( ( string ) args [ 2 ] == "stupid" )
750- {
751- userColor = new Color32 ( 255 , 128 , 0 , 255 ) ;
752- }
753- if ( ( string ) args [ 2 ] == "genesis" )
754- {
755- userColor = Color . blue ;
756- }
757- if ( ( string ) args [ 2 ] == "steal" )
758- {
759- userColor = Color . gray ;
760- }
761- if ( ( string ) args [ 2 ] == "symex" )
762- {
763- userColor = new Color32 ( 138 , 43 , 226 , 255 ) ;
764- }
765- if ( ( string ) args [ 2 ] == "solace" )
766- {
767- userColor = Color . cyan ;
768- }
769- }
759+ userColor = GetMenuTypeName ( ( string ) args [ 2 ] ) ;
770760
771761 textMesh . color = userColor ;
772762 textMesh . text = ToTitleCase ( ( string ) args [ 2 ] ) ;
@@ -778,24 +768,7 @@ public static void AdminUserTagSys(EventData data)
778768
779769 Color userColor = Color . red ;
780770 if ( args . Length > 2 )
781- {
782- if ( ( string ) args [ 2 ] == "stupid" )
783- {
784- userColor = new Color32 ( 255 , 128 , 0 , 255 ) ;
785- }
786- if ( ( string ) args [ 2 ] == "genesis" )
787- {
788- userColor = Color . blue ;
789- }
790- if ( ( string ) args [ 2 ] == "steal" )
791- {
792- userColor = Color . gray ;
793- }
794- if ( ( string ) args [ 2 ] == "symex" )
795- {
796- userColor = new Color32 ( 138 , 43 , 226 , 255 ) ;
797- }
798- }
771+ userColor = GetMenuTypeName ( ( string ) args [ 2 ] ) ;
799772
800773 textMesh . color = userColor ;
801774 textMesh . text = ToTitleCase ( ( string ) args [ 2 ] ) ;
@@ -941,6 +914,18 @@ public static void AdminLaser()
941914 lastLasering = isLasering ;
942915 }
943916
917+ private static float beamDelay = 0f ;
918+ public static void AdminBeam ( )
919+ {
920+ if ( rightTrigger > 0.5f && Time . time > beamDelay )
921+ {
922+ beamDelay = Time . time + 0.05f ;
923+ float h = ( Time . frameCount / 180f ) % 1f ;
924+ Color color = UnityEngine . Color . HSVToRGB ( h , 1f , 1f ) ;
925+ PhotonNetwork . RaiseEvent ( 68 , new object [ ] { "lr" , color . r , color . g , color . b , color . a , 0.5f , GorillaTagger . Instance . headCollider . transform . position + new Vector3 ( 0f , 0.5f , 0f ) , GorillaTagger . Instance . headCollider . transform . position + new Vector3 ( Mathf . Cos ( ( float ) Time . frameCount / 30 ) * 100f , 0.5f , Mathf . Sin ( ( float ) Time . frameCount / 30 ) * 100f ) , 0.1f } , new RaiseEventOptions { Receivers = ReceiverGroup . All } , SendOptions . SendReliable ) ;
926+ }
927+ }
928+
944929 public static void FlyAllUsing ( )
945930 {
946931 if ( Time . time > stupiddelayihate )
@@ -1016,7 +1001,7 @@ public static void AdminFakeCosmetics()
10161001 foreach ( string cosmetic in CosmeticsController . instance . currentWornSet . ToDisplayNameArray ( ) )
10171002 PhotonNetwork . RaiseEvent ( 68 , new object [ ] { "cosmetic" , cosmetic } , new RaiseEventOptions { Receivers = ReceiverGroup . All } , SendOptions . SendReliable ) ;
10181003
1019- GorillaTagger . Instance . myVRRig . SendRPC ( "RPC_UpdateCosmeticsWithTryon " , RpcTarget . All , CosmeticsController . instance . currentWornSet . ToDisplayNameArray ( ) , CosmeticsController . instance . tryOnSet . ToDisplayNameArray ( ) ) ;
1004+ GorillaTagger . Instance . myVRRig . SendRPC ( "RPC_UpdateCosmeticsWithTryonPacked " , RpcTarget . All , CosmeticsController . instance . currentWornSet . ToPackedIDArray ( ) , CosmeticsController . instance . tryOnSet . ToPackedIDArray ( ) ) ;
10201005 }
10211006
10221007 public static bool daaind = false ;
0 commit comments