Esempio n. 1
0
        public AccountHandler(string attributesFile)
        {
            mTokenCollector=new TokenCollector(this);

            mNumHairStyles=Configuration.getValue("char_numHairStyles", 17);
            mNumHairColors=Configuration.getValue("char_numHairColors", 11);
            mNumGenders=Configuration.getValue("char_numGenders", 2);
            mMinNameLength=(uint)Configuration.getValue("char_minNameLength", 4);
            mMaxNameLength=(uint)Configuration.getValue("char_maxNameLength", 25);
            mMaxCharacters=Configuration.getValue("account_maxCharacters", 3);
            mRegistrationAllowed=Configuration.getBoolValue("account_allowRegister", true);
            mUpdateHost=Configuration.getValue("net_defaultUpdateHost", "");
            mDataUrl=Configuration.getValue("net_clientDataUrl", "");

            //XML::Document doc(attributesFile);
            //xmlNodePtr node = doc.rootNode();

            //if (!node || !xmlStrEqual(node.name, BAD_CAST "attributes"))
            //{
            //    LOG_FATAL("Account handler: " << attributesFile << ": "
            //              << " is not a valid database file!");
            //    exit(EXIT_XML_BAD_PARAMETER);
            //}

            //for_each_xml_child_node(attributenode, node)
            //{
            //    if (xmlStrEqual(attributenode.name, BAD_CAST "attribute"))
            //    {
            //        int id = XML::getProperty(attributenode, "id", 0);
            //        if (!id)
            //        {
            //            LOG_WARN("Account handler: " << attributesFile << ": "
            //                     << "An invalid attribute id value (0) has been found "
            //                     << "and will be ignored.");
            //            continue;
            //        }

            //        if (XML::getBoolProperty(attributenode, "modifiable", false))
            //            mModifiableAttributes.push_back(id);

            //        // Store as string initially to check
            //        // that the property is defined.
            //        std::string defStr = XML::getProperty(attributenode, "default",
            //                                              std::string());
            //        if (!defStr.empty())
            //        {
            //            const double val = string_to<double>()(defStr);
            //            mDefaultAttributes.insert(std::make_pair(id, val));
            //        }
            //    }
            //    else if (xmlStrEqual(attributenode.name, BAD_CAST "points"))
            //    {
            //        mStartingPoints = XML::getProperty(attributenode, "start", 0);
            //        mAttributeMinimum = XML::getProperty(attributenode, "minimum", 0);
            //        mAttributeMaximum = XML::getProperty(attributenode, "maximum", 0);

            //        // Stops if not all the values are given.
            //        if (!mStartingPoints || !mAttributeMinimum || !mAttributeMaximum)
            //        {
            //            LOG_FATAL("Account handler: " << attributesFile << ": "
            //                      << " The characters starting points "
            //                      << "are incomplete or not set!");
            //            exit(EXIT_XML_BAD_PARAMETER);
            //        }
            //    }
            //} // End for each XML nodes

            //if (mModifiableAttributes.empty())
            //{
            //    LOG_FATAL("Account handler: " << attributesFile << ": "
            //              << "No modifiable attributes found!");
            //    exit(EXIT_XML_BAD_PARAMETER);
            //}

            //int attributeCount = (int) mModifiableAttributes.size();
            //if (attributeCount * mAttributeMaximum < mStartingPoints ||
            //    attributeCount * mAttributeMinimum > mStartingPoints)
            //{
            //    LOG_FATAL("Account handler: " << attributesFile << ": "
            //              << "Character's point values make "
            //              << "the character's creation impossible!");
            //    exit(EXIT_XML_BAD_PARAMETER);
            //}

            //LOG_DEBUG("Character start points: " << mStartingPoints << " (Min: "
            //          << mAttributeMinimum << ", Max: " << mAttributeMaximum << ")");
        }
Esempio n. 2
0
 public GameHandler()
 {
     mTokenCollector=new TokenCollector(this);
 }
Esempio n. 3
0
 public ChatHandler()
 {
     mTokenCollector=new TokenCollector<ChatHandler, ChatClient, Pending>();
     // mTokenCollector(this)
 }
Esempio n. 4
0
 public ChatHandler()
 {
     mTokenCollector=new TokenCollector(this);
     // mTokenCollector(this)
 }