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
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
,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
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()
EXAMPLE #1
Code:
python manage.py shell
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
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
As you can see, it's quite easy to manipulate data, integrating this into web software is extremely easy too.Quote:
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
TO DO THIS WITH DJANGO:Code:SELECT * FROM ps_GameData.dbo.Chars Where CharName like '%CharNameHere%'
Code:from gamedata.models import Chars Chars.objects.filter(CharName__icontains="CharacterName")
to reset all acc's to leave 0
TO DO THIS WITH DJANGO:Code:UPDATE PS_UserData.dbo.Users_Master SET Leave = 0
Code:from userdata.models import UsersMaster as Users_Master Users_Master.objects.filter().update(Leave=0)
to change a users p/w
TO DO THIS WITH DJANGO:Code:UPDATE PS_UserData.dbo.Users_Master set Pw = 'new p/w' WHERE UserID = 'loginhere'
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
TO DO THIS WITH DJANGO:Code:SELECT * FROM ps_Gamelog.dbo.ActionLog Where CharID like '%idhere%'
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
TO DO THIS WITH DJANGO:Code:SELECT * FROM ps_UserData.dbo.Users_Master Where userIp like '%ip goes here%'
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
TO DO THIS WITH DJANGO:Code:UPDATE PS_GameData.dbo.Chars set Del = '0' Where CharName = 'charnamehere'
Code:from gamedata.models importCode:Chars [I] char = Chars.objects.get(CharName='CHARNAMEHERE') char.Del = '0' char.save()[/I]
to bann all accounts from a single ip
TO DO THIS WITH DJANGO:Code:UPDATE PS_UserData.dbo.Users_Master set Status = -1 WHERE UserIp = 'ipgoeshere'
Code:from userdata.models importto bann a single accountCode:UsersMaster as Users_Master [I] Users_Master.objects.filter(UserIp='IPGOESHERE').update(Status=-1)[/I]
TO DO THIS WITH DJANGO:Code:UPDATE PS_UserData.dbo.Users_Master set Status = -1 WHERE UserUID = 'UserUIDhere'
Code:from userdata.models importThanks 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 galsCode:UsersMaster as Users_Master [I] user = Users_Master.objects.get(UserUID='UserUIDHere') user.Status=-1 user.save()[/I]
I hope this helps the ppl that are starting and or testing a server at home.
Best Regards
Safe
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'),
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
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'
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 %}
will see an (ugly, bare) list of players in your databaseI 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.






