Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server > Shaiya PServer Guides & Releases
You last visited: Today at 14:46

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] (Incompleted) Django/Python server management files

Discussion on [Release] (Incompleted) Django/Python server management files within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old   #1
 
SpInKsTaR's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 125
Received Thanks: 165
[Release] (Incompleted) Django/Python [UPDATED] web server management files

DOWNLOAD IS DOWN BOTTOM (AS ATTACHMENT)

To put a long story short, I was going to enter the world of managing a Shaiya Private server and I saw alot of horribly coded sites, and aidsriffic ways of managing the server, so I figured.. Why not write my own way of managing the server, all from a Web control panel.

The only worthy pre-existing code which someone out there (that actually knows a little about coding) is the models data which replicates the Shaiya SQL Server structure, basically allowing to manipulate everything about it.. from the web (if you know how to work with it)

As a small example I'll show you how some of the code I've written can be manipulated quite easily from this framework.
I've also included 'sqlserver_ado', which a package from the Python repository allowing you to use this Django app with the SQL Server

So in the app(/folder) 'gamedefs' is the models.py which is replicated in sync with Shaiya 4.0 server.

List of apps:

  • billing - Done
  • chatlog - Done
  • gamedata
  • gamedefs - Done
  • gamelog - Done
  • gameweb - Done
  • gmtool
  • statdata
  • statics - Done
  • userdata - Done
Note: The ones not marked as done will not be able to manipulate the database... obviously..
Secondary note: Some of the fields (due to SQL Servers retarded nature) are probably not setup for validation, so make sure you never corrupt the data by inserting something you shouldn't. (IE. Check the ACTUAL SQL Server before messing around with inserting/changing data via this app)
You should be able to just download this zip and do ye old
Code:
python manage.py runserver
and access it on ,
But i'm not 100% as i've not touched this project for a while.
Note: In the settings.py I've got it defined to use a sqlite file for dev purposes, so doing
Code:
python manage.py sycndb
will basically allow you to screw around with data on a local expenadable uncared file.


EXAMPLE MODEL.
Code:
class Skills(models.Model):
    RowID = models.IntegerField()
    SkillID = models.SmallIntegerField()
    SkillLevel = models.IntegerField(max_length=3)
    SkillName = models.CharField(max_length=30)
    Country = models.IntegerField(max_length=3)
    Attackfighter = models.IntegerField(max_length=3)
    Defensefighter = models.IntegerField(max_length=3)
    Patrolrogue = models.IntegerField(max_length=3)
    Shootrogue = models.IntegerField(max_length=3)
    Attackmage = models.IntegerField(max_length=3)
    Defensemage = models.IntegerField(max_length=3)
    PrevSkillID = models.SmallIntegerField()
    ReqLevel = models.SmallIntegerField()
    Grow = models.IntegerField(max_length=3)
    SkillPoint = models.IntegerField(max_length=3)
    TypeShow = models.IntegerField(max_length=3)
    TypeAttack = models.IntegerField(max_length=3)
    TypeEffect = models.IntegerField(max_length=3)
    TypeDetail = models.SmallIntegerField()
    NeedWeapon1 = models.IntegerField(max_length=3)
    NeedWeapon2 = models.IntegerField(max_length=3)
    NeedWeapon3 = models.IntegerField(max_length=3)
    NeedWeapon4 = models.IntegerField(max_length=3)
    NeedWeapon5 = models.IntegerField(max_length=3)
    NeedWeapon6 = models.IntegerField(max_length=3)
    NeedWeapon7 = models.IntegerField(max_length=3)
    NeedWeapon8 = models.IntegerField(max_length=3)
    NeedWeapon9 = models.IntegerField(max_length=3)
    NeedWeapon10 = models.IntegerField(max_length=3)
    NeedWeapon11 = models.IntegerField(max_length=3)
    NeedWeapon12 = models.IntegerField(max_length=3)
    NeedWeapon13 = models.IntegerField(max_length=3)
    NeedWeapon14 = models.IntegerField(max_length=3)
    NeedWeapon15 = models.IntegerField(max_length=3)
    Shield = models.IntegerField(max_length=3)
    SP = models.SmallIntegerField()
    MP = models.SmallIntegerField()
    ReadyTime = models.IntegerField(max_length=3)
    ResetTime = models.SmallIntegerField()
    AttackRange = models.IntegerField(max_length=3)
    StateType = models.IntegerField(max_length=3)
    AttrType = models.IntegerField(max_length=3)
    Disable = models.SmallIntegerField()
    SuccessType = models.IntegerField(max_length=3)
    SuccessValue = models.IntegerField(max_length=3)
    TargetType = models.IntegerField(max_length=3)
    ApplyRange = models.IntegerField(max_length=3)
    MultiAttack = models.IntegerField(max_length=3)
    KeepTime = models.SmallIntegerField()
    Weapon1 = models.IntegerField(max_length=3)
    Weapon2 = models.IntegerField(max_length=3)
    Weaponvalue = models.IntegerField(max_length=3)
    Bag = models.IntegerField(max_length=3)
    Arrow = models.SmallIntegerField()
    DamageType = models.IntegerField(max_length=3)
    DamageHP = models.SmallIntegerField()
    DamageSP = models.SmallIntegerField()
    DamageMP = models.SmallIntegerField()
    TimeDamageType = models.IntegerField(max_length=3)
    TimeDamageHP = models.SmallIntegerField()
    TimeDamageSP = models.SmallIntegerField()
    TimeDamageMP = models.SmallIntegerField()
    AddDamageHP = models.SmallIntegerField()
    AddDamageSP = models.SmallIntegerField()
    AddDamageMP = models.SmallIntegerField()
    AbilityType1 = models.IntegerField(max_length=3)
    AbilityValue1 = models.SmallIntegerField()
    AbilityType2 = models.IntegerField(max_length=3)
    AbilityValue2 = models.SmallIntegerField()
    AbilityType3 = models.IntegerField(max_length=3)
    AbilityValue3 = models.SmallIntegerField()
    HealHP = models.SmallIntegerField()
    HealSP = models.SmallIntegerField()
    HealMP = models.SmallIntegerField()
    TimeHealHP = models.SmallIntegerField()
    TimeHealSP = models.SmallIntegerField()
    TimeHealMP = models.SmallIntegerField()
    DefenceType = models.IntegerField(max_length=3)
    DefenceValue = models.IntegerField(max_length=3)
    LimitHP = models.IntegerField(max_length=3)
    FixRange = models.IntegerField(max_length=3)
    ChangeType = models.SmallIntegerField()
    ChangeLevel = models.SmallIntegerField()
    UpdateDate = models.DateTimeField()
Now assuming you have Python installed, and Django and the environment variable setup, if you were to navigate to the directory of this .zip you've downloaded, and add 'gamedefs' to the settings.py INSTALLED_APPS array, in Terminal/CMD you'd do
EXAMPLE #1
Code:
 python manage.py shell
Which will compile all the .py files into .pyc and allow you to interact with the application.
Now type in
Code:
from gamedefs.models import Skills
Code:
s1 = Skills.objects.filter()[0] #Gets a random/1st Skill it finds
print s1.ReqLevel #Shows this specific skills required level
s1.ReqLevel = 1 #Changes this skills Required Level to be Level 1
s1.save() #Saves the object
etc etc.

EXAMPLE #2
Take this guys post as example #2,
(Credits to SafeBett)


NOTE: You must enable the application in settings.py INSTALLED_APPS to use AND rename the folder accordingly.

Eg to import and use Tables from the Chatlog database,
Open up settings.py and find INSTALLED_APPS
Add a new line 'chatlog' formatted like the rest.
Rename the folder from "chatlog - DONE" to "chatlog"


Examples to do all these querys using Django framework
Quote:
Originally Posted by SafeBett View Post
Hi everyone,

i have been a GM a very long time, but i am not IT i am not a specialist or even good at database or servers in general.

I got sucked into this role by accident way back in the Euro days and its been a passion for even longer.

<3 Shaiya

This is a list of Quirys that are by far the most common needed for a GM, if one does not suit the task just follow the logical path and adjust to the result you require.

if i had these back in the day, my life would have been so much easier ^^

So here we go, my 1st ever release

To search a Char
Code:
SELECT * FROM ps_GameData.dbo.Chars
Where CharName like '%CharNameHere%'
TO DO THIS WITH DJANGO:
Code:
from gamedata.models import Chars
Chars.objects.filter(CharName__icontains="CharacterName")


to reset all acc's to leave 0
Code:
UPDATE PS_UserData.dbo.Users_Master SET Leave = 0
TO DO THIS WITH DJANGO:
Code:
from userdata.models import UsersMaster as Users_Master
Users_Master.objects.filter().update(Leave=0)



to change a users p/w
Code:
UPDATE PS_UserData.dbo.Users_Master set Pw = 'new p/w' WHERE  UserID = 'loginhere'
TO DO THIS WITH DJANGO:
Code:
from userdata.models import UsersMaster as Users_Master
 player = Users_Master.objects.get(UserID='USERID')
player.Pw = 'NEWPASSWORD'
player.save()




to search actionlog for transactions to/from particular char
Code:
SELECT * FROM ps_Gamelog.dbo.ActionLog
Where CharID like '%idhere%'
TO DO THIS WITH DJANGO:
Code:
from gamelog.models import UsersMaster as Users_Master
  player = Users_Master.objects.get(UserID='USERID')
player.Pw = 'NEWPASSWORD'
player.save()




to search attatched accounts from a single IP
Code:
SELECT * FROM ps_UserData.dbo.Users_Master
Where userIp like '%ip goes here%'
TO DO THIS WITH DJANGO:
Code:
from userdata.models import UsersMaster as Users_Master
  for obj in Users_Master.objects.filter(userIp='IP HERE'):
    print obj.RowID
    print obj.JoinDate
    print obj.UserIp

etc.

to ressurect a char by name
Code:
UPDATE PS_GameData.dbo.Chars set Del = '0' Where CharName = 'charnamehere'
TO DO THIS WITH DJANGO:
Code:
from gamedata.models import
Code:
Chars
[I]   char = Chars.objects.get(CharName='CHARNAMEHERE')
char.Del = '0'
char.save()[/I]

to bann all accounts from a single ip
Code:
UPDATE PS_UserData.dbo.Users_Master set Status = -1 WHERE UserIp = 'ipgoeshere'
TO DO THIS WITH DJANGO:
Code:
from userdata.models import
Code:
UsersMaster as Users_Master
[I]   Users_Master.objects.filter(UserIp='IPGOESHERE').update(Status=-1)[/I]
to bann a single account
Code:
UPDATE PS_UserData.dbo.Users_Master set Status = -1 WHERE UserUID =  'UserUIDhere'
TO DO THIS WITH DJANGO:
Code:
from userdata.models import
Code:
UsersMaster as Users_Master
 [I]   user = Users_Master.objects.get(UserUID='UserUIDHere')
user.Status=-1
user.save()[/I]
Thanks go to Abrasive for being a good friend and mentor aswell as the Dev Team/social group for all the support and courage they give. ty guys n gals

I hope this helps the ppl that are starting and or testing a server at home.

Best Regards
Safe
As you can see, it's quite easy to manipulate data, integrating this into web software is extremely easy too.

EXAMPLE #3:

Creating a web page that shows all current user accounts
(Very roughly)

Documentation:

Firstly, add into the urls.py a new line
Code:
url(r'^players/$', 'website.views.players'),
What this does is sets a URL at YOURHOST/players and looks for the function that contains the 'view' at 'website' (Application) 'views' (Filename) 'players' (Function)

So after this open up the views.py inside 'website'
Firstly up top of the file, import the Database that contains the characters

Code:
from gamedata.models import Chars
then create a new function "players"
Code:
def players(request): #Request is the HTTP Request that is called when someone accesses this function
    all_chars = Chars.objects.all() #Puts all characters from the Table inside this variable
    return render_to_response('players.html', {'chars': all_chars}) #Return a page with the variable 'all_chars'
Next, inside the 'templates' folder, create a file called 'players.html' and open it up
Now because you've assigned the variable 'chars' to this template you can manipulate by doing something like this
Code:
{% for char in chars %}
{{ char }} - Whole character object
Show fields by doing the following {{ char.FIELDNAMEHERE }}..
<br />
{% endfor %}
So now anyone that visits will see an (ugly, bare) list of players in your database

I just realized after writing this it's probably a terrible a example seeming as I've not even completed the 'gamedata' apps, but I just wanted to show it's quite easy to show raw data


If you're still interested and want to start integrated with your server ASAP, I recommend you look into Django's database router,
as the whole db server for Shaiya constists of many Databases and I don't think I've included the router in my settings.py & code (It's pretty straightforward)

Information:
Information for SQL Server with Django:



I'm probably a terrible teacher but I hope you get my point.
The entire DB controllable from the web was my plan.
IF YOU STILL DON'T UNDERSTAND WHAT THIS IS, IT'S PROBABLY BEST YOU FIND SOMETHING ELSE MORE SUITED TO YOU.

DOCUMENTATION:

TL;DR: Over 850+ lines of database structure replicating Shaiya's game server database is already completed; this would be an awesome way to manage/manipulate EVERY aspect your Shaiya server all via a website if completed.

If you DO Complete this, don't be ass and share or at least help out it as it's already partially open source.

Enjoy? Let me know if this is useless.
Attached Files
File Type: rar draconian.rar (110.5 KB, 605 views)
SpInKsTaR is offline  
Thanks
30 Users
Old 08/17/2011, 21:20   #2
 
Bаne's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 2,334
Received Thanks: 1,777
I'm not sure how many user's will understand how to use this, but I love it...



#STICKED!!!!
Bаne is offline  
Old 08/17/2011, 21:28   #3
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 812
Were you mapping all the database tables into python objects manually, or did you use a tool that could auto-generate the classes for you?
abrasive is offline  
Old 08/17/2011, 21:47   #4
 
JohnHeatz's Avatar
 
elite*gold: 150
Join Date: Apr 2010
Posts: 9,739
Received Thanks: 8,981
Well....not much to say other than.....epic!!!!!
JohnHeatz is offline  
Old 08/17/2011, 23:18   #5
 
[Admin]Snuggle's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 942
Received Thanks: 1,066
Wow o.o
Really nice release
Thanks ^_^

Can I ask what game that is from on your avatar SpInKsTaR o.O
[Admin]Snuggle is offline  
Old 08/18/2011, 00:38   #6
 
SpInKsTaR's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 125
Received Thanks: 165
Quote:
Originally Posted by abrasive View Post
Were you mapping all the database tables into python objects manually, or did you use a tool that could auto-generate the classes for you?
I was doing it all manually, I'd not trust a tool to generate a db structure :P

Quote:
Originally Posted by [Admin]Snuggle View Post
Can I ask what game that is from on your avatar SpInKsTaR o.O
It's Silkroad Online (many moons ago)
SpInKsTaR is offline  
Old 08/19/2011, 06:29   #7
 
[GM]Recover's Avatar
 
elite*gold: 0
Join Date: Jan 2011
Posts: 279
Received Thanks: 164
Looks awesome Might try it out later tonight
[GM]Recover is offline  
Old 08/19/2011, 09:20   #8
 
elite*gold: 0
Join Date: Jan 2008
Posts: 70
Received Thanks: 7
O nice release i love to play with webpages lets learn DJANGO
Nice can download it for free did not now it.
And its building a web for you how cool is that.
Manny fans for this update.
elco2100 is offline  
Old 09/24/2011, 17:57   #9
 
elite*gold: 0
Join Date: Jan 2011
Posts: 54
Received Thanks: 8
i love u and i wish i was a good coder like you
and i want to know if u go to a school for coding or what pls tell me ???
-Trader is offline  
Old 09/25/2011, 05:55   #10
 
JohnHeatz's Avatar
 
elite*gold: 150
Join Date: Apr 2010
Posts: 9,739
Received Thanks: 8,981
Quote:
Originally Posted by Young.Gotti View Post
nc work
Seriously, this is plain and simple spam, stop doing this, and if you need a reason, check the board rules on the "spam" line, there is a Thanks button on every post, as you claim on your signature (so you know it is there) just use it and stop the spam, else you will be receiving a warning/infraction real soon
JohnHeatz is offline  
Old 09/26/2011, 02:55   #11
 
Bаne's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 2,334
Received Thanks: 1,777
Still a great release, I hope to get to test this out soon.
Bаne is offline  
Old 12/29/2011, 11:15   #12
 
aragonik's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 136
Received Thanks: 38
Greath release i dont know what to use this for actually.. Is it as good as SQL? I do see you puted many effort into this thats why its a greath release!
aragonik is offline  
Reply


Similar Threads Similar Threads
[Python] NDT files decryptor
02/04/2023 - Atlantica Online - 81 Replies
Hi, I was a player of Silkroad Online but since I've quit I've been playing/trying other mmos til I found Altlantica Online. I saw one post (maybe done in ancient times) that someone wanted to decrypt ndt files and so I did my try. Perhaps you all have one already but anyway, I was willing to share. It's made in Python and I did it in one day.
Python + Eric Python IDE installieren ?!
07/05/2011 - General Coding - 0 Replies
hat sich erledigt.
[Release] Pissed off server files. THE ACTUALL FILES
01/06/2011 - Kal Hacks, Bots, Cheats & Exploits - 10 Replies
Server_Files.zip Here you go, enjoy destroying his server lol. The previous upload doesnt work.
[Release]Python Vack[BMR]
05/19/2008 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 151 Replies
Done



All times are GMT +1. The time now is 14:47.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.