Initial Cardcast UI, with chat commands. Javascript formatter stuff in the project.
This commit is contained in:
parent
8638dcadd4
commit
05239299e3
|
@ -0,0 +1,322 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.wst.jsdt.core.compiler.codegen.inlineJsrBytecode=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.codegen.targetPlatform=1.2
|
||||
org.eclipse.wst.jsdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.wst.jsdt.core.compiler.compliance=1.4
|
||||
org.eclipse.wst.jsdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.wst.jsdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.wst.jsdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.wst.jsdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.wst.jsdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.assertIdentifier=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.duplicateLocalVariables=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.fallthroughCase=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.invalidJavadoc=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.invalidJavadocTagsVisibility=default
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.looseVarDecleration=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.missingJavadocComments=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.missingJavadocCommentsVisibility=default
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.missingJavadocTags=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.missingJavadocTagsVisibility=default
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.nullReference=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.optionalSemicolon=error
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.parameterAssignment=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.undefinedField=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.undocumentedEmptyBlock=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.uninitializedGlobalVariable=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.uninitializedLocalVariable=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unresolvedFieldReference=error
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unresolvedMethodReference=error
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unresolvedTypeReference=error
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.wst.jsdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.wst.jsdt.core.compiler.source=1.3
|
||||
org.eclipse.wst.jsdt.core.compiler.taskCaseSensitive=enabled
|
||||
org.eclipse.wst.jsdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
|
||||
org.eclipse.wst.jsdt.core.compiler.taskTags=TODO,FIXME,XXX
|
||||
org.eclipse.wst.jsdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_enum_constants=0
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_multiple_fields=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||
org.eclipse.wst.jsdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_after_imports=1
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_after_package=1
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_before_field=0
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_before_imports=1
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_before_member_type=1
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_before_method=1
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_before_new_chunk=1
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_before_package=0
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_between_import_groups=1
|
||||
org.eclipse.wst.jsdt.core.formatter.blank_lines_between_type_declarations=0
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_block=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_method_declaration=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_objlit_initializer=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_switch=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.format_block_comments=false
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.format_header=true
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.format_html=true
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.format_javadoc_comments=true
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.format_line_comments=true
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.format_source_code=true
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.indent_parameter_description=true
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.indent_root_tags=true
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.comment.line_length=100
|
||||
org.eclipse.wst.jsdt.core.formatter.compact_else_if=true
|
||||
org.eclipse.wst.jsdt.core.formatter.continuation_indentation=2
|
||||
org.eclipse.wst.jsdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||
org.eclipse.wst.jsdt.core.formatter.continuation_indentation_for_objlit_initializer=1
|
||||
org.eclipse.wst.jsdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_empty_lines=false
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indent_switchstatements_compare_to_switch=true
|
||||
org.eclipse.wst.jsdt.core.formatter.indentation.size=2
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_after_annotation=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_after_comma_in_objlit_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_after_opening_brace_in_objlit_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_before_closing_brace_in_objlit_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_colon_in_object_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_ellipsis=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_colon_in_object_initializer=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||
org.eclipse.wst.jsdt.core.formatter.keep_else_statement_on_same_line=false
|
||||
org.eclipse.wst.jsdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.wst.jsdt.core.formatter.keep_empty_objlit_initializer_on_one_line=false
|
||||
org.eclipse.wst.jsdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.wst.jsdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.wst.jsdt.core.formatter.lineSplit=100
|
||||
org.eclipse.wst.jsdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||
org.eclipse.wst.jsdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||
org.eclipse.wst.jsdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||
org.eclipse.wst.jsdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.wst.jsdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.wst.jsdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.wst.jsdt.core.formatter.tabulation.size=2
|
||||
org.eclipse.wst.jsdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.wst.jsdt.core.formatter.wrap_before_binary_operator=true
|
||||
semanticValidation=enabled
|
|
@ -1,3 +1,52 @@
|
|||
#Thu Feb 02 14:32:37 PST 2012
|
||||
eclipse.preferences.version=1
|
||||
editor_save_participant_org.eclipse.wst.jsdt.ui.postsavelistener.cleanup=true
|
||||
formatter_profile=_mine
|
||||
formatter_settings_version=11
|
||||
org.eclipse.wst.jsdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
|
||||
sp_cleanup.add_default_serial_version_id=true
|
||||
sp_cleanup.add_generated_serial_version_id=false
|
||||
sp_cleanup.add_missing_annotations=true
|
||||
sp_cleanup.add_missing_deprecated_annotations=true
|
||||
sp_cleanup.add_missing_nls_tags=false
|
||||
sp_cleanup.add_missing_override_annotations=true
|
||||
sp_cleanup.add_serial_version_id=false
|
||||
sp_cleanup.always_use_blocks=true
|
||||
sp_cleanup.always_use_parentheses_in_expressions=false
|
||||
sp_cleanup.always_use_this_for_non_static_field_access=false
|
||||
sp_cleanup.always_use_this_for_non_static_method_access=false
|
||||
sp_cleanup.convert_to_enhanced_for_loop=false
|
||||
sp_cleanup.format_source_code=true
|
||||
sp_cleanup.make_local_variable_final=false
|
||||
sp_cleanup.make_parameters_final=false
|
||||
sp_cleanup.make_private_fields_final=true
|
||||
sp_cleanup.make_variable_declarations_final=true
|
||||
sp_cleanup.never_use_blocks=false
|
||||
sp_cleanup.never_use_parentheses_in_expressions=true
|
||||
sp_cleanup.on_save_use_additional_actions=true
|
||||
sp_cleanup.organize_imports=true
|
||||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
sp_cleanup.remove_private_constructors=true
|
||||
sp_cleanup.remove_trailing_whitespaces=true
|
||||
sp_cleanup.remove_trailing_whitespaces_all=true
|
||||
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
|
||||
sp_cleanup.remove_unnecessary_casts=true
|
||||
sp_cleanup.remove_unnecessary_nls_tags=false
|
||||
sp_cleanup.remove_unused_imports=false
|
||||
sp_cleanup.remove_unused_local_variables=false
|
||||
sp_cleanup.remove_unused_private_fields=true
|
||||
sp_cleanup.remove_unused_private_members=false
|
||||
sp_cleanup.remove_unused_private_methods=true
|
||||
sp_cleanup.remove_unused_private_types=true
|
||||
sp_cleanup.sort_members=false
|
||||
sp_cleanup.sort_members_all=false
|
||||
sp_cleanup.use_blocks=true
|
||||
sp_cleanup.use_blocks_only_for_return_and_throw=false
|
||||
sp_cleanup.use_parentheses_in_expressions=false
|
||||
sp_cleanup.use_this_for_non_static_field_access=false
|
||||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
||||
sp_cleanup.use_this_for_non_static_method_access=false
|
||||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
|
|
|
@ -405,7 +405,7 @@ span.debug, span.admin {
|
|||
.game_right_side, .game_options {
|
||||
position: absolute;
|
||||
left: 246px;
|
||||
width: 700px;
|
||||
width: 1000px;
|
||||
}
|
||||
|
||||
.game_options {
|
||||
|
|
|
@ -86,19 +86,17 @@ HttpSession hSession = request.getSession(true);
|
|||
If this is your first time playing, you may wish to read <a href="/">the changelog and list of
|
||||
known issues</a>.
|
||||
</p>
|
||||
<p tabindex="0">Most recent update: 7 April 2014:</p>
|
||||
<p tabindex="0">Most recent update: 11 August 2014:</p>
|
||||
<ul>
|
||||
<li>Exploits avoiding the maximum limits for game options have been fixed. No more games with
|
||||
9001 blank white cards.</li>
|
||||
<li>Some minor bugfixes, including one which should prevent the entire server from dying if a
|
||||
single background task gets stuck.</li>
|
||||
<li>Some minor performance improvements.</li>
|
||||
<li><a href="http://houseofcardsagainsthumanity.com/">House of Cards Against Humanity</a> is now
|
||||
available.</li>
|
||||
<li><strong>No further custom card sets will be accepted.</strong> Minor updates to existing
|
||||
ones may still be submitted, but I do not guarantee I will get to it in a timely manner. It is
|
||||
taking too much of my time to administer the custom cards sets; I'd rather focus the time on
|
||||
implementing a way for players to manage card sets in the game by themselves.</li>
|
||||
<li>Loading decks from <a href="http://www.cardcastgame.com/">Cardcast</a> is now supported in a
|
||||
preview release. See <a href="https://github.com/ajanata/PretendYoureXyzzy/wiki/Cardcast">the
|
||||
wiki</a> for instructions. A better UI will hopefully happen before too long, but you can see
|
||||
how long it took to get any sort of custom deck loading implemented...</li>
|
||||
<li>Please go make your own card sets there! It's a really cool site.</li>
|
||||
<li><strong>If you submitted a card set which is currently hosted locally on PYX, please add it
|
||||
to Cardcast and let me know when you have done so, so that I may remove it from the local list
|
||||
to de-clutter the page.</strong> I will list Cardcast codes for previously-hosted decks for a
|
||||
period of time so that users may continue to find them.</li>
|
||||
</ul>
|
||||
<div id="nickbox">
|
||||
Nickname:
|
||||
|
|
|
@ -54,6 +54,17 @@ to, for instance, display the number of connected players.
|
|||
</p>
|
||||
<p>Recent Changes:</p>
|
||||
<ul>
|
||||
<li>11 August 2014:<ul>
|
||||
<li>Loading decks from <a href="http://www.cardcastgame.com/">Cardcast</a> is now supported in a
|
||||
preview release. See <a href="https://github.com/ajanata/PretendYoureXyzzy/wiki/Cardcast">the
|
||||
wiki</a> for instructions. A better UI will hopefully happen before too long, but you can see
|
||||
how long it took to get any sort of custom deck loading implemented...</li>
|
||||
<li>Please go make your own card sets there! It's a really cool site.</li>
|
||||
<li><strong>If you submitted a card set which is currently hosted locally on PYX, please add it
|
||||
to Cardcast and let me know when you have done so, so that I may remove it from the local list
|
||||
to de-clutter the page.</strong> I will list Cardcast codes for previously-hosted decks for a
|
||||
period of time so that users may continue to find them.</li>
|
||||
</ul></li>
|
||||
<li>7 April 2014:<ul>
|
||||
<li>Exploits avoiding the maximum limits for game options have been fixed. No more games with
|
||||
9001 blank white cards.</li>
|
||||
|
|
|
@ -177,6 +177,17 @@ cah.ajax.Builder.prototype.withEmote = function(emote) {
|
|||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string}
|
||||
* id The Cardcast ID of the deck to add.
|
||||
* @returns {cah.ajax.Builder} This object.
|
||||
*/
|
||||
cah.ajax.Builder.prototype.withCardcastId = function(id) {
|
||||
this.assertNotExecuted_();
|
||||
this.data[cah.$.AjaxRequest.CARDCAST_ID] = id;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Assert that the request from this builder has not already run. Throws an exception if it has.
|
||||
*
|
||||
|
|
|
@ -257,10 +257,27 @@ cah.ajax.SuccessHandlers[cah.$.AjaxOperation.BAN] = function(data) {
|
|||
cah.ajax.SuccessHandlers[cah.$.AjaxOperation.SCORE] = function(data, req) {
|
||||
var gameId = req[cah.$.AjaxRequest.GAME_ID];
|
||||
var info = data[cah.$.AjaxResponse.PLAYER_INFO];
|
||||
var msg = info[cah.$.GamePlayerInfo.NAME] + " has " + info[cah.$.GamePlayerInfo.SCORE] + " Awesome Points.";
|
||||
var msg = info[cah.$.GamePlayerInfo.NAME] + " has " + info[cah.$.GamePlayerInfo.SCORE]
|
||||
+ " Awesome Points.";
|
||||
if (gameId) {
|
||||
cah.log.status_with_game(gameId, msg);
|
||||
} else {
|
||||
cah.log.status(msg);
|
||||
}
|
||||
};
|
||||
|
||||
cah.ajax.SuccessHandlers[cah.$.AjaxOperation.CARDCAST_ADD_CARDSET] = function(data) {
|
||||
// pass
|
||||
};
|
||||
|
||||
cah.ajax.SuccessHandlers[cah.$.AjaxOperation.CARDCAST_REMOVE_CARDSET] = function(data) {
|
||||
// pass
|
||||
};
|
||||
|
||||
cah.ajax.SuccessHandlers[cah.$.AjaxOperation.CARDCAST_LIST_CARDSETS] = function(data, req) {
|
||||
var gameId = req[cah.$.AjaxRequest.GAME_ID];
|
||||
var game = cah.currentGames[gameId];
|
||||
if (game) {
|
||||
game.listCardcastDecks(data[cah.$.AjaxResponse.CARD_SETS]);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -193,6 +193,29 @@ function chatsubmit_click(game_id, parent_element) {
|
|||
case 'names':
|
||||
ajax = cah.Ajax.build(cah.$.AjaxOperation.NAMES);
|
||||
break;
|
||||
case 'addcardcast':
|
||||
if (game_id !== null) {
|
||||
ajax = cah.Ajax.build(cah.$.AjaxOperation.CARDCAST_ADD_CARDSET).withCardcastId(
|
||||
text.split(' ')[0]).withGameId(game_id);
|
||||
} else {
|
||||
cah.log.error("This command only works in a game.");
|
||||
}
|
||||
break;
|
||||
case 'removecardcast':
|
||||
if (game_id !== null) {
|
||||
ajax = cah.Ajax.build(cah.$.AjaxOperation.CARDCAST_REMOVE_CARDSET).withCardcastId(
|
||||
text.split(' ')[0]).withGameId(game_id);
|
||||
} else {
|
||||
cah.log.error("This command only works in a game.");
|
||||
}
|
||||
break;
|
||||
case 'listcardcast':
|
||||
if (game_id !== null) {
|
||||
ajax = cah.Ajax.build(cah.$.AjaxOperation.CARDCAST_LIST_CARDSETS).withGameId(game_id);
|
||||
} else {
|
||||
cah.log.error("This command only works in a game.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cah.log.error("Invalid command.");
|
||||
}
|
||||
|
|
|
@ -6,27 +6,30 @@ cah.$.AjaxOperation = function() {
|
|||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.AjaxOperation.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.AjaxOperation.START_GAME = "sg";
|
||||
cah.$.AjaxOperation.FIRST_LOAD = "fl";
|
||||
cah.$.AjaxOperation.SPECTATE_GAME = "vg";
|
||||
cah.$.AjaxOperation.LOG_OUT = "lo";
|
||||
cah.$.AjaxOperation.START_GAME = "sg";
|
||||
cah.$.AjaxOperation.JUDGE_SELECT = "js";
|
||||
cah.$.AjaxOperation.BAN = "b";
|
||||
cah.$.AjaxOperation.SCORE = "SC";
|
||||
cah.$.AjaxOperation.LOG_OUT = "lo";
|
||||
cah.$.AjaxOperation.GAME_LIST = "ggl";
|
||||
cah.$.AjaxOperation.CHANGE_GAME_OPTIONS = "cgo";
|
||||
cah.$.AjaxOperation.GET_GAME_INFO = "ggi";
|
||||
cah.$.AjaxOperation.PLAY_CARD = "pc";
|
||||
cah.$.AjaxOperation.CREATE_GAME = "cg";
|
||||
cah.$.AjaxOperation.KICK = "K";
|
||||
cah.$.AjaxOperation.CARDCAST_LIST_CARDSETS = "clc";
|
||||
cah.$.AjaxOperation.GAME_CHAT = "GC";
|
||||
cah.$.AjaxOperation.KICK = "K";
|
||||
cah.$.AjaxOperation.ADMIN_SET_VERBOSE_LOG = "svl";
|
||||
cah.$.AjaxOperation.GET_CARDS = "gc";
|
||||
cah.$.AjaxOperation.JOIN_GAME = "jg";
|
||||
cah.$.AjaxOperation.REGISTER = "r";
|
||||
cah.$.AjaxOperation.STOP_GAME = "Sg";
|
||||
cah.$.AjaxOperation.CHAT = "c";
|
||||
cah.$.AjaxOperation.NAMES = "gn";
|
||||
cah.$.AjaxOperation.SPECTATE_GAME = "vg";
|
||||
cah.$.AjaxOperation.BAN = "b";
|
||||
cah.$.AjaxOperation.SCORE = "SC";
|
||||
cah.$.AjaxOperation.GET_GAME_INFO = "ggi";
|
||||
cah.$.AjaxOperation.CARDCAST_ADD_CARDSET = "cac";
|
||||
cah.$.AjaxOperation.CARDCAST_REMOVE_CARDSET = "crc";
|
||||
cah.$.AjaxOperation.REGISTER = "r";
|
||||
cah.$.AjaxOperation.STOP_GAME = "Sg";
|
||||
cah.$.AjaxOperation.LEAVE_GAME = "lg";
|
||||
|
||||
cah.$.AjaxRequest = function() {
|
||||
|
@ -38,6 +41,7 @@ cah.$.AjaxRequest.MESSAGE = "m";
|
|||
cah.$.AjaxRequest.CARD_ID = "cid";
|
||||
cah.$.AjaxRequest.GAME_ID = "gid";
|
||||
cah.$.AjaxRequest.EMOTE = "me";
|
||||
cah.$.AjaxRequest.CARDCAST_ID = "cci";
|
||||
cah.$.AjaxRequest.GAME_OPTIONS = "go";
|
||||
cah.$.AjaxRequest.SERIAL = "s";
|
||||
cah.$.AjaxRequest.PASSWORD = "pw";
|
||||
|
@ -113,6 +117,7 @@ cah.$.ErrorCode.RESERVED_NICK = "rn";
|
|||
cah.$.ErrorCode.TOO_MANY_USERS = "tmu";
|
||||
cah.$.ErrorCode.NO_GAME_SPECIFIED = "ngs";
|
||||
cah.$.ErrorCode.SESSION_EXPIRED = "se";
|
||||
cah.$.ErrorCode.CARDCAST_INVALID_ID = "cii";
|
||||
cah.$.ErrorCode.BAD_OP = "bo";
|
||||
cah.$.ErrorCode.TOO_FAST = "tf";
|
||||
cah.$.ErrorCode.NO_SESSION = "ns";
|
||||
|
@ -137,6 +142,7 @@ cah.$.ErrorCode.MESSAGE_TOO_LONG = "mtl";
|
|||
cah.$.ErrorCode.ALREADY_STOPPED = "aS";
|
||||
cah.$.ErrorCode.NOT_ENOUGH_PLAYERS = "nep";
|
||||
cah.$.ErrorCode.INVALID_GAME = "ig";
|
||||
cah.$.ErrorCode.CARDCAST_CANNOT_FIND = "ccf";
|
||||
cah.$.ErrorCode.NO_MSG_SPECIFIED = "nms";
|
||||
cah.$.ErrorCode.NOT_ENOUGH_CARDS = "nec";
|
||||
cah.$.ErrorCode_msg = {};
|
||||
|
@ -162,9 +168,11 @@ cah.$.ErrorCode_msg['ons'] = "Operation not specified.";
|
|||
cah.$.ErrorCode_msg['cjag'] = "You cannot join another game.";
|
||||
cah.$.ErrorCode_msg['ig'] = "Invalid game specified.";
|
||||
cah.$.ErrorCode_msg['nns'] = "No nickname specified.";
|
||||
cah.$.ErrorCode_msg['cii'] = "Invalid Cardcast ID. Must be exactly 5 characters.";
|
||||
cah.$.ErrorCode_msg['ngh'] = "Only the game host can do that.";
|
||||
cah.$.ErrorCode_msg['nec'] = "You must select at least one base card set.";
|
||||
cah.$.ErrorCode_msg['serr'] = "An error occured on the server.";
|
||||
cah.$.ErrorCode_msg['ccf'] = "Cannot find Cardcast deck with given ID. If you just added this deck to Cardcast, wait a few minutes and try again.";
|
||||
cah.$.ErrorCode_msg['nsu'] = "No such user.";
|
||||
cah.$.ErrorCode_msg['wp'] = "That password is incorrect.";
|
||||
cah.$.ErrorCode_msg['as'] = "The game has already started.";
|
||||
|
@ -257,29 +265,31 @@ cah.$.LongPollEvent = function() {
|
|||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.LongPollEvent.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.LongPollEvent.BANNED = "B&";
|
||||
cah.$.LongPollEvent.KICKED = "k";
|
||||
cah.$.LongPollEvent.HURRY_UP = "hu";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_LEAVE = "gvl";
|
||||
cah.$.LongPollEvent.KICKED_FROM_GAME_IDLE = "kfgi";
|
||||
cah.$.LongPollEvent.GAME_JUDGE_SKIPPED = "gjs";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_LEAVE = "gpl";
|
||||
cah.$.LongPollEvent.NEW_PLAYER = "np";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_JOIN = "gvj";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_JOIN = "gpj";
|
||||
cah.$.LongPollEvent.GAME_LIST_REFRESH = "glr";
|
||||
cah.$.LongPollEvent.KICKED_FROM_GAME_IDLE = "kfgi";
|
||||
cah.$.LongPollEvent.GAME_ROUND_COMPLETE = "grc";
|
||||
cah.$.LongPollEvent.NOOP = "_";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_INFO_CHANGE = "gpic";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_KICKED_IDLE = "gpki";
|
||||
cah.$.LongPollEvent.GAME_BLACK_RESHUFFLE = "gbr";
|
||||
cah.$.LongPollEvent.GAME_WHITE_RESHUFFLE = "gwr";
|
||||
cah.$.LongPollEvent.GAME_STATE_CHANGE = "gsc";
|
||||
cah.$.LongPollEvent.GAME_OPTIONS_CHANGED = "goc";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_SKIPPED = "gps";
|
||||
cah.$.LongPollEvent.CHAT = "c";
|
||||
cah.$.LongPollEvent.BANNED = "B&";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_LEAVE = "gvl";
|
||||
cah.$.LongPollEvent.CARDCAST_ADD_CARDSET = "cac";
|
||||
cah.$.LongPollEvent.NEW_PLAYER = "np";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_JOIN = "gpj";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_JOIN = "gvj";
|
||||
cah.$.LongPollEvent.GAME_LIST_REFRESH = "glr";
|
||||
cah.$.LongPollEvent.NOOP = "_";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_KICKED_IDLE = "gpki";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_INFO_CHANGE = "gpic";
|
||||
cah.$.LongPollEvent.CARDCAST_REMOVE_CARDSET = "crc";
|
||||
cah.$.LongPollEvent.GAME_BLACK_RESHUFFLE = "gbr";
|
||||
cah.$.LongPollEvent.GAME_WHITE_RESHUFFLE = "gwr";
|
||||
cah.$.LongPollEvent.PLAYER_LEAVE = "pl";
|
||||
cah.$.LongPollEvent.HAND_DEAL = "hd";
|
||||
cah.$.LongPollEvent.CHAT = "c";
|
||||
cah.$.LongPollEvent.GAME_JUDGE_LEFT = "gjl";
|
||||
|
||||
cah.$.LongPollResponse = function() {
|
||||
|
@ -298,6 +308,7 @@ cah.$.LongPollResponse.BLACK_CARD = "bc";
|
|||
cah.$.LongPollResponse.WINNING_CARD = "WC";
|
||||
cah.$.LongPollResponse.GAME_STATE = "gs";
|
||||
cah.$.LongPollResponse.NICKNAME = "n";
|
||||
cah.$.LongPollResponse.CARDCAST_DECK_INFO = "cdi";
|
||||
cah.$.LongPollResponse.PLAY_TIMER = "Pt";
|
||||
cah.$.LongPollResponse.MESSAGE = "m";
|
||||
cah.$.LongPollResponse.FROM_ADMIN = "fa";
|
||||
|
|
|
@ -325,6 +325,7 @@ cah.Game = function(id) {
|
|||
cah.Game.joinGame = function(gameId) {
|
||||
cah.Ajax.build(cah.$.AjaxOperation.GET_GAME_INFO).withGameId(gameId).run();
|
||||
cah.Ajax.build(cah.$.AjaxOperation.GET_CARDS).withGameId(gameId).run();
|
||||
cah.Ajax.build(cah.$.AjaxOperation.CARDCAST_LIST_CARDSETS).withGameId(gameId).run();
|
||||
cah.GameList.instance.hide();
|
||||
var game = new cah.Game(gameId);
|
||||
cah.currentGames[gameId] = game;
|
||||
|
@ -489,7 +490,7 @@ cah.Game.prototype.removeCardFromHand = function(card) {
|
|||
*/
|
||||
cah.Game.prototype.removeAllCards = function() {
|
||||
var handCount = this.hand_.length;
|
||||
for ( var i = 0; i < handCount; i++) {
|
||||
for (var i = 0; i < handCount; i++) {
|
||||
this.removeCardFromHand(this.hand_[0]);
|
||||
}
|
||||
this.handSelectedCard_ = null;
|
||||
|
@ -764,6 +765,57 @@ cah.Game.prototype.insertIntoDocument = function() {
|
|||
// TODO display a loading animation
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a message that a Cardcast deck has been added to the game.
|
||||
*
|
||||
* @param {object}
|
||||
* data Payload from server.
|
||||
*/
|
||||
cah.Game.prototype.addCardcastDeck = function(data) {
|
||||
this.displayCardcastDeckMessage_(data[cah.$.LongPollResponse.CARDCAST_DECK_INFO], "Added");
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a message that a Cardcast deck has been removed from the game.
|
||||
*
|
||||
* @param {object}
|
||||
* data Payload from server.
|
||||
*/
|
||||
cah.Game.prototype.removeCardcastDeck = function(data) {
|
||||
this.displayCardcastDeckMessage_(data[cah.$.LongPollResponse.CARDCAST_DECK_INFO], "Removed");
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a list of currently in-use Cardcast decks.
|
||||
*
|
||||
* @param {array}
|
||||
* data Array of CardSetDatas.
|
||||
*/
|
||||
cah.Game.prototype.listCardcastDecks = function(cardSets) {
|
||||
for ( var key in cardSets) {
|
||||
var cardSetData = cardSets[key];
|
||||
this.displayCardcastDeckMessage_(cardSetData, "In use");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a message about a Cardcast deck.
|
||||
*
|
||||
* @param {object}
|
||||
* deckInfo The CardSetData of the deck.
|
||||
* @param {string}
|
||||
* verb Verb to display at the beginning of the message: "Added", "Removed", "In use", etc.
|
||||
* @private
|
||||
*/
|
||||
cah.Game.prototype.displayCardcastDeckMessage_ = function(deckInfo, verb) {
|
||||
var code = (-1 * deckInfo[cah.$.CardSetData.ID]).toString(36).toUpperCase();
|
||||
var str = verb + ": Cardcast deck '" + deckInfo[cah.$.CardSetData.CARD_SET_NAME]
|
||||
+ "' (code: <a target='_blank' href='http://www.cardcastgame.com/browse/deck/" + code + "'> "
|
||||
+ code + "</a>), with " + deckInfo[cah.$.CardSetData.BLACK_CARDS_IN_DECK]
|
||||
+ " black cards and " + deckInfo[cah.$.CardSetData.WHITE_CARDS_IN_DECK] + " white cards.";
|
||||
cah.log.status_with_game(this, str, undefined, true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update game status display.
|
||||
*
|
||||
|
@ -1416,7 +1468,7 @@ cah.Game.prototype.optionChanged_ = function(e) {
|
|||
|
||||
var selectedCardSets = $(".card_sets :checked", this.optionsElement_);
|
||||
var cardSetIds = [];
|
||||
for ( var i = 0; i < selectedCardSets.length; i++) {
|
||||
for (var i = 0; i < selectedCardSets.length; i++) {
|
||||
cardSetIds.push(selectedCardSets[i].value);
|
||||
}
|
||||
var options = {};
|
||||
|
|
|
@ -68,8 +68,10 @@ cah.log.status = function(text, opt_class) {
|
|||
* escaped automatically.
|
||||
* @param {string}
|
||||
* opt_class Optional CSS class to use for this message.
|
||||
* @param {boolean}
|
||||
* opt_allow_html Allow HTML to be used.
|
||||
*/
|
||||
cah.log.status_with_game = function(game_or_id, text, opt_class) {
|
||||
cah.log.status_with_game = function(game_or_id, text, opt_class, opt_allow_html) {
|
||||
var logElement;
|
||||
if (game_or_id === null) {
|
||||
logElement = cah.log.log;
|
||||
|
@ -88,7 +90,12 @@ cah.log.status_with_game = function(game_or_id, text, opt_class) {
|
|||
.prop("scrollTop")) <= 5;
|
||||
|
||||
var node = $("<span></span><br/>");
|
||||
$(node[0]).text("[" + new Date().toLocaleTimeString() + "] " + text + "\n");
|
||||
var full_msg = "[" + new Date().toLocaleTimeString() + "] " + text + "\n";
|
||||
if (opt_allow_html) {
|
||||
$(node[0]).html(full_msg);
|
||||
} else {
|
||||
$(node[0]).text(full_msg);
|
||||
}
|
||||
if (opt_class) {
|
||||
$(node).addClass(opt_class);
|
||||
}
|
||||
|
|
|
@ -238,3 +238,13 @@ cah.longpoll.EventHandlers.__gameEvent = function(data, func, funcData, errorStr
|
|||
cah.log.error("Received " + errorStr + " for unknown game id " + gameId);
|
||||
}
|
||||
};
|
||||
|
||||
cah.longpoll.EventHandlers[cah.$.LongPollEvent.CARDCAST_ADD_CARDSET] = function(data) {
|
||||
cah.longpoll.EventHandlers.__gameEvent(data, cah.Game.prototype.addCardcastDeck, data,
|
||||
"add Cardcast");
|
||||
};
|
||||
|
||||
cah.longpoll.EventHandlers[cah.$.LongPollEvent.CARDCAST_REMOVE_CARDSET] = function(data) {
|
||||
cah.longpoll.EventHandlers.__gameEvent(data, cah.Game.prototype.removeCardcastDeck, data,
|
||||
"remove Cardcast");
|
||||
};
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) 2012, Andy Janata
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
* and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
|
@ -32,12 +32,12 @@ import java.util.Set;
|
|||
/**
|
||||
* Constants needed on both the CAH server and client. This file is examined with reflection to
|
||||
* produce a Javascript version for the client to use.
|
||||
*
|
||||
*
|
||||
* All of the enums in here take a string in their constructor to define the over-the-wire value to
|
||||
* be used to represent that enum value. This allows for verbose names while debugging, and short
|
||||
* names to reduce traffic and latency, by only having to change it in one place for both the server
|
||||
* and client.
|
||||
*
|
||||
*
|
||||
* @author Andy Janata (ajanata@socialgamer.net)
|
||||
*/
|
||||
public class Constants {
|
||||
|
@ -52,9 +52,9 @@ public class Constants {
|
|||
add("0:0:0:0:0:0:0:1");
|
||||
add("127.0.0.1");
|
||||
// ajanata
|
||||
add("98.248.33.90");
|
||||
add("64.13.172.41");
|
||||
// vsTerminus
|
||||
add("207.161.39.198");
|
||||
add("207.161.130.75");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class Constants {
|
|||
|
||||
/**
|
||||
* Enums that implement this interface have a user-visible string associated with them.
|
||||
*
|
||||
*
|
||||
* There presently is not support for localization, but the name fits.
|
||||
*/
|
||||
public interface Localizable {
|
||||
|
@ -78,7 +78,7 @@ public class Constants {
|
|||
|
||||
/**
|
||||
* Enums that implement this interface have two user-visible strings associated with them.
|
||||
*
|
||||
*
|
||||
* There presently is not support for localization, but the name fits.
|
||||
*/
|
||||
public interface DoubleLocalizable {
|
||||
|
@ -132,7 +132,7 @@ public class Constants {
|
|||
|
||||
/**
|
||||
* The next thing the client should do during reconnect phase.
|
||||
*
|
||||
*
|
||||
* Leaving these as longer strings as they are only used once per client.
|
||||
*/
|
||||
public enum ReconnectNextAction {
|
||||
|
@ -164,6 +164,9 @@ public class Constants {
|
|||
public enum AjaxOperation {
|
||||
ADMIN_SET_VERBOSE_LOG("svl"),
|
||||
BAN("b"),
|
||||
CARDCAST_ADD_CARDSET("cac"),
|
||||
CARDCAST_LIST_CARDSETS("clc"),
|
||||
CARDCAST_REMOVE_CARDSET("crc"),
|
||||
CHANGE_GAME_OPTIONS("cgo"),
|
||||
CHAT("c"),
|
||||
CREATE_GAME("cg"),
|
||||
|
@ -208,6 +211,7 @@ public class Constants {
|
|||
*/
|
||||
public enum AjaxRequest {
|
||||
CARD_ID("cid"),
|
||||
CARDCAST_ID("cci"),
|
||||
EMOTE("me"),
|
||||
GAME_ID("gid"),
|
||||
GAME_OPTIONS("go"),
|
||||
|
@ -292,6 +296,9 @@ public class Constants {
|
|||
@DuplicationAllowed
|
||||
BANNED(DisconnectReason.BANNED, "Banned."),
|
||||
CANNOT_JOIN_ANOTHER_GAME("cjag", "You cannot join another game."),
|
||||
CARDCAST_CANNOT_FIND("ccf", "Cannot find Cardcast deck with given ID. If you just added this"
|
||||
+ " deck to Cardcast, wait a few minutes and try again."),
|
||||
CARDCAST_INVALID_ID("cii", "Invalid Cardcast ID. Must be exactly 5 characters."),
|
||||
DO_NOT_HAVE_CARD("dnhc", "You don't have that card."),
|
||||
GAME_FULL("gf", "That game is full. Join another."),
|
||||
INVALID_CARD("ic", "Invalid card specified."),
|
||||
|
@ -369,6 +376,10 @@ public class Constants {
|
|||
@DuplicationAllowed
|
||||
BANNED(DisconnectReason.BANNED),
|
||||
@DuplicationAllowed
|
||||
CARDCAST_ADD_CARDSET(AjaxOperation.CARDCAST_ADD_CARDSET),
|
||||
@DuplicationAllowed
|
||||
CARDCAST_REMOVE_CARDSET(AjaxOperation.CARDCAST_REMOVE_CARDSET),
|
||||
@DuplicationAllowed
|
||||
CHAT(AjaxOperation.CHAT),
|
||||
GAME_BLACK_RESHUFFLE("gbr"),
|
||||
GAME_JUDGE_LEFT("gjl"),
|
||||
|
@ -420,6 +431,7 @@ public class Constants {
|
|||
public enum LongPollResponse implements ReturnableData {
|
||||
@DuplicationAllowed
|
||||
BLACK_CARD(AjaxResponse.BLACK_CARD),
|
||||
CARDCAST_DECK_INFO("cdi"),
|
||||
@DuplicationAllowed
|
||||
EMOTE(AjaxRequest.EMOTE),
|
||||
@DuplicationAllowed
|
||||
|
|
|
@ -9,12 +9,15 @@ public class CardcastBlackCard extends BlackCard {
|
|||
private final String text;
|
||||
private final int draw;
|
||||
private final int pick;
|
||||
private final String deckId;
|
||||
|
||||
public CardcastBlackCard(final int id, final String text, final int draw, final int pick) {
|
||||
public CardcastBlackCard(final int id, final String text, final int draw, final int pick,
|
||||
final String deckId) {
|
||||
this.id = id;
|
||||
this.text = text;
|
||||
this.draw = draw;
|
||||
this.pick = pick;
|
||||
this.deckId = deckId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +32,7 @@ public class CardcastBlackCard extends BlackCard {
|
|||
|
||||
@Override
|
||||
public String getWatermark() {
|
||||
return "CC";
|
||||
return deckId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
@ -68,6 +69,8 @@ public class CardcastService {
|
|||
*/
|
||||
private static final long VALID_SET_CACHE_LIFETIME = TimeUnit.MINUTES.toMillis(15);
|
||||
|
||||
private static final Pattern validIdPattern = Pattern.compile("[A-Z0-9]{5}");
|
||||
|
||||
private static final Map<String, SoftReference<CardcastCacheEntry>> cache = Collections
|
||||
.synchronizedMap(new HashMap<String, SoftReference<CardcastCacheEntry>>());
|
||||
|
||||
|
@ -97,9 +100,17 @@ public class CardcastService {
|
|||
}
|
||||
|
||||
public CardcastDeck loadSet(final String setId) {
|
||||
if (!validIdPattern.matcher(setId).matches()) {
|
||||
return null;
|
||||
}
|
||||
final CardcastCacheEntry cached = checkCache(setId);
|
||||
if (null != cached && cached.expires < System.currentTimeMillis()) {
|
||||
if (null != cached && cached.expires > System.currentTimeMillis()) {
|
||||
LOG.info(String.format("Using cache: %s=%s", setId, cached.deck));
|
||||
return cached.deck;
|
||||
} else if (null != cached) {
|
||||
LOG.info(String.format("Cache stale: %s", setId));
|
||||
} else {
|
||||
LOG.info(String.format("Cache miss: %s", setId));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -145,7 +156,7 @@ public class CardcastService {
|
|||
final int pick = strs.size() - 1;
|
||||
final int draw = (pick >= 3 ? pick - 1 : 0);
|
||||
final CardcastBlackCard card = new CardcastBlackCard(cardIdProvider.get(), text, draw,
|
||||
pick);
|
||||
pick, setId);
|
||||
deck.getBlackCards().add(card);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +173,7 @@ public class CardcastService {
|
|||
strs.add((String) o);
|
||||
}
|
||||
final String text = StringUtils.join(strs, "");
|
||||
final CardcastWhiteCard card = new CardcastWhiteCard(cardIdProvider.get(), text);
|
||||
final CardcastWhiteCard card = new CardcastWhiteCard(cardIdProvider.get(), text, setId);
|
||||
deck.getWhiteCards().add(card);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,12 @@ public class CardcastWhiteCard extends WhiteCard {
|
|||
|
||||
private final int id;
|
||||
private final String text;
|
||||
private final String deckId;
|
||||
|
||||
public CardcastWhiteCard(final int id, final String text) {
|
||||
public CardcastWhiteCard(final int id, final String text, final String deckId) {
|
||||
this.id = id;
|
||||
this.text = text;
|
||||
this.deckId = deckId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +27,7 @@ public class CardcastWhiteCard extends WhiteCard {
|
|||
|
||||
@Override
|
||||
public String getWatermark() {
|
||||
return "CC";
|
||||
return deckId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) 2012, Andy Janata
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
* and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
|
@ -27,10 +27,12 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -49,6 +51,7 @@ import net.socialgamer.cah.Constants.LongPollResponse;
|
|||
import net.socialgamer.cah.Constants.ReturnableData;
|
||||
import net.socialgamer.cah.Constants.WhiteCardData;
|
||||
import net.socialgamer.cah.SafeTimerTask;
|
||||
import net.socialgamer.cah.cardcast.CardcastDeck;
|
||||
import net.socialgamer.cah.cardcast.CardcastService;
|
||||
import net.socialgamer.cah.data.GameManager.GameId;
|
||||
import net.socialgamer.cah.data.QueuedMessage.MessageType;
|
||||
|
@ -64,19 +67,19 @@ import com.google.inject.Provider;
|
|||
* Game data and logic class. Games are simple finite state machines, with 3 states that wait for
|
||||
* user input, and 3 transient states that it quickly passes through on the way back to a waiting
|
||||
* state:
|
||||
*
|
||||
*
|
||||
* ......Lobby.----------->.Dealing.(transient).-------->.Playing
|
||||
* .......^........................^.........................|....................
|
||||
* .......|.v----.Win.(transient).<+------.Judging.<---------+....................
|
||||
* .....Reset.(transient)
|
||||
*
|
||||
*
|
||||
* Lobby is the default state. When the game host sends a start game event, the game moves to the
|
||||
* Dealing state, where it deals out cards to every player and automatically moves into the Playing
|
||||
* state. After all players have played a card, the game moves to Judging and waits for the judge to
|
||||
* pick a card. The game either moves to Win, if a player reached the win goal, or Dealing
|
||||
* otherwise. Win moves through Reset to reset the game back to default state. The game also
|
||||
* immediately moves through Reset at any point there are fewer than 3 players in the game.
|
||||
*
|
||||
*
|
||||
* @author Andy Janata (ajanata@socialgamer.net)
|
||||
*/
|
||||
public class Game {
|
||||
|
@ -103,6 +106,7 @@ public class Game {
|
|||
private WhiteDeck whiteDeck;
|
||||
private GameState state;
|
||||
private final GameOptions options = new GameOptions();
|
||||
private final Set<String> cardcastDeckIds = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
private int judgeIndex = 0;
|
||||
|
||||
|
@ -149,7 +153,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Create a new game.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* The game's ID.
|
||||
* @param connectedUsers
|
||||
|
@ -177,9 +181,9 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Add a player to the game.
|
||||
*
|
||||
*
|
||||
* Synchronizes on {@link #players}.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* Player to add to this game.
|
||||
* @throws TooManyPlayersException
|
||||
|
@ -216,7 +220,7 @@ public class Game {
|
|||
* <br/>
|
||||
* Synchronizes on {@link #players}, {@link #playedCards}, {@link #whiteDeck}, and
|
||||
* {@link #roundTimerLock}.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* Player to remove from the game.
|
||||
* @return True if {@code user} was the last player in the game.
|
||||
|
@ -312,9 +316,9 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Add a spectator to the game.
|
||||
*
|
||||
*
|
||||
* Synchronizes on {@link #spectators}.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* Spectator to add to this game.
|
||||
* @throws TooManySpectatorsException
|
||||
|
@ -346,7 +350,7 @@ public class Game {
|
|||
* Remove a spectator from the game.
|
||||
* <br/>
|
||||
* Synchronizes on {@link #spectator}.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* Spectator to remove from the game.
|
||||
*/
|
||||
|
@ -387,7 +391,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Broadcast a message to all players in this game.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* Type of message to broadcast. This determines the order the messages are returned by
|
||||
* priority.
|
||||
|
@ -401,7 +405,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Sends updated player information about a specific player to all players in the game.
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
* The player whose information has been changed.
|
||||
*/
|
||||
|
@ -462,6 +466,10 @@ public class Game {
|
|||
notifyGameOptionsChanged();
|
||||
}
|
||||
|
||||
public Set<String> getCardcastDeckIds() {
|
||||
return cardcastDeckIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about this game, without the game's password.
|
||||
* <br/>
|
||||
|
@ -536,7 +544,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Get player information for a single player.
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
* The player for whom to get status.
|
||||
* @return Information for {@code player}: Name, score, status.
|
||||
|
@ -556,7 +564,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Determine the player status for a given player, based on game state.
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
* Player for whom to get the state.
|
||||
* @return The state of {@code player}, one of {@code HOST}, {@code IDLE}, {@code JUDGE},
|
||||
|
@ -619,7 +627,7 @@ public class Game {
|
|||
* Start the game, if there are at least 3 players present. This does not do any access checking!
|
||||
* <br/>
|
||||
* Synchronizes on {@link #players}.
|
||||
*
|
||||
*
|
||||
* @return True if the game is started. Would only be false if there aren't enough players, or the
|
||||
* game is already started, or doesn't have a base deck, but hopefully clients would
|
||||
* prevent that from happening!
|
||||
|
@ -652,8 +660,23 @@ public class Game {
|
|||
final List<CardSet> cardSets = session.createQuery("from PyxCardSet where id in (:ids)")
|
||||
.setParameterList("ids", options.getPyxCardSetIds()).list();
|
||||
|
||||
// FIXME hardcode hack for testing GBTXA
|
||||
cardSets.add(cardcastServiceProvider.get().loadSet("GBTXA"));
|
||||
// Not injecting the service itself because we might need to assisted inject it later
|
||||
// with card id stuff.
|
||||
// also TODO maybe make card ids longs instead of ints
|
||||
final CardcastService service = cardcastServiceProvider.get();
|
||||
|
||||
// Avoid ConcurrentModificationException
|
||||
for (final String cardcastId : cardcastDeckIds.toArray(new String[0])) {
|
||||
// Ideally, we can assume that anything in that set is going to load, but it is entirely
|
||||
// possible that the cache has expired and we can't re-load it for some reason, so
|
||||
// let's be safe.
|
||||
final CardcastDeck cardcastDeck = service.loadSet(cardcastId);
|
||||
if (null == cardcastDeck) {
|
||||
// TODO better way to indicate this to the user
|
||||
logger.error(String.format("Unable to load %s from Cardcast", cardcastId));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
blackDeck = new BlackDeck(cardSets);
|
||||
whiteDeck = new WhiteDeck(cardSets, options.blanksInDeck);
|
||||
|
@ -979,9 +1002,9 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Reset the game state to a lobby.
|
||||
*
|
||||
*
|
||||
* TODO change the message sent to the client if the game reset due to insufficient players.
|
||||
*
|
||||
*
|
||||
* @param lostPlayer
|
||||
* True if because there are no long enough people to play a game, false if because the
|
||||
* previous game finished.
|
||||
|
@ -1025,7 +1048,7 @@ public class Game {
|
|||
/**
|
||||
* Check to see if judging should begin, based on the number of players that have played and the
|
||||
* number of cards they have played.
|
||||
*
|
||||
*
|
||||
* @return True if judging should begin.
|
||||
*/
|
||||
private boolean startJudging() {
|
||||
|
@ -1081,7 +1104,7 @@ public class Game {
|
|||
/**
|
||||
* @return A HashMap to use for events dispatched from this game, with the game id already set.
|
||||
*/
|
||||
private HashMap<ReturnableData, Object> getEventMap() {
|
||||
public HashMap<ReturnableData, Object> getEventMap() {
|
||||
final HashMap<ReturnableData, Object> data = new HashMap<ReturnableData, Object>();
|
||||
data.put(LongPollResponse.GAME_ID, id);
|
||||
return data;
|
||||
|
@ -1119,7 +1142,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Get the {@code Player} object for a given {@code User} object.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* @return The {@code Player} object representing {@code user} in this game, or {@code null} if
|
||||
* {@code user} is not in this game.
|
||||
|
@ -1137,7 +1160,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Synchronizes on {@link #blackCardLock}.
|
||||
*
|
||||
*
|
||||
* @return Client data for the current {@code BlackCard}, or {@code null} if there is not a
|
||||
* {@code BlackCard}.
|
||||
*/
|
||||
|
@ -1177,7 +1200,6 @@ public class Game {
|
|||
* @return The white cards the specified user can see, i.e., theirs and face-down cards for
|
||||
* everyone else.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<List<Map<WhiteCardData, Object>>> getWhiteCards(final User user) {
|
||||
// if we're in judge mode, return all of the cards and ignore which user is asking
|
||||
if (state == GameState.JUDGING) {
|
||||
|
@ -1207,7 +1229,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Convert a list of {@code WhiteCard}s to data suitable for sending to a client.
|
||||
*
|
||||
*
|
||||
* @param cards
|
||||
* Cards to convert to client data.
|
||||
* @return Client representation of {@code cards}.
|
||||
|
@ -1223,7 +1245,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Send a list of {@code WhiteCard}s to a player.
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
* Player to send the cards to.
|
||||
* @param cards
|
||||
|
@ -1239,7 +1261,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Get a client data representation of a user's hand.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* User whose hand to convert to client data.
|
||||
* @return Client representation of {@code user}'s hand.
|
||||
|
@ -1287,7 +1309,7 @@ public class Game {
|
|||
|
||||
/**
|
||||
* Play a card.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* User playing the card.
|
||||
* @param cardId
|
||||
|
@ -1343,7 +1365,7 @@ public class Game {
|
|||
* The judge has selected a card. The {@code cardId} passed in may be any white cards's ID for
|
||||
* black cards that have multiple selection, however only the first card in the set's ID will be
|
||||
* passed around to clients.
|
||||
*
|
||||
*
|
||||
* @param user
|
||||
* Judge user.
|
||||
* @param cardId
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) 2012, Andy Janata
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
* and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
|
@ -34,7 +34,7 @@ import net.socialgamer.cah.JsonWrapper;
|
|||
|
||||
/**
|
||||
* Options for an individual game.
|
||||
*
|
||||
*
|
||||
* @author Gavin Lambert (uecasm)
|
||||
*/
|
||||
public class GameOptions {
|
||||
|
@ -63,7 +63,7 @@ public class GameOptions {
|
|||
|
||||
/**
|
||||
* Update the options in-place (so that the Game doesn't need more locks).
|
||||
*
|
||||
*
|
||||
* @param newOptions
|
||||
* The new options to use.
|
||||
*/
|
||||
|
@ -82,7 +82,7 @@ public class GameOptions {
|
|||
|
||||
/**
|
||||
* Get the options in a form that can be sent to clients.
|
||||
*
|
||||
*
|
||||
* @param includePassword
|
||||
* Include the actual password with the information. This should only be
|
||||
* sent to people in the game.
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package net.socialgamer.cah.handlers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import net.socialgamer.cah.Constants.AjaxOperation;
|
||||
import net.socialgamer.cah.Constants.AjaxRequest;
|
||||
import net.socialgamer.cah.Constants.ErrorCode;
|
||||
import net.socialgamer.cah.Constants.GameState;
|
||||
import net.socialgamer.cah.Constants.LongPollEvent;
|
||||
import net.socialgamer.cah.Constants.LongPollResponse;
|
||||
import net.socialgamer.cah.Constants.ReturnableData;
|
||||
import net.socialgamer.cah.RequestWrapper;
|
||||
import net.socialgamer.cah.cardcast.CardcastDeck;
|
||||
import net.socialgamer.cah.cardcast.CardcastService;
|
||||
import net.socialgamer.cah.data.Game;
|
||||
import net.socialgamer.cah.data.GameManager;
|
||||
import net.socialgamer.cah.data.QueuedMessage.MessageType;
|
||||
import net.socialgamer.cah.data.User;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class CardcastAddCardsetHandler extends GameWithPlayerHandler {
|
||||
|
||||
public static final String OP = AjaxOperation.CARDCAST_ADD_CARDSET.toString();
|
||||
|
||||
private final CardcastService cardcastService;
|
||||
|
||||
@Inject
|
||||
public CardcastAddCardsetHandler(final GameManager gameManager,
|
||||
final CardcastService cardcastService) {
|
||||
super(gameManager);
|
||||
this.cardcastService = cardcastService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request,
|
||||
final HttpSession session, final User user, final Game game) {
|
||||
final Map<ReturnableData, Object> data = new HashMap<ReturnableData, Object>();
|
||||
|
||||
if (game.getHost() != user) {
|
||||
return error(ErrorCode.NOT_GAME_HOST);
|
||||
} else if (game.getState() != GameState.LOBBY) {
|
||||
return error(ErrorCode.ALREADY_STARTED);
|
||||
} else {
|
||||
String deckId = request.getParameter(AjaxRequest.CARDCAST_ID);
|
||||
if (null == deckId) {
|
||||
return error(ErrorCode.BAD_REQUEST);
|
||||
}
|
||||
deckId = deckId.toUpperCase();
|
||||
if (deckId.length() != 5) {
|
||||
return error(ErrorCode.CARDCAST_INVALID_ID);
|
||||
}
|
||||
|
||||
final CardcastDeck deck = cardcastService.loadSet(deckId);
|
||||
if (null == deck) {
|
||||
return error(ErrorCode.CARDCAST_CANNOT_FIND);
|
||||
}
|
||||
|
||||
final HashMap<ReturnableData, Object> map = game.getEventMap();
|
||||
map.put(LongPollResponse.EVENT, LongPollEvent.CARDCAST_ADD_CARDSET.toString());
|
||||
map.put(LongPollResponse.CARDCAST_DECK_INFO, deck.getClientMetadata());
|
||||
game.broadcastToPlayers(MessageType.GAME_EVENT, map);
|
||||
|
||||
game.getCardcastDeckIds().add(deckId);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package net.socialgamer.cah.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import net.socialgamer.cah.Constants.AjaxOperation;
|
||||
import net.socialgamer.cah.Constants.AjaxResponse;
|
||||
import net.socialgamer.cah.Constants.CardSetData;
|
||||
import net.socialgamer.cah.Constants.ErrorCode;
|
||||
import net.socialgamer.cah.Constants.ReturnableData;
|
||||
import net.socialgamer.cah.RequestWrapper;
|
||||
import net.socialgamer.cah.cardcast.CardcastDeck;
|
||||
import net.socialgamer.cah.cardcast.CardcastService;
|
||||
import net.socialgamer.cah.data.Game;
|
||||
import net.socialgamer.cah.data.GameManager;
|
||||
import net.socialgamer.cah.data.User;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class CardcastListCardsetsHandler extends GameWithPlayerHandler {
|
||||
|
||||
public static final String OP = AjaxOperation.CARDCAST_LIST_CARDSETS.toString();
|
||||
|
||||
private final CardcastService cardcastService;
|
||||
|
||||
@Inject
|
||||
public CardcastListCardsetsHandler(final GameManager gameManager,
|
||||
final CardcastService cardcastService) {
|
||||
super(gameManager);
|
||||
this.cardcastService = cardcastService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request,
|
||||
final HttpSession session, final User user, final Game game) {
|
||||
final Map<ReturnableData, Object> data = new HashMap<ReturnableData, Object>();
|
||||
|
||||
final List<Map<CardSetData, Object>> setDatas = new ArrayList<>();
|
||||
for (final String deckId : game.getCardcastDeckIds().toArray(new String[0])) {
|
||||
final CardcastDeck deck = cardcastService.loadSet(deckId);
|
||||
if (null == deck) {
|
||||
// FIXME we need a way to tell the user which one is broken.
|
||||
return error(ErrorCode.CARDCAST_CANNOT_FIND);
|
||||
}
|
||||
setDatas.add(deck.getClientMetadata());
|
||||
}
|
||||
data.put(AjaxResponse.CARD_SETS, setDatas);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package net.socialgamer.cah.handlers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import net.socialgamer.cah.Constants.AjaxOperation;
|
||||
import net.socialgamer.cah.Constants.AjaxRequest;
|
||||
import net.socialgamer.cah.Constants.ErrorCode;
|
||||
import net.socialgamer.cah.Constants.GameState;
|
||||
import net.socialgamer.cah.Constants.LongPollEvent;
|
||||
import net.socialgamer.cah.Constants.LongPollResponse;
|
||||
import net.socialgamer.cah.Constants.ReturnableData;
|
||||
import net.socialgamer.cah.RequestWrapper;
|
||||
import net.socialgamer.cah.cardcast.CardcastDeck;
|
||||
import net.socialgamer.cah.cardcast.CardcastService;
|
||||
import net.socialgamer.cah.data.Game;
|
||||
import net.socialgamer.cah.data.GameManager;
|
||||
import net.socialgamer.cah.data.QueuedMessage.MessageType;
|
||||
import net.socialgamer.cah.data.User;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
public class CardcastRemoveCardsetHandler extends GameWithPlayerHandler {
|
||||
|
||||
public static final String OP = AjaxOperation.CARDCAST_REMOVE_CARDSET.toString();
|
||||
|
||||
private final CardcastService cardcastService;
|
||||
|
||||
@Inject
|
||||
public CardcastRemoveCardsetHandler(final GameManager gameManager,
|
||||
final CardcastService cardcastService) {
|
||||
super(gameManager);
|
||||
this.cardcastService = cardcastService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ReturnableData, Object> handleWithUserInGame(final RequestWrapper request,
|
||||
final HttpSession session, final User user, final Game game) {
|
||||
final Map<ReturnableData, Object> data = new HashMap<ReturnableData, Object>();
|
||||
|
||||
if (game.getHost() != user) {
|
||||
return error(ErrorCode.NOT_GAME_HOST);
|
||||
} else if (game.getState() != GameState.LOBBY) {
|
||||
return error(ErrorCode.ALREADY_STARTED);
|
||||
} else {
|
||||
String deckId = request.getParameter(AjaxRequest.CARDCAST_ID);
|
||||
if (null == deckId) {
|
||||
return error(ErrorCode.BAD_REQUEST);
|
||||
}
|
||||
deckId = deckId.toUpperCase();
|
||||
if (deckId.length() != 5) {
|
||||
return error(ErrorCode.CARDCAST_INVALID_ID);
|
||||
}
|
||||
|
||||
final CardcastDeck deck = cardcastService.loadSet(deckId);
|
||||
if (null == deck) {
|
||||
// Remove it from the set anyway.
|
||||
game.getCardcastDeckIds().remove(deckId);
|
||||
return error(ErrorCode.CARDCAST_CANNOT_FIND);
|
||||
}
|
||||
|
||||
final HashMap<ReturnableData, Object> map = game.getEventMap();
|
||||
map.put(LongPollResponse.EVENT, LongPollEvent.CARDCAST_REMOVE_CARDSET.toString());
|
||||
map.put(LongPollResponse.CARDCAST_DECK_INFO, deck.getClientMetadata());
|
||||
game.broadcastToPlayers(MessageType.GAME_EVENT, map);
|
||||
|
||||
game.getCardcastDeckIds().add(deckId);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,9 @@ public class Handlers {
|
|||
LIST = new HashMap<String, Class<? extends Handler>>();
|
||||
LIST.put(AdminSetVerboseLog.OP, AdminSetVerboseLog.class);
|
||||
LIST.put(BanHandler.OP, BanHandler.class);
|
||||
LIST.put(CardcastAddCardsetHandler.OP, CardcastAddCardsetHandler.class);
|
||||
LIST.put(CardcastListCardsetsHandler.OP, CardcastListCardsetsHandler.class);
|
||||
LIST.put(CardcastRemoveCardsetHandler.OP, CardcastRemoveCardsetHandler.class);
|
||||
LIST.put(ChangeGameOptionHandler.OP, ChangeGameOptionHandler.class);
|
||||
LIST.put(ChatHandler.OP, ChatHandler.class);
|
||||
LIST.put(CreateGameHandler.OP, CreateGameHandler.class);
|
||||
|
|
Loading…
Reference in New Issue