Changeset 83f6b1daba5922e5cc8fce2548a41c4d65a4099c
- Timestamp:
- 12/28/07 11:28:43
(9 months ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1198837723 +0100
- git-parent:
[90eb19f5ebbb35fed952c0052cf8c391ba9452f5]
- git-author:
- Christopher Jung <bktheg@web.de> 1198837723 +0100
- Message:
Die fuer NPC-Scripte verwendete ScriptEngine? wird nun aus den Scripten ermittelt
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r177e8e0 |
r83f6b1d |
|
| 31 | 31 | import net.driftingsouls.ds2.server.entities.User; |
|---|
| 32 | 32 | import net.driftingsouls.ds2.server.framework.Common; |
|---|
| | 33 | import net.driftingsouls.ds2.server.scripting.EngineIdentifier; |
|---|
| 33 | 34 | import net.driftingsouls.ds2.server.scripting.NullLogger; |
|---|
| 34 | 35 | import net.driftingsouls.ds2.server.scripting.ScriptParserContext; |
|---|
| … | … | |
| 80 | 81 | this.log("Fuehre automatische NPC-Aktionen durch"); |
|---|
| 81 | 82 | |
|---|
| 82 | | ScriptEngine scriptparser = getContext().get(ContextCommon.class).getScriptParser("DSActionScript"); |
|---|
| 83 | | |
|---|
| 84 | 83 | List<User> users = getContext().query("from User where locate('execnotes',flags)!=0", User.class); |
|---|
| 85 | 84 | for( User user : users ) { |
|---|
| 86 | | if( !user.hasFlag( User.FLAG_SCRIPT_DEBUGGING ) ) { |
|---|
| 87 | | scriptparser.getContext().setErrorWriter(new NullLogger()); |
|---|
| 88 | | } |
|---|
| 89 | | else { |
|---|
| 90 | | scriptparser.getContext().setErrorWriter(new TickLogger()); |
|---|
| | 85 | Writer logger = new NullLogger(); |
|---|
| | 86 | if( user.hasFlag( User.FLAG_SCRIPT_DEBUGGING ) ) { |
|---|
| | 87 | logger = new TickLogger(); |
|---|
| 91 | 88 | } |
|---|
| 92 | 89 | |
|---|
| … | … | |
| 96 | 93 | .list(); |
|---|
| 97 | 94 | for( Iterator iter=ships.iterator(); iter.hasNext(); ) { |
|---|
| 98 | | Ship ship = (Ship)iter.next(); |
|---|
| | 95 | final Ship ship = (Ship)iter.next(); |
|---|
| 99 | 96 | try { |
|---|
| 100 | 97 | this.log("+++ Ship "+ship.getId()+" +++"); |
|---|
| | 98 | |
|---|
| | 99 | final ScriptEngine scriptparser = getContext().get(ContextCommon.class) |
|---|
| | 100 | .getScriptParser(EngineIdentifier.identifyEngine(ship.getScript())); |
|---|
| 101 | 101 | |
|---|
| 102 | 102 | Blob scriptExecData = ship.getScriptExeData(); |
|---|
| … | … | |
| 109 | 109 | scriptparser.setContext(new ScriptParserContext()); |
|---|
| 110 | 110 | } |
|---|
| | 111 | |
|---|
| | 112 | scriptparser.getContext().setErrorWriter(logger); |
|---|
| 111 | 113 | |
|---|
| 112 | 114 | scriptparser.getContext().setAttribute("_SHIP", ship, ScriptContext.ENGINE_SCOPE); |
|---|
| r90eb19f |
r83f6b1d |
|
| 19 | 19 | package net.driftingsouls.ds2.server.scripting; |
|---|
| 20 | 20 | |
|---|
| | 21 | import static org.hamcrest.CoreMatchers.*; |
|---|
| 21 | 22 | import static org.junit.Assert.*; |
|---|
| 22 | | import static org.hamcrest.CoreMatchers.*; |
|---|
| 23 | 23 | |
|---|
| 24 | 24 | import org.junit.Test; |
|---|