3 import Crossfire,sys,datetime
4 whoami=Crossfire.WhoAmI()
5 activator=Crossfire.WhoIsActivator()
6 import CFDataBase,CFBank
13 PicDict=PicDB.get(
"Dict")
15 pshop=whoami.Map.Path.replace(
"/",
"_")
23 activator=Crossfire.WhoIsActivator()
29 Inventory=mymap.ObjectAt(43,2)
30 MailMap=Crossfire.ReadyMap(
"/planes/IPO_storage")
31 while Inventory!=
None:
32 if Inventory.Name!=
"Vault":
33 package=whoami.CreateObject(
"package")
34 package.Name=
"IPO-package F: Your-Private-Shop T: "+Owner
35 Inventory.InsertInto(package)
36 package.Teleport(MailMap,2,2)
38 Inventory=Inventory.Above
39 Inventory=mymap.ObjectAt(43,2)
40 while Inventory!=
None:
41 if Inventory.Name!=
"Vault":
42 package=whoami.CreateObject(
"package")
43 package.Name=
"IPO-package F: Your-Private-Shop T: "+Owner
44 Inventory.InsertInto(package)
45 package.Teleport(MailMap,2,2)
47 Inventory=Inventory.Below
49 Dict=CFDB.get(pshop, {})
53 if This[1]!=
"PickedUp":
54 That=mymap.ObjectAt(This[1][0],This[1][1])
58 That.Teleport(whoami.Map,37,0)
62 Chest=mymap.ObjectAt(30,8)
65 Chest.Teleport(mymap, 15,10)
73 for obj
in [
GetObjectAt(whoami.Map,30,5,
"Brazier material"),
75 GetObjectAt(whoami.Map,30,7,
"Bright Firepot Material"),
81 for pos_from, pos_to
in [((49, 5), (30, 5)),
85 obj = whoami.Map.ObjectAt(*pos_from)
88 obj.Teleport(whoami.Map, *pos_to)
90 while object.Name!=Name:
96 Object=Map.ObjectAt(X,Y)
104 while object.WeightLimit!=WeightLimit:
110 while object.Name.split()[0]!=UID:
123 CoinTypes={
"SILVER":1,
"GOLD":10,
"PLATINUM":50,
"JADE":5000,
"AMBER":500000,
"IMPERIAL":10000}
124 Params=Crossfire.ScriptParameters()
125 if whoami.Name.find(
"Store")>-1:
130 whoami.Say(
"Useage: Put an item in me and name a price. For details, ask for 'help'.")
133 Message=Crossfire.WhatIsMessage()
134 Message=Message.split()
136 for i
in range(len(Message)):
137 CoinType=CoinTypes.get(Message[i].upper())
139 Quantity=
int(Message[i-1])
140 Value+=Quantity*CoinType
141 Package=whoami.CreateObject(
"dust_generic")
142 Package.Face=
"package.111"
143 Package.Teleport(whoami.Map,43,2)
145 for i
in range(InvCount):
146 Item=whoami.Inventory
147 Item.InsertInto(Package)
149 Package.Name=
str(whoami.Value)+
" "+
str(Value)
150 Package.Speed=whoami.Value
151 Package.WeightLimit=0
152 z=Package.CreateObject(
"event_pickup")
155 z.Slaying=
"/python/pshop/pshop.py"
162 if Item.Name==Crossfire.ScriptParameters():
167 GlassReplica=whoami.CreateObject(
"icecube")
168 GlassReplica.WeightLimit=whoami.Value
169 GlassReplica.Weight=
max(Item.Weight*Item.Quantity,1)
170 GlassReplica.Quantity=1
171 t=GlassReplica.CreateObject(
"event_drop")
175 t.Slaying=
"/python/pshop/Ice.py"
176 t=GlassReplica.CreateObject(
"event_pickup")
179 t.Slaying=
"/python/pshop/Ice.py"
180 t=GlassReplica.CreateObject(
"event_destroy")
183 t.Slaying=
"/python/pshop/Ice.py"
184 t=GlassReplica.CreateObject(
"event_time")
187 t.Slaying=
"/python/pshop/Ice.py"
188 GlassReplica.Speed=0.0010000000475
190 GlassReplica.Face=(
str(Item.Face))
193 GlassReplica.Name=
str(Item.Quantity)+
" "+Item.Name+
" Price: "+
str(Value)
194 GlassReplica.NamePl=
"0"
197 Message=
"Name: "+
str(Item.Name)
198 Message+=
"\nTitle: "+
str(Item.Title)
200 Message+=
"\nQuantity: "+
str(Item.Quantity)
202 Message+=
"\nCursed: True"
203 Message+=
"\nWeight: "+
str(Item.Weight)
206 Message+=
"\nDam: "+
str(Item.Dam)
208 Message+=
"\nAC: "+
str(Item.AC)
210 Message+=
"\nWC: "+
str(Item.WC)
212 Message+=
"\nWis: "+
str(Item.Wis)
214 Message+=
"\nStr: "+
str(Item.Str)
217 Message+=
"\nPow: "+
str(Item.Pow)
219 Message+=
"\nInt: "+
str(Item.Int)
221 Message+=
"\nDex: "+
str(Item.Dex)
223 Message+=
"\nCon: "+
str(Item.Con)
225 Message+=
"\nCha: "+
str(Item.Cha)
227 Message+=
"\nValue: "+
str(Item.Value)
228 GlassReplica.Message=Message
229 Dict=CFDB.get(pshop, {})
230 Dict.update({
str(whoami.Value):(Value,
"PickedUp",Message)})
233 CFDB.store(pshop,Dict)
236 elif whoami.Name.find(
"Rent Box")>-1:
238 Inventory=whoami.Inventory
240 while Inventory!=
None:
242 if Inventory.ArchName==
"event_close":
243 Inventory=Inventory.Below
245 Value+=Inventory.Value*Inventory.Quantity
247 Inventory.Teleport(whoami.Map,37,5)
248 Inventory=whoami.Inventory
249 Variables=whoami.Map.ObjectAt(49,0)
251 VariableList= Variables.Message.split(
'\n')
252 Owner=VariableList[0].
split(
": ")[1]
258 Year, Month, Day=Date.split(
"-")
259 LastDate=datetime.datetime(
int(Year),
int(Month),
int(Day))
260 Today=datetime.date(1,2,3).today()
261 Today=datetime.datetime(Today.year, Today.month, Today.day)
262 DaysPast=(Today-LastDate).days
273 Value-=
int(Value/50)*50
285 Value-=
int(Value/100)*100
295 Value-=
int(Value/200)*200
304 Value-=
int(Value/400)*400
313 Value-=
int(Value/800)*800
321 Days+=
int(Value/1600)
322 Value-=
int(Value/1600)*1600
326 if DT210<=Value/3200:
330 Days+=
int(Value/3200)
331 Value-=
int(Value/3200)*3200
335 if DT240<=Value/6400:
339 Days+=
int(Value/6400)
340 Value-=
int(Value/6400)*6400
344 if DT270<=Value/12800:
348 Days+=
int(Value/12800)
349 Value-=
int(Value/12800)*12800
353 if DT300<=Value/25600:
357 Days+=
int(Value/25600)
358 Value-=
int(Value/25600)*25600
363 if DT330<=Value/51200:
367 Days+=
int(Value/51200)
368 Value-=
int(Value/51200)*51200
372 if DT366<=Value/102400:
376 Days+=
int(Value/102400)
377 Value-=
int(Value/102400)*102400
378 tmp=whoami.CreateObject(
"silvercoin")
380 Days=min(Days,MaxDays)
391 tmp=whoami.CreateObject(
"silvercoin")
394 whoami.Teleport(whoami.Map,30,8)
396 whoami.Teleport(whoami.Map,15,10)
397 Variables.Message=
"Owner: "+Owner+
"\nDate: "+
str(Today.year)+
"-"+
str(Today.month)+
"-"+
str(Today.day)+
"\nDays: "+
str(Days)
398 elif Params==
"Trade":
399 Message=Crossfire.WhatIsMessage().
split()
400 if Message[0].upper()==
'TRADE':
404 for i
in range(len(Message)):
406 if Message[i].upper()==
"NAME":
408 elif Message[i].upper()==
'TITLE':
410 elif Message[i].upper()==
'QUANTITY':
411 Quantity=
int(Message[i+1])
412 elif Params==
"Exchange":
414 elif Params==
"InventorySay":
416 Message=Crossfire.WhatIsMessage().
split()
417 if Message[0]==
"Remove":
419 CFDB.remove_record(pshop)
420 if Message[0].upper().find(
"DETAIL")>-1:
421 Item=
' '.join(Message[1:])
423 Dict=CFDB.get(pshop, {})
432 Message=
"\n"+
str(Dict.get(i)[2])
434 Message+=(
"\nAsking Price: "+
str(Dict.get(i)[0])+
"\nLocation: ")
436 if Dict.get(i)[1]==
"PickedUp":
438 Message+=
"Not on store floor"
440 elif Dict.get(i)[1][1]<=9:
441 Message+=
"In employee only area."
443 Message+=
str(Dict.get(i)[1])
444 Message+=
"\n(You are at ("+
str(whoami.X)+
","+
str(whoami.Y)+
")."
453 Item=
list(Dict)[Item-1]
455 Item=Dict.get(
str(Item))[2].
split(
'\n')[0].
split(
'Name: ')[1]
463 Message=
"\n"+
str(Dict.get(i)[2])
465 Message+=(
"\nAsking Price: "+
str(Dict.get(i)[0])+
"\nLocation: ")
467 if Dict.get(i)[1]==
"PickedUp":
469 Message+=
"Not on store floor"
471 elif Dict.get(i)[1][1]<=9:
472 Message+=
"In employee only area."
474 Message+=
str(Dict.get(i)[1])
475 Message+=
"\n(You are at ("+
str(whoami.X)+
","+
str(whoami.Y)+
")."
478 elif Params==
"AutoCheckout":
479 Dict=CFDB.get(pshop, {})
480 Inv=activator.Inventory
488 if (Inv.Name.find(
"Price: ")>-1):
490 Items=Items.__add__([Inv])
494 Item=(activator.Map.ObjectAt(43,2))
502 Price+=
int(Item.Name.split()[1])
503 RealItems=RealItems.__add__([Item])
506 whoami.Say(
"Item "+i.Name+
" missing.")
507 MissingItems=MissingItems.__add__([i])
508 if activator.PayAmount(Price):
510 i.InsertInto(activator)
511 tmp=Dict.pop((
str(i.Name.split()[0])))
513 i.Teleport(activator.Map, 37,0)
514 i.Speed+=(0.00010000000475*2)
516 for i
in MissingItems:
517 i.Teleport(activator.Map,37,0)
518 i.Speed+=(0.00010000000475*2)
519 tmp=Dict.pop((
str(i.WeightLimit)))
522 CFDB.store(pshop,Dict)
528 VariableList= Variables.Message.split(
'\n')
529 Owner=VariableList[0]
533 Owner=Owner.split(
": ")[1]
534 Date=Date.split(
": ")[1]
536 Days=
int(Days.split(
": ")[1])
538 Year, Month, Day=Date.split(
"-")
539 LastDate=datetime.datetime(
int(Year),
int(Month),
int(Day))
540 Today=datetime.date(1,2,3).today()
541 Today=datetime.datetime(Today.year, Today.month, Today.day)
542 DaysPast=(Today-LastDate).days
560 Variables.Message=
"Owner: "+Owner+
"\nDate: "+
str(Today.year)+
"-"+
str(Today.month)+
"-"+
str(Today.day)+
"\nDays: "+
str(Days)
561 bank.deposit(Owner,
int(Price/1.01))
564 whoami.Say(
"You do not have enough cash, "+
str(Price)+
" silver needed.")
565 elif Params==
"BankCheckout":
566 Dict=CFDB.get(pshop, {})
567 Inv=activator.Inventory
574 if (Inv.Name.find(
"Price: ")>-1):
576 Items=Items.__add__([Inv])
581 Item=(activator.Map.ObjectAt(43,2))
589 Price+=
int(Item.Name.split()[1])
590 RealItems=RealItems.__add__([Item])
593 whoami.Say(
"Item "+i.Name+
" missing.")
594 MissingItems=MissingItems.__add__([i])
595 if bank.getbalance(activator.Name)>=Price:
596 bank.withdraw(activator.Name, Price)
598 i.InsertInto(activator)
599 tmp=Dict.pop((
str(i.Name.split()[0])))
601 i.Teleport(activator.Map, 37,0)
602 i.Speed+=(0.00010000000475*2)
604 for i
in MissingItems:
605 i.Teleport(activator.Map,37,0)
606 i.Speed+=(0.00010000000475*2)
607 tmp=Dict.pop((
str(i.WeightLimit)))
610 CFDB.store(pshop,Dict)
616 VariableList= Variables.Message.split(
'\n')
617 Owner=VariableList[0]
621 Owner=Owner.split(
": ")[1]
622 Date=Date.split(
": ")[1]
624 Days=
int(Days.split(
": ")[1])
626 Year, Month, Day=Date.split(
"-")
627 LastDate=datetime.datetime(
int(Year),
int(Month),
int(Day))
628 Today=datetime.date(1,2,3).today()
629 Today=datetime.datetime(Today.year, Today.month, Today.day)
630 DaysPast=(Today-LastDate).days
648 Variables.Message=
"Owner: "+Owner+
"\nDate: "+
str(Today.year)+
"-"+
str(Today.month)+
"-"+
str(Today.day)+
"\nDays: "+
str(Days)
649 bank.deposit(Owner,
int(Price/1.01))
652 whoami.Say(
"You do not have enough funds in the bank. "+
str(Price)+
" needed.")
653 elif Params==
"TrashOpen":
654 Trash=whoami.Map.ObjectAt(37,0)
657 Trash.InsertInto(whoami)
659 elif Params==
"TrashClose":
660 Trash=whoami.Inventory
662 if (Trash.Name==
"TrashClose")
or (Trash.Name==
"TrashOpen"):
665 Trash.Teleport(whoami.Map,37,0)
667 if Trash.ArchName==
"icecube":
668 Trash.Speed+=(0.00010000000475*2)
669 Trash=whoami.Inventory
672 whoami.Message=
"xyzzy"
673 Dict=CFDB.get(pshop, {})
676 Str=Dict.get(i)[2].
split(
'\n')[0]
678 whoami.Message+=
str(Str)