属性提取和转移Npc脚本

用于战神引擎玩家把自己的装备属性提取和转移Npc脚本。

属性提取和转移Npc脚本

属性提取和转移Npc脚本

部分脚本

	begin 
		if state='可提取' then //属性转移
		begin
			if This_Player.YBNum >= 0 then
			begin
				kind:=ReadIniSectionStr('qq1797962565.txt',This_Player.Name,'装备类别');
				wpname:=ReadIniSectionStr('qq1797962565.txt',This_Player.Name,'源装备');//源物品名称
				wlv1:=getf(getb(getb(getb(getb(getb(getb(getjlitem(wpname))))))));
				wlv2:=getb(getb(getb(getb(getb(getb(getb(getb(getjlitem(wpname)))))))));
				if (kind = lx) and ((pa[6] = wlv1) or (pa[6]=wlv2))then //判断类型是否一致
				begin
					for i := 1 to 7 do
					begin
						astr:=ReadIniSectionStr('qq1797962565.txt',This_Player.Name,'属性'+inttostr(i));
						abil[i]:=getf(astr);  //读取属性备注
						anum[i]:=StrtoIntDef(getb(getb(astr)),0);//读取属性值
					end
					if kou = 666 then 
					begin
					if (This_Player.YBNum < 20) then begin This_Npc.NpcDialog(This_Player,'你的元宝不足!'); exit; end; This_Player.ScriptRequestSubYBNum(20); if anum[1] >=1 then This_Item.AddPa1:=anum[1];
					if anum[2] >=1 then This_Item.AddPa2:=anum[2];
					if anum[3] >=1 then This_Item.AddPa3:=anum[3];
					if anum[4] >=1 then This_Item.AddPa4:=anum[4];
					if anum[5] >=1 then This_Item.AddPa5:=anum[5];
					end else
					begin ///免费方式
					if anum[1] >=1 then 
					begin
					if random(10) = 0 then 
					begin//30%几率减去1点
					This_Item.AddPa1:=anum[1];
					end else
					This_Item.AddPa1:=anum[1]-1;
					end;
					if anum[2] >=1 then
					begin
					if random(10) = 0 then 
					begin//30%几率减去1点
					This_Item.AddPa2:=anum[2];
					end else
					This_Item.AddPa2:=anum[2]-1;
					end;
					if anum[3] >=1 then 
					begin
					if random(10) = 0 then 
					begin//30%几率减去1点
					This_Item.AddPa3:=anum[3];
					end else
					This_Item.AddPa3:=anum[3]-1;
					end;
					if anum[4] >=1 then 
					begin
					if random(10) = 0 then
					begin//30%几率减去1点
					This_Item.AddPa4:=anum[4];
					end else
					This_Item.AddPa4:=anum[4]-1;
					end;
					if anum[5] >=1 then 
					begin
					if random(10) = 0 then 
					begin//30%几率减去1点
					This_Item.AddPa5:=anum[5];
					end else
					This_Item.AddPa5:=anum[5]-1;
					end;
					end;
					if (lx = '项链') then begin 
					This_Item.AddPa1:=shuxing1;
					This_Item.AddPa2:=shuxing2;
					end;
					if (lx = '武器') then begin 
					This_Item.AddPa4:=shuxing4;
					This_Item.AddPa5:=shuxing5;
					end;
					WriteIniSectionStr('qq1797962565.txt',This_Player.Name,'提取状态','已提取 '+MirDateTimeToStr('MM-dd hh:mm' , GetNow)); //提取状态改变
					This_Player.NotifyClientCommitItem(0,'属性转移成功!');
					This_NPC.NotifyClientUPdBagItem(This_Player,This_Item);
					domain;
				end else
				begin
				if wlv2 <> '' then begin
					This_Player.NotifyClientCommitItem(0,'只能放入《'+kind+'》类型的装备或你提供的装备不是《'+wlv1+'》或《'+wlv2+'》层次装备!');
				end else begin
					This_Player.NotifyClientCommitItem(0,'只能放入《'+kind+'》类型的装备或你提供的装备不是《'+wlv1+'》层次装备!');
				end;
					This_NPC.NotifyClientUPdBagItem(This_Player,This_Item);		
					This_NPC.Click_CommitItem(This_Player,1,'请放入'+kind+':');
				end
			end else
			begin
				This_Player.NotifyClientCommitItem(0,'转移属性需要'+inttostr(jl_gold)+'元宝!');
				This_NPC.NotifyClientUPdBagItem(This_Player,This_Item);		
				This_NPC.Click_CommitItem(This_Player,1,'请放入'+kind+':');
			end
		end else //属性提取
		begin
				bnum[1]:=This_Item.AddPa1;
				bnum[2]:=This_Item.AddPa2;
				bnum[3]:=This_Item.AddPa3;
				bnum[4]:=This_Item.AddPa4;
				bnum[5]:=This_Item.AddPa5;
				bnum[6]:=0;
				bnum[7]:=0;
				if (bnum[1] >=11) or (bnum[2] >=11) or (bnum[3] >=11) or (bnum[4] >=11) or (bnum[5] >=11)then begin 
				This_Npc.NpcDialog(This_Player,'极品属性超过10的物品我还没有能力提取!');
				exit;end;
			if bnum[1]+bnum[2]+bnum[3]+bnum[4]+bnum[5] > 0 then
			begin
				This_Item.AddPa1:=0;
				This_Item.AddPa2:=0;
				This_Item.AddPa3:=0;
				This_Item.AddPa4:=0;
				This_Item.AddPa5:=0;
			if (lx = '项链') then begin 
			This_Item.AddPa1:=shuxing1;
			This_Item.AddPa2:=shuxing2;
			bnum[1]:=0;bnum[2]:=0;
			end;
			if (lx = '武器') then begin 
			This_Item.AddPa4:=shuxing4;
			This_Item.AddPa5:=shuxing5;
			bnum[4]:=0;bnum[5]:=0;
			end;
				for i:=1 to 7 do
				begin
				WriteIniSectionStr('qq1797962565.txt',This_Player.Name,'属性'+inttostr(i),pa[i]+','+inttostr(bnum[i]));//写极品值
				end
				WriteIniSectionStr('qq1797962565.txt',This_Player.Name,'提取状态','可提取');
				WriteIniSectionStr('qq1797962565.txt',This_Player.Name,'装备类别',lx);
				WriteIniSectionStr('qq1797962565.txt',This_Player.Name,'源装备',This_Item.ItemName);
				This_Player.NotifyClientCommitItem(0,'极品值提取成功!');
				This_NPC.NotifyClientUPdBagItem(This_Player,This_Item);					
				domain;
			end else
			begin
				This_Player.NotifyClientCommitItem(0,'这件装备没有极品属性!');
				This_NPC.NotifyClientUPdBagItem(This_Player,This_Item);		
				This_NPC.Click_CommitItem(This_Player,1,'放入要提取的装备:');	
			end
		end;
	end;
end;
begin
domain;
end.
分享到:
赞(0)