用于战神引擎的全服悬赏/求购装备或物品的脚本,玩家也不需要在线喊话或者摆摊出售,直接可以通过NPC发布求购或者悬赏的信息,玩家与玩家之间不需要做任何交流,直接出售和交易即可。也不占用玩家摆摊的时间。
部分脚本
procedure _jiesuan(id:string); var wpidx,oname,bname,lname,mtype,state,lqzt,jpstr,wpname:string; wgold,wpnum,i,ppos:integer; begin state:=ReadIniSectionStr('悬赏求购.txt',id,'悬赏状态'); oname:=ReadIniSectionStr('悬赏求购.txt',id,'卖家'); bname:=ReadIniSectionStr('悬赏求购.txt',id,'买家'); mtype:=ReadIniSectionStr('悬赏求购.txt',id,'货币类型'); wpname:=ReadIniSectionStr('悬赏求购.txt',id,'物品名'); wpnum:=StrToIntDef(ReadIniSectionStr('悬赏求购.txt',id,'物品数量'),1); wgold:=StrToIntDef(ReadIniSectionStr('悬赏求购.txt',id,'收购价'),0); lqzt:=ReadIniSectionStr('悬赏求购.txt',id,'领取状态'); if state = '已成交' then begin if This_Player.Name = oname then //卖家结算 begin if mtype = '金币' then This_Player.AddGold(wgold*(100-pm_cost) div 100); if mtype = '元宝' then This_Player.ScriptRequestAddYBNum(wgold*(100-pm_cost) div 100); if mtype = '灵符' then This_Player.AddLF(0,wgold*(100-pm_cost) div 100); if mtype =pm_wphb then This_Player.Give(pm_wphb,wgold*(100-pm_cost) div 100); WriteIniSectionStr('悬赏求购.txt',id,'卖家',(oname+' 已结算 '+MirDateTimeToStr('MM-dd hh:mm' , GetNow))); This_Player.PlayerNotice(oname+' 已结算 '+MirDateTimeToStr('MM-dd hh:mm' , GetNow),3); end else begin if This_Player.Name = bname then //买家结算 begin if (length(lqzt) <=0) then begin if This_Player.FreeBagNum >= 3 then begin for i:=1 to pm_limit do begin wpidx:=ReadIniSectionStr('悬赏求购.txt','物品'+inttostr(i),This_Player.Name); if wpidx=id then begin WriteIniSectionStr('悬赏求购.txt','物品'+inttostr(i),This_Player.Name,''); //删除文本关联记录 end end; This_Player.Give(wpname,wpnum); WriteIniSectionStr('悬赏求购.txt',id,'领取状态','已领取'); dellist(id); _myinfo; end else begin This_Player.PlayerNotice('请至少预留出3个以上的背包空格再领取!',0); exit; end; end end end end end; procedure _sold(id:string); var wpname,mtype,wpstate:string;wpgold,wpnum:integer; begin wpname:=ReadIniSectionStr('悬赏求购.txt',id,'物品名'); mtype:=ReadIniSectionStr('悬赏求购.txt',id,'货币类型') wpgold:=StrToIntDef(ReadIniSectionStr('悬赏求购.txt',id,'收购价'),0); wpnum:=StrToIntDef(ReadIniSectionStr('悬赏求购.txt',id,'物品数量'),1); wpstate:=ReadIniSectionStr('悬赏求购.txt',id,'悬赏状态'); if wpstate = '悬赏中' then begin This_Npc.NpcDialog(This_Player,'你将以<'+inttostr(wpgold)+mtype+'/fcolor=254>的价格卖出<'+inttostr(wpnum)+'个'+wpname+'>,交易成功将获得<'+inttostr(wpgold*(100-pm_cost) div 100)+mtype+'/fcolor=250>(<手续费'+inttostr(pm_cost)+'%/fcolor=247>),是否继续?|{cmd}<确认售出/@sold_ok~'+id+'> ^<返回大厅/@main>'); end end; procedure _sold_ok(id:string); var wpname,mtype,wpstate:string;wpgold,wpnum:integer; begin wpname:=ReadIniSectionStr('悬赏求购.txt',id,'物品名'); mtype:=ReadIniSectionStr('悬赏求购.txt',id,'货币类型') wpgold:=StrToIntDef(ReadIniSectionStr('悬赏求购.txt',id,'收购价'),0); wpnum:=StrToIntDef(ReadIniSectionStr('悬赏求购.txt',id,'物品数量'),1); wpstate:=ReadIniSectionStr('悬赏求购.txt',id,'悬赏状态'); if wpstate = '悬赏中' then begin if This_Player.GetBagItemCount(wpname) >= wpnum then begin This_Player.Take(wpname,wpnum); if mtype=pm_wphb then begin if This_Player.FreeBagNum <= 0 then begin This_Player.PlayerNotice('背包已满,请至少空出一个格子!',0); exit; end end WriteIniSectionStr('悬赏求购.txt',id,'悬赏状态','已成交'); WriteIniSectionStr('悬赏求购.txt',id,'卖家',This_Player.Name); _jiesuan(id); recode(id); // dellist(id);//删除悬赏列表 This_Player.PlayerNotice('卖出'+inttostr(wpnum)+'个'+wpname+',获得了'+inttostr(wpgold)+mtype,2); _dating('1'); end else This_Player.PlayerNotice('你并没有'+inttostr(wpnum)+'个'+wpname+'!',0); end else This_NPC.NpcDialog(This_Player,'下手晚了,该条悬赏已经不存在!{cmd}<返回/@main>'); end; procedure _donelog(ipage:string); var donelog:array [1..102] of string; j:integer;donerec,donecmd:string; begin donerec:=''; for j:=1+(strtoint(ipage)-1)*10 to strtoint(ipage)*10 do begin donelog[j]:=ReadIniSectionStr('悬赏求购.txt','历史记录',inttostr(j)); if length(donelog[j]) > 0 then begin donerec:=donerec +donelog[j]+'|'; end end if length(donelog[100]) > 0 then begin for j:=1+(strtoint(ipage)-1)*10 to strtoint(ipage)*10 do begin donelog[j]:=donelog[j+1]; end end donecmd:='|{cmd}<下一页/@donelog~'+inttostr(strtoint(ipage)+1)+'> ^<返回大厅/@main>' if strtoint(ipage) > 1 then donecmd:='|{cmd}<上一页/@donelog~'+inttostr(strtoint(ipage)-1)+'> ^<下一页/@donelog~'+inttostr(strtoint(ipage)+1)+'> ^<返回大厅/@main>' This_Npc.NpcDialog(This_Player, '|^<悬赏行/fcolor=241> <历史行情/fcolor=250>^^' +'|<————————————————————/fcolor=247>|' +donerec +'<————————————————————/fcolor=247>' +'|<最多显示100条记录/fcolor=242>' +donecmd ); end; begin if GetG(111,11) < 100000 then SetG(111,11,100000); _dating('1'); end.