Ejemplo n.º 1
0
    private void SetServerActionHierarchy(SFSObject hierarchy)
    {
        serverActionHierarchy = new ActionList();

        for (int a = 0; a < hierarchy.Size(); a++)
        {
            SFSObject actionObject = hierarchy.GetObj(Convert.ToString(a));
            Action action = new Action();
            action.name = actionObject.GetString("n");
            int numParam = actionObject.Size();
            for (int i = 0; i < numParam - 1; i++)
            {
                SFSObject param = actionObject.GetObj(Convert.ToString(i));
                string paramName = param.GetString("n");
                string paramType = param.GetString("t");
                switch (paramType)
                {
                    case "b" ://boolean
                        bool boolValue = param.GetBool("v");
                        action.AddBoolParam(paramName, boolValue);
                        break;
                    case "maq"://maximum quantity (integer > 0 or "MAX")
                        //
                        break;
                    case "miq"://minimum quantity (integer > 0 or "MIN")
                        //
                        break;
                    case "n"://integer with min and max values
                        //
                        break;
                    case "mi"://minored integer : integer with min value or "INF"
                        string value = param.GetString("v");
                        int minValue = (int) param.GetNumber("m");
                        action.AddMinoredIntegerParam(paramName, value, minValue);
                        break;
                    case "ii"://inventory item
                        //
                        break;
                    case "it"://item type
                        //
                        break;
                    case "am"://actionMark (an absolute position or the position of a physical entity marked by the player or his faction)
                        bool playerIsMarkOwner = param.GetBool("o");
                        int actionMarkID = (int)param.GetNumber("n");
                        action.AddActionMark(paramName, playerIsMarkOwner, actionMarkID);
                        break;
                    case "c"://character (player or npc)
                        //
                        break;
                    case "s"://string message
                        //
                        break;

                }
            }

            serverActionHierarchy.Add(action);
        }
    }