public MapNpc(string mapID, DataManager.Maps.MapNpc rawNpc) : base(rawNpc) { SpeedLimit = Enums.Speed.Running; Moves = new Players.RecruitMove[4]; for (int i = 0; i < Moves.Length; i++) { Moves[i] = new Players.RecruitMove(RawNpc.Moves[i]); } //if (RawNpc.HeldItem == null) { // HeldItem = null; //} else { // HeldItem = new InventoryItem(RawNpc.HeldItem); //} heldItem = new InventoryItem(RawNpc.HeldItem); VolatileStatus = new ExtraStatusCollection(); for (int i = 0; i < RawNpc.VolatileStatus.Count; i++) { VolatileStatus.Add(new ExtraStatus(RawNpc.VolatileStatus[i])); } MapID = mapID; ActiveItems = new List<int>(); //CalculateOriginalSprite(); //CalculateOriginalStats(); //CalculateOriginalType(); //CalculateOriginalAbility(); //CalculateOriginalMobility(); if (Num > 0) { LoadActiveItemList(); } }
public static void OnPickupItem(ICharacter character, int itemSlot, InventoryItem invItem) { try { PacketHitList hitlist = null; IMap map = MapManager.RetrieveActiveMap(character.MapID); PacketHitList.MethodStart(ref hitlist); if (character.CharacterType == Enums.CharacterType.MapNpc) { hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic131.wav"), character.X, character.Y, 50); } else { if (ItemManager.Items[invItem.Num].Type == Enums.ItemType.Currency) { hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic" + ItemManager.Items[invItem.Num].Data1 + ".wav"), character.X, character.Y, 10); } else if (ItemManager.Items[invItem.Num].Type == Enums.ItemType.Held || ItemManager.Items[invItem.Num].Type == Enums.ItemType.HeldByParty || ItemManager.Items[invItem.Num].Type == Enums.ItemType.HeldInBag) { hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic148.wav"), character.X, character.Y, 10); } else if (ItemManager.Items[invItem.Num].Type == Enums.ItemType.Key || ItemManager.Items[invItem.Num].Type == Enums.ItemType.Scripted && (ItemManager.Items[invItem.Num].Data1 == 4 || ItemManager.Items[invItem.Num].Data1 == 43)) { hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic681.wav"), character.X, character.Y, 10); } else if (ItemManager.Items[invItem.Num].Type == Enums.ItemType.TM) { hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic162.wav"), character.X, character.Y, 10); } else if (ItemManager.Items[invItem.Num].Type == Enums.ItemType.Scripted && ItemManager.Items[invItem.Num].Data1 == 12) { hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic99.wav"), character.X, character.Y, 10); } else { hitlist.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("magic130.wav"), character.X, character.Y, 10); } } PacketHitList.MethodEnded(ref hitlist); } catch { } }
public static void ThrewItem(BattleSetup setup, InventoryItem item, int invNum) { try { if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { setup.PacketStack.AddPacket(((Recruit)setup.Attacker).Owner, PacketBuilder.CreateChatMsg("Throwing items currently in progress.", Text.Black)); } } catch (Exception ex) { Messenger.AdminMsg("Error: ThrewItem", Text.Black); } }
public static bool CanUseItem(BattleSetup setup, InventoryItem item) { try { if (setup.Attacker.AttackTimer == null) { setup.Attacker.AttackTimer = new TickCount(Core.GetTickCount().Tick); } if (setup.Attacker.AttackTimer.Tick > Core.GetTickCount().Tick) { setup.Cancel = true; return false; } if (setup.Attacker.PauseTimer == null) { setup.Attacker.PauseTimer = new TickCount(Core.GetTickCount().Tick); } if (setup.Attacker.PauseTimer.Tick > Core.GetTickCount().Tick) { setup.Cancel = true; return false; } if (item.Sticky) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("The " + ItemManager.Items[item.Num].Name + " is all sticky and doesn't work!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); setup.Cancel = true; return false; } if (setup.Attacker.VolatileStatus.GetStatus("Embargo") != null) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " can't use items due to the Embargo!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); setup.Cancel = true; return false; } int itemEdibility = CheckItemEdibility(item.Num); if (itemEdibility != 0) { TargetCollection checkedTargets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Room, 10, setup.AttackerMap, setup.Attacker, setup.Attacker.X, setup.Attacker.Y, Enums.Direction.Up, true, false, false); for (int i = 0; i < checkedTargets.Foes.Count; i++) { if (HasAbility(checkedTargets.Foes[i], "Unnerve")) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " is unnerved! It can't eat anything!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); setup.Cancel = true; return false; } } if (setup.Attacker.VolatileStatus.GetStatus("Nausea") != null) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " is nauseated! It can't eat anything!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); setup.Cancel = true; return false; } if (HasAbility(setup.Attacker, "Gluttony") || HasActiveBagItem(setup.Attacker, 40, 0, 0)) { if (itemEdibility == 1) { setup.BattleTags.Add("Gluttony:60"); } else if (itemEdibility == 3) { setup.BattleTags.Add("Gluttony:20"); } } } return true; } catch (Exception ex) { Messenger.AdminMsg("Error: CanUseItem", Text.Black); return false; } }
public static void ScriptedItem(BattleSetup setup, InventoryItem item, int invNum) { try { // Called when a scripted item is used ExtraStatus status; int itemNum = item.Num; int itemEdibility = CheckItemEdibility(itemNum); if (itemEdibility == 3 && HasAbility(setup.Attacker, "Harvest") && GetBattleTagArg(setup.BattleTags, "Harvest", 0) == null) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " harvested the berry!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); BattleSetup extraSetup = new BattleSetup(); extraSetup.Attacker = setup.Attacker; extraSetup.BattleTags.Add("Harvest"); BattleProcessor.HandleItemUse(item, -1, extraSetup); setup.PacketStack.AddHitList(extraSetup.PacketStack); } switch (itemEdibility) { case 0: { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " used the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 1: {//apple setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic143.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 2: {//gummi setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic145.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 3: {//berry setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic144.wav"), setup.Attacker.X, setup.Attacker.Y, 10); AddExtraStatus(setup.Attacker, setup.AttackerMap, "AteBerry", 0, null, "", setup.PacketStack); } break; case 4: {//seed setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic144.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 5: {//herb setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic144.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 6: {//poffin setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 7: {//bad food setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic143.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 8: {//drink setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " drank the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic142.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 9: {//other consumable setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " ate the " + ItemManager.Items[itemNum].Name + ".", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic143.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } break; } switch (ItemManager.Items[itemNum].Data1) { case 0: { } break; case 1: { //Level-Up TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); int leveldiff = 100 - setup.Attacker.Level; if (leveldiff > ItemManager.Items[itemNum].Data2) { leveldiff = ItemManager.Items[itemNum].Data2; } if (leveldiff < 1) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } else { for (int i = 0; i < leveldiff; i++) { if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; client.Player.GetActiveRecruit().Exp = client.Player.GetActiveRecruit().GetNextLevel(); PlayerLevelUp(setup.PacketStack, client); } else { ((MapNpc)setup.Attacker).Level++; } } } } break; case 2: { //Escape Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; //if (client.Player.PK == true) { // Messenger.PlayerMsg(client, "An outlaw cannot escape!", Text.BrightRed); Escape(client); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " escaped from the dungeon!", Text.Yellow), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("escape.wav"), setup.Attacker.X, setup.Attacker.Y, 10); setup.AttackerMap.ActiveNpc[((MapNpc)setup.Attacker).MapSlot] = new MapNpc(setup.Attacker.MapID, ((MapNpc)setup.Attacker).MapSlot); setup.PacketStack.AddPacketToMap(setup.AttackerMap, TcpPacket.CreatePacket("npcdead", ((MapNpc)setup.Attacker).MapSlot)); } } break; case 3: { //Adds a stat TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); int rand = ItemManager.Items[itemNum].Data2; switch (rand) { case 0: { setup.Attacker.MaxHPBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Maximum HP was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 1: { setup.Attacker.AtkBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Attack was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 2: { setup.Attacker.DefBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Defense was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 3: { setup.Attacker.SpclAtkBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Special Attack was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 4: { setup.Attacker.SpclDefBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Special Defense was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 5: { setup.Attacker.SpdBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Speed was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; } setup.Attacker.CalculateOriginalStats(); if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; PacketBuilder.AppendStats(client, setup.PacketStack); } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 4: { //Chamber Key int x = setup.Attacker.X; int y = setup.Attacker.Y; MoveInDirection(setup.Attacker.Direction, 1, ref x, ref y); if (x >= 0 && x <= setup.AttackerMap.MaxX && y >= 0 && y <= setup.AttackerMap.MaxY) { Tile tile = setup.AttackerMap.Tile[x, y]; if (tile.Type == Enums.TileType.ScriptedSign && tile.Data1 == 10) { TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); string[] start = tile.String1.Split(':'); string[] end = tile.String2.Split(':'); ClearChamber(setup.AttackerMap, x + start[0].ToInt(), y + start[1].ToInt(), x + end[0].ToInt(), y + end[1].ToInt(), setup.PacketStack); } } } break; case 5: { //fossil revival if (Server.Globals.ServerTime == Enums.Time.Night) { if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; IMap map = client.Player.Map; if (map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Scripted && map.Tile[client.Player.X, client.Player.Y].Data1 == 71) { TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //Messenger.PlayerMsg(client, "And then " + Pokedex.GetPokemon(ItemManager.Items[itemNum].Data2).Name + " appears.", Text.Pink); map.SetTile(9, 0, 0, 1, 7); map.SetTile(9, 0, 0, 1, 8); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 0, map)); map.SetTile(9, 1, 0, 1, 7); map.SetTile(9, 1, 0, 1, 8); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 1, map)); map.SetTile(9, 2, 0, 1, 7); map.SetTile(9, 2, 0, 1, 8); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 2, map)); map.SetAttribute(9, 3, Enums.TileType.Walkable, 0, 0, 0, "", "", ""); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 3, map)); Story story = new Story(); StoryBuilderSegment segment = StoryBuilder.BuildStory(); StoryBuilder.AppendPlayMusicAction(segment, "PMD2) Growing Anxiety.ogg", true, true); StoryBuilder.AppendRunScriptAction(segment, 5, "magic654.wav", "", "", true); StoryBuilder.AppendSaySegment(segment, "The moonlight bathes the " + ItemManager.Items[itemNum].Name + " in its mysterious red glow...", -1, 0, 0); StoryBuilder.AppendSaySegment(segment, "The " + ItemManager.Items[itemNum].Name + " is glowing with an intense, ancient power...!", -1, 0, 0); StoryBuilder.AppendMapVisibilityAction(segment, false); StoryBuilder.AppendRunScriptAction(segment, 5, "magic685.wav", "", "", true); StoryBuilder.AppendSaySegment(segment, "!!!!!!!!!", -1, 0, 0); StoryBuilder.AppendRunScriptAction(segment, 5, "magic648.wav", "", "", true); StoryBuilder.AppendWarpAction(segment, client.Player.Map.MapID, 9, 12); StoryBuilder.AppendMapVisibilityAction(segment, true); StoryBuilder.AppendCreateFNPCAction(segment, "0", "s-2", 9, 3, ItemManager.Items[itemNum].Data2); StoryBuilder.AppendChangeFNPCDirAction(segment, "0", Enums.Direction.Up); StoryBuilder.AppendSaySegment(segment, Pokedex.GetPokemon(ItemManager.Items[itemNum].Data2).Name + " was revived from the fossil!", -1, 0, 0); StoryBuilder.AppendPauseAction(segment, 200); StoryBuilder.AppendChangeFNPCDirAction(segment, "0", Enums.Direction.Right); StoryBuilder.AppendPauseAction(segment, 200); StoryBuilder.AppendChangeFNPCDirAction(segment, "0", Enums.Direction.Left); StoryBuilder.AppendPauseAction(segment, 200); StoryBuilder.AppendChangeFNPCDirAction(segment, "0", Enums.Direction.Right); StoryBuilder.AppendPauseAction(segment, 200); StoryBuilder.AppendChangeFNPCDirAction(segment, "0", Enums.Direction.Left); StoryBuilder.AppendPauseAction(segment, 200); StoryBuilder.AppendSaySegment(segment, "It's looking around desperately, as if confused...", -1, 0, 0); StoryBuilder.AppendChangeFNPCDirAction(segment, "0", Enums.Direction.Down); StoryBuilder.AppendSaySegment(segment, "...It seems to take your presence as a threat! It's going to attack!", -1, 0, 0); StoryBuilder.AppendDeleteFNPCAction(segment, "0"); StoryBuilder.AppendPlayMusicAction(segment, "St2) Elite 4 Battle 2.ogg", true, true); StoryBuilder.AppendRunScriptAction(segment, 46, ItemManager.Items[itemNum].Data2.ToString(), "25", "0", false); segment.AppendToStory(story); StoryManager.PlayStory(client, story); } } } } break; case 6: { //level down TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (!setup.Attacker.HasActiveItem(92) && setup.Attacker.Level > 1) { int negative = ItemManager.Items[itemNum].Data2; if (negative > setup.Attacker.Level - 1) negative = setup.Attacker.Level - 1; setup.Attacker.Level -= negative; if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; client.Player.GetActiveRecruit().Exp = client.Player.GetActiveRecruit().GetNextLevel() - 1; } setup.Attacker.CalculateOriginalStats(); if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; PacketBuilder.AppendStats(client, setup.PacketStack); } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " dropped to level " + setup.Attacker.Level + "!", Text.BrightRed)); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke)); } } break; case 7: { //level 1 TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (!setup.Attacker.HasActiveItem(92)) { setup.Attacker.Level = 1; if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; client.Player.GetActiveRecruit().Exp = 0; } setup.Attacker.AtkBonus = 0; setup.Attacker.DefBonus = 0; setup.Attacker.SpdBonus = 0; setup.Attacker.SpclAtkBonus = 0; setup.Attacker.SpclDefBonus = 0; setup.Attacker.CalculateOriginalStats(); if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; PacketBuilder.AppendStats(client, setup.PacketStack); } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " dropped to level 1!", Text.Magenta)); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke)); } } break; case 8: { //Adds Speed } break; case 9: { //adds a random stat TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); int rand = Server.Math.Rand(0, 6); switch (rand) { case 0: { setup.Attacker.MaxHPBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Maximum HP was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 1: { setup.Attacker.AtkBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Attack was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 2: { setup.Attacker.DefBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Defense was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 3: { setup.Attacker.SpclAtkBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Special Attack was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 4: { setup.Attacker.SpclDefBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Special Defense was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 5: { setup.Attacker.SpdBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Speed was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); } break; } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 10: {//Adds all stats TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); setup.Attacker.MaxHPBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Maximum HP was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); setup.Attacker.AtkBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Attack was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); setup.Attacker.DefBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Defense was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); setup.Attacker.SpclAtkBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Special Attack was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); setup.Attacker.SpclDefBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Special Defense was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); setup.Attacker.SpdBonus += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s Speed was boosted!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 11: { //Full HP recovery TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //if (GetBattleTagArg(setup.BattleTags, "Gluttony", 0) != null) { //HealCharacter(setup.Attacker, setup.AttackerMap, ItemManager.Items[itemNum].Data2 + GetBattleTagArg(setup.BattleTags, "Gluttony", 0).ToInt(), setup.PacketStack); //} else { HealCharacter(setup.Attacker, setup.AttackerMap, setup.Attacker.MaxHP, setup.PacketStack); //} HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data3, setup.PacketStack); } break; case 12: { //Box if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; //TODO: check if the player has a key, and ask to open with the key Messenger.PlaySoundToMap(client.Player.MapID, "magic669.wav"); Messenger.PlayerMsg(client, "The box is locked shut. Perhaps there's someone who knows how to open it...", Text.Cyan); /* if (client.Player.Map.Moral == Enums.MapMoral.Safe || client.Player.Map.Moral == Enums.MapMoral.House) { Messenger.PlayerMsg(client, "You opened up the " + ItemManager.Items[itemNum].Name + "!", Text.Yellow); string[] itemSelection = client.Player.Inventory[invNum].Tag.Split(';'); string[] chosenItem = itemSelection[Server.Math.Rand(0, itemSelection.Length)].Split(','); client.Player.TakeItemSlot(invNum, 1, true); if (chosenItem[0].IsNumeric()) { if (chosenItem.Length > 1 && chosenItem[1].IsNumeric()) { client.Player.GiveItem(chosenItem[0].ToInt(), chosenItem[1].ToInt()); Messenger.PlayerMsg(client, "Inside was " + chosenItem[1] + " " + ItemManager.Items[chosenItem[0].ToInt()].Name + "!", Text.Yellow); } else { client.Player.GiveItem(chosenItem[0].ToInt(), 1); Messenger.PlayerMsg(client, "Inside was a " + ItemManager.Items[chosenItem[0].ToInt()].Name + "!", Text.Yellow); } } else { Messenger.PlayerMsg(client, "But there was nothing inside...", Text.Yellow); } } else { Messenger.PlayerMsg(client, "This item cannot be opened in dungeons!", Text.BrightRed); } */ } } break; case 13: { //Unknown Effect Mushroom TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); string[] effects = item.Tag.Split(';'); for (int i = 0; i < effects.Length; i++) { //trigger each effect } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 14: { //herbal tea TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); HealCharacter(setup.Attacker, setup.AttackerMap, 100, setup.PacketStack); HealCharacterPP(setup.Attacker, setup.AttackerMap, 10, setup.PacketStack); AddExtraStatus(setup.Attacker, setup.AttackerMap, "Yawn", 3, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 15: { //warp seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.AttackerMap.MapType == Enums.MapType.RDungeonMap) { RandomWarp(setup.Attacker, setup.AttackerMap, true, setup.PacketStack); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 16: { //Single Nonvolatile Status Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.StatusAilment == (Enums.StatusAilment)ItemManager.Items[itemNum].Data2) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.OK, 0, setup.PacketStack); } else { //setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); AddExtraStatus(setup.Attacker, setup.AttackerMap, "Status Guard", 10, null, ItemManager.Items[itemNum].Data2.ToString(), setup.PacketStack); } HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data3, setup.PacketStack); } break; case 17: { //HP recovery TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //if (GetBattleTagArg(setup.BattleTags, "Gluttony", 0) != null) { //HealCharacter(setup.Attacker, setup.AttackerMap, ItemManager.Items[itemNum].Data2 + GetBattleTagArg(setup.BattleTags, "Gluttony", 0).ToInt(), setup.PacketStack); //} else { if (ItemManager.Items[itemNum].Data2 >= 0) { HealCharacter(setup.Attacker, setup.AttackerMap, ItemManager.Items[itemNum].Data2, setup.PacketStack); } else { DamageCharacter(setup.Attacker, setup.AttackerMap, ItemManager.Items[itemNum].Data2, Enums.KillType.Other, setup.PacketStack, true); } //} HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data3, setup.PacketStack); } break; case 18: { //PP recovery TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); HealCharacterPP(setup.Attacker, setup.AttackerMap, ItemManager.Items[itemNum].Data2, setup.PacketStack); HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data3, setup.PacketStack); } break; case 19: { //Belly recovery TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { if (((Recruit)setup.Attacker).Belly < ((Recruit)setup.Attacker).MaxBelly) { if (ItemManager.Items[itemNum].Data2 >= 1000 && ((Recruit)setup.Attacker).MaxBelly < 200) { ((Recruit)setup.Attacker).MaxBelly += (ItemManager.Items[itemNum].Data2 / 100); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s belly size increased!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data2, setup.PacketStack); } else { ((Recruit)setup.Attacker).MaxBelly += ItemManager.Items[itemNum].Data3; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s belly size increased!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data3, setup.PacketStack); } if (((Recruit)setup.Attacker).MaxBelly > 200 && ((Recruit)setup.Attacker).MaxBelly < 200) { ((Recruit)setup.Attacker).MaxBelly = 200; } if (((Recruit)setup.Attacker).Belly > ((Recruit)setup.Attacker).MaxBelly) { ((Recruit)setup.Attacker).Belly = ((Recruit)setup.Attacker).MaxBelly; } PacketBuilder.AppendBelly(((Recruit)setup.Attacker).Owner, setup.PacketStack); } } break; case 20: { //Multi-Belly recovery TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (client.Player.Team[i] != null && client.Player.Team[i].Loaded) { HealCharacterBelly(client.Player.Team[i], ItemManager.Items[itemNum].Data2, setup.PacketStack); } } } } break; case 21: { //sweet heart TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); int add = 5; TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, setup.AttackerMap, setup.Attacker, setup.Attacker.X, setup.Attacker.Y, Enums.Direction.Up, false, true, false); for (int i = 0; i < targets.Friends.Count; i++) { int dx = setup.Attacker.X - targets[i].X; int dy = setup.Attacker.Y - targets[i].Y; if (dx < 2 && dy < 2) { add += 5; } else if (dx < 8 && dy < 8) { add += 4; } else if (dx < 16 && dy < 16) { add += 3; } else { add += 2; } } if (add > 5) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("The feelings of nearby friends made it sweeter!", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); } HealCharacter(setup.Attacker, setup.AttackerMap, add*4, setup.PacketStack); HealCharacterPP(setup.Attacker, setup.AttackerMap, add, setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 22: { //casteliacone TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //HealCharacter(setup.Attacker, setup.AttackerMap, setup.Attacker.MaxHP, setup.PacketStack); HealCharacterPP(setup.Attacker, setup.AttackerMap, 100, setup.PacketStack); SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.OK, 0, setup.PacketStack); if (Server.Math.Rand(0, 3) == 0 && !CheckStatusProtection(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Freeze.ToString(), false, setup.PacketStack)) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Freeze, 0, setup.PacketStack); } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 23: { // Pounce Orb if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; client.Player.TakeItemSlot(invNum, 1, true); IMap map = client.Player.Map; Messenger.MapMsg(map.MapID, client.Player.Name + " used a Pounce Orb!", Text.BrightCyan); int npc = FindNearestNpc(client); int playerX = client.Player.X; int playerY = client.Player.Y; if (IsPathClear(client, npc)) { MapNpc activeNpc = map.ActiveNpc[npc]; if (playerX == activeNpc.X) { if (playerY > activeNpc.Y) { Messenger.PlayerWarp(client, map, playerX, activeNpc.Y + 1); } else { Messenger.PlayerWarp(client, map, playerX, activeNpc.Y - 1); } } else { if (playerX > activeNpc.X) { Messenger.PlayerWarp(client, map, activeNpc.X + 1, playerY); } else { Messenger.PlayerWarp(client, map, activeNpc.X - 1, playerY); } } } else { int blockX = 0; int blockY = 0; FindNearestBlock(setup.AttackerMap, client.Player.Direction, ref blockX, ref blockY); Messenger.PlayerWarp(client, map, blockX, blockY); } Messenger.PlaySoundToMap(setup.AttackerMap.MapID, "magic50.wav"); } } break; case 24: { // Blowback Orb if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; int npc = FindNearestNpc(client); IMap map = client.Player.Map; if (IsPathClear(client, npc)) { client.Player.TakeItem(181, 1); Messenger.MapMsg(map.MapID, "An enemy was blown back!", Text.BrightCyan); int x = 0; int y = 0; FindNearestBlock(setup.AttackerMap, client.Player.Direction, ref x, ref y); MapNpc activeNpc = map.ActiveNpc[npc]; activeNpc.X = x; activeNpc.Y = y; int npc2 = FindNearestNpc(client); if (npc2 != npc) { MapNpc activeNpc2 = map.ActiveNpc[npc2]; if (activeNpc.X == activeNpc2.X) { if (activeNpc.Y > activeNpc2.Y) { activeNpc.Y = activeNpc2.Y - 1; } else { activeNpc.Y = activeNpc2.Y + 1; } } else { if (activeNpc.X > activeNpc2.X) { activeNpc.X = activeNpc2.X - 1; } else { activeNpc.X = activeNpc2.X + 1; } } //BattleProcessor.PlayerAttackNpc(client, npc2, 15); } //BattleProcessor.PlayerAttackNpc(client, npc, 15); // SendMapNpc } else { Messenger.PlayerMsg(client, "It had no effect!", Text.BrightRed); } Messenger.PlaySoundToMap(setup.AttackerMap.MapID, "magic50.wav"); } } break; case 25: {//Two-Edge Orb if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; client.Player.TakeItemSlot(invNum, 1, true); IMap map = client.Player.Map; for (int j = 0; j <= 14; j++) { if (map.ActiveNpc[j].Num > 0) { if (setup.Attacker.Level >= map.ActiveNpc[j].Level) { map.ActiveNpc[j].HP = 1; } map.ActiveNpc[j].Target = client; } } Messenger.BattleMsg(client, "All weaker foes in the room are now close to fainting!", Text.BrightRed); //DamagePlayer(client, (setup.Attacker.HP / 2), Enums.KillType.Npc); Messenger.PlaySoundToMap(setup.AttackerMap.MapID, "magic54.wav"); } } break; case 26: {//White Flute ~adjust for NPC levels (still unfinished) if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; Messenger.BattleMsg(client, "You used the White Flute!", Text.White); //Messenger.SpellAnim(498, setup.AttackerMap, client.Player.X, client.Player.Y); Messenger.PlaySoundToMap(setup.AttackerMap.MapID, "magic52.wav"); IMap map = client.Player.Map; for (int j = 0; j <= 14; j++) { //if (CheckPlayerRange(index, j, 5, Enums.TargetType.Npc) == true && CheckTarget(index, j, Enums.TargetType.Npc) == true) { map.ActiveNpc[j].Target = client; //} } Messenger.BattleMsg(client, "Other Pokémon were lured.", Text.White); } } break; case 27: {//Black Flute if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; Messenger.BattleMsg(client, "You used the Black Flute!", Text.White); //Messenger.SpellAnim(498, setup.AttackerMap, client.Player.X, client.Player.Y); Messenger.PlaySoundToMap(setup.AttackerMap.MapID, "magic52.wav"); IMap map = client.Player.Map; for (int j = 0; j <= 14; j++) { //if (CheckPlayerRange(index, j, 5, Enums.TargetType.Npc) == true && CheckTarget(index, j, Enums.TargetType.Npc) == true && ObjectFactory.GetMapNpc(setup.AttackerMap, j).Target == index) { map.ActiveNpc[j].Target = null; //} } Messenger.BattleMsg(client, "Other Pokémon were repelled.", Text.White); } } break; case 28: {//trawl orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("Magic322.wav"), setup.Attacker.X, setup.Attacker.Y, 50); if (setup.AttackerMap.MapType == Enums.MapType.RDungeonMap) { for (int i = 0; i < Server.Constants.MAX_MAP_ITEMS; i++) { if (setup.AttackerMap.ActiveItem[i].Num != 0 && !setup.AttackerMap.ActiveItem[i].Hidden && setup.AttackerMap.Tile[setup.AttackerMap.ActiveItem[i].X, setup.AttackerMap.ActiveItem[i].Y].Type != Enums.TileType.DropShop) { int x = Server.Math.Rand(setup.Attacker.X-1, setup.Attacker.X+2); int y = Server.Math.Rand(setup.Attacker.Y-1, setup.Attacker.Y+2); if (x < 0) x = 0; if (x >= setup.AttackerMap.MaxX) x = setup.AttackerMap.MaxX-1; if (y < 0) y = 0; if (y >= setup.AttackerMap.MaxY) y = setup.AttackerMap.MaxY-1; setup.AttackerMap.SpawnItemSlot(i, setup.AttackerMap.ActiveItem[i].Num, setup.AttackerMap.ActiveItem[i].Value, setup.AttackerMap.ActiveItem[i].Sticky, false, setup.AttackerMap.ActiveItem[i].Tag, x, y, null); } } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("Items were pulled close to "+setup.Attacker.Name+"!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("Items can only be pulled in Mystery Dungeons!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); } } break; case 29: { //Quick Seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //if ((int)client.Player.SpeedLimit < 6) { //client.Player.SpeedLimit++; //Messenger.SendSpeedLimit(client); // if (setup.Attacker.VolatileStatus.GetStatus("MovementSpeed") != null) { // AddExtraStatus(setup.Attacker, setup.AttackerMap, "MovementSpeed", setup.Attacker.VolatileStatus.GetStatus("MovementSpeed").Counter + 1, null, setup.PacketStack); // } else { // AddExtraStatus(setup.Attacker, setup.AttackerMap, "MovementSpeed", 1, null, setup.PacketStack); // } //} else { // setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " can't go any faster!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); //} status = setup.Attacker.VolatileStatus.GetStatus("MovementSpeed"); if (status != null) { AddExtraStatus(setup.Attacker, setup.AttackerMap, "MovementSpeed", status.Counter + 1, null, "", setup.PacketStack); } else { AddExtraStatus(setup.Attacker, setup.AttackerMap, "MovementSpeed", 1, null, "", setup.PacketStack); } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 30: { //Violent Seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //StrBuff(index, 2, 0); //PPBuff(index, 2, 0); // TODO: Violent Seed [Scripts] } break; case 31: { //Bad EGG } break; case 32: {//seaside key if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; IMap map = client.Player.Map; if (map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.RDungeonGoal) { map.Tile[client.Player.X, client.Player.Y].Mask2Set = 4; map.Tile[client.Player.X, client.Player.Y].Mask2 = 2; map.Tile[client.Player.X, client.Player.Y].Data1 = 1; map.TempChange = true; setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(client.Player.X, client.Player.Y, map)); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The passage to the next floor was opened!", Text.BrightGreen), client.Player.X, client.Player.Y, 50); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("Magic127.wav"), client.Player.X, client.Player.Y, 50); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateBattleDivider(), client.Player.X, client.Player.Y, 50); TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); } } } break; case 33: {//Teru-Sama if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; client.Player.TakeItemSlot(invNum, 1, true); client.CloseConnection(); } } break; case 34: {// Lottery Ticket if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; if (DateTime.Now.DayOfWeek == Lottery.LOTTERY_DAY) { IMap map = client.Player.Map; if (map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.ScriptedSign && map.Tile[client.Player.X, client.Player.Y].Data1 == 5) { // Do nothing... } else { Messenger.PlayerMsg(client, "Today is " + Lottery.LOTTERY_DAY.ToString() + "! Go to Felicity to see if you won!", Text.Grey); } } else { Messenger.PlayerMsg(client, "Talk to Felicity on " + Lottery.LOTTERY_DAY.ToString() + " to see if you won!", Text.Grey); } } } break; case 35: { //Attack Items TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //setup.SetupMove(MoveManager.Moves[ItemManager.Items[itemNum].Data2].MoveNum]); //setup.Move.Name = setup.Attacker.Name + " used the " + ItemManager.Items[itemNum].Name + "!"; setup.moveSlot = -1; setup.moveIndex = ItemManager.Items[itemNum].Data2; BattleProcessor.HandleAttack(setup); if (ItemManager.Items[itemNum].Data3 > 0) { HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data3, setup.PacketStack); } } break; case 36: { //Gummi // TODO: Type of Gummi is based on data2 TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); //if (NetScript.GetPlayerClass(index) == 2 || NetScript.GetPlayerClass(index) == 6 || NetScript.GetPlayerClass(index) == 10) { // NetScript.SetPlayerMP(index, NetScript.GetPlayerMP(index) + 500); // NetScript.SetPlayerHP(index, NetScript.GetPlayerHP(index) + 500); //} else { // NetScript.SetPlayerMP(index, NetScript.GetPlayerMP(index) + 50); // NetScript.SetPlayerHP(index, NetScript.GetPlayerHP(index) + 50); //} } break; case 37: {//Tasty Honey TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " used the Tasty Honey!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); if (setup.AttackerMap.Moral != Enums.MapMoral.Safe && setup.AttackerMap.Moral != Enums.MapMoral.House) { for (int i = 0; i < Constants.MAX_MAP_NPCS / 4; i++) { setup.AttackerMap.SpawnNpc(); } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("Pokémon were attracted to the scent!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("Pokémon can't be lured in this area!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } } break; case 38: { //Grimy Food TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); int rand = Server.Math.Rand(0, 1000); //if (setup.AttackerMap.Name == "Spinda's Cafe") rand = 0; if (rand > 750 && !CheckStatusProtection(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Burn.ToString(), false, setup.PacketStack)) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Burn, 0, setup.PacketStack); } else if (rand > 500 && !CheckStatusProtection(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Paralyze.ToString(), false, setup.PacketStack)) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Paralyze, 0, setup.PacketStack); } else if (rand > 250 && !CheckStatusProtection(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Poison.ToString(), false, setup.PacketStack)) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Poison, 1, setup.PacketStack); } else if (rand > 0) { ChangeAttackBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); ChangeSpAtkBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); } else { rand = Server.Math.Rand(0, 1000); //if (setup.AttackerMap.Name == "Spinda's Cafe") rand = 0; if (rand > 0) { ChangeAttackBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); ChangeSpAtkBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); } else { DamageCharacter(setup.Attacker, setup.AttackerMap, Int32.MaxValue, Enums.KillType.Other, setup.PacketStack, true); } } HealCharacterBelly(setup.Attacker, 30, setup.PacketStack); } break; case 39: { //Grimy Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); int rand = Server.Math.Rand(0, 14); switch (rand) { case 0: { ChangeAttackBuff(setup.Attacker, setup.AttackerMap, -1, setup.PacketStack); } break; case 1: { ChangeDefenseBuff(setup.Attacker, setup.AttackerMap, -1, setup.PacketStack); } break; case 2: { ChangeSpAtkBuff(setup.Attacker, setup.AttackerMap, -1, setup.PacketStack); } break; case 3: { ChangeSpDefBuff(setup.Attacker, setup.AttackerMap, -1, setup.PacketStack); } break; case 4: { ChangeAccuracyBuff(setup.Attacker, setup.AttackerMap, -1, setup.PacketStack); } break; case 5: { ChangeEvasionBuff(setup.Attacker, setup.AttackerMap, -1, setup.PacketStack); } break; case 6: { ChangeSpeedBuff(setup.Attacker, setup.AttackerMap, -1, setup.PacketStack); } break; } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 40: { //Attack Items Infinite Use //setup.SetupMove(MoveManager.Moves[ItemManager.Items[itemNum].Data2].MoveNum]); //setup.Move.Name = setup.Attacker.Name + " used the " + ItemManager.Items[itemNum].Name + "!"; setup.moveSlot = -1; setup.moveIndex = ItemManager.Items[itemNum].Data2; BattleProcessor.HandleAttack(setup); HealCharacterBelly(setup.Attacker, ItemManager.Items[itemNum].Data3, setup.PacketStack); } break; case 41: {//Musical Items if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; for (int i = client.Player.X - 3; i <= client.Player.X + 3; i++) { for (int j = client.Player.Y - 3; j <= client.Player.Y + 3; j++) { if (i < 0 || j < 0 || i > client.Player.Map.MaxX || j > client.Player.Map.MaxY) { } else { setup.PacketStack.AddPacketToMap(client.Player.Map, PacketBuilder.CreateSpellAnim(498, i, j)); } } } string musicName = ""; switch (ItemManager.Items[itemNum].Data2) { case 1: { musicName = "PMD2) Northern Desert.ogg"; } break; case 2: { musicName = "PMD2) Dark Crater.ogg"; } break; case 3: { musicName = "PMD2) Sky Peak Snowfield.ogg"; } break; case 4: { musicName = "PMD2) Miracle Sea.ogg"; } break; case 5: { musicName = "PMD2) Concealed Ruins.ogg"; } break; case 6: { musicName = "PMD2) Sky Peak Forest.ogg"; } break; case 7: { musicName = "PMD) Sky Tower.ogg"; } break; case 8: { musicName = "PMD2) Star Cave.ogg"; } break; default: { musicName = "RBY) Lavender Town.ogg"; } break; } TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Room, 3, client.Player.Map, null, client.Player.X, client.Player.Y, Enums.Direction.Up, true, true, true); for (int i = 0; i < targets.Count; i++) { if (targets[i].CharacterType == Enums.CharacterType.Recruit) { Messenger.PlayMusic(((Recruit)targets[i]).Owner, musicName); } } } } break; case 42: { //traps TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic105.wav"), setup.Attacker.X, setup.Attacker.Y, 10); bool trapPlaced = false; if (setup.AttackerMap.Moral == Enums.MapMoral.None || setup.AttackerMap.Moral == Enums.MapMoral.NoPenalty) { if (setup.AttackerMap.Tile[setup.Attacker.X, setup.Attacker.Y].Type == Enums.TileType.Scripted && GetTrapType(setup.AttackerMap.Tile[setup.Attacker.X, setup.Attacker.Y].Data1) != null) { //remove preexisting trap RemoveTrap(setup.AttackerMap, setup.Attacker.X, setup.Attacker.Y, setup.PacketStack); } if (setup.AttackerMap.Tile[setup.Attacker.X, setup.Attacker.Y].Type == Enums.TileType.Walkable) { //set the trap on a walkable tile Tile tile = setup.AttackerMap.Tile[setup.Attacker.X, setup.Attacker.Y]; tile.Type = Enums.TileType.Scripted; tile.Data1 = ItemManager.Items[itemNum].Data2; tile.Data2 = 0; tile.Data3 = 2; if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { tile.String1 = ((Recruit)setup.Attacker).Owner.Player.CharID; tile.String2 = ((Recruit)setup.Attacker).Owner.Player.GuildName; } else { tile.String1 = ""; tile.String2 = ""; } tile.String2 = ItemManager.Items[itemNum].Data3.ToString(); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " placed a trap!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); trapPlaced = true; } } if (!trapPlaced) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("A trap can't be placed here!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); } } break; case 43: {//Tanren Key if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; IMap map = client.Player.Map; TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); /* string param1 = map.Tile[client.Player.X, client.Player.Y].String1; string param2 = map.Tile[client.Player.X, client.Player.Y].String2; string param3 = map.Tile[client.Player.X, client.Player.Y].String3; if (client.Player.PartyID == null) { TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); client.Player.WarpToRDungeon(param1.ToInt()-1, ((RDungeonMap)client.Player.Map).RDungeonFloor + 1); } else { bool warp = true; Party party = PartyManager.FindPlayerParty(client); IMap sourceMap = client.Player.Map; foreach (Client member in party.GetOnlineMemberClients()) { if (!member.Player.Dead && member.Player.MapID == client.Player.MapID && (member.Player.X != client.Player.X || member.Player.Y != client.Player.Y)) { warp = false; } } if (warp) { TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); foreach (Client member in party.GetOnlineMemberClients()) { if (member.Player.Map != sourceMap) continue; member.Player.WarpToRDungeon(param1.ToInt()-1, ((RDungeonMap)member.Player.Map).RDungeonFloor + 1); } } else { setup.PacketStack.AddPacket(client, PacketBuilder.CreateChatMsg("All surviving players on the floor must be on the goal in order to continue.", Text.WhiteSmoke)); } } */ if (map.Tile[client.Player.X, client.Player.Y].Type == Enums.TileType.Scripted && map.Tile[client.Player.X, client.Player.Y].Data1 == 68) { map.Tile[client.Player.X, client.Player.Y].Mask2Set = 4; map.Tile[client.Player.X, client.Player.Y].Mask2 = 2; map.Tile[client.Player.X, client.Player.Y].Data1 = 69; map.Tile[client.Player.X, client.Player.Y].String2 = ""; map.TempChange = true; setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(client.Player.X, client.Player.Y, map)); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("A secret passage was opened!", Text.BrightGreen), client.Player.X, client.Player.Y, 50); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateSoundPacket("Magic127.wav"), client.Player.X, client.Player.Y, 50); setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateBattleDivider(), client.Player.X, client.Player.Y, 50); TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); } } } break; case 44: { //Gracidea TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.Species == 492 && setup.Attacker.Form == 0) { setup.Attacker.PermanentForm = 1; setup.Attacker.Form = 1; setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("Magic838.wav"), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSpellAnim(502, setup.Attacker.X, setup.Attacker.Y)); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " changed forme!", Text.BrightGreen), setup.Attacker.X, setup.Attacker.Y, 10); RefreshCharacterTraits(setup.Attacker, setup.AttackerMap, setup.PacketStack); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } } break; case 45: { //Ragecandybar TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); HealCharacterBelly(setup.Attacker, 30, setup.PacketStack); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSpellAnim(500, setup.Attacker.X, setup.Attacker.Y)); TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Room, 3, setup.AttackerMap, setup.Attacker, setup.Attacker.X, setup.Attacker.Y, Enums.Direction.Up, false, true, false); if (targets.Friends.Count > 0) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + " shared some pieces with the others!", Text.Pink), setup.Attacker.X, setup.Attacker.Y, 10); for (int i = 0; i < targets.Friends.Count; i++) { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSpellAnim(Server.Moves.MoveManager.Moves[500].TravelingAnim, setup.Attacker.X, setup.Attacker.Y, targets.Friends[i].X - setup.Attacker.X, targets.Friends[i].Y - setup.Attacker.Y, 0)); HealCharacterBelly(targets.Friends[i], 30, setup.PacketStack); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSpellAnim(504, targets.Friends[i].X, targets.Friends[i].Y)); } } } break; case 46: {//scanner orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("Magic322.wav"), setup.Attacker.X, setup.Attacker.Y, 50); for (int i = 0; i < Server.Constants.MAX_MAP_ITEMS; i++) { if (setup.AttackerMap.ActiveItem[i].Num != 0 && setup.AttackerMap.ActiveItem[i].Hidden) { setup.AttackerMap.SpawnItemSlot(i, setup.AttackerMap.ActiveItem[i].Num, setup.AttackerMap.ActiveItem[i].Value, setup.AttackerMap.ActiveItem[i].Sticky, false, setup.AttackerMap.ActiveItem[i].Tag, setup.AttackerMap.ActiveItem[i].X, setup.AttackerMap.ActiveItem[i].Y, null); } } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("All hidden items on the floor were revealed!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } break; case 47: { //Lava Cookie TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); HealCharacter(setup.Attacker, setup.AttackerMap, setup.Attacker.MaxHP, setup.PacketStack); if (setup.Attacker.StatusAilment != Enums.StatusAilment.OK) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.OK, 0, null); //Messenger.BattleMsg(client, "You are no longer poisoned!", Text.White); } else { } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 48: { //Energy Root TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); HealCharacter(setup.Attacker, setup.AttackerMap, setup.Attacker.MaxHP, setup.PacketStack); HealCharacterPP(setup.Attacker, setup.AttackerMap, 100, setup.PacketStack); HealCharacterBelly(setup.Attacker, 200, setup.PacketStack); AddExtraStatus(setup.Attacker, setup.AttackerMap, "Nausea", 0, null, "", setup.PacketStack); } break; case 49: { //Slowpoketail TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); HealCharacterBelly(setup.Attacker, 60, setup.PacketStack); TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, setup.AttackerMap, setup.Attacker, setup.Attacker.X, setup.Attacker.Y, Enums.Direction.Up, true, false, false); for (int i = 0; i < targets.Count; i++) { if (targets[i].Species == 79 || targets[i].Species == 80 || targets[i].Species == 199) { AddExtraStatus(targets[i], setup.AttackerMap, "Grudge", 0, null, "", setup.PacketStack); } } } break; case 53: { //Wonder Gummi // TODO: Wonder Gummi ////if (NetScript.GetPlayerClass(index) == 2 || NetScript.GetPlayerClass(index) == 6 || NetScript.GetPlayerClass(index) == 10) { //client.Player.TakeItem(520, 1); //NetScript.SetPlayerMP(index, NetScript.GetPlayerMP(index) + 500); //NetScript.SetPlayerHP(index, NetScript.GetPlayerHP(index) + 500); ////} } break; case 55: { //Old Gateau TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.StatusAilment != Enums.StatusAilment.OK) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.OK, 0, null); //Messenger.BattleMsg(client, "You are no longer poisoned!", Text.White); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } HealCharacterBelly(setup.Attacker, 30, setup.PacketStack); } break; case 56: {//for west wing if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; if (client.Player.Direction == Enums.Direction.Up && setup.AttackerMap.MapID == MapManager.GenerateMapID(743) && client.Player.X == 11) { Messenger.AskQuestion(client, "AbandonedMansion", "Will you use the West Wing Key to enter?", -1); } else { StoryManager.PlayStory(client, 298); } } } break; case 57: {//for east wing if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; if (client.Player.Direction == Enums.Direction.Up && setup.AttackerMap.MapID == MapManager.GenerateMapID(743) && client.Player.X == 21) { Messenger.AskQuestion(client, "AbandonedMansion", "Will you use the East Wing Key to enter?", -1); } else { StoryManager.PlayStory(client, 298); } } } break; case 58: {//for abandoned mansion if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; if (client.Player.Direction == Enums.Direction.Up && setup.AttackerMap.MapID == MapManager.GenerateMapID(743) && client.Player.X == 16) { Messenger.AskQuestion(client, "AbandonedMansion", "Will you use the Mansion Key to enter?", -1); } else { StoryManager.PlayStory(client, 298); } } } break; case 59: {//One-Room Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.AttackerMap.MapType == Enums.MapType.RDungeonMap) { RDungeonMap map = (RDungeonMap)setup.AttackerMap; int[,] intArray = new int[map.MaxX + 1, map.MaxY + 1]; for (int x = 0; x <= map.MaxX; x++) { for (int y = 0; y <= map.MaxY; y++) { if (x == 0 || y == 0 || x == map.MaxX || y == map.MaxY) { map.Tile[x, y].RDungeonMapValue = 1; RDungeonFloorGen.AmbiguateTile(map.Tile[x, y]); } else if (map.Tile[x, y].RDungeonMapValue == 4 || map.Tile[x, y].RDungeonMapValue == 5 || map.Tile[x, y].RDungeonMapValue >= 256 && map.Tile[x, y].RDungeonMapValue < 512) { map.Tile[x, y].RDungeonMapValue = 3; RDungeonFloorGen.AmbiguateTile(map.Tile[x, y]); } intArray[x, y] = map.Tile[x, y].RDungeonMapValue; } } DungeonArrayFloor.TextureDungeon(intArray); for (int x = 0; x <= map.MaxX; x++) { for (int y = 0; y <= map.MaxY; y++) { map.Tile[x, y].RDungeonMapValue = intArray[x, y]; } } RDungeonFloorGen.TextureDungeonMap(map); for (int x = 0; x <= map.MaxX; x++) { for (int y = 0; y <= map.MaxY; y++) { setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map)); } } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("The walls crumbled, forming one big room!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic174.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } } break; case 60: {//Drought Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.AttackerMap.MapType == Enums.MapType.RDungeonMap) { RDungeonMap map = (RDungeonMap)setup.AttackerMap; int[,] intArray = new int[map.MaxX + 1, map.MaxY + 1]; for (int x = 0; x <= map.MaxX; x++) { for (int y = 0; y <= map.MaxY; y++) { if (map.Tile[x, y].RDungeonMapValue >= 512 && map.Tile[x, y].RDungeonMapValue < 768) { map.Tile[x, y].RDungeonMapValue = 3; RDungeonFloorGen.AmbiguateTile(map.Tile[x, y]); } intArray[x, y] = map.Tile[x, y].RDungeonMapValue; } } DungeonArrayFloor.TextureDungeon(intArray); for (int x = 0; x <= map.MaxX; x++) { for (int y = 0; y <= map.MaxY; y++) { map.Tile[x, y].RDungeonMapValue = intArray[x, y]; } } RDungeonFloorGen.TextureDungeonMap(map); for (int x = 0; x <= map.MaxX; x++) { for (int y = 0; y <= map.MaxY; y++) { setup.PacketStack.AddPacketToMap(map, PacketBuilder.CreateTilePacket(x, y, map)); } } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("All liquids were drained from the floor!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic170.wav"), setup.Attacker.X, setup.Attacker.Y, 10); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } } break; case 61: { //heal seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.StatusAilment != Enums.StatusAilment.OK) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.OK, 0, setup.PacketStack); //Messenger.BattleMsg(client, "You are no longer poisoned!", Text.White); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 69: { //blinker seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); AddExtraStatus(setup.Attacker, setup.AttackerMap, "Blind", 20, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 70: {//Weather Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.AttackerMap.Tile[setup.Attacker.X, setup.Attacker.Y].Type == Enums.TileType.Arena || setup.AttackerMap.Moral == Enums.MapMoral.None || setup.AttackerMap.Moral == Enums.MapMoral.NoPenalty) { if (Server.Math.Rand(0, 10) == 0) { SetMapWeather(setup.AttackerMap, (Enums.Weather)ItemManager.Items[itemNum].Data3, setup.PacketStack); } else { SetMapWeather(setup.AttackerMap, (Enums.Weather)ItemManager.Items[itemNum].Data2, setup.PacketStack); } } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("The weather can only change in dungeons and arenas!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); } } break; case 71: {//Recycle Orb if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); bool grimy = false; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num != 74 && client.Player.Inventory[i].Num != 75) { } else if (client.Player.Inventory[i].Tag.IsNumeric() && client.Player.Inventory[i].Tag.ToInt() > 0) { int grimyItem = client.Player.Inventory[i].Num; client.Player.Inventory[i].Num = client.Player.Inventory[i].Tag.ToInt(); client.Player.Inventory[i].Tag = ""; } else { grimy = true; } if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { PacketBuilder.AppendInventory(((Recruit)setup.Attacker).Owner, setup.PacketStack); } } Messenger.PlayerMsg(client, "Grimy items in the bag have been restored!", Text.Cyan); Messenger.PlayerMsg(client, "But some items were too grimy to recycle...", Text.Blue); } } break; case 72: {//heart slate if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; int slot = -1; for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Num == 171 && !client.Player.Inventory[i].Tag.Contains(item.Tag)) { slot = i; break; } } if (slot > -1) { client.Player.Inventory[slot].Tag += (item.Tag + ";"); TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); Messenger.PlayerMsg(client, "The item disappeared, and its symbol was imprinted into the Mystery Part!", Text.Cyan); Messenger.PlaySoundToMap(client.Player.MapID, "magic765.wav"); } else { Messenger.PlayerMsg(client, "But nothing happened...", Text.Blue); } } } break; case 73: {//mystery part if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; string[] choicesNum = item.Tag.Split(';'); if (choicesNum.Length > 1 && IsHardModeEntrance(setup.AttackerMap)) { List<string> choices = new List<string>(); bool tooMany = false; for (int i = 0; i < choicesNum.Length-1; i++) { if (choices.Count >= 5) { tooMany = true; break; } choices.Add("#" + choicesNum[i] + ": " + Pokedex.GetPokemon(choicesNum[i].ToInt()).Name); } if (tooMany) { choices.Add("Others"); } choices.Add("Cancel"); Messenger.AskQuestion(client, "SummonGuardian:0:" + item.Tag, "Which ally will you call forth?", -1, choices.ToArray()); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened...", Text.Blue), setup.Attacker.X, setup.Attacker.Y, 10); } } } break; case 74: {//Luminous Orb if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateSoundPacket("magic322.wav"), setup.Attacker.X, setup.Attacker.Y, 10); if (setup.AttackerMap.Tile[setup.Attacker.X, setup.Attacker.Y].Type == Enums.TileType.Arena || setup.AttackerMap.Moral == Enums.MapMoral.None || setup.AttackerMap.Moral == Enums.MapMoral.NoPenalty) { AddMapStatus(setup.AttackerMap, "Luminous", 0, "", -1, setup.PacketStack); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("The map can only be lit up in dungeons and arenas!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); } } } break; case 75: { //Vanish seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); AddExtraStatus(setup.Attacker, setup.AttackerMap, "Invisible", 20, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 76: {//Cleanse Orb if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Client client = ((Recruit)setup.Attacker).Owner; TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); for (int i = 1; i <= client.Player.Inventory.Count; i++) { if (client.Player.Inventory[i].Sticky) { client.Player.SetItemSticky(i, false); } } Messenger.PlayerMsg(client, "All sticky items have been cleansed!", Text.Cyan); } } break; case 77: { //Pinch Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); // if (setup.Attacker.HP <= setup.Attacker.MaxHP / 2) { int raisedStat = ItemManager.Items[itemNum].Data2; if (raisedStat == -1) { raisedStat = Server.Math.Rand(0, 7); } switch (raisedStat) { case 0: { ChangeAttackBuff(setup.Attacker, setup.AttackerMap, 20, setup.PacketStack); } break; case 1: { ChangeDefenseBuff(setup.Attacker, setup.AttackerMap, 20, setup.PacketStack); } break; case 2: { ChangeSpAtkBuff(setup.Attacker, setup.AttackerMap, 20, setup.PacketStack); } break; case 3: { ChangeSpDefBuff(setup.Attacker, setup.AttackerMap, 20, setup.PacketStack); } break; case 4: { ChangeSpeedBuff(setup.Attacker, setup.AttackerMap, 20, setup.PacketStack); } break; case 5: { ChangeAccuracyBuff(setup.Attacker, setup.AttackerMap, 20, setup.PacketStack); } break; case 6: { ChangeEvasionBuff(setup.Attacker, setup.AttackerMap, 20, setup.PacketStack); } break; } //} else { // setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); //} //HealCharacter(setup.Attacker, setup.AttackerMap, setup.Attacker.MaxHP / 2, setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 78: { //Persim Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.VolatileStatus.GetStatus("Confusion") != null) { RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "Confusion", setup.PacketStack); } else { //setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); AddExtraStatus(setup.Attacker, setup.AttackerMap, "Confusion Guard", 10, null, "", setup.PacketStack); } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 79: { //Lum Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.Attacker.StatusAilment != Enums.StatusAilment.OK) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.OK, 0, setup.PacketStack); //Messenger.BattleMsg(client, "You are no longer poisoned!", Text.White); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("But nothing happened.", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); } for (int i = setup.Attacker.VolatileStatus.Count - 1; i > -1; i--) { if (IsStatusBad(setup.Attacker.VolatileStatus[i].Name)) { RemoveExtraStatus(setup.Attacker, setup.AttackerMap, setup.Attacker.VolatileStatus[i].Name, setup.PacketStack); } } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 80: { //Type-reduce Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); AddExtraStatus(setup.Attacker, setup.AttackerMap, "TypeReduce", ItemManager.Items[itemNum].Data2, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 81: { //Trap-See Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); for (int x = 0; x <= setup.AttackerMap.MaxX; x++) { for (int y = 0; y <= setup.AttackerMap.MaxY; y++) { if (setup.AttackerMap.Tile[x, y].Type == Enums.TileType.Scripted && GetTrapType(setup.AttackerMap.Tile[x, y].Data1) != null && GetTrapType(setup.AttackerMap.Tile[x, y].Data1) != "SecretRoom") { RevealTrap(setup.AttackerMap, x, y, setup.PacketStack); } } } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("All traps on the floor were exposed!", Text.Pink)); } break; case 82: { //Trapbust Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); for (int x = 0; x <= setup.AttackerMap.MaxX; x++) { for (int y = 0; y <= setup.AttackerMap.MaxY; y++) { if (setup.AttackerMap.Tile[x, y].Type == Enums.TileType.Scripted && GetTrapType(setup.AttackerMap.Tile[x, y].Data1) != null && GetTrapType(setup.AttackerMap.Tile[x, y].Data1) != "SecretRoom") { RemoveTrap(setup.AttackerMap, x, y, setup.PacketStack); } } } setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("All traps on the floor were destroyed!", Text.Pink)); } break; case 83: {//White Herb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); RemoveBuffs(setup.Attacker); setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg(setup.Attacker.Name + "'s stats were returned to normal!", Text.WhiteSmoke), setup.Attacker.X, setup.Attacker.Y, 10); HealCharacterBelly(setup.Attacker, 3, setup.PacketStack); } break; case 84: {//Evasion Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); ChangeEvasionBuff(setup.Attacker, setup.AttackerMap, 2, setup.PacketStack); } break; case 85: { //Slip Seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); AddExtraStatus(setup.Attacker, setup.AttackerMap, "Slip", 0, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 86: { //Mobile Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); AddExtraStatus(setup.Attacker, setup.AttackerMap, "SuperMobile", 0, null, "", setup.PacketStack); } break; case 87: {//Power Herb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); AddExtraStatus(setup.Attacker, setup.AttackerMap, "SuperCharge", 0, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 3, setup.PacketStack); } break; case 88: { //Type-boost gem TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); AddExtraStatus(setup.Attacker, setup.AttackerMap, "TypeBoost", ItemManager.Items[itemNum].Data2, null, "", setup.PacketStack); } break; case 89: {//Mental Herb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "Attract", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "Encore", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "Torment", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "Taunt", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "Disable", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "MoveSeal:0", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "MoveSeal:1", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "MoveSeal:2", setup.PacketStack); RemoveExtraStatus(setup.Attacker, setup.AttackerMap, "MoveSeal:3", setup.PacketStack); HealCharacterBelly(setup.Attacker, 3, setup.PacketStack); } break; case 90: {//revives and max revives if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { ActivateRevivalItem(((Recruit)setup.Attacker).Owner, itemNum); } } break; case 91: {//Pathfinder Orb TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); Client client = ((Recruit)setup.Attacker).Owner; if (setup.AttackerMap.Name != "Pitch-Black Abyss") { Messenger.PlayerMsg(client, "The orb fills with a brilliant light, then fades out.", Text.Cyan); } else { int left, right, up, down; string dir = ""; int x = -1; int y = -1; for (int i = 0; i < exPlayer.Get(client).DungeonMaxX; i++) { for (int j = 0; j < exPlayer.Get(client).DungeonMaxY; j++) { if (exPlayer.Get(client).DungeonMap[i,j] == PitchBlackAbyss.Room.End) { x = i; y = j; } } } if (exPlayer.Get(client).DungeonX >= x) { left = exPlayer.Get(client).DungeonX - x; right = exPlayer.Get(client).DungeonMaxX - left; } else { right = x - exPlayer.Get(client).DungeonX; left = exPlayer.Get(client).DungeonMaxX - right; } if (exPlayer.Get(client).DungeonY >= y) { up = exPlayer.Get(client).DungeonY - y; down = exPlayer.Get(client).DungeonMaxY - up; } else { down = y - exPlayer.Get(client).DungeonY; up = exPlayer.Get(client).DungeonMaxY - down; } if (left == 0) { if (up < down) dir = "North"; else dir = "South"; } else if (up == 0) { if (left < right) dir = "West"; else dir = "East"; } else { //composite cases if (up < down) dir = "North"; else dir = "South"; if (left < right) dir = dir + "-West"; else dir = dir + "-East"; } Messenger.PlayerMsg(client, "The exit is to the " + dir + ".", Text.Cyan); } } break; case 92: { //sleep seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Sleep, Server.Math.Rand(2, 4), setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 93: { //dark liquid TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); HealCharacter(setup.Attacker, setup.AttackerMap, setup.Attacker.MaxHP, setup.PacketStack); HealCharacterPP(setup.Attacker, setup.AttackerMap, 100, setup.PacketStack); HealCharacterBelly(setup.Attacker, 200, setup.PacketStack); //grimy food effect int rand = Server.Math.Rand(0, 1000); if (rand > 750 && !CheckStatusProtection(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Burn.ToString(), false, setup.PacketStack)) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Burn, 0, setup.PacketStack); } else if (rand > 500 && !CheckStatusProtection(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Paralyze.ToString(), false, setup.PacketStack)) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Paralyze, 0, setup.PacketStack); } else if (rand > 250 && !CheckStatusProtection(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Poison.ToString(), false, setup.PacketStack)) { SetStatusAilment(setup.Attacker, setup.AttackerMap, Enums.StatusAilment.Poison, 1, setup.PacketStack); } else if (rand > 0) { ChangeAttackBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); ChangeSpAtkBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); } else { rand = Server.Math.Rand(0, 1000); if (rand > 0) { ChangeAttackBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); ChangeSpAtkBuff(setup.Attacker, setup.AttackerMap, -3, setup.PacketStack); } else { DamageCharacter(setup.Attacker, setup.AttackerMap, Int32.MaxValue, Enums.KillType.Other, setup.PacketStack, true); } } } break; case 94: { //jaboca/rowap Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); // if (setup.Attacker.HP <= setup.Attacker.MaxHP / 2) { AddExtraStatus(setup.Attacker, setup.AttackerMap, "AttackReturn", ItemManager.Items[itemNum].Data2, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 95: { //lansat Berry TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); // if (setup.Attacker.HP <= setup.Attacker.MaxHP / 2) { AddExtraStatus(setup.Attacker, setup.AttackerMap, "FocusEnergy", 8, null, "", setup.PacketStack); HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; case 96: { //pure seed TakeItemSlotFromCharacter(setup.Attacker, invNum, 1); if (setup.AttackerMap.MapType == Enums.MapType.RDungeonMap) { WarpToStairs(setup.Attacker, setup.AttackerMap, setup.PacketStack, 5); } else { setup.PacketStack.AddPacketToMap(setup.AttackerMap, PacketBuilder.CreateBattleMsg("Warping works only Mystery Dungeons!", Text.BrightRed), setup.Attacker.X, setup.Attacker.Y, 10); } HealCharacterBelly(setup.Attacker, 5, setup.PacketStack); } break; } //if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { //Client client = ((Recruit)setup.Attacker).Owner; //Logger.AppendToLog("/Player Event Logs/" + client.Player.Name + ".txt", "Used scripted item: " + ItemManager.Items[itemNum].Name, true); //} } catch (Exception ex) { Messenger.AdminMsg("Error: ScriptedItem " + item.Num + "-" + invNum, Text.Black); Messenger.AdminMsg(ex.ToString(), Text.Black); } }
public static void OpenBox(Client client, InventoryItem item, int invNum) { string itemName = ItemManager.Items[item.Num].Name; string[] itemSelection = client.Player.Inventory[invNum].Tag.Split(';'); string[] chosenItem = itemSelection[Server.Math.Rand(0, itemSelection.Length)].Split(','); client.Player.TakeItemSlot(invNum, 1, true); if (chosenItem[0].IsNumeric()) { if (chosenItem.Length == 2 && chosenItem[1].IsNumeric()) { client.Player.GiveItem(chosenItem[0].ToInt(), chosenItem[1].ToInt()); Messenger.PlayerMsg(client, "Inside the " + itemName + " was " + chosenItem[1] + " " + ItemManager.Items[chosenItem[0].ToInt()].Name + "!", Text.Yellow); } else if (chosenItem.Length == 3 && chosenItem[2].IsNumeric()) { client.Player.GiveItem(chosenItem[0].ToInt(), 1, chosenItem[2]); //Messenger.PlayerMsg(client, "Inside the " + itemName + " was " + chosenItem[1] + " " + ItemManager.Items[chosenItem[0].ToInt()].Name + "!", Text.Yellow); Messenger.PlayerMsg(client, "Inside the " + itemName + " was a " + ItemManager.Items[chosenItem[0].ToInt()].Name + "!", Text.Yellow); } else { client.Player.GiveItem(chosenItem[0].ToInt(), 1); Messenger.PlayerMsg(client, "Inside the " + itemName + " was a " + ItemManager.Items[chosenItem[0].ToInt()].Name + "!", Text.Yellow); } } else { Messenger.PlayerMsg(client, "There was nothing inside the " + itemName + "...", Text.Yellow); } }
public static void OnNpcSpawn(IMap map, MapNpcPreset npc, MapNpc spawnedNpc, PacketHitList hitlist) { try { if (spawnedNpc.Num == 0) return; bool listed = false; for (int i = 0; i < map.Npc.Count; i++) { if (map.Npc[i].NpcNum == spawnedNpc.Num) { listed = true; break; } } if (!listed && map.MapType == Enums.MapType.RDungeonMap) { //Messenger.AdminMsg("[Admin] An unlisted NPC " + NpcManager.Npcs[spawnedNpc.Num].Name + " spawned on " + map.Name, Text.Red); //map.ActiveNpc[spawnedNpc.MapSlot] = new MapNpc(map.MapID, spawnedNpc.MapSlot); //hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("npcdead", spawnedNpc.MapSlot)); } Client sprinko = ClientManager.FindClient("Sprinko"); if (sprinko != null && sprinko.Player.Map == map) { Messenger.PlayerMsg(sprinko, "Npc Spawned:" + spawnedNpc.Num, Text.Pink); } switch (spawnedNpc.Num) { case 33: case 230: case 244: case 245: {//friendly npcs AddExtraStatus(spawnedNpc, map, "Immobilize", 0, null, "", hitlist, false); } break; case 32: {//kecleon map.Npc.Remove(npc); } break; case 1233: {//hitmonchan map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 300; spawnedNpc.AttackBuff = 1; spawnedNpc.SpeedBuff = 8; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1234: {//hitmonlee map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 340; spawnedNpc.AttackBuff = 3; spawnedNpc.SpeedBuff = 8; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1235: {//hitmontop map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 480; spawnedNpc.AttackBuff = 3; spawnedNpc.SpeedBuff = 10; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 306: {//regice foreach (Client n in map.GetClients()) { StoryManager.PlayStory(n, 259); } map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 10; spawnedNpc.SpDefBuff = 10; spawnedNpc.MaxHPBonus = 550; spawnedNpc.SpAtkBuff = 5; spawnedNpc.SpeedBuff = 10; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1401: {//Vespiquen (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 150; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1402: {//Roselia (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 100; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1403: {//Vileplume (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 100; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1404: {//Rhyperior (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 195; spawnedNpc.AttackBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1405: {//Golem (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 165; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1406: {//Rhydon (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 165; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1407: {//Lapras (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 335; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1408: {//Gorebyss (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 235; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1409: {//Huntail (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 215; spawnedNpc.AttackBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1410: {//Regice (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 150; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1411: {//Froslass (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.EvasionBuff = 1; spawnedNpc.MaxHPBonus = 100; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1412: {//Beartic (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.AttackBuff = 2; spawnedNpc.MaxHPBonus = 200; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1413: {//Umbreon (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 200; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1414: {//Mogok (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 4; spawnedNpc.SpDefBuff = 4; spawnedNpc.AttackBuff = 5; spawnedNpc.SpeedBuff = 10; spawnedNpc.MaxHPBonus = 450; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1415: {//Silvan (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 5; spawnedNpc.AttackBuff = 6; spawnedNpc.SpAtkBuff = 5; spawnedNpc.SpeedBuff = 10; spawnedNpc.MaxHPBonus = 400; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1416: {//Erkenwald (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.AttackBuff = 3; spawnedNpc.SpAtkBuff = 3; spawnedNpc.SpeedBuff = 10; spawnedNpc.MaxHPBonus = 400; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1417: {//Alistar (Boss Rush) map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 300; spawnedNpc.SpAtkBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1397: {//Vespiquen map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 325; spawnedNpc.AttackBuff = 2; spawnedNpc.SpeedBuff = 10; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 177: {//Luxray map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 200; spawnedNpc.SpAtkBuff = 1; spawnedNpc.AttackBuff = 2; spawnedNpc.EvasionBuff = 2; spawnedNpc.SpeedBuff = 10; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1192: {//Entei foreach (Client n in map.GetClients()) { StoryManager.PlayStory(n, 381); } map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 300; spawnedNpc.SpAtkBuff = 3; spawnedNpc.AttackBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1194: {//Suicune foreach (Client n in map.GetClients()) { StoryManager.PlayStory(n, 382); } map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 300; spawnedNpc.SpAtkBuff = 3; spawnedNpc.AttackBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1193: {//Raikou foreach (Client n in map.GetClients()) { StoryManager.PlayStory(n, 380); } map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 300; spawnedNpc.SpAtkBuff = 3; spawnedNpc.AttackBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1195: {//Flareon map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 4; spawnedNpc.MaxHPBonus = 350; spawnedNpc.AttackBuff = 3; spawnedNpc.SpeedBuff = 8; spawnedNpc.SpAtkBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1196: {//Leafeon map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.MaxHPBonus = 385; spawnedNpc.AttackBuff = 3; spawnedNpc.SpeedBuff = 7; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1197: {//Vaporeon map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 5; spawnedNpc.MaxHPBonus = 425; spawnedNpc.SpAtkBuff = 2; spawnedNpc.SpeedBuff = 9; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1198: {//Glaceon map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 350; spawnedNpc.SpAtkBuff = 4; spawnedNpc.EvasionBuff = 2; spawnedNpc.AccuracyBuff = 3; spawnedNpc.SpeedBuff = 6; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1199: {//Jolteon map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.MaxHPBonus = 300; spawnedNpc.SpAtkBuff = 4; spawnedNpc.SpeedBuff = 9; spawnedNpc.EvasionBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1200: {//Umbreon map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 500; spawnedNpc.AttackBuff = 2; spawnedNpc.SpeedBuff = 4; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1201: {//Espeon map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.MaxHPBonus = 350; spawnedNpc.SpAtkBuff = 2; spawnedNpc.SpeedBuff = 8; spawnedNpc.EvasionBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1202: {//Ho-Oh map.Npc.Remove(npc); spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 4; spawnedNpc.MaxHPBonus = 850; spawnedNpc.AttackBuff = 3; spawnedNpc.SpeedBuff = 10; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 806: {//rotom spawnedNpc.MaxHPBonus = 200; spawnedNpc.AttackBuff = 1; spawnedNpc.SpAtkBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 807: {//rotom spawnedNpc.MaxHPBonus = 200; spawnedNpc.AttackBuff = 1; spawnedNpc.SpAtkBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 434: {//rotom spawnedNpc.MaxHPBonus = 200; spawnedNpc.AttackBuff = 1; spawnedNpc.SpAtkBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 422: {//rotom spawnedNpc.MaxHPBonus = 200; spawnedNpc.AttackBuff = 1; spawnedNpc.SpAtkBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 886: {//lapras spawnedNpc.MaxHPBonus = 550; spawnedNpc.SpeedBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.DefenseBuff = 3; spawnedNpc.SpAtkBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 397: {//golem spawnedNpc.DefenseBuff = 1; spawnedNpc.SpeedBuff = 8; spawnedNpc.SpDefBuff = 1; spawnedNpc.AttackBuff = 3; spawnedNpc.MaxHPBonus = 250; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 578: {//froslass spawnedNpc.MaxHPBonus = 350; spawnedNpc.SpeedBuff = 7; spawnedNpc.SpAtkBuff = 3; spawnedNpc.EvasionBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1527: {//Nidoking spawnedNpc.MaxHPBonus = 350; spawnedNpc.SpeedBuff = 10; spawnedNpc.SpAtkBuff = 3; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1528: {//Nidoking spawnedNpc.MaxHPBonus = 400; spawnedNpc.SpeedBuff = 10; spawnedNpc.SpAtkBuff = 1; spawnedNpc.DefenseBuff = 3; spawnedNpc.SpDefBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1529: {//Regirock spawnedNpc.MaxHPBonus = 850; spawnedNpc.SpeedBuff = 10; spawnedNpc.AttackBuff = 3; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 4; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1521: {//Steelix spawnedNpc.MaxHPBonus = 255; spawnedNpc.SpDefBuff = 4; spawnedNpc.AttackBuff = 1; spawnedNpc.DefenseBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1523: {//Aggron spawnedNpc.MaxHPBonus = 155; spawnedNpc.SpDefBuff = 3; spawnedNpc.AttackBuff = 1; spawnedNpc.DefenseBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1522: {//Golem spawnedNpc.MaxHPBonus = 125; spawnedNpc.SpDefBuff = 2; spawnedNpc.AttackBuff = 1; spawnedNpc.DefenseBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1520: {//Crobat spawnedNpc.MaxHPBonus = 100; spawnedNpc.SpDefBuff = 2; spawnedNpc.AttackBuff = 3; spawnedNpc.DefenseBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 389: {//rhyperior spawnedNpc.MaxHPBonus = 400; spawnedNpc.AttackBuff = 2; spawnedNpc.SpeedBuff = 8; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 145: {//mamoswine spawnedNpc.MaxHPBonus = 400; spawnedNpc.AttackBuff = 2; spawnedNpc.SpeedBuff = 6; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 381: {//rhydon spawnedNpc.MaxHPBonus = 250; spawnedNpc.SpeedBuff = 6; spawnedNpc.AttackBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 640: {//huntail spawnedNpc.MaxHPBonus = 200; spawnedNpc.SpAtkBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 641: {//gorebyss spawnedNpc.MaxHPBonus = 250; spawnedNpc.SpDefBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 579: {//xatu spawnedNpc.MaxHPBonus = 200; spawnedNpc.SpAtkBuff = 4; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 481: {//weepinbell spawnedNpc.MaxHPBonus = 125; spawnedNpc.AttackBuff = 1; spawnedNpc.DefenseBuff = 1; spawnedNpc.SpeedBuff = 3; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1220: {//Groundon spawnedNpc.MaxHPBonus = 775; spawnedNpc.SpeedBuff = 10; spawnedNpc.SpDefBuff = 6; spawnedNpc.DefenseBuff = 6; spawnedNpc.AttackBuff = 5; spawnedNpc.SpAtkBuff = 5; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1060: {//Abomsnow spawnedNpc.MaxHPBonus = 400; spawnedNpc.SpeedBuff = 1; spawnedNpc.SpDefBuff = 2; spawnedNpc.DefenseBuff = 2; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 480: {//vileplume spawnedNpc.MaxHPBonus = 200; spawnedNpc.SpAtkBuff = 2; spawnedNpc.DefenseBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.SpeedBuff = 6; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1046: {//beartic spawnedNpc.MaxHPBonus = 450; spawnedNpc.HP = spawnedNpc.MaxHP; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.EvasionBuff = 1; spawnedNpc.AttackBuff = 2; spawnedNpc.SpeedBuff = 4; } break; case 1047: {//umbreon spawnedNpc.MaxHPBonus = 450; spawnedNpc.HP = spawnedNpc.MaxHP; spawnedNpc.DefenseBuff = 4; spawnedNpc.SpDefBuff = 4; spawnedNpc.AttackBuff = 2; spawnedNpc.SpeedBuff = 6; } break; case 1048: {//hitmonlee spawnedNpc.MaxHPBonus = 300; spawnedNpc.HP = spawnedNpc.MaxHP; spawnedNpc.AttackBuff = 5; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.SpeedBuff = 8; } break; case 1049: {//grumpig spawnedNpc.MaxHPBonus = 250; spawnedNpc.HP = spawnedNpc.MaxHP; spawnedNpc.SpAtkBuff = 5; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpDefBuff = 2; spawnedNpc.SpeedBuff = 6; } break; case 1050: {//clefable spawnedNpc.MaxHPBonus = 250; spawnedNpc.HP = spawnedNpc.MaxHP; spawnedNpc.EvasionBuff = 3; spawnedNpc.SpDefBuff = 2; spawnedNpc.DefenseBuff = 2; spawnedNpc.SpeedBuff = 8; } break; case 800: {//mew map.Npc.Remove(npc); spawnedNpc.MaxHPBonus = 50; spawnedNpc.HP = spawnedNpc.MaxHP; spawnedNpc.AttackBuff = 1; spawnedNpc.DefenseBuff = 1; spawnedNpc.SpAtkBuff = 1; spawnedNpc.SpDefBuff = 1; spawnedNpc.AccuracyBuff = 1; spawnedNpc.EvasionBuff = 1; AddExtraStatus(spawnedNpc, null, map, "Invisible", 1000, null, "", hitlist, false); TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, null, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, true, true, true); for (int i = 0; i < targets.Count; i++) { if (targets[i].CharacterType == Enums.CharacterType.Recruit) { Messenger.PlayMusic(((Recruit)targets[i]).Owner, "PMDB) Friend Area ~ Final Island.ogg"); } } } break; case 846: {//zorua map.Npc.Remove(npc); } break; case 1394: {//Scyther map.Npc.Remove(npc); } break; case 1395: {//Pinsir map.Npc.Remove(npc); } break; case 936: {//vanilluxe //foreach (Client n in map.GetClients()) { // StoryManager.PlayStory(n, 187); //} map.Npc.Remove(npc); spawnedNpc.MaxHPBonus = 200; spawnedNpc.HP = spawnedNpc.MaxHP; } break; case 1061: {//ARTICUNO //map.Npc.Remove(npc); spawnedNpc.MaxHPBonus = 300; spawnedNpc.HP = spawnedNpc.MaxHP; if (map.PlayersOnMap.Count == 1) { InventoryItem item = new InventoryItem(); item.Num = 156; item.Tag = "144"; spawnedNpc.GiveItem(item); } } break; } if ((map.MapType == Enums.MapType.RDungeonMap) && spawnedNpc.HeldItem == null) { if (((RDungeonMap)map).RDungeonIndex != 21 && ((RDungeonMap)map).RDungeonIndex != 22) { if (Server.Math.Rand(0, 50) <= 0) { //create a chest InventoryItem item = new InventoryItem(); item.Num = Server.Math.Rand(531, 542); if (item.Num == 533) item.Num = 542; List<int> possibleItems = new List<int>(); if (Server.Math.Rand(0, 31) < 5) { //2* item for (int i = 1001; i <= 1838; i++) { if (ItemManager.Items[i].Rarity == 2 && !ItemManager.Items[i].Name.EndsWith("`")) { possibleItems.Add(i); } } } else { //1* item for (int i = 1001; i <= 1838; i++) { if (ItemManager.Items[i].Rarity == 1 && !ItemManager.Items[i].Name.EndsWith("`")) { possibleItems.Add(i); } } } item.Tag = possibleItems[Server.Math.Rand(0, possibleItems.Count)].ToString(); spawnedNpc.GiveItem(item); } } } if (map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) { if (((RDungeonMap)map).RDungeonIndex == 50 && ((RDungeonMap)map).RDungeonFloor >= 2) { if (Server.Math.Rand(0, 10) == 0) { InventoryItem item = new InventoryItem(); item.Num = Server.Math.Rand(244, 249); if (item.Num == 247) item.Num = 213; if (item.Num == 248) item.Num = 224; spawnedNpc.GiveItem(item); } } else if (((RDungeonMap)map).RDungeonIndex == 17 && ((RDungeonMap)map).RDungeonFloor >= 25 || ((RDungeonMap)map).RDungeonIndex == 18) { if (Server.Math.Rand(0, 10) == 0) { InventoryItem item = new InventoryItem(); item.Num = 259; switch (Server.Math.Rand(0, 5)) { case 0: { item.Tag = "151"; } break; case 1: { item.Tag = "251"; } break; case 2: { item.Tag = "385"; } break; case 3: { item.Tag = "490"; } break; case 4: { item.Tag = "492"; } break; } spawnedNpc.GiveItem(item); } } } if (HasAbility(spawnedNpc, "Pickup") && map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) { RDungeonFloor floor = RDungeonManager.RDungeons[((RDungeonMap)map).RDungeonIndex].Floors[((RDungeonMap)map).RDungeonFloor]; if (floor.Items.Count > 0) { int rand = Server.Math.Rand(0, floor.Items.Count); if (Server.Math.Rand(0, 200) <= floor.Items[rand].AppearanceRate) { int amount = (floor.Items[rand].MinAmount + floor.Items[rand].MaxAmount) / 2; InventoryItem item = new InventoryItem(); item.Num = floor.Items[rand].ItemNum; item.Amount = amount; item.Tag = floor.Items[rand].Tag; spawnedNpc.GiveItem(item); } } } if (HasAbility(spawnedNpc, "Honey Gather") && map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) { RDungeonFloor floor = RDungeonManager.RDungeons[((RDungeonMap)map).RDungeonIndex].Floors[((RDungeonMap)map).RDungeonFloor]; if (Server.Math.Rand(0, 400) <= spawnedNpc.Level) { InventoryItem item = new InventoryItem(); item.Num = 11; spawnedNpc.GiveItem(item); } } if (HasAbility(spawnedNpc, "Illusion")) { TargetCollection friendlyTargets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, spawnedNpc, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, false, true, false); if (friendlyTargets.Friends.Count > 0) { AddExtraStatus(spawnedNpc, map, "Illusion", friendlyTargets[Server.Math.Rand(0, friendlyTargets.Friends.Count)].Sprite, null, "", hitlist); } } if (spawnedNpc.HasActiveItem(213)) { AddExtraStatus(spawnedNpc, map, "Illusion", 25, null, "", hitlist, false); } if (spawnedNpc.HasActiveItem(224)) { AddExtraStatus(spawnedNpc, map, "Illusion", 300, null, "", hitlist, false); } if (spawnedNpc.HasActiveItem(244)) { AddExtraStatus(spawnedNpc, map, "Illusion", 387, null, "", hitlist, false); } if (spawnedNpc.HasActiveItem(245)) { AddExtraStatus(spawnedNpc, map, "Illusion", 390, null, "", hitlist, false); } if (spawnedNpc.HasActiveItem(246)) { AddExtraStatus(spawnedNpc, map, "Illusion", 393, null, "", hitlist, false); } //if (spawnedNpc.HasActiveItem(259) && spawnedNpc.HeldItem.Num == 259 && map.Moral == Enums.MapMoral.House) { // AddExtraStatus(spawnedNpc, map, "Illusion", spawnedNpc.HeldItem.Tag.ToInt(), null, "", hitlist); //} RefreshCharacterTraits(spawnedNpc, map, hitlist); if (map.Tile[spawnedNpc.X, spawnedNpc.Y].Type == Enums.TileType.Arena || map.Moral == Enums.MapMoral.None || map.Moral == Enums.MapMoral.NoPenalty) { if (HasAbility(spawnedNpc, "Sand Stream")) { SetMapWeather(map, Enums.Weather.Sandstorm, hitlist); } else if (HasAbility(spawnedNpc, "Snow Warning")) { SetMapWeather(map, Enums.Weather.Hail, hitlist); } else if (HasAbility(spawnedNpc, "Drizzle")) { SetMapWeather(map, Enums.Weather.Raining, hitlist); } else if (HasAbility(spawnedNpc, "Drought")) { SetMapWeather(map, Enums.Weather.Sunny, hitlist); } else if (HasAbility(spawnedNpc, "Air Lock")) { SetMapWeather(map, Enums.Weather.None, hitlist); } else if (HasAbility(spawnedNpc, "Cloud Nine")) { SetMapWeather(map, Enums.Weather.None, hitlist); } } if (HasAbility(spawnedNpc, "Download")) { int totalDef = 0; int totalSpDef = 0; TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, spawnedNpc, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, true, false, false); for (int i = 0; i < targets.Foes.Count; i++) { totalDef += targets.Foes[i].Def; totalSpDef += targets.Foes[i].SpclDef; } if (totalDef < totalSpDef) { ChangeAttackBuff(spawnedNpc, map, 1, hitlist); } else { ChangeSpAtkBuff(spawnedNpc, map, 1, hitlist); } } if (HasAbility(spawnedNpc, "Stench")) { if (map.NpcSpawnWait == null) map.NpcSpawnWait = Core.GetTickCount(); map.NpcSpawnWait = new TickCount(map.NpcSpawnWait.Tick + map.NpcSpawnTime * 500); } if (HasAbility(spawnedNpc, "Illuminate")) { if (map.NpcSpawnWait == null) map.NpcSpawnWait = Core.GetTickCount(); map.NpcSpawnWait = new TickCount(map.NpcSpawnWait.Tick - map.NpcSpawnTime * 500); } //if (MapManager.ActiveMaps[spawnedNpc.MapID].MapType == Enums.MapType.RDungeonMap) { // RDungeonMap map = (RDungeonMap)MapManager.ActiveMaps[spawnedNpc.MapID]; // if (map.RDungeonIndex == 34 && map.RDungeonFloor > 8) { // if (Server.Math.Rand(0, 20) == 0 && !MapContainsNpc(map, 306)) { // foreach(Client n in map.GetClients()) { // StoryManager.PlayStory(n, 185); // } // } // } //} } catch (Exception ex) { Messenger.AdminMsg("Error: OnNpcSpawn", Text.Black); Messenger.AdminMsg(map.Name + " with " + spawnedNpc.Num + " from " + spawnedNpc.MapSlot, Text.Pink); Messenger.AdminMsg(ex.ToString(), Text.Black); } }
public static void HandleItemUse(InventoryItem item, int invNum, BattleSetup setup) { // Prevent hacking if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { if (invNum != -1 && (invNum < 1 || invNum > ((Recruit)setup.Attacker).Owner.Player.MaxInv)) { Messenger.HackingAttempt(((Recruit)setup.Attacker).Owner, "Invalid InvNum"); return; } } if (item.Num < 0 || item.Num >= Items.ItemManager.Items.MaxItems) { if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { Messenger.HackingAttempt(((Recruit)setup.Attacker).Owner, "Invalid ItemNum"); } return; } setup.AttackerMap.ProcessingPaused = false; if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { if (Ranks.IsDisallowed(((Recruit)setup.Attacker).Owner, Enums.Rank.Moniter) || ((Recruit)setup.Attacker).Owner.Player.ProtectionOff) { ((Recruit)setup.Attacker).Owner.Player.Hunted = true; PacketBuilder.AppendHunted(((Recruit)setup.Attacker).Owner, setup.PacketStack); } } if (!(bool)Scripting.ScriptManager.InvokeFunction("CanUseItem", setup, item)) { return; } // Find out what kind of item it is switch (ItemManager.Items[item.Num].Type) { case Enums.ItemType.PotionAddHP: { setup.Attacker.HP += ItemManager.Items[item.Num].Data1; if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { ((Recruit)setup.Attacker).Belly += ItemManager.Items[item.Num].Data2; if (((Recruit)setup.Attacker).Belly > ((Recruit)setup.Attacker).MaxBelly) { ((Recruit)setup.Attacker).Belly = ((Recruit)setup.Attacker).MaxBelly; } PacketBuilder.AppendBelly(((Recruit)setup.Attacker).Owner, setup.PacketStack); if (ItemManager.Items[item.Num].StackCap > 0) { ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 1, true); } else { ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 0, true); } } else { if (invNum != -1) { setup.Attacker.TakeHeldItem(1); } } } break; case Enums.ItemType.PotionAddMP: { for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) { if (setup.Attacker.Moves[i] != null) { setup.Attacker.Moves[i].CurrentPP += ItemManager.Items[item.Num].Data1; if (setup.Attacker.Moves[i].CurrentPP > setup.Attacker.Moves[i].MaxPP) { setup.Attacker.Moves[i].CurrentPP = setup.Attacker.Moves[i].MaxPP; } } } if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { PacketBuilder.AppendPlayerMoves(((Recruit)setup.Attacker).Owner, setup.PacketStack); ((Recruit)setup.Attacker).Belly += ItemManager.Items[item.Num].Data2; if (((Recruit)setup.Attacker).Belly > ((Recruit)setup.Attacker).MaxBelly) { ((Recruit)setup.Attacker).Belly = ((Recruit)setup.Attacker).MaxBelly; } PacketBuilder.AppendBelly(((Recruit)setup.Attacker).Owner, setup.PacketStack); if (ItemManager.Items[item.Num].StackCap > 0) { ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 1, true); } else { ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 0, true); } } else { if (invNum != -1) { setup.Attacker.TakeHeldItem(1); } } } break; case Enums.ItemType.PotionAddBelly: { if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { if (((Recruit)setup.Attacker).Belly < ((Recruit)setup.Attacker).MaxBelly) { ((Recruit)setup.Attacker).MaxBelly += ItemManager.Items[item.Num].Data2; ((Recruit)setup.Attacker).Belly += ItemManager.Items[item.Num].Data1; } else { ((Recruit)setup.Attacker).MaxBelly += ItemManager.Items[item.Num].Data3; ((Recruit)setup.Attacker).Belly += ItemManager.Items[item.Num].Data1; } if (((Recruit)setup.Attacker).MaxBelly > 200) { ((Recruit)setup.Attacker).MaxBelly = 200; } if (((Recruit)setup.Attacker).Belly > ((Recruit)setup.Attacker).MaxBelly) { ((Recruit)setup.Attacker).Belly = ((Recruit)setup.Attacker).MaxBelly; } PacketBuilder.AppendBelly(((Recruit)setup.Attacker).Owner, setup.PacketStack); if (ItemManager.Items[item.Num].StackCap > 0) { ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 1, true); } else { ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 0, true); } } else { if (invNum != -1) { setup.Attacker.TakeHeldItem(1); } } } break; case Enums.ItemType.Key: { if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { int x = 0; int y = 0; IMap map = ((Recruit)setup.Attacker).Owner.Player.GetCurrentMap(); switch (((Recruit)setup.Attacker).Direction) { case Enums.Direction.Up: { if (((Recruit)setup.Attacker).Y > 0) { x = ((Recruit)setup.Attacker).X; y = ((Recruit)setup.Attacker).Y - 1; } else { return; } } break; case Enums.Direction.Down: { if (((Recruit)setup.Attacker).Y < map.MaxY) { x = ((Recruit)setup.Attacker).X; y = ((Recruit)setup.Attacker).Y + 1; } else { return; } } break; case Enums.Direction.Left: { if (((Recruit)setup.Attacker).X > 0) { x = ((Recruit)setup.Attacker).X - 1; y = ((Recruit)setup.Attacker).Y; } else { return; } } break; case Enums.Direction.Right: { if (((Recruit)setup.Attacker).X < map.MaxX) { x = ((Recruit)setup.Attacker).X + 1; y = ((Recruit)setup.Attacker).Y; } else { return; } } break; } // Check if a key exists if (map.Tile[x, y].Type == Enums.TileType.Key) { // Check if the key they are using matches the map key if (item.Num == map.Tile[x, y].Data1) { map.Tile[x, y].DoorOpen = true; map.Tile[x, y].DoorTimer = Core.GetTickCount(); Messenger.SendDataToMap(((Recruit)setup.Attacker).MapID, TcpPacket.CreatePacket("mapkey", x.ToString(), y.ToString(), "1")); if (map.Tile[x, y].String1.Trim() != "") { Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, "A door has been unlocked!", Text.White); } else { Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, map.Tile[x, y].String1.Trim(), Text.White); } Messenger.PlaySoundToMap(((Recruit)setup.Attacker).MapID, "key.wav"); // Check if we are supposed to take the item away if (map.Tile[x, y].Data2 == 1) { ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 0, true); Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, "The key dissolves.", Text.Yellow); } } } if (map.Tile[x, y].Type == Enums.TileType.Door) { map.Tile[x, y].DoorOpen = true; map.Tile[x, y].DoorTimer = Core.GetTickCount(); Messenger.SendDataToMap(((Recruit)setup.Attacker).MapID, TcpPacket.CreatePacket("mapkey", x.ToString(), y.ToString(), "1")); Messenger.PlaySoundToMap(((Recruit)setup.Attacker).MapID, "key.wav"); } } } break; case Enums.ItemType.TM: { // Get the spell num if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) { int n = ItemManager.Items[item.Num].Data1; if (n > 0) { // Make sure they are the right class if (((Recruit)setup.Attacker).CanLearnTMMove(n)) { if (((Recruit)setup.Attacker).CanLearnNewMove()) { if (((Recruit)setup.Attacker).HasMove(n) == false) { ((Recruit)setup.Attacker).LearnNewMove(n); ((Recruit)setup.Attacker).Owner.Player.TakeItemSlot(invNum, 0, true); Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, "You have learned a new move!", Text.White); Messenger.SendPlayerMoves(((Recruit)setup.Attacker).Owner); } else { Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, "You already know this move!", Text.BrightRed); } } else { if (((Recruit)setup.Attacker).HasMove(n) == false) { int itemNum = item.Num; ((Recruit)setup.Attacker).MoveItem = itemNum; ((Recruit)setup.Attacker).LearnNewMove(n); } else { Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, "You already know this move!", Text.BrightRed); } } } else { Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, "You cannot learn this move!", Text.White); } } else { Messenger.PlayerMsg(((Recruit)setup.Attacker).Owner, "There is no move that can be learned. Please inform an admin.", Text.BrightRed); } } } break; case Enums.ItemType.Scripted: { Scripting.ScriptManager.InvokeSub("ScriptedItem", setup, item, invNum); } break; } }
public MapNpc(string mapID, int mapSlot) : base(new DataManager.Maps.MapNpc(mapSlot)) { SpeedLimit = Enums.Speed.Running; Moves = new Players.RecruitMove[4]; for (int i = 0; i < Moves.Length; i++) { Moves[i] = new Players.RecruitMove(RawNpc.Moves[i]); } //if (RawNpc.HeldItem == null) { // HeldItem = null; //} else { // HeldItem = new InventoryItem(RawNpc.HeldItem); //} heldItem = new InventoryItem(RawNpc.HeldItem); VolatileStatus = new ExtraStatusCollection(); for (int i = 0; i < RawNpc.VolatileStatus.Count; i++) { VolatileStatus.Add(new ExtraStatus(RawNpc.VolatileStatus[i])); } MapID = mapID; ActiveItems = new List<int>(); SpeedLimit = Enums.Speed.Running; }
public void MapGetItem() { int i = 0; IMap map = MapManager.RetrieveActiveMap(MapID); for (i = 0; i < Constants.MAX_MAP_ITEMS; i++) { // See if theres even an item here if ((map.ActiveItem[i].Num >= 0) & (map.ActiveItem[i].Num < Items.ItemManager.Items.MaxItems)) { // Check if item is at the same location as the player if ((map.ActiveItem[i].X == X) & (map.ActiveItem[i].Y == Y)) { // Open slot available? if (HeldItem == null) { // Set item in players inventory InventoryItem newItem = new InventoryItem(); newItem.Num = map.ActiveItem[i].Num; newItem.Sticky = map.ActiveItem[i].Sticky; newItem.Tag = map.ActiveItem[i].Tag; if (ItemManager.Items[map.ActiveItem[i].Num].Type == Enums.ItemType.Currency || ItemManager.Items[map.ActiveItem[i].Num].StackCap > 0) { newItem.Amount = map.ActiveItem[i].Value; if (newItem.Amount > ItemManager.Items[map.ActiveItem[i].Num].StackCap) { newItem.Amount = ItemManager.Items[map.ActiveItem[i].Num].StackCap; } } else { newItem.Amount = 0; } GiveItem(newItem); // Erase item from the map ~ done in spawnitemslot map.SpawnItemSlot(i, -1, 0, false, false, "", X, Y, null); Scripting.ScriptManager.InvokeSub("OnPickupItem", this, -1, HeldItem); return; } else { if (map.ActiveItem[i].Num == HeldItem.Num && (ItemManager.Items[map.ActiveItem[i].Num].Type == Enums.ItemType.Currency || ItemManager.Items[map.ActiveItem[i].Num].StackCap > 0)) { HeldItem.Amount += map.ActiveItem[i].Value; if (HeldItem.Amount > ItemManager.Items[map.ActiveItem[i].Num].StackCap) { HeldItem.Amount = ItemManager.Items[map.ActiveItem[i].Num].StackCap; } HeldItem.Sticky = map.ActiveItem[i].Sticky; } } } } } }
public void GiveItem(InventoryItem item) { HeldItem = item; if (!HeldItem.Sticky && MeetsReqs(HeldItem.Num)) { AddToActiveItemList(HeldItem.Num); } }
public void GiveHeldItem(int num, int val, string tag, bool sticky) { InventoryItem newItem = new InventoryItem(); newItem.Num = num; newItem.Amount = val; newItem.Sticky = sticky; newItem.Tag = tag; GiveItem(newItem); }
public void GenerateHeldItem() { //add sticky? List<InventoryItem> possibleDrops = new List<InventoryItem>(); for (int i = 0; i < Constants.MAX_NPC_DROPS; i++) { if (NpcManager.Npcs[Num].Drops[i].ItemNum > 0) { if (NpcManager.Npcs[Num].Drops[i].Chance == 1) { InventoryItem drop = new InventoryItem(); drop.Num = NpcManager.Npcs[Num].Drops[i].ItemNum; drop.Amount = NpcManager.Npcs[Num].Drops[i].ItemValue; drop.Tag = NpcManager.Npcs[Num].Drops[i].Tag; possibleDrops.Add(drop); } else { if (NpcManager.Npcs[Num].Drops[i].Chance > 0) { if (Server.Math.Rand(0, NpcManager.Npcs[Num].Drops[i].Chance + 1) == 0) { InventoryItem drop = new InventoryItem(); drop.Num = NpcManager.Npcs[Num].Drops[i].ItemNum; drop.Amount = NpcManager.Npcs[Num].Drops[i].ItemValue; drop.Tag = NpcManager.Npcs[Num].Drops[i].Tag; possibleDrops.Add(drop); } } } } } if (possibleDrops.Count > 0) { GiveItem(possibleDrops[Server.Math.Rand(0, possibleDrops.Count)]); } }
public void Add(int slot, InventoryItem item) { items.Add(slot, item); }