root/npc/custom/Auctioneer.txt

Revision 1, 19.7 kB (checked in by jinshiro, 17 years ago)
Line 
1//===== eAthena Script ======================================================================
2//= 1. Auctioneer
3//= 2. Auction Helping (Gives info only, but still good to have in)
4//===== Original By =========================================================================
5//= Fredzilla
6//===== Helped By ===========================================================================
7//= Not one quite yet, but you never know ;)
8//===== Current Version: ====================================================================
9//= 1.0 (Beta) < Thats means it is in testing
10//===== Compatible With: ====================================================================
11//= Any eAthena, that also has a script_athena.conf
12//===== Description: ========================================================================
13//= Lets a people place items into an auction, max of 10 items per round
14//= People can bid on them item
15//= Then buy the items, and sellers pickup there money
16//===== Comments and Credits ===========================================================
17//= This script would not have been made possible if it was not for "Maeki Rika"
18//= My praise goes out to her for finding out all the things we can do with the
19//= current system that eAthena uses
20//=
21//= More comments are listed down the page, in a attempt to explain what is going on in each
22//= section of the script
23//=
24//= This script is currently in testing, and any loss of items will, not only need to be
25//= reported inside the thread I made for this script, but be replaced by GM if proof was given :D
26//===========================================================================================
27
28prontera,153,193,5      script  Auctioneer      807,{
29        mes "[Auctioneer]";
30        set @num,0;
31// These few line below are to recover item that would be lost due to a new auction starting
32L_RNameLoop:
33        if(strcharinfo(0)==$ANamesB$[@num] && $paidB[@num]==0) goto L_RBackup;
34        set @num,@num+1;
35        if(@num<10) goto L_RNameLoop;
36        if($Auction==1) goto L_Register;
37        if($Auction==2) goto L_Bid;
38        if($Auction==3) goto L_PayPickup;
39
40// After a server restart, and no auction value is set, it will run this
41// People who placed items in there before the restart should still be to retrieve there items
42
43        mes "You are able to sell and buy things inside the auction, unfortunately nothing has been started, you need to wait for the auction to start";
44        mes "No items lost will be given back, please remember you used this at your own risk";
45        next;
46        mes "[Auctioneer]";
47        mes "I am very sorry if you have lost items";
48        close;
49
50// If the Auction has started, it will run this, during this time items can be registered and registered items retrieved
51
52L_Register:
53        mes "Welcome to the auction, you may register you items at this time";
54        next;
55        set @num,0;
56L_NameLoop:
57        if(strcharinfo(0)==$ANames$[@num]) goto L_Already;
58        set @num,@num+1;
59        if(@num<10) goto L_NameLoop;
60        if(getarraysize($AItems)==10) goto L_AFull;
61        menu "I want to register an item now",L_IRegister,"I don't want to leave an item",-;
62L_End:
63        mes "[Auctioneer]";
64        mes "Ok, come back whenever";
65        close;
66L_IRegister:
67        mes "[Auctioneer]";
68        mes "Listed below is the first 10 items you have on you now";
69        mes "What do you want to register?";
70        next;
71        set @array,0;
72        set @item,500;
73//      set @loopcount,0;
74L_ILoop:
75//      set @loopcount,@loopcount+1;
76//      debugmes @loopcount;
77        set @item,@item+1;
78        if(@item>=13005) goto L_Menu;
79        if(countitem(@item)>0) set @item2[@array],@item;
80        if(countitem(@item)>0) set @array,@array+1;
81        if(@array==10) goto L_Menu;
82        set @item,@item+1;
83        if(countitem(@item)>0) set @item2[@array],@item;
84        if(countitem(@item)>0) set @array,@array+1;
85        if(@array==10) goto L_Menu;
86        set @item,@item+1;
87        if(countitem(@item)>0) set @item2[@array],@item;
88        if(countitem(@item)>0) set @array,@array+1;
89        if(@array==10) goto L_Menu;
90        set @item,@item+1;
91        if(countitem(@item)>0) set @item2[@array],@item;
92        if(countitem(@item)>0) set @array,@array+1;
93        if(@array==10) goto L_Menu;
94        set @item,@item+1;
95        if(countitem(@item)>0) set @item2[@array],@item;
96        if(countitem(@item)>0) set @array,@array+1;
97        if(@array==10) goto L_Menu;
98        set @item,@item+1;
99        if(countitem(@item)>0) set @item2[@array],@item;
100        if(countitem(@item)>0) set @array,@array+1;
101        if(@array==10) goto L_Menu;
102        set @item,@item+1;
103        if(countitem(@item)>0) set @item2[@array],@item;
104        if(countitem(@item)>0) set @array,@array+1;
105        if(@array==10) goto L_Menu;
106        set @item,@item+1;
107        if(countitem(@item)>0) set @item2[@array],@item;
108        if(countitem(@item)>0) set @array,@array+1;
109        if(@array==10) goto L_Menu;
110        set @item,@item+1;
111        if(countitem(@item)>0) set @item2[@array],@item;
112        if(countitem(@item)>0) set @array,@array+1;
113        if(@array==10) goto L_Menu;
114        set @item,@item+1;
115        if(countitem(@item)>0) set @item2[@array],@item;
116        if(countitem(@item)>0) set @array,@array+1;
117        if(@array==10) goto L_Menu;
118        goto L_ILoop;
119L_Menu:
120        menu getitemname(@item2[0]),-,getitemname(@item2[1]),-,getitemname(@item2[2]),-,getitemname(@item2[3]),-,getitemname(@item2[4]),-,getitemname(@item2[5]),-,getitemname(@item2[6]),-,getitemname(@item2[7]),-,getitemname(@item2[8]),-,getitemname(@item2[9]),-,"Next Page",L_WipeLoop;
121        set @setitem,@item2[@menu-1];
122        set @num,0;
123L_SorryLoop:
124        set @num,@num+1;
125        if(@menu==@num && @setitem == 0) goto L_Sorry;
126        if(@num==10) goto L_FinalReg;
127        goto L_SorryLoop;
128L_FinalReg:
129        mes "[Auctioneer]";
130        mes "Please remember that if this item does contain cards, or is crafted, these distinctions will be lost when it is put into the auction";
131        mes "This also means if you get the item back, that this applies to, you will have lost out";
132        mes " ";
133        mes "So you want to register your "+getitemname(@setitem);
134        next;
135        menu "Yes please",-,"No",L_End;
136        mes "[Auctioneer]";
137        mes "Ok I will register this item now";
138        next;
139        set @amount,1;
140        if(countitem(@setitem)==1) goto L_FinalInput;
141        mes "[Auctioneer]";
142        mes "Wait a minute it seems you have more than one of that item, please enter the ammount you want to put in the aution";
143        next;
144        input @amount;
145        if(countitem(@setitem)<@amount) goto L_NotEnough;
146L_FinalInput:
147        set $AItems[$array],@setitem;
148        set $ANames$[$array],strcharinfo(0);
149        set $AAmount[$array],@amount;
150        set $array,$array+1;
151        delitem @setitem,@amount;
152        mes "[Auctioneer]";
153        mes "You item has been taken into storage, ready for sale, the auction will begin soon, watch for the announcment";
154        close;
155L_AFull:
156        mes "[Auctioneer]";
157        mes "Oh, sorry, it seems my auction is full this time round, please try in the next one";
158        close;
159L_WipeLoop:
160        deletearray @item2[0],10;
161        set @array,0;
162        goto L_ILoop;
163L_Sorry:
164        mes "[Auctioneer]";
165        mes "It seems that is all you have to offer me, come back when you know what you want to sell";
166        close;
167L_Already:
168        mes "[Auctioneer]";
169        mes "It seems you already have have an item registered here, would you like to retrieve your item?";
170        next;
171        menu "Yes",-,"No",L_End;
172        getitem $AItems[@num],$AAmount[@num];
173L_AItemsLoop:
174        set $AItems[@num],$AItems[@num+1];
175        set $ANames$[@num],$ANames$[@num+1];
176        set $AAmount[@num],$AAmount[@num+1];
177        set @num,@num+1;
178        if(@num<10) goto L_AItemsLoop;
179        set $array,$array-1;
180        set @num,0;
181        mes "[Auctioneer]";
182        mes "Ok, all items present and acounted for, have a nice day";
183        close;
184L_NotEnough:
185        mes "[Auctioneer]";
186        mes "Seems you don't have that many "+getitemname(@setitem)+"'s";
187        close;
188// If the Auction has enterd phase 2, it will run this, during this time items you can bid on registered
189// No items can be retrieved during this time, they are now stuck
190
191L_Bid:
192        mes "What would you like to bid on?";
193        next;
194        set @num,0;
195L_MenuLoop:
196        set @menu$[@num],$AAmount[@num]+" x "+getitemname($AItems[@num])+" "+$bid[@num]+"z";
197        set @num,@num+1;
198        if($AItems[@num]!=0) goto L_MenuLoop;
199        menu
200        @menu$[0],-,
201        @menu$[1],-,
202        @menu$[2],-,
203        @menu$[3],-,
204        @menu$[4],-,
205        @menu$[5],-,
206        @menu$[6],-,
207        @menu$[7],-,
208        @menu$[8],-,
209        @menu$[9],-;
210        mes "[Auctioneer]";
211        set @num,@menu-1;
212        if(strcharinfo(0)==$ANames$[@num]) goto L_CantBid;
213L_ReBid:
214        mes "You are currently bidding on "+$AAmount[@num]+" x "+getitemname($AItems[@num]);
215        mes "The current bid is at "+$bid[@num]+"z";
216        mes "This was made by "+$bidders$[@num];
217        if($bidders$[@num]==strcharinfo(0)) goto L_AlreadyBid;
218        mes "How much do you want to bid yourself";
219        mes "(Use 0 to cancel at this point)";
220        next;
221        input @bid;
222        if(@bid<=0) goto L_End;
223        if(zeny<@bid) goto L_LowZeny;
224        if(@bid<$bid[@num]) goto L_LowBid;
225        mes "[Auctioneer]";
226        mes "You are about to bid "+@bid+"z for "+$AAmount[@num]+" x "+getitemname($AItems[@num]);
227        mes "Are you sure?";
228        next;
229        menu "Yes",-,"No",L_End;
230        set $bid[@num],@bid;
231        set $bidders$[@num],strcharinfo(0);
232        mes "[Auctioneer]";
233        mes "Your bid has been entered";
234        close;
235L_LowZeny:
236        mes "[Auctioneer]";
237        mes "Sorry you need to show me that amount as proof you could pay, if you do win";
238        mes "Please either get more money, or bid lower";
239        close;
240L_CantBid:
241        mes "Sorry, you can't bid on your own lots";
242        close;
243L_LowBid:
244        mes "[Auctioneer]";
245        mes "Your bid seems lower than the current one, try entering a higher ammount of zeny";
246        next;
247        mes "[Auctioneer]";
248        goto L_ReBid;
249L_AlreadyBid:
250        mes "Hey wait, that is you, you can't bid again";
251        close;
252// If the Auction has entered phase 3, it will run this
253// During this time, items that have been bid on can be bought
254// Items not bid on can be picked back up by the seller
255// And if any of the items have been bought, and are paid for, seller can pick up their money
256
257L_PayPickup:
258        mes "The auction has now ended";
259        mes "What would you like to do?";
260        next;
261        menu "Check for items I have sold",-,"Check for items I have won",L_Won,"Nothing",L_End;
262
263// Check starts here for if you have sold anything during this auction
264
265        set @num,0;
266L_SoldLoop:
267        if($ANames$[@num]==strcharinfo(0)) goto L_Sold;
268        set @num,@num+1;
269        if(@num<10) goto L_SoldLoop;
270        mes "[Auctioneer]";
271        mes "Sorry it seems you have either picked up all you items, money";
272        mes "or you didn't register any items in this auction";
273        close;
274L_Sold:
275        mes "[Auctioneer]";
276        if($paid[@num]==3) goto L_Returned;
277        mes "Ah I see here, you sold your "+$AAmount[@num]+" x "+getitemname($AItems[@num]);
278        mes "Lets see here it sold for";
279        next;
280        if($bid[@num]==0) goto L_GiveBack;
281        if($paid[@num]==2) goto L_AlreadyPaid;
282        mes "[Auctioneer]";
283        mes $bid[@num]+"z and "+$bidders$[@num]+" bought it from you";
284        if($paid[@num]!=1) goto L_NoMoney;
285        mes "They have fully paid for it, so here is your money";
286        next;
287        set zeny,zeny+$bid[@num];
288        set $paid[@num],2;
289        goto L_End;
290L_AlreadyPaid:
291        mes "[Auctioneer]";
292        mes "Hmm, seems you already have you money for this lot, not trying to con me are you?";
293        close;
294L_Returned:
295        mes "[Auctioneer]";
296        mes "Seems we returned you item already";
297        close;
298L_GiveBack:
299        mes "[Auctioneer]";
300        mes "Seems no-one wanted your item(s)";
301        mes "So you can have them back now";
302        getitem $AItems[@num],$AAmount[@num];
303        set $paid[@num],3;
304        close;
305L_NoMoney:
306        mes "Sorry to say this but they haven't paid this yet";
307        mes "You can go and talk to them now, or you can wait";
308        mes "If they haven't paid by the time the next Auction starts come back to me to retrieve your item(s)";
309        close;
310
311// Check starts here for if you won any items during this auction, futher options follow
312
313L_Won:
314        set @num,0;
315        mes "[Auctioneer]";
316L_WonLoop:
317        if($bidders$[@num]==strcharinfo(0)) goto L_Winner;
318L_CarryOn:
319        set @num,@num+1;
320        if(@num<10) goto L_WonLoop;
321        mes "Sorry you didn't win any of the lots, please try again next time";
322        close;
323L_Winner:
324        if($paid[@num]>0) goto L_CarryOn;
325        mes "Well it does seem you have won an item";
326        mes "You won "+$AAmount[@num]+" x "+getitemname($AItems[@num]);
327        mes "And you bid "+$bid[@num]+"z for this lot";
328        mes "What do you want to do now?";
329        next;
330
331// At this point they can choose from 3 options, to Buy the current lot
332// see the next one they might have won, or give up that lot
333
334        menu "Buy this lot",-,"See Next Lot you won",L_CarryOn,"Relinquish this lot",L_Back;
335        if(zeny<$bid[@num]) goto L_2lowzeny;
336        set zeny,zeny-$bid[@num];
337        getitem $AItems[@num],$AAmount[@num];
338        set $paid[@num],1;
339        mes "[Auctioneer]";
340        mes "Our transaction is completed";
341        mes "See you again soon";
342        close;
343L_2lowzeny:
344        mes "[Auctioneer]";
345        mes "Sorry it seems you don't have enough zeny on you, please acquire more";
346        close;
347L_Back:
348        mes "[Auctioneer]";
349        mes "Are you sure you want to give up this lot?";
350        next;
351        menu "Yes",-,"No",L_End;
352        set $bid[@num],0;
353        set $bidders$[@num],"no-one";
354        mes "[Auctioneer]";
355        mes "It is done, you might want to tell "+$ANames$[@num]+" they can come and pickup his item(s)";
356        close; 
357       
358// All the times that will start the Auction
359
360OnClock0100:
361OnClock0400:
362OnClock0700:
363OnClock1000:
364OnClock1300:
365OnClock1600:
366OnClock1900:
367OnClock2200:
368// Starting Backup
369        copyarray $AItemsB[0],$AItems[0],10;
370        copyarray $ANamesB$[0],$ANames$[0],10;
371        copyarray $AAmountB[0],$AAmount[0],10;
372        copyarray $paidB[0],$paid[0],10;
373// End backup - Start Wiping
374        deletearray $paid[0],10;
375        deletearray $bid[0],10;
376        deletearray $bidders$[0],10;
377        deletearray $AItems[0],10;
378        deletearray $ANames$[0],10;
379        deletearray $AAmount[0],10;
380        set $array,0;
381// End Wiping - Begin Announce + Phase setting
382        announce "Registration time has begun, see the Auctioneer to register your items",0;
383        cleararray $bidders$[0],"no-one",10;
384        set $Auction,1;
385        end;
386
387// All the times that will start the bidding section
388
389OnClock0200:
390OnClock0500:
391OnClock0800:
392OnClock1100:
393OnClock1400:
394OnClock1700:
395OnClock2000:
396OnClock2300:
397        if($Auction==0) end;
398        announce "Registration time has ended, time for the biding to begin",0;
399        set $Auction,2;
400        initnpctimer;
401        end;
402
403// All the times that will start the last phase, buying and seller, and item retrieval
404
405OnClock0300:
406OnClock0600:
407OnClock0900:
408OnClock1200:
409OnClock1500:
410OnClock1800:
411OnClock2100:
412OnClock0000:
413        if($Auction==0) end;
414        announce "Bidding time has ended, see the Auctioneer to get your items, or money",0;
415        set $Auction,3;
416        end;
417
418// On the start of the server it will reset the Auction state, but not the items it contains
419// so people still have have a chance to retrieve there lost items
420
421OnInit:
422        copyarray $AItemsB[0],$AItems[0],10;
423        copyarray $ANamesB$[0],$ANames$[0],10;
424        copyarray $AAmountB[0],$AAmount[0],10;
425        copyarray $paidB[0],$paid[0],10;
426        deletearray $paid[0],10;
427        deletearray $bid[0],10;
428        deletearray $bidders$[0],10;
429        deletearray $AItems[0],10;
430        deletearray $ANames$[0],10;
431        deletearray $AAmount[0],10;
432        set $array,0;
433        set $Auction,0;
434        end;
435
436// All below is for anouncing the items in this auction, if there are none it will say so
437// and if there are none in there at the start of phase 2 it will reset the auctions state
438// This is to stop the auction ending message, and will only start again when it reachs phase 1 again
439
440OnTimer5000:
441        announce "Today in our auction we have",0;
442        end;
443OnTimer7000:
444        if($AItems[0]==0) setnpctimer 25001;
445        if($AAmount[0]==1) announce "A lovely "+getitemname($AItems[0])+" left by "+$ANames$[0],0;
446        if($AAmount[0]>1) announce $AAmount[0]+" lovely "+getitemname($AItems[0])+" left by "+$ANames$[0],0;
447        end;
448OnTimer9000:
449        if($AItems[1]==0) setnpctimer 25001;
450        if($AAmount[1]==1) announce "A great "+getitemname($AItems[1])+" left by "+$ANames$[1],0;
451        if($AAmount[1]>1) announce $AAmount[1]+" great "+getitemname($AItems[1])+" left by "+$ANames$[1],0;
452        end;
453OnTimer11000:
454        if($AItems[2]==0) setnpctimer 25001;
455        if($AAmount[2]==1) announce "A excellent "+getitemname($AItems[2])+" left by "+$ANames$[2],0;
456        if($AAmount[2]>1) announce $AAmount[2]+" excellent "+getitemname($AItems[2])+" left by "+$ANames$[2],0;
457        end;
458OnTimer13000:
459        if($AItems[3]==0) setnpctimer 25001;
460        if($AAmount[3]==1) announce "A superb "+getitemname($AItems[3])+" left by "+$ANames$[3],0;
461        if($AAmount[3]>1) announce $AAmount[3]+" superb "+getitemname($AItems[3])+" left by "+$ANames$[3],0;
462        end;
463OnTimer15000:
464        if($AItems[4]==0) setnpctimer 25001;
465        if($AAmount[4]==1) announce "A terrific "+getitemname($AItems[4])+" left by "+$ANames$[4],0;
466        if($AAmount[4]>1) announce $AAmount[4]+" terrific "+getitemname($AItems[4])+" left by "+$ANames$[4],0;
467        end;
468OnTimer17000:
469        if($AItems[5]==0) setnpctimer 25001;
470        if($AAmount[5]==1) announce "A wonderful "+getitemname($AItems[5])+" left by "+$ANames$[5],0;
471        if($AAmount[5]>1) announce $AAmount[5]+" wonderful "+getitemname($AItems[5])+" left by "+$ANames$[5],0;
472        end;
473OnTimer19000:
474        if($AItems[6]==0) setnpctimer 25001;
475        if($AAmount[6]==1) announce "A pretty "+getitemname($AItems[6])+" left by "+$ANames$[6],0;
476        if($AAmount[6]>1) announce $AAmount[6]+" pretty "+getitemname($AItems[6])+" left by "+$ANames$[6],0;
477        end;
478OnTimer21000:
479        if($AItems[7]==0) setnpctimer 25001;
480        if($AAmount[7]==1) announce "A sweet "+getitemname($AItems[7])+" left by "+$ANames$[7],0;
481        if($AAmount[7]>1) announce $AAmount[7]+" sweet "+getitemname($AItems[7])+" left by "+$ANames$[7],0;
482        end;
483OnTimer23000:
484        if($AItems[8]==0) setnpctimer 25001;
485        if($AAmount[8]==1) announce "A stunning "+getitemname($AItems[8])+" left by "+$ANames$[8],0;
486        if($AAmount[8]>1) announce $AAmount[8]+" stunning "+getitemname($AItems[8])+" left by "+$ANames$[8],0;
487        end;
488OnTimer25000:
489        if($AItems[9]==0) end;
490        if($AAmount[9]==1) announce "A fine "+getitemname($AItems[9])+" left by "+$ANames$[9],0;
491        if($AAmount[9]>1) announce $AAmount[9]+" fine "+getitemname($AItems[9])+" left by "+$ANames$[9],0;
492OnTimer27000:
493        if($AItems[0]!=0) announce "That is all the items we have this time round, so get bidding",0;
494        if($AItems[0]==0) announce "Seems there are no items this time round",0;
495        if($AItems[0]==0) set $Auction,0;
496        stopnpctimer;
497        setnpctimer 0;
498        end;
499
500// this is only be run if you own any items left over, not paid for, from the last auction, or the server failed, and items are left over
501
502L_RBackup:
503        mes "You seem to have items left over from the last auction, here you go, have it back";
504        next;
505        getitem $AItemsB[@num],$AAmountB[@num];
506L_BItemsLoop:
507        set $AItemsB[@num],$AItemsB[@num+1];
508        set $ANamesB$[@num],$ANamesB$[@num+1];
509        set $AAmountB[@num],$AAmountB[@num+1];
510        set @num,@num+1;
511        if(@num<10) goto L_BItemsLoop;
512        mes "[Auctioneer]";
513        mes "Have a nice day";
514        close;
515}
516
517// Only for display purposes, and telling people info about the auction
518// Can also be used for finding out what phase the auction is in
519
520prontera,158,193,3      script  Auction Helper  833,{
521        mes "[Auction Helper]";
522        set @num,0;
523        if($Auction==0 && $AItemsB[@num]!=0) goto L_ItemRecover;
524        if(($Auction==1 || $Auction ==2) && $AItems[@num]!=0) goto L_LLoop;
525        if($Auction==3 && $AItems[@num]!=0) goto L_Win;
526        mes "Ok Currently we have nothing in the auction.";
527        mes "Please return at the correct time.";
528        close;
529L_LLoop:
530        mes "Ok Currently we have :-";
531L_Loop:
532        mes $ANames$[@num]+" with "+$AAmount[@num]+" x "+getitemname($AItems[@num])+"('s)";
533        set @num,@num+1;
534        if($AItems[@num]==0) close;
535        if(@num<10) goto L_Loop;
536        close;
537L_ItemRecover:
538        mes "Seems there was a problem, and the auction ended prematurely.";
539        mes "This means we still have :-";
540L_BLoop:
541        if($paid[@num]==0) mes $ANamesB$[@num]+" with "+$AAmountB[@num]+" x "+getitemname($AItemsB[@num])+"('s)";
542        set @num,@num+1;
543        if($AItems[@num]==0) close;
544        if(@num<10) goto L_BLoop;
545        close;
546L_Win:
547        mes "The Auction is in the last stage, at this point you can :-";
548        mes " * buy your items";
549        mes " * Pick-up you money";
550        mes "(or if you were unlucky)";
551        mes " * Pick-up unsold items";
552        next;
553        mes "[Auction Helper]";
554        mes "Here is a list of Sellers and Winners";
555        set @num,0;
556L_Loop2:
557        mes $ANames$[@num]+" with "+$AAmount[@num]+" "+getitemname($AItems[@num])+"('s), won by "+$bidders$[@num]+" for "+$bid[@num]+"z";
558        set @num,@num+1;
559        if($AItems[@num]==0) close;
560        if(@num<10) goto L_Loop2;
561        close;
562
563}
Note: See TracBrowser for help on using the browser.