Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
thetrap.py
Package: MMOPRG_server_dev.rar [view]
Upload User: ghyvgy
Upload Date: 2009-05-26
Package Size: 547k
Code Size: 2k
Category:
Other Games
Development Platform:
Python
- # thetrap.py
- #
- # A SafeSandbox that represents a region that contains
- # a deadly trap, where one wrong step can kill you.
- #
- # ... if there were any code here!
- #
- # Instead, we demonstrate some of the things you can't
- # do in a safesandbox.
- #
- class TheTrap:
- """A very dangerous place, where one wrong step can kill you."""
- def Init(self):
- print 'TheTrap.Init()'
- def OnPlayerEnter(self, key):
- print 'OnPlayerEnter( %s )' % (key,)
- self.ClientMessage(key.subj, 'This is a test of the SafeSandbox system!')
- player = self.GetGameObject(key.subj)
- # try to access the deferred module
- try:
- import deferred
- self.ClientMessage(key.subj, 'You succeeded in importing the deferred module - this is bad.')
- except:
- self.ClientMessage(key.subj, 'You failed to import the deferred module - this is good.')
- # try to access the health attribute of a player
- try:
- print 'player.health = ', player.health
- self.ClientMessage(key.subj, 'You succeeded in accessing the health attribute - this is bad.')
- except:
- self.ClientMessage(key.subj, 'You failed to access the health attribute - this is good.')
- # try to access a protected method on a player
- try:
- player._GetWeapon()
- self.ClientMessage(key.subj, 'You succeeded in calling the _GetWeapon() method - this is bad.')
- except:
- self.ClientMessage(key.subj, 'You failed to call the _GetWeapon() method - this is good.')
- # try to open a file for writing
- try:
- f = open('junk.txt', 'w')
- self.ClientMessage(key.subj, 'You succeeded opening a file - this is bad.')
- except:
- self.ClientMessage(key.subj, 'You failed to open a file - this is good.')