1- using HintServiceMeow . Core . Extension ;
1+ using CustomPlayerEffects ;
2+ using HintServiceMeow . Core . Extension ;
23using HintServiceMeow . Core . Models . Hints ;
4+ using HintServiceMeow . UI . Extension ;
35using LabApi . Events . Arguments . PlayerEvents ;
46using LabApi . Events . Arguments . Scp914Events ;
57using LabApi . Events . Arguments . ServerEvents ;
1113using PlayerRoles ;
1214using PlayerRoles . PlayableScps . Scp079 ;
1315using PlayerRoles . Spectating ;
16+ using PlayerRoles . Subroutines ;
1417using System ;
1518using System . Collections . Generic ;
1619using System . Linq ;
@@ -23,8 +26,155 @@ namespace LabMorePlugins.API
2326{
2427 public class Events : CustomEventsHandler
2528 {
29+ public static bool IsLabby = false ;
30+ public static List < ushort > SCP1068 = new List < ushort > ( ) ;
31+ public static List < ushort > SCP1056 = new List < ushort > ( ) ;
32+ public static System . Random Random = new System . Random ( ) ;
33+ public override void OnPlayerEscaping ( PlayerEscapingEventArgs ev )
34+ {
35+ if ( ev . Player == null )
36+ return ;
37+ if ( ev . Player . Role == RoleTypeId . FacilityGuard )
38+ {
39+ if ( Plugin . Instance . Config . FFcanEsx )
40+ {
41+ ev . NewRole = Plugin . Instance . Config . BAESCRoleName ;
42+ }
43+ }
44+ }
45+ public override void OnPlayerInteractedDoor ( PlayerInteractedDoorEventArgs ev )
46+ {
47+ if ( ev . Player == null )
48+ return ;
49+ if ( SRoleSystem . IsRole ( ev . Player . PlayerId , RoleName . SCP181 ) && Random . Next ( 1 , 5 ) >= 2 && ! ev . Door . IsLocked && ! ev . Door . IsOpened )
50+ {
51+ ev . Door . IsOpened = true ;
52+ ev . Player . GetPlayerUi ( ) . CommonHint . ShowOtherHint ( "你打开了这道权限门" , 6 ) ;
53+ }
54+ }
55+ public override void OnServerRoundStarted ( )
56+ {
57+ var SCP1056Item = ItemType . Medkit . SpawnItem ( RoleTypeId . ClassD . GetRandomSpawnLocation ( ) ) ;
58+ SCP1056 . Add ( SCP1056Item . Serial ) ;
59+ var SCP1068Item = ItemType . SCP2176 . SpawnItem ( RoleTypeId . Scp096 . GetRandomSpawnLocation ( ) ) ;
60+ SCP1068 . Add ( SCP1068Item . Serial ) ;
61+ var SCP181 = SAPI . GetRandomSpecialPlayer ( RoleTypeId . ClassD ) ;
62+ SRoleSystem . Add ( RoleName . SCP181 , SCP181 . PlayerId ) ;
63+ SCP181 . setRankName ( "SCP-181" , "pick" ) ;
64+ SCP181 . SendHint ( "你是[SCP181]\n 你的运气很好|概率打开一个权限门" , 20 ) ;
65+ }
66+ public override void OnServerRoundStarting ( RoundStartingEventArgs ev )
67+ {
68+ IsLabby = false ;
69+ foreach ( var item in Player . List )
70+ {
71+ item . SetRole ( RoleTypeId . Spectator ) ;
72+ }
73+ }
74+ public override void OnServerWaitingForPlayers ( )
75+ {
76+ IsLabby = true ;
77+ short StartTime = GameCore . RoundStart . singleton . NetworkTimer ;
78+ UnityEngine . GameObject . Find ( "RoundStart" ) . gameObject . transform . localScale = Vector3 . zero ;
79+ AdminToy . TryGet ( new AdminToys . ShootingTarget ( ) , out var adminToy ) ;
80+ adminToy . Position = RoleTypeId . Tutorial . GetRandomSpawnLocation ( ) ;
81+ adminToy . Spawn ( ) ;
82+ Hint hint = new Hint ( )
83+ {
84+ AutoText = a =>
85+ {
86+ string Infp = "" ;
87+ if ( IsLabby == true )
88+ {
89+ if ( Player . List . Count >= 2 )
90+ {
91+ Infp = $ "回合即将开始|服务器人数[{ Player . List . Count } ]\n 倒计时[{ StartTime } ]";
92+ }
93+ else
94+ {
95+ Infp = $ "回合已锁|服务器人数[{ Player . List . Count } ]";
96+ }
97+ }
98+ else if ( Round . IsLobbyLocked )
99+ {
100+ Infp = $ "回合已锁|服务器人数[{ Player . List . Count } ]";
101+ }
102+ else if ( IsLabby )
103+ {
104+ Infp = $ "" ;
105+ }
106+ return Infp ;
107+ } ,
108+ YCoordinate = 100 ,
109+ Alignment = HintServiceMeow . Core . Enum . HintAlignment . Center ,
110+ FontSize = 25 ,
111+ } ;
112+ foreach ( var item in Player . List )
113+ {
114+ if ( IsLabby == true )
115+ {
116+ item . AddHint ( hint ) ;
117+ }
118+ }
119+ }
120+ public override void OnPlayerThrewItem ( PlayerThrewItemEventArgs ev )
121+ {
122+ if ( ev . Player == null )
123+ return ;
124+ if ( SCP1068 . Contains ( ev . Pickup . Serial ) )
125+ {
126+ Warhead . Shake ( ) ;
127+ }
128+ }
129+ public override void OnPlayerLeft ( PlayerLeftEventArgs ev )
130+ {
131+ Plugin . Instance . SavePlayerData ( ) ;
132+ GameCore . Console . AddLog ( $ "玩家{ ev . Player . Nickname } 离开了服务器|Steam64ID为{ ev . Player . UserId } |已保存经验信息", Color . blue ) ;
133+ }
26134 public override void OnPlayerChangingRole ( PlayerChangingRoleEventArgs ev )
27135 {
136+ if ( ev . NewRole == RoleTypeId . Spectator )
137+ {
138+ var TotalTime = SpawnProtected . SpawnDuration ;
139+ var NtfSpawnWave = RespawnWaves . Get ( new Respawning . Waves . NtfSpawnWave ( ) ) ;
140+ var CISpawnWave = RespawnWaves . Get ( new Respawning . Waves . ChaosSpawnWave ( ) ) ;
141+ string NextTeam = "[不知道]" ;
142+ if ( CISpawnWave . RespawnTokens == 0 && NtfSpawnWave . RespawnTokens > 0 )
143+ {
144+ NextTeam = "[<color=blue>九尾特遣队</color>]" ;
145+ }
146+ else if ( NtfSpawnWave . RespawnTokens == 0 && CISpawnWave . RespawnTokens > 0 )
147+ {
148+ NextTeam = "[<color=green>混沌特遣队</color>]" ;
149+ }
150+ else if ( NtfSpawnWave . RespawnTokens == 0 && CISpawnWave . RespawnTokens == 0 )
151+ {
152+ NextTeam = "[无可用支援]" ;
153+ }
154+ else if ( ( int ) NtfSpawnWave . TimeLeft < ( int ) CISpawnWave . TimeLeft )
155+ {
156+ NextTeam = "[<color=blue>九尾特遣队</color>]" ;
157+ }
158+ else if ( ( int ) CISpawnWave . TimeLeft < ( int ) NtfSpawnWave . TimeLeft )
159+ {
160+ NextTeam = "[<color=green>混沌特遣队</color>]" ;
161+ }
162+ else
163+ {
164+ NextTeam = "[不知道]" ;
165+ }
166+ Hint hint = new Hint ( )
167+ {
168+ AutoText = g =>
169+ {
170+ return $ "你还剩[{ TotalTime } ]秒就可以去白给了\n 下一波刷{ NextTeam } \n 九尾狐时间[{ NtfSpawnWave . TimeLeft } ]\n 混沌时间[{ CISpawnWave . TimeLeft } ]";
171+ } ,
172+ YCoordinate = 600 ,
173+ Alignment = HintServiceMeow . Core . Enum . HintAlignment . Right ,
174+ FontSize = 25
175+ } ;
176+ ev . Player . AddHint ( hint ) ;
177+ }
28178 if ( ev . NewRole == RoleTypeId . Spectator )
29179 {
30180 Hint sphint = new Hint ( )
@@ -48,9 +198,61 @@ public override void OnPlayerChangingRole(PlayerChangingRoleEventArgs ev)
48198 } ;
49199 ev . Player . GetPlayerDisplay ( ) . AddHint ( sphint ) ;
50200 }
201+ if ( ev . Player . Team == Team . SCPs )
202+ {
203+ Hint hint = new Hint ( )
204+ {
205+ AutoText = g =>
206+ {
207+ string SCPInfo = "<color=red>------</color>\n " ;
208+ int ZombieCount = 0 ;
209+ foreach ( Player player in Player . List )
210+ {
211+ if ( player . Team == Team . SCPs )
212+ {
213+ switch ( player . Role )
214+ {
215+ case RoleTypeId . Scp049 :
216+ case RoleTypeId . Scp173 :
217+ case RoleTypeId . Scp096 :
218+ case RoleTypeId . Scp106 :
219+ case RoleTypeId . Scp939 :
220+ case RoleTypeId . Scp3114 :
221+ SCPInfo += $ "{ GetSCPName ( player ) } ";
222+ break ;
223+ default :
224+ break ;
225+ }
226+ if ( player . Role == RoleTypeId . Scp0492 )
227+ {
228+ ZombieCount ++ ;
229+ }
230+ if ( player . RoleBase is Scp079Role scp079 )
231+ {
232+ scp079 . SubroutineModule . TryGetSubroutine ( out Scp079AuxManager scp079AuxManager ) ;
233+ scp079 . SubroutineModule . TryGetSubroutine ( out Scp079TierManager scp079TierManager ) ;
234+ SCPInfo += $ "<color=red>SCP079[在线] =>[Lv.{ scp079TierManager . AccessTierLevel } |电力:{ scp079AuxManager . CurrentAux } ]\n </color>";
235+ }
236+ }
237+ }
238+ return SCPInfo + $ "<color=red>\n ------\n 小僵尸数量[{ ZombieCount } ]</color>";
239+ } ,
240+ } ;
241+ }
242+ }
243+ public static string GetSCPName ( Player player )
244+ {
245+ return $ "<color=red>[{ player . Role } ] => [HP:{ player . Health } AHP:{ player . ArtificialHealth } ]</color>\n ";
51246 }
52247 public override void OnPlayerJoined ( PlayerJoinedEventArgs ev )
53248 {
249+ if ( IsLabby == true )
250+ {
251+ ev . Player . SetRole ( RoleTypeId . Tutorial ) ;
252+ ev . Player . AddItem ( ItemType . GunFRMG0 ) ;
253+ ev . Player . AddItem ( ItemType . Coin ) ;
254+
255+ }
54256 Plugin . Instance . SavePlayerData ( ) ;
55257 Timing . CallDelayed ( 0.1f , ( ) =>
56258 {
@@ -87,7 +289,7 @@ public override void OnPlayerHurting(PlayerHurtingEventArgs ev)
87289 {
88290 if ( ev . Attacker . Role == PlayerRoles . RoleTypeId . Scp106 )
89291 {
90- if ( ! SRoleSystem . IsRole ( ev . Player . PlayerId , Enums . RoleName . SCP550 ) && Plugin . Instance . Config . SCP106Pock )
292+ if ( Plugin . Instance . Config . SCP106Pock )
91293 {
92294 ev . Player . EnableEffect ( new CustomPlayerEffects . PocketCorroding ( ) ) ;
93295 }
@@ -99,6 +301,7 @@ public override void OnPlayerDeath(PlayerDeathEventArgs ev)
99301 {
100302 if ( ev . Player != null && ev . Attacker != null )
101303 {
304+ SRoleSystem . RemoveRole ( ev . Player . PlayerId ) ;
102305 ev . Player . setRankName ( "" , "" ) ;
103306 ev . Player . SetScale ( Vector3 . one ) ;
104307 ev . Player . DisableAllEffects ( ) ;
@@ -182,9 +385,12 @@ public override void OnServerWaveRespawned(WaveRespawnedEventArgs ev)
182385 }
183386 public override void OnPlayerUsedItem ( PlayerUsedItemEventArgs ev )
184387 {
185- if ( ev . Player != null )
388+ if ( ev . Player == null )
389+ return ;
390+ if ( SCP1056 . Contains ( ev . UsableItem . Serial ) )
186391 {
187-
392+ ev . Player . SetScale ( new Vector3 ( 0.5f , 0.5f , 0.5f ) ) ;
393+ ev . Player . SendHint ( "变小了awa" , 5 ) ;
188394 }
189395 }
190396 public override void OnPlayerInteractingDoor ( PlayerInteractingDoorEventArgs ev )
0 commit comments