示例#1
0
    private void RegisterGate(string name, string keyword, string fullName)
    {
        // Get prop
        // The moon gate props are client props, they are added to the world
        // on startup and they can't be removed.
        var prop = ChannelServer.Instance.World.GetProp(fullName);

        if (prop == null)
        {
            Log.Error("MoonGateScript: Prop '{0}' not found.", fullName);
            return;
        }

        // Get keyword data for id
        var keywordData = AuraData.KeywordDb.Find(keyword);

        if (keywordData == null)
        {
            Log.Error("MoonGateScript: Unknown keyword '{0}'.", keyword);
            return;
        }

        // Open map window when prop is clicked
        prop.Behavior = MoonGateBehavior;

        // Save gate
        var gate = new MoonGate(name, keyword, keywordData.Id, prop);

        gates.Add(prop.EntityId, gate);
        gatesStr.Add(keyword, gate);
    }
示例#2
0
    private bool CanWarpTo(Creature creature, MoonGate gate)
    {
        if (!IsEnabled("MoonTunnel"))
        {
            return(true);
        }

        var freeRoaming = (FreeRoaming || creature.HasKeyword("freemoongate"));

        return(freeRoaming || creature.HasKeyword(gate.Keyword));
    }
示例#3
0
    private void SendMoonGateMap(Creature creature, MoonGate fromGate, IEnumerable <MoonGate> gates)
    {
        var packet = new Packet(Op.MoonGateMap, creature.EntityId);

        packet.PutInt(2);
        packet.PutString(fromGate.Keyword);
        packet.PutByte((byte)gates.Count());
        foreach (var gate in gates)
        {
            packet.PutUShort((ushort)gate.KeywordId);
            packet.PutByte(1);
            packet.PutInt(gate.Prop.Info.Region);
            packet.PutInt((int)gate.Prop.Info.X);
            packet.PutInt((int)gate.Prop.Info.Y);
        }

        creature.Client.Send(packet);
    }
示例#4
0
	private void SendMoonGateMap(Creature creature, MoonGate fromGate, IEnumerable<MoonGate> gates)
	{
		var packet = new Packet(Op.MoonGateMap, creature.EntityId);

		packet.PutInt(2);
		packet.PutString(fromGate.Keyword);
		packet.PutByte((byte)gates.Count());
		foreach (var gate in gates)
		{
			packet.PutUShort((ushort)gate.KeywordId);
			packet.PutByte(1);
			packet.PutInt(gate.Prop.Info.Region);
			packet.PutInt((int)gate.Prop.Info.X);
			packet.PutInt((int)gate.Prop.Info.Y);
		}

		creature.Client.Send(packet);
	}
示例#5
0
	private bool CanWarpTo(Creature creature, MoonGate gate)
	{
		if (!IsEnabled("MoonTunnel"))
			return true;

		var freeRoaming = (FreeRoaming || creature.Keywords.Has("freemoongate"));
		return (freeRoaming || creature.Keywords.Has(gate.Keyword));
	}
示例#6
0
	private void RegisterGate(string name, string keyword, string fullName)
	{
		// Get prop
		// The moon gate props are client props, they are added to the world
		// on startup and they can't be removed.
		var prop = ChannelServer.Instance.World.GetProp(fullName);
		if (prop == null)
		{
			Log.Error("MoonGateScript: Prop '{0}' not found.", fullName);
			return;
		}

		// Get keyword data for id
		var keywordData = AuraData.KeywordDb.Find(keyword);
		if (keywordData == null)
		{
			Log.Error("MoonGateScript: Unknown keyword '{0}'.", keyword);
			return;
		}

		// Open map window when prop is clicked
		prop.Behavior = MoonGateBehavior;

		// Save gate
		var gate = new MoonGate(name, keyword, keywordData.Id, prop);
		gates.Add(prop.EntityId, gate);
		gatesStr.Add(keyword, gate);
	}
示例#7
0
	private void RegisterGate(string keyword, long entityId)
	{
		// Get prop
		// The moon gate props are client props, they are added to the world
		// on startup and they can't be removed.
		var prop = ChannelServer.Instance.World.GetProp(entityId);
		if (prop == null)
		{
			Log.Error("MoongateScript: Prop '{0:X16}' not found.", entityId);
			return;
		}

		// Get keyword data for id
		var keywordData = AuraData.KeywordDb.Find(keyword);
		if (keywordData == null)
		{
			Log.Error("MoongateScript: Unknown keyword '{0}'.", keyword);
			return;
		}

		prop.State = ErinnTime.Now.IsNight || AlwaysOpen ? "open" : "closed";

		// Open map window when prop is clicked
		SetPropBehavior(entityId, OpenMapWindow);

		// Save gate
		var gate = new MoonGate(keyword, keywordData.Id, prop);
		gates.Add(entityId, gate);
		gatesStr.Add(keyword, gate);
	}
示例#8
0
	private bool CanUseGate(Creature creature, MoonGate gate)
	{
		var freeRoaming = (FreeRoaming || creature.Keywords.Has("freemoongate"));
		return (freeRoaming || creature.Keywords.Has(gate.Keyword));
	}