|
Система торговли, взято с http://forum.spherecommunity.net |
|
|
KonstantiN |
25.11.2012, 15:38
|
Группа: Пользователи Наличность: 0
Пользователь №: 6.583
|
Обновленный скрипт от 7 числа этого месяца Код [comment information] This script allows you to add 'tag.override.value' to any item in-game to modify the value of an item sold on a vendor.
Installation:
Open speakshopkeep.scp and replace the BUY command with NEW_BUY and the SELL command with NEW_SELL.
Enjoy.
[defname defnames_shop_sell] vendor_limit_sell 25 //amount of items displayed in the sell list vendor_limit_buy 25 //amount of items displayed in the buy list
vendor_limit_names 25 //limit of characters of items names in vendor list
[function new_buy] if (<src.ischar>) if (<src.isplayer>) if !(<src.tag0.new_buysell>) src.tag.new_buysell=1 src.timerf 1, tag.new_buysell= buy updatex src.timerf 1, f_packet_0x09e 0, <uid> endif endif endif
[function new_sell] if (<src.ischar>) if (<src.isplayer>) if !(<src.tag0.new_buysell>) src.tag.new_buysell=1 src.timerf 1, tag.new_buysell= sell updatex src.timerf 1, f_packet_0x09e 1, <uid> endif endif endif
[function f_packet_0x09e] if (<uid.<argn2>.ischar>) if (<uid.<argn2>.npc>==brain_vendor) ctag.buysell=<argn1> if (<dargn1>==1) if (<uid.<argn2>.findlayer.28.rescount>) forcont <findlayer.21> if (<uid.<argn2>.findlayer.28.findid.<baseid>>) if (<tag0.override.value>) || (<value>) if (<dlocal.x> < <ddef0.vendor_limit_sell>) local.x += 1 local.uid<dlocal.x>=<uid> local.uid<dlocal.x>.amount=<amount> if (<tag0.override.value>) local.uid<dlocal.x>.value=<tag0.override.value> else local.uid<dlocal.x>.value=<value> endif endif endif endif endfor if (<local.x>) for x 1 <local.x> if (strmatch(<local.packet>,0)) local.packet=d<local.uid<dlocal.x>>
w<uid.<local.uid<dlocal.x>>.dispiddec> w<uid.<local.uid<dlocal.x>>.color> w<uid.<local.uid<dlocal.x>>.amount>
w<uid.<local.uid<dlocal.x>>.value> w<qval <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ?
<eval strlen(<uid.<local.uid<dlocal.x>>.name>)>:<ddef0.vendor_limit_names>> <qval <eval strlen
(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ? <asc <uid.<local.uid<dlocal.x>>.name>>:<strsub 0
<ddef0.vendor_limit_names> <asc <uid.<local.uid<dlocal.x>>.name>>>> else local.packet=<local.packet> d<local.uid<dlocal.x>>
w<uid.<local.uid<dlocal.x>>.dispiddec> w<uid.<local.uid<dlocal.x>>.color> w<uid.<local.uid<dlocal.x>>.amount>
w<uid.<local.uid<dlocal.x>>.value> w<qval <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ?
<eval strlen(<uid.<local.uid<dlocal.x>>.name>)>:<ddef0.vendor_limit_names>> <qval <eval strlen
(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ? <asc <uid.<local.uid<dlocal.x>>.name>>:<strsub 0
<ddef0.vendor_limit_names> <asc <uid.<local.uid<dlocal.x>>.name>>>> endif local.packetlength += <eval <qval <eval strlen
(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ? <eval strlen(<uid.<local.uid<dlocal.x>>.name>)
>:<ddef0.vendor_limit_names>> +14> endfor if (<dlocal.x> > 5) uid.<argn2>.speak You have many items I am interested in. else uid.<argn2>.speak What would you like to sell? endif sendpacket 09e w<eval <local.packetlength> +9> d<argn2> w<local.x> <local.packet> else uid.<argn2>.speak Sorry you have nothing of interest. endif else uid.<argn2>.speak Sorry I am not buying any items at this time. endif else if (<uid.<argn2>.findlayer.26.rescount>) forcont <uid.<argn2>.findlayer.26> if (<tag0.override.value>) || (<value>) if (<dlocal.x> < <ddef0.vendor_limit_buy>) local.x += 1 local.uid<dlocal.x>=<uid> if (<tag0.override.value>) local.uid<dlocal.x>.value=<tag0.override.value> else local.uid<dlocal.x>.value=<value> endif endif endif endfor forcont <uid.<argn2>.findlayer.27> if (<tag0.override.value>) || (<value>) if (<dlocal.x> < <ddef0.vendor_limit_buy>) local.x += 1 local.uid<dlocal.x>=<uid> if (<tag0.override.value>) local.uid<dlocal.x>.value=<tag0.override.value> else local.uid<dlocal.x>.value=<value> endif endif endif endfor if (<local.x>) for x 1 <local.x> if (strmatch(<local.packet>,0)) local.packet=d<local.uid<dlocal.x>>
w<uid.<local.uid<dlocal.x>>.dispiddec> w<uid.<local.uid<dlocal.x>>.color> w<uid.<local.uid<dlocal.x>>.amount>
w<uid.<local.uid<dlocal.x>>.value> w<qval <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ?
<eval strlen(<uid.<local.uid<dlocal.x>>.name>)>:<ddef0.vendor_limit_names>> <qval <eval strlen
(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ? <asc <uid.<local.uid<dlocal.x>>.name>>:<asc <strsub 0
<ddef0.vendor_limit_names> <uid.<local.uid<dlocal.x>>.name>>>> else local.packet=<local.packet> d<local.uid<dlocal.x>>
w<uid.<local.uid<dlocal.x>>.dispiddec> w<uid.<local.uid<dlocal.x>>.color> w<uid.<local.uid<dlocal.x>>.amount>
w<uid.<local.uid<dlocal.x>>.value> w<qval <eval strlen(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ?
<eval strlen(<uid.<local.uid<dlocal.x>>.name>)>:<ddef0.vendor_limit_names>> <qval <eval strlen
(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ? <asc <uid.<local.uid<dlocal.x>>.name>>:<asc <strsub 0
<ddef0.vendor_limit_names> <uid.<local.uid<dlocal.x>>.name>>>> endif local.packetlength += <eval <qval <eval strlen
(<uid.<local.uid<dlocal.x>>.name>)> < <ddef0.vendor_limit_names> ? <eval strlen(<uid.<local.uid<dlocal.x>>.name>)
>:<ddef0.vendor_limit_names>> +14> endfor if (<dlocal.x> > 5) uid.<argn2>.speak I have many goods for sale. else uid.<argn2>.speak What would you like yo buy? endif ctag.buysell= sendpacket 09e w<eval <local.packetlength> +9> d<argn2> w<local.x> <local.packet> else uid.<argn2>.speak Sorry I do not have any items in stock at this time. endif else uid.<argn2>.speak Sorry I am not selling any items at this time. endif endif endif endif return 1
[function f_packet_0x9f] ref1=<local.char> ref2=((<local.6> | (<local.5> * 256)) | (( <local.4> | (<local.3> * 256)) * 65536)) for x 1 <local.8> local.item<dlocal.x>=((<local.<eval <local.item> +12>> | (<local.<eval <local.item> +11>> * 256)) | ((
<local.<eval <local.item> +10>> | (<local.<eval <local.item> +9>> * 256)) * 65536)) local.item<dlocal.x>.amount=(<local.<eval <local.item> +13>> | <local.<eval <local.item> +14>>) local.item += 6 endfor if (<ref1.ctag0.buysell>) for x 1 <local.x> if (<ref1.findlayer.21.finduid.<local.item<dlocal.x>>>) if (<ref1.findlayer.21.finduid.<local.item<dlocal.x>>.amount>==<dlocal.item<dlocal.x>.amount>) local.value += <eval <ref1.findlayer.21.finduid.<local.item<dlocal.x>>.value> *
<dlocal.item<dlocal.x>.amount>> ref1.findlayer.21.finduid.<local.item<dlocal.x>>.remove elseif (<ref1.findlayer.21.finduid.<local.item<dlocal.x>>.amount> >=
<dlocal.item<dlocal.x>.amount>) local.value += <eval <ref1.findlayer.21.finduid.<local.item<dlocal.x>>.value> *
<dlocal.item<dlocal.x>.amount>> endif endif endfor if (<local.value>) if (<ref2.findlayer.29.more1> >= <local.value>) ref2.timerf 1, speak I have bought your items for <dlocal.value> gold pieces. if (<dlocal.value>==1) ref2.sound=53 elseif (<dlocal.value> < 5) ref2.sound=54 else ref2.sound=55 endif ref2.findlayer.29.more1 -= <local.value> while (<dlocal.value> >= 65535) serv.newitem=i_gold new.amount=65535 new.cont=<ref1.findlayer.21> local.value -= 65535 endwhile if (<local.value> > 0) serv.newitem=i_gold new.amount=<local.value> new.cont=<ref1.findlayer.21> endif ref2.timerf 1, Thank you. else ref2.timerf 1, speak I can not afford to purchase that from you. endif else ref2.timerf 1, speak Sorry, your items have no value to me. endif else for x 1 <local.x> if (<uid.<local.item<dlocal.x>>.tag0.override.value>) local.cost += <uid.<local.item<dlocal.x>>.tag0.override.value>) else local.cost += <uid.<local.item<dlocal.x>>.value> endif endfor if (<eval <ref1.findlayer.21.rescount i_gold> +<ref1.findlayer.29.rescount i_gold>> >= <dlocal.cost>) ||
(<ref1.isgm>) for x 1 <local.x> if (<uid.<local.item<dlocal.x>>.amount>==<dlocal.item<dlocal.x>.amount>) uid.<local.item<dlocal.x>>.cont=<ref1.findlayer.21> else uid.<local.item<dlocal.x>>.amount -= <local.item<dlocal.x>.amount> serv.newitem=<uid.<local.item<dlocal.x>>.baseid> new.amount=<local.item<dlocal.x>.amount> new.cont=<ref1.findlayer.21> endif if (strmatch(<local.items>,0)) local.items=<uid.<local.item<dlocal.x>>.name> else if !(<local.item<eval <local.x> +1>>) local.items=<local.items>, and <uid.<local.item<dlocal.x>>.name> else local.items=<local.items>, <uid.<local.item<dlocal.x>>.name> endif endif endfor ref2.timerf 1, speak Here <qval <dlocal.x>==1 ?is:are> your <qval <dlocal.x>==1 ?item:items>
<local.items>. ref2.timerf 1, speak That will be <dlocal.cost> gold. if (<dlocal.value>==1) ref2.sound=53 elseif (<dlocal.value> < 5) ref2.sound=54 else ref2.sound=55 endif if !(<ref1.isgm>) ref2.findlayer.29.more1 += <local.cost> if (<ref2.findlayer.29.more1> > <ref2.findlayer.29.more2>) ref2.findlayer.29.more1=<ref2.findlayer.29.more2> endif forcont <ref1.findlayer.21> if (<local.cost>) if (<type>==t_gold) if (<amount> > <local.cost>) amount -= <local.cost> update local.cost= else local.cost -= <amount> remove endif endif endif endfor if (<local.cost>) forcont <ref1.findlayer.29> if (<local.cost>) if (<type>==t_gold) if (<amount> > <local.cost>) amount -= <local.cost> update local.cost= else local.cost -= <amount> remove endif endif endif endfor endif endif ref2.timerf 1, speak Thank you very much! else ref2.timerf 1, speak Sorry but you can not afford that. endif endif ref2.updatex return 1
[eof]
--------------------
По тихоньку возрождаю The Odyssey.
|
|
|
|
Sirocco |
16.1.2013, 13:41
|
Expert
Сообщений: 812
Регистрация: 2.2.2012 Группа: Пользователи Наличность: 15739
Пользователь №: 14.566
Возраст: 30
|
Цитата(vpopaj @ 16.1.2013, 14:30) Ты что-то путаешь! Какой шард ??!!
не за что не поверю... что такой гениальный вопрос родился еще в чье-то голове одновременно, и оба эти человека решили его озвучить... мне пришел гмпейдж с каторги с вопросом... про 9999 итемов, от игрока с ником Jih. В предоставлении таковой информации ему было отказано. на что тот заявил, мол скриптеры горят желанием похвастаться как они это сделали. Ну чтож я тут отвечу... no way dude!
|
|
|
|
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|