function UseItem: Boolean;
var temp_rdm : integer; //定义随机数
begin
if This_Player.Level >= 40 then //定义领取等级
begin
if This_Player.FreeBagNum > 1 then //定义包裹剩余
begin
case This_Player.Job of //职业,如果不要职业限制,那就取消 case This_Player.Job of
0:
begin
temp_rdm := random(100); //随机数总数
if (temp_rdm >= 0) and (temp_rdm < 20) then //随机数范围
begin
This_Player.Give('雷霆战戒',1); //给予道具,如果要做全服通知,加一条 ServerSay('玩家<' + This_Player.Name + '>使用XXXX获得 XXXX !', 2);
end else
if (temp_rdm >= 20) and (temp_rdm < 40) then
begin
This_Player.Give('雷霆护腕',1);
end else
if (temp_rdm >= 40) and (temp_rdm < 60) then
begin
This_Player.Give('雷霆项链',1);
end else
if (temp_rdm >= 60) and (temp_rdm < 80) then
begin
This_Player.Give('雷霆腰带',1);
end else
if (temp_rdm >= 80) and (temp_rdm <= 100) then
begin
This_Player.Give('雷霆战靴',1);
end;
end;
1: //职业
begin
temp_rdm := random(100);
if (temp_rdm >= 0) and (temp_rdm < 20) then
begin
This_Player.Give('烈焰魔戒',1);
end else
if (temp_rdm >= 20) and (temp_rdm < 40) then
begin
This_Player.Give('烈焰护腕',1);
end else
if (temp_rdm >= 40) and (temp_rdm < 60) then
begin
This_Player.Give('烈焰腰带',1);
end else
if (temp_rdm >= 60) and (temp_rdm < 80) then
begin
This_Player.Give('烈焰魔靴',1);
end else
if (temp_rdm >= 80) and (temp_rdm <= 100) then
begin
This_Player.Give('烈焰项链',1);
end;
end;
2: //职业
begin
temp_rdm := random(100);
if (temp_rdm >= 0) and (temp_rdm < 20) then
begin
This_Player.Give('光芒道戒',1);
end else
if (temp_rdm >= 20) and (temp_rdm < 40) then
begin
This_Player.Give('光芒护腕',1);
end else
if (temp_rdm >= 40) and (temp_rdm < 60) then
begin
This_Player.Give('光芒项链',1);
end else
if (temp_rdm >= 60) and (temp_rdm < 80) then
begin
This_Player.Give('光芒腰带',1);
end else
if (temp_rdm >= 80) and (temp_rdm <= 100) then
begin
This_Player.Give('光芒道靴',1);
end;
end;
end;
Result := true;
end
else
begin
This_Player.PlayerDialog(
'对不起,包裹空间不足,请预留1个以上再次开启!'
);
Result := false;
end;
end
else
begin
This_Player.PlayerDialog(
'对不起,您的等级尚未达到40级,不能开启礼盒!\'
);
Result := false;
end;
end;
begin
end.
|