Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
add player level and vip points modification
Browse files Browse the repository at this point in the history
  • Loading branch information
Arzaroth Lekva committed Feb 29, 2016
1 parent a1c6dca commit 761c0fa
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 31 deletions.
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@ CelestiaSunrise

A savegame editor for the mobile game "My Little Pony"

```
Required:
args==0.1.0
clint==0.4.1
docopt==0.6.2
RapidXml==1.0.7
requests==2.7.0
six==1.9.0
```

Dependencies can be installed with the following command:
```
> pip install -r requirements.txt
pip install -r requirements.txt
```

Basic usage: python CelestiaSunrise.py
Expand All @@ -35,16 +25,17 @@ Linux

Ezpz.
```
> python setup.py install
python setup.py install
```
Alternatively, you can specify the --user switch to install it locally, which doesn't require sudo privileges.
It will work regardless of your python version.
Alternatively, you can specify the --user switch to install it locally, which doesn't require sudo privileges.
It will work regardless of your python version.

Windows
-------------

* Grab the latest release executable.
* Run it.
* ???
* Profit.

Project Current State
Expand Down
7 changes: 4 additions & 3 deletions celestia/gui/currenciesframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import Tkinter as tk
import ttk
from Tkconstants import N, S, E, W, NSEW
from .scrolledframe import ScrolledFrame
from celestia.utility.tkvardescriptor import TkVarDescriptor, TkVarDescriptorOwner

@six.add_metaclass(TkVarDescriptorOwner)
Expand All @@ -42,16 +43,16 @@ def __init__(self, parent, text, value, limit, offset):
self._limit.grid(row=offset, column=2, sticky=NSEW, **options)


class CurrenciesFrame(ttk.Frame):
class CurrenciesFrame(ScrolledFrame):
def __init__(self, parent, xml_handle):
ttk.Frame.__init__(self, parent)
ScrolledFrame.__init__(self, parent)

self._xml_handle = xml_handle
self._currencies = defaultdict(dict)
n = 0
for name, typ in xml_handle.currencies.items():
for cur, val in typ.items():
self._currencies[name][cur] = CurrencyFrame(self,
self._currencies[name][cur] = CurrencyFrame(self.interior,
cur,
val.value,
val.limit, n)
Expand Down
37 changes: 37 additions & 0 deletions celestia/gui/playerframe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# File: playerframe.py
# by Arzaroth Lekva
# [email protected]
#

from __future__ import print_function, absolute_import, unicode_literals

import six
try:
# py3
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.constants import N, S, E, W, NSEW
except ImportError:
# py2
import Tkinter as tk
import ttk
from Tkconstants import N, S, E, W, NSEW
from celestia.gui.currenciesframe import CurrencyFrame

class PlayerFrame(ttk.Frame):
def __init__(self, parent, xml_handle):
ttk.Frame.__init__(self, parent, height=400)
self.grid_propagate(0)

self._xml_handle = xml_handle
self._player_infos = {}
for n, (name, typ) in enumerate(xml_handle.player_infos.items()):
self._player_infos[name] = CurrencyFrame(self, name, typ.value,
typ.limit, n)

def commit(self):
for name, typ in self._xml_handle.player_infos.items():
typ.value = self._player_infos[name].value
16 changes: 14 additions & 2 deletions celestia/gui/ponygui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from .basegui import BaseGui
from .missingponiesframe import MissingPoniesFrame
from .currenciesframe import CurrenciesFrame
from .playerframe import PlayerFrame
from .poniesframe import PoniesFrame
from .zonesframe import ZonesFrame
from .threaded import ThreadedLoad, ThreadedSave
Expand Down Expand Up @@ -70,7 +71,10 @@ def success_callback(res):
success_callback, self._unload)

def _export_xml(self):
filename = asksaveasfilename()
filename = asksaveasfilename(defaultextension='.xml',
filetypes=[('XML files', '.xml'),
('All files', '*')],
parent=self)
if filename:
loadingbox = LoadingDialog(self)
queue = Queue()
Expand All @@ -86,7 +90,10 @@ def _export_xml(self):
self, queue, loadingbox)

def _import_xml(self):
filename = askopenfilename()
filename = askopenfilename(defaultextension='.xml',
filetypes=[('XML files', '.xml'),
('All files', '*')],
parent=self)
if filename:
self.withdraw()
loadingbox = LoadingDialog(self, False)
Expand Down Expand Up @@ -129,6 +136,8 @@ def _create_widgets(self):
def _create_frames(self):
BaseGui._create_frames(self)
self._notebook = ttk.Notebook(self._main_frame)
self._player_frame = PlayerFrame(self._main_frame,
self._xml_handle)
self._currencies_frame = CurrenciesFrame(self._main_frame,
self._xml_handle)
self._zones_frame = ZonesFrame(self._main_frame,
Expand All @@ -137,6 +146,8 @@ def _create_frames(self):
self._xml_handle)
self._missing_ponies_frame = MissingPoniesFrame(self._main_frame,
self._xml_handle)
self._notebook.add(self._player_frame,
text="Player")
self._notebook.add(self._currencies_frame,
text="Currencies")
self._notebook.add(self._ponies_frame,
Expand All @@ -160,6 +171,7 @@ def _grid_widgets(self):
self._save_button.grid(row=2, column=0, sticky=NSEW, padx=3, pady=4)

def _commit(self):
self._player_frame.commit()
self._currencies_frame.commit()
self._ponies_frame.commit()
self._zones_frame.commit()
Expand Down
9 changes: 5 additions & 4 deletions celestia/gui/zonesframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import Tkinter as tk
import ttk
from Tkconstants import N, S, E, W, NSEW
from .scrolledframe import ScrolledFrame
from celestia.utility.tkvardescriptor import TkVarDescriptor, TkVarDescriptorOwner

@six.add_metaclass(TkVarDescriptorOwner)
Expand Down Expand Up @@ -68,16 +69,16 @@ def update(self):
"s" if len(self.zone.shops) > 1 else ""))


class ZonesFrame(ttk.Frame):
class ZonesFrame(ScrolledFrame):
def __init__(self, parent, xml_handle):
ttk.Frame.__init__(self, parent)
ScrolledFrame.__init__(self, parent)

self._xml_handle = xml_handle
self._zones = {}
reset_offset = len(self._xml_handle.zones) * 2
ttk.Label(self).grid(row=reset_offset, column=0)
ttk.Label(self.interior).grid(row=reset_offset, column=0)
for n, (ID, zone) in enumerate(self._xml_handle.zones.items()):
self._zones[ID] = ZoneFrame(self, zone, n, reset_offset + 1)
self._zones[ID] = ZoneFrame(self.interior, zone, n, reset_offset + 1)

def commit(self):
for ID, zone in self._xml_handle.zones.items():
Expand Down
11 changes: 9 additions & 2 deletions celestia/shell/ponyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
from celestia.utility.gluid import retrieve_gluid
from celestia.utility.version import check_version
from .docopt_utils import docopt_cmd, docopt_cmd_completion
from .show import (show_currencies, show_currency,
from .show import (show_player,
show_currencies, show_currency,
show_ponies, show_pony,
show_zones, show_zone)
from .set import (set_currency,
from .set import (set_player, set_currency,
set_ponies, set_pony,
set_zones, set_zone,
set_inventory)
Expand Down Expand Up @@ -52,6 +53,7 @@ def __init__(self, savedata):
self._xml_handle.pre_load()
self.savedata = savedata
self._show_functions = {
'player': show_player,
'currencies': show_currencies,
'currency': show_currency,
'ponies': show_ponies,
Expand All @@ -60,6 +62,7 @@ def __init__(self, savedata):
'zone': show_zone,
}
self._set_functions = {
'player': set_player,
'currency': set_currency,
'ponies': set_ponies,
'pony': set_pony,
Expand All @@ -81,6 +84,7 @@ def do_show(self, args):
"""Show what you requested.
Usage:
show player [<player_data>]
show currencies
show currency <currency_id>...
show ponies [-i|-o]
Expand All @@ -89,6 +93,7 @@ def do_show(self, args):
show zone <zone_id>...
Arguments:
player_data Id of a player_data item. Can be retrieved with "show player".
currency_id Id of a currency. Can be retrieved with "show currencies".
pony_id Id of a pony. Can be retrieved with "show ponies".
zone_id Id of a zone. Can be retrieved with "show zones".
Expand All @@ -107,6 +112,7 @@ def do_set(self, args):
"""Set what you requested.
Usage:
set player <player_data> <value>
set currency <value> <currency_id>...
set ponies (level|shards) (up|down)
set ponies (level|shards) <value>
Expand All @@ -121,6 +127,7 @@ def do_set(self, args):
set inventory add <not_owned_pony_id>...
Arguments:
player_data Id of a player_data item. Can be retrieved with "show player".
currency_id Id of a currency. Can be retrieved with "show currencies".
pony_id Id of a pony. Can be retrieved with "show ponies".
zone_id Id of a zone. Can be retrieved with "show zones".
Expand Down
8 changes: 8 additions & 0 deletions celestia/shell/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

from __future__ import print_function, absolute_import, unicode_literals

def set_player(xml_handle, args):
for typ in xml_handle.player_infos.values():
if args['<player_data>'] == typ.name:
try:
typ.value = args['<value>']
except ValueError as e:
print(str(e))

def set_currency(xml_handle, args):
for currency_id in args['<currency_id>']:
for typ in xml_handle.currencies.values():
Expand Down
5 changes: 5 additions & 0 deletions celestia/shell/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

from __future__ import print_function, absolute_import, unicode_literals

def show_player(xml_handle, args):
for typ in xml_handle.player_infos.values():
if not args['<player_data>'] or args['<player_data>'] == typ.name:
print(typ)

def show_currencies(xml_handle, args):
for name, typ in xml_handle.currencies.items():
print('{}:'.format(name))
Expand Down
24 changes: 20 additions & 4 deletions celestia/utility/ponies.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,28 @@
('Pony_Big_Mac', 'Big Macintosh'),
('Pony_Blue_moon', 'Blue Moon'),
('Pony_Bon_Bon', 'Bon Bon'),
('Pony_Braeburn', 'Braeburn'),
('Pony_Bright_Unicorn', 'Bright Unicorn'),
('Pony_Bulk_Biceps', 'Bulk Biceps'),
('Pony_Braeburn', 'Braeburn'),
('Pony_Candy_Apples', 'Candy Apples'),
('Pony_Caramel', 'Caramel'),
('Pony_Caramel_Apple', 'Caramel Apple'),
('Pony_Cheerilee', 'Cheerilee'),
('Pony_Cheese_Sandwich', 'Cheese Sandwich'),
('Pony_CherryBerry', 'Cherry Berry'),
('Pony_Cherry_Fizzy', 'Cherry Fizzy'),
('Pony_Cherry_Jubilee', 'Cherry Jubilee'),
('Pony_CherryBerry', 'Cherry Berry'),
('Pony_Claude_the_Puppeteer', 'Claude the Puppeteer'),
('Pony_Clear_Skies', 'Clear Skies'),
('Pony_Clumsy_Clownspony', 'Clumsy Clownspony'),
('Pony_Coco_Pommel', 'Coco Pommel'),
('Pony_Comet_Tail', 'Comet Tail'),
('Pony_Compass_Star', 'Compass Star'),
('Pony_Conductor', 'Conductor'),
('Pony_Curio_Shopkeeper', 'Curio Shopkeeper'),
('Pony_Crescent_Moon', 'Crescent Moon'),
('Pony_Curio_Shopkeeper', 'Curio Shopkeeper'),
('Pony_Daisy', 'Daisy'),
('Pony_Dancing_Clownspony', 'Dancing Clownspony'),
('Pony_Daring', 'Daring Do'),
('Pony_Diamond_Tiara', 'Diamond Tiara'),
('Pony_Discord', 'Discord'),
Expand Down Expand Up @@ -86,23 +88,32 @@
('Pony_Four_Step', 'Four Step'),
('Pony_Frederic', 'Frederic'),
('Pony_Gala_Appleby', 'Gala Appleby'),
('Pony_Gilda', 'Gilda'),
('Pony_Gleeful_Clownspony', 'Gleeful Clownspony'),
('Pony_Golden_Delicious', 'Golden Delicious'),
('Pony_Golden_Harvest', 'Golden Harvest'),
('Pony_Goldie_Delicious', 'Goldie Delicious'),
('Pony_Goth_Unicorn', 'Goth Unicorn'),
('Pony_Grampa_Gruff', 'Grampa Gruff'),
('Pony_Granny_Smith', 'Granny Smith'),
('Pony_Green_Jewel', 'Green Jewel'),
('Pony_Greta', 'Greta'),
('Pony_Griffon_Shopkeeper', 'Griffon Shopkeeper'),
('Pony_Half_Baked_Apple', 'Half Baked Apple'),
('Pony_Hayseed_Turnip_Truck', 'Hayseed Turnip Truck'),
('Pony_Hoity_Toity', 'Hoity Toity'),
('Pony_Jeff_Letrotski', 'Jeff Letrotski'),
('Pony_Jet_Set', 'Jet Set'),
('Pony_Jigging_Clownspony', 'Jigging Clownspony'),
('Pony_Joe', 'Joe'),
('Pony_Jokester_Clownspony', 'Jokester Clownspony'),
('Pony_Junebug', 'Junebug'),
('Pony_Junior_Deputy', 'Junior Deputy'),
('Pony_King_Sombra', 'King Sombra'),
('Pony_Lassoing_Clownspony', 'Lassoing Clownspony'),
('Pony_Lemon_Hearts', 'Lemon Hearts'),
('Pony_Lemony_Gem', 'Lemony Gem'),
('Pony_Li_I_Griffon', 'Li\'l Griffon'),
('Pony_Lightning_Dust', 'Lightning Dust'),
('Pony_Lily_Valley', 'Lily Valley'),
('Pony_Limestone_Pie', 'Limestone Pie'),
Expand All @@ -115,6 +126,7 @@
('Pony_Lyrica', 'Lyrica'),
('Pony_Magnum', 'Hondo Flanks (Magnum)'),
('Pony_Mane_iac', 'Mane-iac'),
('Pony_Manehattan_Delegate', 'Manehattan Delegate'),
('Pony_Marble_Pie', 'Marble Pie'),
('Pony_Maud_Pie', 'Maud Pie'),
('Pony_Mayor', 'Mayor'),
Expand All @@ -124,6 +136,7 @@
('Pony_Mr_Cake', 'Mr. Cake'),
('Pony_Mrs_Cake', 'Mrs. Cake'),
('Pony_MsHarshwhinny', 'Ms. Harshwhinny'),
('Pony_Musical_Clownspony', 'Musical Clownspony'),
('Pony_Neon_Lights', 'Neon Lights'),
('Pony_Nerdpony', 'Nerdpony'),
('Pony_Night_Glider', 'Night Glider'),
Expand Down Expand Up @@ -179,6 +192,7 @@
('Pony_Spitfire', 'Spitfire'),
('Pony_Sprinkle_Stripe', 'Sprinkle Stripe'),
('Pony_Starlight_Glimmer', 'Starlight Glimmer'),
('Pony_Studious_Delegate', 'Studious Delegate'),
('Pony_Sugar_Belle', 'Sugar Belle'),
('Pony_Sunny_Daze', 'Sunny Daze'),
('Pony_Sunsetshimmer', 'Sunset Shimmer'),
Expand All @@ -204,10 +218,12 @@
('Pony_Twist', 'Twist'),
('Pony_Uncle_Orange', 'Uncle Orange'),
('Pony_Unicorn_Guard', 'Unicorn Guard'),
('Pony_Unicorn_Painter', 'Unicorn Painter'),
('Pony_Uppercrust', 'Upper Crust'),
('Pony_Walter', 'Walter (Bowling Pony)'),
('Pony_Wensley', 'Wensley'),
('Pony_Whinnyapolis_Delegate', 'Whinnyapolis Delegate'),
('Pony_Wild_Fire', 'Wild Fire'),
('Pony_Zecora', 'Zecora'),
('Pony_Zipporwhill', 'Zipporwhill'),
('Pony_Zipporwhill', 'Zipporwhill')
])
Loading

0 comments on commit 761c0fa

Please sign in to comment.