public override bool CheckRequirement(EntityPlayer player) { LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal); // The respondent is an EntityNPC, and we don't have that. Check for the patch scripted otherEntitySDX. Entity respondent = uiforPlayer.xui.Dialog.Respondent; if (respondent == null) { respondent = uiforPlayer.xui.Dialog.otherEntitySDX; } if (respondent != null) { EntityAliveSDX myEntity = player.world.GetEntity(respondent.entityId) as EntityAliveSDX; if (myEntity != null) { bool isTame = false; if (base.Value.EqualsCaseInsensitive("not")) { isTame = !myEntity.isTame(player); } else { isTame = myEntity.isTame(player); } return(isTame); } } return(false); }
public override void OnOpen() { if (base.xui.Dialog.Respondent != null) { EntityAliveSDX myEntity = base.xui.Dialog.Respondent as EntityAliveSDX; if (myEntity == null) { myEntity = base.xui.Dialog.otherEntitySDX as EntityAliveSDX; } if (myEntity) { if (myEntity.isTame(base.xui.playerUI.entityPlayer)) { return; } } } base.OnOpen(); base.RefreshBindings(false); }