public void OnTouch(WorldClient c, MabiPC cr, MabiProp pr) { var r = RandomProvider.Get(); var p = _revivalLocations[r.Next(_revivalLocations.Length)]; // Just warp them for now c.Warp(29, p.X, p.Y); }
/// <summary> /// Warps creature to the specified coordinates in the current region. /// If coordinates are ommited, a random location will be used. /// </summary> private CommandResult Command_jump(WorldClient client, MabiCreature creature, string[] args, string msg) { var pos = creature.GetPosition(); uint region = creature.Region; uint x = pos.X, y = pos.Y; if (args.Length > 1 && !uint.TryParse(args[1], out x)) return CommandResult.WrongParameter; if (args.Length > 2 && !uint.TryParse(args[2], out y)) return CommandResult.WrongParameter; if (args.Length == 1) { // Random coordinates. var rndc = MabiData.RegionInfoDb.RandomCoord(region); x = rndc.X; y = rndc.Y; } client.Warp(region, x, y); return CommandResult.Okay; }
private CommandResult Command_go(WorldClient client, MabiCreature creature, string[] args, string msg) { if (args.Length < 2) { Send.ServerMessage(client, creature, Localization.Get("gm.go_dest") + // Destinations: " Tir Chonaill, Dugald Isle, Dunbarton, Gairech, Bangor, Emain Macha, Taillteann, Nekojima, GM Island" ); return CommandResult.WrongParameter; } uint region = 0, x = 0, y = 0; var destination = msg.Substring(args[0].Length + 1).Trim(); if (destination.StartsWith("tir")) { region = 1; x = 12991; y = 38549; } else if (destination.StartsWith("dugald")) { region = 16; x = 23017; y = 61244; } else if (destination.StartsWith("dun")) { region = 14; x = 38001; y = 38802; } else if (destination.StartsWith("gairech")) { region = 30; x = 39295; y = 53279; } else if (destination.StartsWith("bangor")) { region = 31; x = 12904; y = 12200; } else if (destination.StartsWith("emain")) { region = 52; x = 39818; y = 41621; } else if (destination.StartsWith("tail")) { region = 300; x = 212749; y = 192720; } else if (destination.StartsWith("neko")) { region = 600; x = 114430; y = 79085; } else if (destination.StartsWith("gm")) { region = 22; x = 2500; y = 2500; } else { Send.ServerMessage(client, creature, Localization.Get("gm.go_unk")); // Unknown destination. return CommandResult.Fail; } client.Warp(region, x, y); return CommandResult.Okay; }
/// <summary> /// Warps creature to the specified region and coordinates. /// If coordinates are ommited, a random location will be used. /// </summary> private CommandResult Command_warp(WorldClient client, MabiCreature creature, string[] args, string msg) { if (args.Length < 2) return CommandResult.WrongParameter; var pos = creature.GetPosition(); uint region = 0; if (!uint.TryParse(args[1], out region)) { var mapInfo = MabiData.RegionDb.Find(args[1]); if (mapInfo != null) region = mapInfo.Id; else { Send.ServerMessage(client, creature, Localization.Get("gm.warp_region"), args[1]); // Region '{0}' not found. return CommandResult.Fail; } } uint x = pos.X, y = pos.Y; if (args.Length > 2 && !uint.TryParse(args[2], out x)) return CommandResult.WrongParameter; if (args.Length > 3 && !uint.TryParse(args[3], out y)) return CommandResult.WrongParameter; if (args.Length == 2) { // Random coordinates. var rndc = MabiData.RegionInfoDb.RandomCoord(region); x = rndc.X; y = rndc.Y; } client.Warp(region, x, y); return CommandResult.Okay; }
private IEnumerable Warp(WorldClient c, string location) { uint region = 0, x = 0, y = 0; switch(location) { case "@neko": region = 600; x = 93757; y = 88234; break; case "@moon": region = 1003; x = 7058; y = 6724; break; case "@soul": region = 1000; x = 6368; y = 7150; break; case "@tir": region = 1; x = 12991; y = 38549; break; case "@dun": region = 14; x = 38001; y = 38802; break; case "@bangor": region = 31; x = 12904; y = 12200; break; case "@emain": region = 52; x = 39818; y = 41621; break; case "@tail": region = 300; x = 212749; y = 192720; break; case "@tara": region = 401; x = 99793; y = 91209; break; case "@cobh": region = 23; x = 28559; y = 37693; break; case "@ceo": region = 56; x = 8743; y = 9299; break; case "@quilla": region = 3001; x = 166562; y = 168930; break; case "@filia": region = 3100; x = 373654; y = 424901; break; case "@vales": region = 3200; x = 289556; y = 211936; break; case "@cor": region = 3300; x = 254233; y = 186929; break; case "@calida": region = 3400; x = 328825; y = 176094; break; case "@cross": region = 51; x = 10410; y = 10371; break; case "@tir_a": region = 35; x = 12801; y = 38380; break; case "@bangor_a": region = 84; x = 12888; y = 7986; break; case "@gairech_a": region = 83; x = 38405; y = 47366; break; case "@belvast": region = 4005; x = 63373; y = 26475; break; case "@avon": region = 501; x = 64195; y = 63211; break; case "@falias": region = 500; x = 11839; y = 23832; break; // Unknown location, just cancel. default: Close(c); Stop(); break; } Msg(c, "You will be teleported now, see you on the other side!", Button("Okay")); var r = Select(c); c.Warp(region, x, y); Close(c); }
private void HandleMoonGateUse(WorldClient client, MabiPacket packet) { var character = client.GetCreatureOrNull(packet.Id) as MabiPC; if(character == null) goto L_Fail; var source = packet.GetString(); var target = packet.GetString(); // Check gates MoonGate sGate, tGate; _gates.TryGetValue(source, out sGate); _gates.TryGetValue(target, out tGate); if (sGate == null || tGate == null || sGate.Prop.State == "closed") goto L_Fail; // Check range to source if (character.Region != sGate.Region || !WorldManager.InRange(character, sGate.X, sGate.Y, 1000)) goto L_Fail; // Check if char has target if (!character.Keywords.Contains(tGate.KeywordId) && !_freeRoaming && !character.Keywords.Contains(10142)) goto L_Fail; client.Warp(tGate.Region, tGate.X, tGate.Y); client.Send(new MabiPacket(Op.MoonGateUseR, client.Character.Id).PutByte(true)); return; L_Fail: client.Send(new MabiPacket(Op.MoonGateUseR, client.Character.Id).PutByte(false)); }