Changeset 109

Show
Ignore:
Timestamp:
10/14/07 15:41:33 (1 year ago)
Author:
elghinn
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • adventure/adventuremuc.py

    r104 r109  
    22# -*- coding: utf-8 -*- 
    33 
    4 from xmpp import Component, JID 
     4from xmpp import Component, JID, NS_COMPONENT_1 
    55from sys import argv 
    66from world import World 
     
    88class AdventureMUC(Component): 
    99    def __init__(self, jid, password, server, port=5347): 
    10         Component.__init__(server, port) 
     10        self.Namespace = NS_COMPONENT_1 
     11        self.DBG = '' 
     12        Component.__init__(self, server=server, port=port, debug=[]) 
    1113        self.worlds = {} 
    1214     
     
    115117 
    116118if __name__ == '__main__': 
    117     if len(argv) != 4
     119    if len(argv) != 5
    118120        print 'Syntax: ./adventuremuc.py <JID> <Password> <Host> <Port>' 
    119121        print 'See README for further help' 
    120     muc = AdventureMUC(*argv
     122    muc = AdventureMUC(argv[1], argv[2], argv[3], int(argv[4])
    121123    muc.add_world('cave.xml') 
  • adventure/thing.py

    r108 r109  
    11# -*- coding: utf-8 -*- 
    22 
    3 from player import Player 
     3#from player import Player 
    44from xmpp import Presence 
    55 
     
    5757            else: 
    5858                text = '' 
     59            target = None 
    5960            if command.action[2]: 
    60                 target = .... # élément de nom command.action[2] avec le même place que self 
    61             else: 
     61                for object_ in self.place.objects: 
     62                    if object_.place == self.place and object_.name == command.action[2]: 
     63                        target = object_ 
     64                        break 
     65                for participant in self.place.participants: 
     66                    if participant.place == self.place and participant.name == command.action[2]: 
     67                        target = participant 
     68                        break 
     69            #else: 
     70            if not target: 
    6271                target = self 
    6372            text.replace('%self%', target.name)