public void EggCollected(BasePlayer player) { EggHuntEvent.EggHunter eggHunter = null; if (!this._eggHunters.ContainsKey(player.userID)) { eggHunter = new EggHuntEvent.EggHunter() { displayName = player.displayName, userid = player.userID }; this._eggHunters.Add(player.userID, eggHunter); } else { eggHunter = this._eggHunters[player.userID]; } if (eggHunter == null) { Debug.LogWarning("Easter error"); return; } eggHunter.numEggs++; this.QueueUpdate(); int num = ((float)Mathf.RoundToInt(player.eggVision) * 0.5f < 1f ? UnityEngine.Random.Range(0, 2) : 1); this.SpawnEggsAtPoint(UnityEngine.Random.Range(1 + num, 3 + num), player.transform.position, player.eyes.BodyForward(), 15f, 25f); }
public void PrintWinnersAndAward() { List <EggHuntEvent.EggHunter> topHunters = this.GetTopHunters(); if (topHunters.Count <= 0) { Chat.Broadcast("Wow, no one played so no one won.", "", "#eee", (ulong)0); return; } EggHuntEvent.EggHunter item = topHunters[0]; Chat.Broadcast(string.Concat(new object[] { item.displayName, " is the top bunny with ", item.numEggs, " eggs collected." }), "", "#eee", (ulong)0); for (int i = 0; i < topHunters.Count; i++) { EggHuntEvent.EggHunter eggHunter = topHunters[i]; BasePlayer basePlayer = BasePlayer.FindByID(eggHunter.userid); if (!basePlayer) { Debug.LogWarning(string.Concat("EggHuntEvent Printwinners could not find player with id :", eggHunter.userid)); } else { basePlayer.ChatMessage(string.Concat(new object[] { "You placed ", i + 1, " of ", topHunters.Count, " with ", topHunters[i].numEggs, " eggs collected." })); } } for (int j = 0; j < (int)this.placementAwards.Length && j < topHunters.Count; j++) { BasePlayer basePlayer1 = BasePlayer.FindByID(topHunters[j].userid); if (basePlayer1) { basePlayer1.inventory.GiveItem(ItemManager.Create(this.placementAwards[j].itemDef, (int)this.placementAwards[j].amount, (ulong)0), basePlayer1.inventory.containerMain); basePlayer1.ChatMessage(string.Concat(new object[] { "You received ", (int)this.placementAwards[j].amount, "x ", this.placementAwards[j].itemDef.displayName.english, " as an award!" })); } } }