Esempio n. 1
0
    private void RebirthEventReceivePotion(ChannelClient client, Packet packet)
    {
        var entityId = packet.GetLong();
        var creature = client.GetCreatureSafe(packet.Id);

        if (!IsEventActive("new_rebirth_event"))
        {
            Send.MsgBox(creature, L("The event is over."));
            return;
        }

        var duration      = PlayTimeNeeded;
        var startPlayTime = (long)creature.Vars.Perm[StartPlayTimeVar];
        var pastPlayTime  = TimeSpan.FromSeconds(creature.PlayTime - startPlayTime);

        if (pastPlayTime < duration)
        {
            Send.MsgBox(creature, L("The time isn't over yet."));
            return;
        }

        creature.AcquireItem(Item.Create(RebirthPotion));

        ResetStart(creature);
        SendRebirthEventInfo(creature);
    }
Esempio n. 2
0
    private void HandleMoonGateUse(ChannelClient client, Packet packet)
    {
        var origin      = packet.GetString();
        var destination = packet.GetString();

        var creature = client.GetCreatureSafe(packet.Id);

        var success = UseMoonGate(creature, origin, destination);

        SendMoonGateUseR(creature, success);
    }
Esempio n. 3
0
	private void RebirthEventInfoRequest(ChannelClient client, Packet packet)
	{
		var entityId = packet.GetLong();
		var creature = client.GetCreatureSafe(packet.Id);

		if (!IsEventActive("new_rebirth_event"))
		{
			Send.MsgBox(creature, L("The event is over."));
			return;
		}

		if (creature.Vars.Perm[StartPlayTimeVar] == null)
			return;

		SendRebirthEventInfo(creature);
	}
Esempio n. 4
0
    private void RebirthEventInfoRequest(ChannelClient client, Packet packet)
    {
        var entityId = packet.GetLong();
        var creature = client.GetCreatureSafe(packet.Id);

        if (!IsEventActive("new_rebirth_event"))
        {
            Send.MsgBox(creature, L("The event is over."));
            return;
        }

        if (creature.Vars.Perm[StartPlayTimeVar] == null)
        {
            return;
        }

        SendRebirthEventInfo(creature);
    }
Esempio n. 5
0
	private void HandleMoonGateInfoRequest(ChannelClient client, Packet packet)
	{
		var creature = client.GetCreatureSafe(packet.Id);

		SendMoonGateInfoRequestR(creature, currentGateKeyword, nextGateKeyword);
	}
Esempio n. 6
0
	private void HandleMoonGateUse(ChannelClient client, Packet packet)
	{
		var origin = packet.GetString();
		var destination = packet.GetString();

		var creature = client.GetCreatureSafe(packet.Id);

		var success = UseMoonGate(creature, origin, destination);

		SendMoonGateUseR(creature, success);
	}
Esempio n. 7
0
    private void HandleMoonGateInfoRequest(ChannelClient client, Packet packet)
    {
        var creature = client.GetCreatureSafe(packet.Id);

        SendMoonGateInfoRequestR(creature, currentGateKeyword, nextGateKeyword);
    }
Esempio n. 8
0
	private void MoonGateUse(ChannelClient client, Packet packet)
	{
		var origin = packet.GetString();
		var destination = packet.GetString();

		var creature = client.GetCreatureSafe(packet.Id);

		// Check gates
		MoonGate originGate, destinationGate;
		if (!gatesStr.TryGetValue(origin, out originGate) || !gatesStr.TryGetValue(destination, out destinationGate))
		{
			Send.Notice(creature, Localization.Get("This moon gate is currently not operable. Please report."));
			return;
		}

		// Check origin gate
		if (originGate.Prop.State == "closed")
		{
			// Don't log, someone could be waiting with the map open and
			// select a destination too late.
			SendMoonGateUseR(creature, false);
			return;
		}

		// Check range to origin gate
		if (creature.RegionId != originGate.Prop.Info.Region || !creature.GetPosition().InRange(originGate.Prop.GetPosition(), 1000))
		{
			// Could happen due to desync? The range at least.
			SendMoonGateUseR(creature, false);
			return;
		}

		// Check if char has target
		if (!CanUseGate(creature, destinationGate))
		{
			Log.Warning("MoongateScript.MoonGateUse: Creature '{0:X16}' tried to warp to moon gate that he can't use.", creature.EntityId);
			SendMoonGateUseR(creature, false);
			return;
		}

		creature.Warp(destinationGate.Prop.GetLocation());

		SendMoonGateUseR(creature, true);
	}
Esempio n. 9
0
	private void RebirthEventReceivePotion(ChannelClient client, Packet packet)
	{
		var entityId = packet.GetLong();
		var creature = client.GetCreatureSafe(packet.Id);

		if (!IsEventActive("new_rebirth_event"))
		{
			Send.MsgBox(creature, L("The event is over."));
			return;
		}

		var duration = PlayTimeNeeded;
		var startPlayTime = (long)creature.Vars.Perm[StartPlayTimeVar];
		var pastPlayTime = TimeSpan.FromSeconds(creature.PlayTime - startPlayTime);
		if (pastPlayTime < duration)
		{
			Send.MsgBox(creature, L("The time isn't over yet."));
			return;
		}

		creature.AcquireItem(Item.Create(RebirthPotion));

		ResetStart(creature);
		SendRebirthEventInfo(creature);
	}