41 lines
1.9 KiB
C#
41 lines
1.9 KiB
C#
public class DialogActionRemoveWaypointRebirth : BaseDialogAction
|
|
{
|
|
public override void PerformAction(EntityPlayer player)
|
|
{
|
|
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
|
|
if (!string.IsNullOrEmpty(Value) && Value.ToLower() == "self")
|
|
{
|
|
var entityNPC = uiforPlayer.xui.Dialog.Respondent;
|
|
if (entityNPC != null)
|
|
{
|
|
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
|
|
|
Vector3i blockPosition = World.worldToBlockPos(entityNPC.position);
|
|
|
|
foreach (Waypoint waypoint in primaryPlayer.Waypoints.Collection.list)
|
|
{
|
|
if ((waypoint.pos.x <= blockPosition.x + 2)
|
|
&& (waypoint.pos.x >= blockPosition.x - 2)
|
|
&& (waypoint.pos.y <= blockPosition.y + 2)
|
|
&& (waypoint.pos.y >= blockPosition.y - 2)
|
|
&& (waypoint.pos.z <= blockPosition.z + 2)
|
|
&& (waypoint.pos.z >= blockPosition.z - 2)
|
|
&& waypoint.name.Text.ToLower().Trim() == Localization.Get(entityNPC.EntityClass.entityClassName).ToLower().Trim()
|
|
)
|
|
{
|
|
primaryPlayer.Waypoints.Collection.Remove(waypoint);
|
|
NavObjectManager.Instance.UnRegisterNavObject(waypoint.navObject);
|
|
XUiV_Window window = uiforPlayer.xui.GetWindow("mapTracking");
|
|
if (window != null)
|
|
{
|
|
((XUiC_MapWaypointList)window.Controller.GetChildById("waypointList")).UpdateWaypointsList(null);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|