//检查对面站的是否是一个可结婚的对象
function CheckPoseCreateCanMarry(Player: TPlayObject): Boolean;
var
APoseCreate: TActor;
begin
APoseCreate := Player.PoseCreate; //取得站立在对面的对象
Result := (APoseCreate <> nil) and //如果对象存在
APoseCreate.ISPlayer and //并且是一个玩家
(Player.Gender<>APoseCreate.Gender) and //并且是异性
not Player.Married and //并且是没有结婚的
not TPlayObject(APoseCreate).Married; //并且自己也没结婚
end;
procedure RevMarry(Npc: TNormNpc; Player: TPlayObject; Args: TArgs);
const
S=
[[
{S=<$UserName$>;C=251}:\
{S=<$PoseName$>;C=251}已经向你求婚!你是否愿意嫁给他?\\
<我愿意/@agreeMarry> \\
<我不愿意/@disagreeMarry>
]];
var
AMessage: String;
begin
if CheckPoseCreateCanMarry(Player) then //检查结婚对象
begin
AMessage := ReplaceStr(S, '<$UserName$>', Player.Name); //将消息中的标识位替换成当前玩家的名字
AMessage := ReplaceStr(AMessage, '<$PoseName$>', Player.PoseCreate.Name); //将消息中的标识位替换成当前玩家对面站立的角色的名字
Npc.Say(Player, AMessage); //将消息发给玩家
end;
end;