public override void NewRightClick(int i, int j) { Player player = Main.player[Main.myPlayer]; Item currentSelectedItem = player.inventory[player.selectedItem]; Tile tile = Main.tile[i, j]; int left = i - (tile.frameX / 18); int top = j - (tile.frameY / 18); int index = ModContent.GetInstance <MobSpawnerEntity>().Find(left, top); if (index == -1) { Main.NewText("fail"); return; } MobSpawnerEntity mse = (MobSpawnerEntity)TileEntity.ByID[index]; if (Main.LocalPlayer.HeldItem.modItem is SoulCrystal) { SoulCrystal sc = Main.LocalPlayer.HeldItem.modItem as SoulCrystal; if (sc.isFull()) { mse.setMob(sc.getMobID()); } } }
public override bool OnBeforeDeath() { if (!base.OnBeforeDeath()) { return(false); } if (!NoKillAwards) { SoulCrystal crystal = new SoulCrystal(); crystal.MoveToWorld(Location, Map); } Effects.SendLocationEffect(Location, Map, 0x376A, 10, 1); return(true); }
public override bool OnDragDrop(Mobile from, Item dropped) { PlayerMobile player = from as PlayerMobile; if (dropped is CellKey) { this.Say("That looks like the type of key used on the prison doors around here! Go and find Tear's prison and release her!"); return(false); } if (player != null) { QuestSystem qs = player.Quest; if (qs is GhostQuest) { if (dropped is JalindeLetter) { JalindeLetter letter = (JalindeLetter)dropped; QuestObjective obj = qs.FindObjective(typeof(WhatHappenedToTearObjective)); letter.Delete(); SayTo(from, "A letter from Tear? Thank you kind mortal."); if (obj != null) { obj.Complete(); } } if (dropped is SoulCrystal) { SoulCrystal crystal = (SoulCrystal)dropped; QuestObjective obj = qs.FindObjective(typeof(TheGatheringOfSoulCrystalsObjective)); if (obj != null && !obj.Completed) { int need = obj.MaxProgress - obj.CurProgress; if (crystal.Amount < need) { obj.CurProgress += crystal.Amount; crystal.Delete(); qs.ShowQuestLogUpdated(); } else { obj.Complete(); crystal.Consume(need); if (!crystal.Deleted) { SayTo(from, "I already have enough soul crystals to perform the summoning."); } } } else { SayTo(from, "That is not something I can use."); } return(false); } } } return(base.OnDragDrop(from, dropped)); }