装备属性清理示例,具体的根据实际情况修改
program mir2; procedure _DoExit; begin This_Npc.CloseDialog(This_Player); end; function Gaoji0LB18(price, num: Integer):boolean; begin result := true; end; procedure _Exit; begin This_Npc.CloseDialog(This_Player); end; var ck_name : array[1..12] of string; ck_value : array[1..12] of integer; procedure OnInitialize; begin ck_name[1] :='逆火魔盔'; ck_name[2] :='逆火项链'; ck_name[3] :='逆火护腕'; ck_name[4] :='逆火魔戒'; ck_name[5] :='逆火腰带'; ck_name[6] :='逆火魔靴'; ck_name[7] :='逆火魔盔*'; ck_name[8] :='逆火项链*'; ck_name[9] :='逆火护腕*'; ck_name[10] :='逆火魔戒*'; ck_name[11] :='逆火腰带*'; ck_name[12] :='逆火魔靴*'; ck_value[1] :=50; ck_value[2] :=50; ck_value[3] :=50; ck_value[4] :=50; ck_value[5] :=50; ck_value[6] :=50; ck_value[7] :=50; ck_value[8] :=50; ck_value[9] :=50; ck_value[10] :=50; ck_value[11] :=50; ck_value[12] :=50; end; procedure _Checkup; begin This_NPC.Click_CommitItem(This_Player,1,'待清除装备:'); end; procedure CommitItem(AType:word); var i,ck_num,ck_kind,ck_gold,ck_rand:integer; ck_str,ck_red:string; begin ck_gold := 0; //初始化 ck_str := ''; //初始化 ck_red := ''; //初始化
for ck_kind := 1 to 12 do begin if ck_name[ck_kind] = This_Item.ItemName then begin ck_num := This_Item.AddPa1 + This_Item.AddPa2 + This_Item.AddPa3 + This_Item.AddPa4 + This_Item.AddPa5; ck_gold := ck_value[ck_kind]; if (ck_num > 0) and (ck_num < 999) then begin for i:= 1 to ck_num do begin ck_gold := ck_gold; end; end; end; end;
if ck_num <= 0 then begin This_Player.NotifyClientCommitItem(0,'无法清除:你的'+This_Item.ItemName+'已清除所有附加属性!'); end else if ck_gold > 0 then begin if This_Player.YBNum>= ck_gold then begin ck_rand := random(100); if ck_rand < 99 then begin This_Item.AddPa5 := 0; //道术-1 ck_str :='所有'; This_Item.AddPa3 := 0; //攻击-1 ck_str :='所有'; This_Item.AddPa4 := 0; //魔法-1 ck_str :='所有'; This_Item.AddPa2 := 0; //魔御-1 ck_str :='所有'; This_Item.AddPa1 := 0; //防御-1 ck_str :='所有'; end; This_Player.PsYBConsum(This_NPC,'Gaoji0LB18',20151,ck_gold,1); if ck_str <> '' then begin This_Player.NotifyClientCommitItem(0,'清除成功:你的'+This_Item.ItemName+'清除了'+ck_str+'属性!'); This_NPC.NotifyClientUPdBagItem(This_Player,This_Item); end; This_Player.AddLogRec(9, This_Item.ItemName, 811152, ck_gold, ck_str); end else begin This_Player.NotifyClientCommitItem(0,'无法清除:你的元宝不足,需要'+inttostr(ck_gold)+'元宝。'); end; end else begin This_Player.NotifyClientCommitItem(0,'该物品不可清除,请投入可清除的装备!'); end; end; procedure _CheckupRule58; begin This_Player.Flyto('0170',10,20); end; begin This_Npc.NpcDialog(This_Player, '我可以帮你清除还原首饰全部属性哦:|\' +'<每次清除需要50元宝./c=red>|\' +'|{cmd}<开始清除首饰属性/@Checkup> \' +'|{cmd}<返回酒馆/@CheckupRule58> \' ); end. |