| 1 |
|
| 2 |
|
| 3 |
import Crossfire,sys,datetime |
| 4 |
whoami=Crossfire.WhoAmI() |
| 5 |
activator=Crossfire.WhoIsActivator() |
| 6 |
import CFDataBase,CFBank |
| 7 |
#for i in dir(CFDataBase): |
| 8 |
#print i |
| 9 |
#print CFDataBase.__file__ |
| 10 |
|
| 11 |
CFDB=CFDataBase.CFDataBase("PShop") |
| 12 |
PicDB=CFDataBase.CFDataBase("PicDB") |
| 13 |
PicDict=PicDB.get("Dict") |
| 14 |
bank=CFBank.CFBank("ImperialBank_DB") |
| 15 |
pshop=whoami.Map.Path.replace("/","_") |
| 16 |
|
| 17 |
|
| 18 |
#print CFDB.get(pshop) |
| 19 |
#print pshop |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
activator=Crossfire.WhoIsActivator() |
| 24 |
|
| 25 |
|
| 26 |
def Expire(): |
| 27 |
global Owner |
| 28 |
|
| 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) |
| 37 |
|
| 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) |
| 46 |
|
| 47 |
Inventory=Inventory.Below |
| 48 |
|
| 49 |
Dict=CFDB.get(pshop, {}) |
| 50 |
|
| 51 |
for i in Dict: |
| 52 |
This=Dict.get(i) |
| 53 |
if This[1]!="PickedUp": |
| 54 |
That=mymap.ObjectAt(This[1][0],This[1][1]) |
| 55 |
if That!=None: |
| 56 |
That=GetObjectByWeightLimit(That,int(i)) |
| 57 |
if That!=0: |
| 58 |
That.Teleport(whoami.Map,37,0) |
| 59 |
|
| 60 |
CFDB.store(pshop,{}) |
| 61 |
Owner="Unowned" |
| 62 |
Chest=mymap.ObjectAt(30,8) |
| 63 |
Chest=GetObjectByName(Chest, "Rent Box") |
| 64 |
if Chest!=0: |
| 65 |
Chest.Teleport(mymap, 15,10) |
| 66 |
for i in range(0,34): |
| 67 |
for a in range(0,35): |
| 68 |
for obj in [GetObjectAt(whoami.Map,i,a,'NoBuild'), |
| 69 |
GetObjectAt(whoami.Map,i,a,'NoSpell')]: |
| 70 |
if obj: |
| 71 |
obj.Remove() |
| 72 |
|
| 73 |
for obj in [GetObjectAt(whoami.Map,30,5,"Brazier material"), |
| 74 |
GetObjectAt(whoami.Map,30,6,"Firepot material"), |
| 75 |
GetObjectAt(whoami.Map,30,7,"Bright Firepot Material"), |
| 76 |
GetObjectAt(whoami.Map,29,8,"Red CWall material")]: |
| 77 |
if obj: |
| 78 |
obj.Remove() |
| 79 |
|
| 80 |
|
| 81 |
for pos_from, pos_to in [((49, 5), (30, 5)), |
| 82 |
((49, 4), (30, 6)), |
| 83 |
((49, 6), (30, 7)), |
| 84 |
((49, 7), (29, 8))]: |
| 85 |
obj = whoami.Map.ObjectAt(*pos_from) |
| 86 |
|
| 87 |
if obj: |
| 88 |
obj.Teleport(whoami.Map, *pos_to) |
| 89 |
def GetObjectByName(object, Name): |
| 90 |
while object.Name!=Name: |
| 91 |
object=object.Above |
| 92 |
if not object: |
| 93 |
return 0 |
| 94 |
return object |
| 95 |
def GetObjectAt(Map,X,Y,Name): |
| 96 |
Object=Map.ObjectAt(X,Y) |
| 97 |
while Object!=None: |
| 98 |
if Object.Name==Name: |
| 99 |
return Object |
| 100 |
else: |
| 101 |
Object=Object.Above |
| 102 |
return Object |
| 103 |
def GetObjectByWeightLimit(object, WeightLimit): |
| 104 |
while object.WeightLimit!=WeightLimit: |
| 105 |
object=object.Above |
| 106 |
if not object: |
| 107 |
return 0 |
| 108 |
return object |
| 109 |
def GetObjectByUID(object, UID): |
| 110 |
while object.Name.split()[0]!=UID: |
| 111 |
object=object.Above |
| 112 |
if not object: |
| 113 |
return 0 |
| 114 |
return object |
| 115 |
def GetInvCount(object): |
| 116 |
Inv=object.Inventory |
| 117 |
Counter=-1 |
| 118 |
while Inv!=None: |
| 119 |
Counter+=1 |
| 120 |
Inv=Inv.Below |
| 121 |
return Counter |
| 122 |
mymap=whoami.Map |
| 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: |
| 126 |
|
| 127 |
|
| 128 |
InvCount=GetInvCount(whoami) |
| 129 |
if InvCount==0: |
| 130 |
whoami.Say("Useage: Put an item in me and name a price. For details, ask for 'help'.") |
| 131 |
|
| 132 |
else: |
| 133 |
Message=Crossfire.WhatIsMessage() |
| 134 |
Message=Message.split() |
| 135 |
Value=0 |
| 136 |
for i in range(len(Message)): |
| 137 |
CoinType=CoinTypes.get(Message[i].upper()) |
| 138 |
if CoinType!=None: |
| 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) |
| 144 |
|
| 145 |
for i in range(InvCount): |
| 146 |
Item=whoami.Inventory |
| 147 |
Item.InsertInto(Package) |
| 148 |
|
| 149 |
Package.Name=str(whoami.Value)+" "+str(Value) |
| 150 |
Package.Speed=whoami.Value |
| 151 |
Package.WeightLimit=0 |
| 152 |
z=Package.CreateObject("event_pickup") |
| 153 |
z.Name="Pickup" |
| 154 |
z.Title="Python" |
| 155 |
z.Slaying="/python/pshop/pshop.py" |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
#STRING=STRING.split("Items: ")[1] |
| 161 |
|
| 162 |
if Item.Name==Crossfire.ScriptParameters(): |
| 163 |
Item=Item.Below |
| 164 |
|
| 165 |
|
| 166 |
|
| 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") |
| 172 |
t.Name="Drop" |
| 173 |
t.Value=whoami.Value |
| 174 |
t.Title="Python" |
| 175 |
t.Slaying="/python/pshop/Ice.py" |
| 176 |
t=GlassReplica.CreateObject("event_pickup") |
| 177 |
t.Name="Get" |
| 178 |
t.Title="Python" |
| 179 |
t.Slaying="/python/pshop/Ice.py" |
| 180 |
t=GlassReplica.CreateObject("event_destroy") |
| 181 |
t.Name="Destroy" |
| 182 |
t.Title="Python" |
| 183 |
t.Slaying="/python/pshop/Ice.py" |
| 184 |
t=GlassReplica.CreateObject("event_time") |
| 185 |
t.Name="Timer" |
| 186 |
t.Title="Python" |
| 187 |
t.Slaying="/python/pshop/Ice.py" |
| 188 |
GlassReplica.Speed=0.0010000000475 |
| 189 |
|
| 190 |
GlassReplica.Face=(str(Item.Face)) |
| 191 |
#GlassReplica.Material=(96,'ice') |
| 192 |
|
| 193 |
GlassReplica.Name=str(Item.Quantity)+" "+Item.Name+" Price: "+str(Value) |
| 194 |
GlassReplica.NamePl="0" |
| 195 |
|
| 196 |
|
| 197 |
Message="Name: "+str(Item.Name) |
| 198 |
Message+="\nTitle: "+str(Item.Title) |
| 199 |
#Message+="\nMaterial: "+str(Item.Material.get("MaterialName")) |
| 200 |
Message+="\nQuantity: "+str(Item.Quantity) |
| 201 |
if Item.Cursed==1: |
| 202 |
Message+="\nCursed: True" |
| 203 |
Message+="\nWeight: "+str(Item.Weight) |
| 204 |
|
| 205 |
if Item.Dam!=0: |
| 206 |
Message+="\nDam: "+str(Item.Dam) |
| 207 |
if Item.AC!=0: |
| 208 |
Message+="\nAC: "+str(Item.AC) |
| 209 |
if Item.WC!=0: |
| 210 |
Message+="\nWC: "+str(Item.WC) |
| 211 |
if Item.Wis!=0: |
| 212 |
Message+="\nWis: "+str(Item.Wis) |
| 213 |
if Item.Str!=0: |
| 214 |
Message+="\nStr: "+str(Item.Str) |
| 215 |
|
| 216 |
if Item.Pow!=0: |
| 217 |
Message+="\nPow: "+str(Item.Pow) |
| 218 |
if Item.Int!=0: |
| 219 |
Message+="\nInt: "+str(Item.Int) |
| 220 |
if Item.Dex!=0: |
| 221 |
Message+="\nDex: "+str(Item.Dex) |
| 222 |
if Item.Con!=0: |
| 223 |
Message+="\nCon: "+str(Item.Con) |
| 224 |
if Item.Cha!=0: |
| 225 |
Message+="\nCha: "+str(Item.Cha) |
| 226 |
if Item.Value!=0: |
| 227 |
Message+="\nValue: "+str(Item.Value) |
| 228 |
GlassReplica.Message=Message |
| 229 |
Dict=CFDB.get(pshop, {}) |
| 230 |
Dict.update({str(whoami.Value):(Value,"PickedUp",Message)}) |
| 231 |
|
| 232 |
|
| 233 |
CFDB.store(pshop,Dict) |
| 234 |
|
| 235 |
whoami.Value+=1 |
| 236 |
elif whoami.Name.find("Rent Box")>-1: |
| 237 |
Value=0 |
| 238 |
Inventory=whoami.Inventory |
| 239 |
|
| 240 |
while Inventory!=None: |
| 241 |
|
| 242 |
if Inventory.ArchName=="event_close": |
| 243 |
Inventory=Inventory.Below |
| 244 |
else: |
| 245 |
Value+=Inventory.Value*Inventory.Quantity |
| 246 |
|
| 247 |
Inventory.Teleport(whoami.Map,37,5) |
| 248 |
Inventory=whoami.Inventory |
| 249 |
Variables=whoami.Map.ObjectAt(49,0) |
| 250 |
Variables=GetObjectByName(Variables,"Variables") |
| 251 |
VariableList= Variables.Message.split('\n') |
| 252 |
Owner=VariableList[0].split(": ")[1] |
| 253 |
Date=VariableList[1].split(": ")[1] |
| 254 |
Days=int(VariableList[2].split(": ")[1]) |
| 255 |
|
| 256 |
|
| 257 |
|
| 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 |
| 263 |
Days-=DaysPast |
| 264 |
MaxDays=int(Params) |
| 265 |
if Owner!="Unowned": |
| 266 |
if Days<30: |
| 267 |
DT30=30-Days |
| 268 |
if DT30<=Value/50: |
| 269 |
Value-=DT30*50 |
| 270 |
Days=30 |
| 271 |
else: |
| 272 |
Days+=int(Value/50) |
| 273 |
Value-=int(Value/50)*50 |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
if Value>=100: |
| 278 |
if Days<60: |
| 279 |
DT60=60-Days |
| 280 |
if DT60<=Value/100: |
| 281 |
Value-=DT60*100 |
| 282 |
Days=60 |
| 283 |
else: |
| 284 |
Days+=int(Value/100) |
| 285 |
Value-=int(Value/100)*100 |
| 286 |
|
| 287 |
if Value>=200: |
| 288 |
if Days<90: |
| 289 |
DT90=90-Days |
| 290 |
if DT90<=Value/200: |
| 291 |
Value-=DT90*200 |
| 292 |
Days=90 |
| 293 |
else: |
| 294 |
Days+=int(Value/200) |
| 295 |
Value-=int(Value/200)*200 |
| 296 |
if Value>=400: |
| 297 |
if Days<120: |
| 298 |
DT120=120-Days |
| 299 |
if DT120<=Value/400: |
| 300 |
Value-=DT120*400 |
| 301 |
Days=120 |
| 302 |
else: |
| 303 |
Days+=int(Value/400) |
| 304 |
Value-=int(Value/400)*400 |
| 305 |
if Value>=800: |
| 306 |
if Days<150: |
| 307 |
DT150=150-Days |
| 308 |
if DT150<=Value/800: |
| 309 |
Value-=DT150*800 |
| 310 |
Days=150 |
| 311 |
else: |
| 312 |
Days+=int(Value/800) |
| 313 |
Value-=int(Value/800)*800 |
| 314 |
if Value>=1600: |
| 315 |
if Days<180: |
| 316 |
DT180=180-Days |
| 317 |
if DT90<=Value/1600: |
| 318 |
Value-=DT180*1600 |
| 319 |
Days=180 |
| 320 |
else: |
| 321 |
Days+=int(Value/1600) |
| 322 |
Value-=int(Value/1600)*1600 |
| 323 |
if Value>=3200: |
| 324 |
if Days<210: |
| 325 |
DT210=210-Days |
| 326 |
if DT210<=Value/3200: |
| 327 |
Value-=DT210*3200 |
| 328 |
Days=210 |
| 329 |
else: |
| 330 |
Days+=int(Value/3200) |
| 331 |
Value-=int(Value/3200)*3200 |
| 332 |
if Value>=6400: |
| 333 |
if Days<240: |
| 334 |
DT240=240-Days |
| 335 |
if DT240<=Value/6400: |
| 336 |
Value-=DT240*6400 |
| 337 |
Days=240 |
| 338 |
else: |
| 339 |
Days+=int(Value/6400) |
| 340 |
Value-=int(Value/6400)*6400 |
| 341 |
if Value>=12800: |
| 342 |
if Days<270: |
| 343 |
DT270=270-Days |
| 344 |
if DT270<=Value/12800: |
| 345 |
Value-=DT270*12800 |
| 346 |
Days=270 |
| 347 |
else: |
| 348 |
Days+=int(Value/12800) |
| 349 |
Value-=int(Value/12800)*12800 |
| 350 |
if Value>=25600: |
| 351 |
if Days<300: |
| 352 |
DT300=300-Days |
| 353 |
if DT300<=Value/25600: |
| 354 |
Value-=DT300*25600 |
| 355 |
Days=300 |
| 356 |
else: |
| 357 |
Days+=int(Value/25600) |
| 358 |
Value-=int(Value/25600)*25600 |
| 359 |
|
| 360 |
if Value>=51200: |
| 361 |
if Days<330: |
| 362 |
DT330=330-Days |
| 363 |
if DT330<=Value/51200: |
| 364 |
Value-=DT330*51200 |
| 365 |
Days=330 |
| 366 |
else: |
| 367 |
Days+=int(Value/51200) |
| 368 |
Value-=int(Value/51200)*51200 |
| 369 |
if Value>=102400: |
| 370 |
if Days<366: |
| 371 |
DT366=366-Days |
| 372 |
if DT366<=Value/102400: |
| 373 |
Value-=DT366*102400 |
| 374 |
Days=366 |
| 375 |
else: |
| 376 |
Days+=int(Value/102400) |
| 377 |
Value-=int(Value/102400)*102400 |
| 378 |
tmp=whoami.CreateObject("silvercoin") |
| 379 |
tmp.Quantity=Value |
| 380 |
Days=min(Days,MaxDays) |
| 381 |
else: |
| 382 |
DT30=30 |
| 383 |
Owner=activator.Name |
| 384 |
if DT30<=Value/50: |
| 385 |
Value-=DT30*50 |
| 386 |
Days=30 |
| 387 |
else: |
| 388 |
Days+=int(Value/50) |
| 389 |
Value-=int(Value/50) |
| 390 |
if Value>0: |
| 391 |
tmp=whoami.CreateObject("silvercoin") |
| 392 |
tmp.Quantity=Value |
| 393 |
if Days>=1: |
| 394 |
whoami.Teleport(whoami.Map,30,8) |
| 395 |
else: |
| 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': |
| 401 |
Name='' |
| 402 |
Title='' |
| 403 |
Quantity=0 |
| 404 |
for i in range(len(Message)): |
| 405 |
|
| 406 |
if Message[i].upper()=="NAME": |
| 407 |
Name=Message[i+1] |
| 408 |
elif Message[i].upper()=='TITLE': |
| 409 |
Title=Message[i+1] |
| 410 |
elif Message[i].upper()=='QUANTITY': |
| 411 |
Quantity=int(Message[i+1]) |
| 412 |
elif Params=="Exchange": |
| 413 |
pass |
| 414 |
elif Params=="InventorySay": |
| 415 |
|
| 416 |
Message=Crossfire.WhatIsMessage().split() |
| 417 |
if Message[0]=="Remove": |
| 418 |
|
| 419 |
CFDB.remove_record(pshop) |
| 420 |
if Message[0].upper().find("DETAIL")>-1: |
| 421 |
Item=' '.join(Message[1:]) |
| 422 |
|
| 423 |
Dict=CFDB.get(pshop, {}) |
| 424 |
|
| 425 |
Ctrl=1 |
| 426 |
for i in Dict: |
| 427 |
Str=Dict.get(str(i)) |
| 428 |
Name=Str[2].split('\n')[0].split("Name: ")[1] |
| 429 |
|
| 430 |
if Item==Name: |
| 431 |
|
| 432 |
Message="\n"+str(Dict.get(i)[2]) |
| 433 |
|
| 434 |
Message+=("\nAsking Price: "+str(Dict.get(i)[0])+"\nLocation: ") |
| 435 |
|
| 436 |
if Dict.get(i)[1]=="PickedUp": |
| 437 |
|
| 438 |
Message+="Not on store floor" |
| 439 |
|
| 440 |
elif Dict.get(i)[1][1]<=9: |
| 441 |
Message+="In employee only area." |
| 442 |
else: |
| 443 |
Message+=str(Dict.get(i)[1]) |
| 444 |
Message+="\n(You are at ("+str(whoami.X)+","+str(whoami.Y)+")." |
| 445 |
whoami.Say(Message) |
| 446 |
Ctrl=0 |
| 447 |
if Ctrl==1: |
| 448 |
|
| 449 |
|
| 450 |
Item=int(Message[1]) |
| 451 |
|
| 452 |
|
| 453 |
Item=list(Dict)[Item-1] |
| 454 |
|
| 455 |
Item=Dict.get(str(Item))[2].split('\n')[0].split('Name: ')[1] |
| 456 |
|
| 457 |
for i in Dict: |
| 458 |
Str=Dict.get(str(i)) |
| 459 |
Name=Str[2].split('\n')[0].split("Name: ")[1] |
| 460 |
|
| 461 |
if Item==Name: |
| 462 |
|
| 463 |
Message="\n"+str(Dict.get(i)[2]) |
| 464 |
|
| 465 |
Message+=("\nAsking Price: "+str(Dict.get(i)[0])+"\nLocation: ") |
| 466 |
|
| 467 |
if Dict.get(i)[1]=="PickedUp": |
| 468 |
|
| 469 |
Message+="Not on store floor" |
| 470 |
|
| 471 |
elif Dict.get(i)[1][1]<=9: |
| 472 |
Message+="In employee only area." |
| 473 |
else: |
| 474 |
Message+=str(Dict.get(i)[1]) |
| 475 |
Message+="\n(You are at ("+str(whoami.X)+","+str(whoami.Y)+")." |
| 476 |
whoami.Say(Message) |
| 477 |
Ctrl=0 |
| 478 |
elif Params=="AutoCheckout": |
| 479 |
Dict=CFDB.get(pshop, {}) |
| 480 |
Inv=activator.Inventory |
| 481 |
Items=[] |
| 482 |
RealItems=[] |
| 483 |
MissingItems=[] |
| 484 |
Price=0 |
| 485 |
|
| 486 |
while Inv!=None: |
| 487 |
|
| 488 |
if (Inv.Name.find("Price: ")>-1): |
| 489 |
|
| 490 |
Items=Items.__add__([Inv]) |
| 491 |
|
| 492 |
Inv=Inv.Below |
| 493 |
for i in Items: |
| 494 |
Item=(activator.Map.ObjectAt(43,2)) |
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
Item=GetObjectByUID(Item,str(i.WeightLimit)) |
| 499 |
|
| 500 |
if Item!=0: |
| 501 |
|
| 502 |
Price+=int(Item.Name.split()[1]) |
| 503 |
RealItems=RealItems.__add__([Item]) |
| 504 |
else: |
| 505 |
|
| 506 |
whoami.Say("Item "+i.Name+" missing.") |
| 507 |
MissingItems=MissingItems.__add__([i]) |
| 508 |
if activator.PayAmount(Price): |
| 509 |
for i in RealItems: |
| 510 |
i.InsertInto(activator) |
| 511 |
tmp=Dict.pop((str(i.Name.split()[0]))) |
| 512 |
for i in Items: |
| 513 |
i.Teleport(activator.Map, 37,0) |
| 514 |
i.Speed+=(0.00010000000475*2) |
| 515 |
|
| 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))) |
| 520 |
|
| 521 |
|
| 522 |
CFDB.store(pshop,Dict) |
| 523 |
|
| 524 |
Variables=GetObjectByName(mymap.ObjectAt(49,0),"Variables") |
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
VariableList= Variables.Message.split('\n') |
| 529 |
Owner=VariableList[0] |
| 530 |
Date=VariableList[1] |
| 531 |
Days=VariableList[2] |
| 532 |
|
| 533 |
Owner=Owner.split(": ")[1] |
| 534 |
Date=Date.split(": ")[1] |
| 535 |
|
| 536 |
Days=int(Days.split(": ")[1]) |
| 537 |
|
| 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 |
| 543 |
Days-=DaysPast |
| 544 |
|
| 545 |
if Days<30: |
| 546 |
DT30=30-Days |
| 547 |
if DT30<=Price/50: |
| 548 |
Price-=DT30*50 |
| 549 |
Days=30 |
| 550 |
else: |
| 551 |
Days+=int(Price/50) |
| 552 |
Price-=int(Price/50) |
| 553 |
|
| 554 |
if Days<=0: |
| 555 |
global Owner |
| 556 |
|
| 557 |
|
| 558 |
Expire() |
| 559 |
|
| 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)) |
| 562 |
|
| 563 |
else: |
| 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 |
| 568 |
Items=[] |
| 569 |
RealItems=[] |
| 570 |
MissingItems=[] |
| 571 |
Price=0 |
| 572 |
|
| 573 |
while Inv!=None: |
| 574 |
if (Inv.Name.find("Price: ")>-1): |
| 575 |
|
| 576 |
Items=Items.__add__([Inv]) |
| 577 |
|
| 578 |
Inv=Inv.Below |
| 579 |
|
| 580 |
for i in Items: |
| 581 |
Item=(activator.Map.ObjectAt(43,2)) |
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
Item=GetObjectByUID(Item,str(i.WeightLimit)) |
| 586 |
|
| 587 |
if Item!=0: |
| 588 |
|
| 589 |
Price+=int(Item.Name.split()[1]) |
| 590 |
RealItems=RealItems.__add__([Item]) |
| 591 |
else: |
| 592 |
|
| 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) |
| 597 |
for i in RealItems: |
| 598 |
i.InsertInto(activator) |
| 599 |
tmp=Dict.pop((str(i.Name.split()[0]))) |
| 600 |
for i in Items: |
| 601 |
i.Teleport(activator.Map, 37,0) |
| 602 |
i.Speed+=(0.00010000000475*2) |
| 603 |
|
| 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))) |
| 608 |
|
| 609 |
|
| 610 |
CFDB.store(pshop,Dict) |
| 611 |
|
| 612 |
Variables=GetObjectByName(mymap.ObjectAt(49,0),"Variables") |
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
VariableList= Variables.Message.split('\n') |
| 617 |
Owner=VariableList[0] |
| 618 |
Date=VariableList[1] |
| 619 |
Days=VariableList[2] |
| 620 |
|
| 621 |
Owner=Owner.split(": ")[1] |
| 622 |
Date=Date.split(": ")[1] |
| 623 |
|
| 624 |
Days=int(Days.split(": ")[1]) |
| 625 |
|
| 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 |
| 631 |
Days-=DaysPast |
| 632 |
|
| 633 |
if Days<30: |
| 634 |
DT30=30-Days |
| 635 |
if DT30<=Price/50: |
| 636 |
Price-=DT30*50 |
| 637 |
Days=30 |
| 638 |
else: |
| 639 |
Days+=int(Price/50) |
| 640 |
Price-=int(Price/50) |
| 641 |
|
| 642 |
if Days<=0: |
| 643 |
global Owner |
| 644 |
|
| 645 |
|
| 646 |
Expire() |
| 647 |
|
| 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)) |
| 650 |
|
| 651 |
else: |
| 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) |
| 655 |
while Trash!=None: |
| 656 |
Trash1=Trash.Above |
| 657 |
Trash.InsertInto(whoami) |
| 658 |
Trash=Trash1 |
| 659 |
elif Params=="TrashClose": |
| 660 |
Trash=whoami.Inventory |
| 661 |
while Trash!=None: |
| 662 |
if (Trash.Name=="TrashClose") or (Trash.Name=="TrashOpen"): |
| 663 |
Trash=Trash.Above |
| 664 |
else: |
| 665 |
Trash.Teleport(whoami.Map,37,0) |
| 666 |
|
| 667 |
if Trash.ArchName=="icecube": |
| 668 |
Trash.Speed+=(0.00010000000475*2) |
| 669 |
Trash=whoami.Inventory |
| 670 |
|
| 671 |
else: |
| 672 |
whoami.Message="xyzzy" |
| 673 |
Dict=CFDB.get(pshop, {}) |
| 674 |
whoami.Message='' |
| 675 |
for i in Dict: |
| 676 |
Str=Dict.get(i)[2].split('\n')[0] |
| 677 |
|
| 678 |
whoami.Message+=str(Str) |