-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_use.py
73 lines (47 loc) · 1.56 KB
/
example_use.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from swordie_db.database import SwordieDB
import time
swordie_data = SwordieDB(schema="spirit") # If no parameters are given, it will attempt to connect to localhost
char = swordie_data.get_char_by_name("brandon")
assert char is not None, "Character does not exist"
print("Character Name:", char.name)
print("Character Level:", char.level)
print("Job:", char.get_job_name())
print("Mesos:", char.money)
print("Fame:", char.fame)
print("Character image", char.get_char_img())
primary_stats = char.get_primary_stats()
for stat in primary_stats:
print(f"{stat}: {primary_stats[stat]}")
# Str
# Dex
# Int
# Luk
# User Class
user = char.user
user.is_admin()
# Inventory
print("Consume Inventory:", char.inventory.consume_inv)
equip_inv = char.inventory.consume_inv
print("Testing equip checks....")
def test_check_speed():
for bag_index in equip_inv:
if 2000000 in equip_inv[bag_index].values():
return True
return False
def test_check_speed_equals():
for bag_index in equip_inv:
if 2000000 == equip_inv[bag_index]['itemid']:
return True
return False
print("Starting list comprehension test")
start_time = time.time()
for i in range(100000):
test_check_speed()
end_time = time.time()
print(f"Completed List Comprehension 100000 iterations in: {end_time - start_time} seconds")
print("Starting == test")
start_time1 = time.time()
for n in range(100000):
test_check_speed_equals()
end_time1 = time.time()
print(f"Completed 100000 iterations of == operations in: {end_time1 - start_time1} seconds")