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