From 2dbafdc55f1d5012b3655798acd79c340132ec20 Mon Sep 17 00:00:00 2001 From: Richard Laughlin Date: Thu, 4 Oct 2012 07:07:35 -0400 Subject: [PATCH 1/5] Added docstrings --- data/scripts/__init__.py | 1 - data/scripts/__init__.pyc | Bin 130 -> 0 bytes data/scripts/commands/addfriend.py | 18 ++-- data/scripts/commands/addignore.py | 16 ++-- data/scripts/commands/burstrun.py | 32 +++---- data/scripts/commands/deathblow.py | 14 +-- data/scripts/commands/duel.py | 24 ++--- data/scripts/commands/endduel.py | 12 +-- data/scripts/commands/kneel.py | 4 +- data/scripts/commands/peace.py | 24 ++--- data/scripts/commands/prone.py | 4 +- data/scripts/commands/removefriend.py | 16 ++-- data/scripts/commands/removeignore.py | 16 ++-- data/scripts/commands/setmoodinternal.py | 30 +++--- data/scripts/commands/sitserver.py | 4 +- data/scripts/commands/stand.py | 4 +- data/scripts/commands/transferItem.py | 8 +- data/scripts/commands/transferItemArmor.py | 9 +- data/scripts/commands/transferItemMisc.py | 9 +- data/scripts/commands/transferItemWeapon.py | 9 +- data/scripts/radials/radial_menu.py | 6 +- data/scripts/scripta.py | 4 - data/scripts/scripta.pyc | Bin 202 -> 0 bytes data/scripts/scriptb.py | 1 - data/scripts/scriptb.pyc | Bin 122 -> 0 bytes data/scripts/spawn_test.py | 18 ---- data/scripts/sui_test.py | 60 ------------ data/scripts/test_python_obj.py | 5 - data/scripts/weather/weather.py | 60 ++++++------ src/swganh/app/swganh_kernel_binding.h | 22 ++--- src/swganh/combat/combat_service_binding.h | 4 +- .../command/base_combat_command_binding.cc | 2 +- src/swganh/command/command_binding.cc | 38 ++++---- src/swganh/command/command_service_binding.cc | 10 +- .../equipment/equipment_service_binding.h | 10 +- src/swganh/object/creature/creature_binding.h | 66 ++++++------- src/swganh/object/guild/guild_binding.h | 4 +- src/swganh/object/object_binding.h | 46 ++++----- src/swganh/object/object_controller_binding.h | 2 +- src/swganh/object/player/player_binding.h | 90 +++++++++--------- src/swganh/object/tangible/tangible_binding.h | 24 ++--- .../simulation/simulation_service_binding.h | 14 +-- src/swganh/social/social_service_binding.h | 4 +- src/swganh/sui/sui_service_binding.h | 60 ++++++------ src/swganh/terrain/terrain_service_binding.h | 6 +- src/swganh/weather/weather_service_binding.h | 12 +-- .../attributes/armor_attribute_template.h | 15 +++ .../attributes_get_batch_command.cc | 2 +- .../attributes/attributes_get_batch_command.h | 16 ++++ .../attributes/attributes_helper.h | 10 ++ .../attributes/attributes_service.cc | 11 --- .../attributes/attributes_service.h | 50 +++++++++- .../attributes/base_attribute_template.h | 29 +++++- .../crafting_tool_attribute_template.h | 14 +++ .../attributes/deed_attribute_template.h | 13 +++ .../attributes/droid_attribute_template.h | 13 +++ .../factory_crate_attribute_template.h | 12 ++- .../attributes/food_attribute_template.h | 14 +++ .../attributes/furniture_attribute_template.h | 14 +++ .../attributes/meds_attribute_template.h | 14 +++ .../attributes/ship_attribute_template.h | 13 +++ .../attributes/weapon_attribute_template.h | 16 +++- .../attributes/wearable_attribute_template.h | 16 +++- .../character/character_service.cc | 2 - src/swganh_core/character/character_service.h | 32 ++++++- .../character/mysql_character_provider.cc | 4 +- .../character/mysql_character_provider.h | 56 ++++++++++- src/swganh_core/chat/chat_service.cc | 5 - src/swganh_core/chat/chat_service.h | 61 ++++++++---- .../chat/spatial_chat_internal_command.cc | 3 - .../chat/spatial_chat_internal_command.h | 12 ++- src/swganh_core/combat/combat_data.h | 15 ++- src/swganh_core/combat/combat_service.h | 53 +++++++++-- src/swganh_core/command/command_factory.cc | 3 - src/swganh_core/command/command_factory.h | 23 ++++- src/swganh_core/command/command_filter.h | 18 ++++ src/swganh_core/command/command_queue.h | 34 ++++++- .../command/command_queue_manager.cc | 3 - .../command/command_queue_manager.h | 37 ++++++- src/swganh_core/command/command_service.cc | 8 -- src/swganh_core/command/command_service.h | 82 +++++++++++++++- src/swganh_core/command/command_validator.cc | 3 - src/swganh_core/command/command_validator.h | 22 ++++- .../connection/connection_client.h | 26 +++++ .../connection/connection_service.h | 37 +++++++ .../equipment/equipment_service.cc | 3 + src/swganh_core/equipment/equipment_service.h | 57 ++++++++--- src/swganh_core/galaxy/galaxy_service.h | 65 +++++++++---- .../galaxy/mysql_galaxy_provider.cc | 2 - .../galaxy/mysql_galaxy_provider.h | 10 +- .../login/authentication_manager.h | 12 +++ src/swganh_core/login/login_service.h | 61 +++++++++++- .../login/mysql_account_provider.cc | 2 - .../login/mysql_account_provider.h | 37 ++++++- .../login/mysql_session_provider.cc | 2 - .../login/mysql_session_provider.h | 24 ++++- src/swganh_core/login/sha512_encoder.cc | 1 - src/swganh_core/login/sha512_encoder.h | 15 ++- 98 files changed, 1306 insertions(+), 618 deletions(-) delete mode 100644 data/scripts/__init__.pyc delete mode 100644 data/scripts/scripta.py delete mode 100644 data/scripts/scripta.pyc delete mode 100644 data/scripts/scriptb.py delete mode 100644 data/scripts/scriptb.pyc delete mode 100644 data/scripts/spawn_test.py delete mode 100644 data/scripts/sui_test.py delete mode 100644 data/scripts/test_python_obj.py diff --git a/data/scripts/__init__.py b/data/scripts/__init__.py index 975c31007..e69de29bb 100644 --- a/data/scripts/__init__.py +++ b/data/scripts/__init__.py @@ -1 +0,0 @@ -print('init.py called') diff --git a/data/scripts/__init__.pyc b/data/scripts/__init__.pyc deleted file mode 100644 index 463c2cda27be6115479b386f3dcb572136047a6c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 130 zcmcckiIO{(SIh;{n_QGxP?D&dky!#VuDCQ+14Nf_0Ey(H)Wnj~qSO*b5T^vB xGcPeWRRc&fAc$fiAQxgxaSYTry@E=x2{yU;DWy57b|3?a*?ZaP0}}+0SXv_v;z("Kernel", no_init) ; class_, boost::noncopyable>("SWGKernel", "Provides an interface to access the Service Manager and App Configuration", no_init) - .def("app_config", &swganh::app::SwganhKernel::GetAppConfig, return_value_policy(), "gets the app configuration") - .def("service_manager", &swganh::app::SwganhKernel::GetServiceManager,return_internal_reference<>(), "Gets the application's :class:`.ServiceManager`") - .def("event_dispatcher", &swganh::app::SwganhKernel::GetEventDispatcher, return_value_policy(), "gets the applications :class:`.EventDispatcher`") + .def("appConfig", &swganh::app::SwganhKernel::GetAppConfig, return_value_policy(), "gets the app configuration") + .def("serviceManager", &swganh::app::SwganhKernel::GetServiceManager,return_internal_reference<>(), "Gets the application's :class:`.ServiceManager`") + .def("eventDispatcher", &swganh::app::SwganhKernel::GetEventDispatcher, return_value_policy(), "gets the applications :class:`.EventDispatcher`") ; class_("ServiceManager", "provides an interface to common services", no_init) - .def("combat_service", make_function( + .def("combatService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "CombatService"), return_value_policy(), boost::mpl::vector()), "returns an internal refrence of the :class:`.CombatServiceInterface`") - .def("command_service", make_function( + .def("commandService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "CommandService"), return_value_policy(), boost::mpl::vector()), "returns an internal refrence of the :class:`.CommandService`") - .def("simulation_service", make_function( + .def("simulationService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "SimulationService"), return_value_policy(), boost::mpl::vector()), "returns an internal refrence of the :class:`.SimulationService`") - .def("social_service", make_function( + .def("socialService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "SocialService"), return_value_policy(), boost::mpl::vector()), "returns an internal refrence of the :class:`.SocialService`") - .def("sui_service", make_function( + .def("suiService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "SuiService"), return_value_policy(), boost::mpl::vector()), "returns an internal refrence of the :class:`.SUIService`") - .def("terrain_service", make_function( + .def("terrainService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "TerrainService"), return_value_policy(), boost::mpl::vector()), "returns an internal refrence of the :class:`.TerrainService`") - .def("equipment_service", make_function( + .def("equipmentService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "EquipmentService"), return_value_policy(), boost::mpl::vector()), "returns an internal refrence of the :class:`.EquipmentService`") - .def("weather_service", make_function( + .def("weatherService", make_function( std::bind(&swganh::service::ServiceManager::GetService, std::placeholders::_1, "WeatherService"), return_value_policy(), boost::mpl::vector()), diff --git a/src/swganh/combat/combat_service_binding.h b/src/swganh/combat/combat_service_binding.h index ca4034a43..1099f1bed 100644 --- a/src/swganh/combat/combat_service_binding.h +++ b/src/swganh/combat/combat_service_binding.h @@ -20,7 +20,7 @@ void exportCombatService() class_, boost::noncopyable>("CombatServiceInterface", no_init) .def("incapacitate", &CombatServiceInterface::SetIncapacitated, "sets the target as incapacitated and sends out appropriate system messages") .def("kill", &CombatServiceInterface::SetDead, "Sets the target as dead and sends out the appropriate system messages and begins the cloning process") - .def("end_duel", &CombatServiceInterface::EndDuel, "Ends the duel between the two players") - .def("end_combat", &CombatServiceInterface::EndCombat, "Ends combat between the attacker and target") + .def("endDuel", &CombatServiceInterface::EndDuel, "Ends the duel between the two players") + .def("endCombat", &CombatServiceInterface::EndCombat, "Ends combat between the attacker and target") ; } diff --git a/src/swganh/command/base_combat_command_binding.cc b/src/swganh/command/base_combat_command_binding.cc index 2336633f3..cb56fb6a2 100644 --- a/src/swganh/command/base_combat_command_binding.cc +++ b/src/swganh/command/base_combat_command_binding.cc @@ -146,6 +146,6 @@ void swganh::command::ExportBaseCombatCommand() { bp::class_, boost::noncopyable> ("BaseCombatCommand", bp::init()) - .def("Run", &BaseCombatCommandWrapper::Run) + .def("run", &BaseCombatCommandWrapper::Run) ; } diff --git a/src/swganh/command/command_binding.cc b/src/swganh/command/command_binding.cc index 5ebf64475..91d3ea7de 100644 --- a/src/swganh/command/command_binding.cc +++ b/src/swganh/command/command_binding.cc @@ -125,31 +125,31 @@ void swganh::command::ExportCommand() { bp::class_, boost::noncopyable> ("Callback", bp::init()) - .def("GetDelayTimeInMs", &CommandCallbackWrapper::GetDelayTimeInMs) - .def("Execute", &CommandCallbackWrapper::operator()) + .def("getDelayTimeInMs", &CommandCallbackWrapper::GetDelayTimeInMs) + .def("execute", &CommandCallbackWrapper::operator()) ; bp::class_("CommandInterface", bp::no_init) - .def("Validate", bp::pure_virtual(&CommandInterface::Validate)) - .def("Run", bp::pure_virtual(&CommandInterface::Run)) + .def("validate", bp::pure_virtual(&CommandInterface::Validate)) + .def("run", bp::pure_virtual(&CommandInterface::Run)) ; bp::class_, boost::noncopyable> ("BaseSwgCommand", bp::init()) - .def("Validate", &BaseSwgCommandWrapper::Validate) - .def("GetKernel", &BaseSwgCommandWrapper::GetKernel, bp::return_internal_reference<>()) - .def("GetCommandName", &BaseSwgCommandWrapper::GetCommandName) - .def("GetActionCounter", &BaseSwgCommandWrapper::GetActionCounter) - .def("GetPriority", &BaseSwgCommandWrapper::GetPriority) - .def("GetCommandGroup", &BaseSwgCommandWrapper::GetCommandGroup) - .def("GetCommandString", &BaseSwgCommandWrapper::GetCommandString, bp::return_value_policy()) - .def("GetTargetRequiredType", &BaseSwgCommandWrapper::GetTargetRequiredType) - .def("GetMaxRangeToTarget", &BaseSwgCommandWrapper::GetMaxRangeToTarget) - .def("GetDefaultTime", &BaseSwgCommandWrapper::GetDefaultTime) - .def("GetRequiredAbility", &BaseSwgCommandWrapper::GetRequiredAbility) - .def("IsQueuedCommand", &BaseSwgCommandWrapper::IsQueuedCommand) - .def("GetActor", &BaseSwgCommandWrapper::GetActor, bp::return_value_policy()) - .def("GetTarget", &BaseSwgCommandWrapper::GetTarget, bp::return_value_policy()) - .def("GetTargetCreature", &BaseSwgCommandWrapper::GetTargetCreature) + .def("validate", &BaseSwgCommandWrapper::Validate) + .def("getKernel", &BaseSwgCommandWrapper::GetKernel, bp::return_internal_reference<>()) + .def("getCommandName", &BaseSwgCommandWrapper::GetCommandName) + .def("getActionCounter", &BaseSwgCommandWrapper::GetActionCounter) + .def("getPriority", &BaseSwgCommandWrapper::GetPriority) + .def("getCommandGroup", &BaseSwgCommandWrapper::GetCommandGroup) + .def("getCommandString", &BaseSwgCommandWrapper::GetCommandString, bp::return_value_policy()) + .def("getTargetRequiredType", &BaseSwgCommandWrapper::GetTargetRequiredType) + .def("getMaxRangeToTarget", &BaseSwgCommandWrapper::GetMaxRangeToTarget) + .def("getDefaultTime", &BaseSwgCommandWrapper::GetDefaultTime) + .def("getRequiredAbility", &BaseSwgCommandWrapper::GetRequiredAbility) + .def("isQueuedCommand", &BaseSwgCommandWrapper::IsQueuedCommand) + .def("getActor", &BaseSwgCommandWrapper::GetActor, bp::return_value_policy()) + .def("getTarget", &BaseSwgCommandWrapper::GetTarget, bp::return_value_policy()) + .def("getTargetCreature", &BaseSwgCommandWrapper::GetTargetCreature) ; } diff --git a/src/swganh/command/command_service_binding.cc b/src/swganh/command/command_service_binding.cc index 35d4ff55a..a1b23ac74 100644 --- a/src/swganh/command/command_service_binding.cc +++ b/src/swganh/command/command_service_binding.cc @@ -12,10 +12,10 @@ namespace bp = boost::python; void swganh::command::ExportCommandService() { bp::class_("CommandService", bp::no_init) - .def("CreateCommand", &CommandServiceInterface::CreateCommand) - .def("EnqueueCommand", &CommandServiceInterface::EnqueueCommand) - .def("SetDefaultCommand", &CommandServiceInterface::SetDefaultCommand) - .def("HasDefaultCommand", &CommandServiceInterface::HasDefaultCommand) - .def("ClearDefaultCommand", &CommandServiceInterface::ClearDefaultCommand) + .def("createCommand", &CommandServiceInterface::CreateCommand) + .def("enqueueCommand", &CommandServiceInterface::EnqueueCommand) + .def("setDefaultCommand", &CommandServiceInterface::SetDefaultCommand) + .def("hasDefaultCommand", &CommandServiceInterface::HasDefaultCommand) + .def("clearDefaultCommand", &CommandServiceInterface::ClearDefaultCommand) ; } diff --git a/src/swganh/equipment/equipment_service_binding.h b/src/swganh/equipment/equipment_service_binding.h index 6e03b5d4f..31186f4c1 100644 --- a/src/swganh/equipment/equipment_service_binding.h +++ b/src/swganh/equipment/equipment_service_binding.h @@ -26,11 +26,11 @@ void exportEquipmentService() std::shared_ptr (EquipmentServiceInterface::*GetFunc)(std::shared_ptr, std::string) = &EquipmentServiceInterface::GetEquippedObject; class_, boost::noncopyable>("EquipmentService", "The equipment service is a utility class for helping with equipping.", no_init) - .def("GetSlotIdByName", &EquipmentServiceInterface::GetSlotIdByName,"Returns the slot id associated with a slot name. This slot_id can then be used by objects to do equipment operations.") - .def("GetSlotNameById", &EquipmentServiceInterface::GetSlotNameById,"Returns the slot name by the slot_id. This can be used to 'undo' GetSlotIdByName") - .def("ClearSlot", ClearFunc,"Utility method that gets the slot id for a slot name and then clears that slot from an object.") - .def("GetEquippedObject", GetFunc,"Utility method that gets the slot id for a slot name and then returns the object in that slot for a given object.") - .def("GetPlayerObject", make_function( + .def("getSlotIdByName", &EquipmentServiceInterface::GetSlotIdByName,"Returns the slot id associated with a slot name. This slot_id can then be used by objects to do equipment operations.") + .def("getSlotNameById", &EquipmentServiceInterface::GetSlotNameById,"Returns the slot name by the slot_id. This can be used to 'undo' GetSlotIdByName") + .def("clearSlot", ClearFunc,"Utility method that gets the slot id for a slot name and then clears that slot from an object.") + .def("getEquippedObject", GetFunc,"Utility method that gets the slot id for a slot name and then returns the object in that slot for a given object.") + .def("getPlayerObject", make_function( std::bind(&EquipmentServiceInterface::GetEquippedObject, std::placeholders::_1, std::placeholders::_2, "ghost"), return_value_policy(), boost::mpl::vector, EquipmentServiceInterface*, shared_ptr>()), diff --git a/src/swganh/object/creature/creature_binding.h b/src/swganh/object/creature/creature_binding.h index 9b375032a..c580164eb 100644 --- a/src/swganh/object/creature/creature_binding.h +++ b/src/swganh/object/creature/creature_binding.h @@ -110,45 +110,45 @@ void exportCreature() ; class_, std::shared_ptr, boost::noncopyable>("Creature", "Object that describes the creature object, child of Tangible") // STATS - .def("set_stat_base", &Creature::SetStatBase, "sets the base :class:`.STATS` value") - .def("add_stat_base", &Creature::AddStatBase, "adds to the given :class:`.STATS`") - .def("deduct_stat_base", &Creature::DeductStatBase, "deducts from the :class:`.STATS`") - .def("get_stat_base", &Creature::GetStatBase, "gets the value of the :class:`.STATS`") - .def("set_stat_current", &Creature::SetStatCurrent, "sets the current :class:`.STATS`") - .def("add_stat_current", &Creature::AddStatCurrent, "adds to the given :class:`.STATS`") - .def("deduct_stat_current", &Creature::DeductStatCurrent, "deducts from the current :class:`.STATS`") - .def("get_stat_current", &Creature::GetStatCurrent, "gets the value of the current :class:`.STATS`") - .def("add_stat_wound", &Creature::AddStatWound, "adds to the given wound :class:`.STATS`") - .def("deduct_stat_wound", &Creature::DeductStatWound, "deducts from the given wound :class:`.STATS`") - .def("get_stat_wound", &Creature::GetStatWound, "gets the value of the current wound :class:`.STATS`") - .def("add_stat_encumberance", &Creature::AddStatEncumberance, "adds to the given encumberance :class:`.STATS`") - .def("deduct_stat_encumberance", &Creature::DeductStatEncumberance, "deducts from the given encumberance :class:`.STATS`") - .def("get_stat_encumberance", &Creature::GetStatEncumberance, "gets the value of the current encumberance :class:`.STATS`") - .def("set_stat_max", &Creature::SetStatMax, "sets the given MAX :class:`.STATS`") - .def("add_stat_max", &Creature::AddStatMax, "adds to the given MAX :class:`.STATS`") - .def("deduct_stat_max", &Creature::DeductStatMax, "deducts from the given MAX :class:`.STATS`") - .def("get_stat_max", &Creature::GetStatMax, "gets the value of the current MAX :class:`.STATS`") + .def("setStatBase", &Creature::SetStatBase, "sets the base :class:`.STATS` value") + .def("addStatBase", &Creature::AddStatBase, "adds to the given :class:`.STATS`") + .def("deductStatBase", &Creature::DeductStatBase, "deducts from the :class:`.STATS`") + .def("getStatBase", &Creature::GetStatBase, "gets the value of the :class:`.STATS`") + .def("setStatCurrent", &Creature::SetStatCurrent, "sets the current :class:`.STATS`") + .def("addStatCurrent", &Creature::AddStatCurrent, "adds to the given :class:`.STATS`") + .def("deductStatCurrent", &Creature::DeductStatCurrent, "deducts from the current :class:`.STATS`") + .def("getStatCurrent", &Creature::GetStatCurrent, "gets the value of the current :class:`.STATS`") + .def("addStatWound", &Creature::AddStatWound, "adds to the given wound :class:`.STATS`") + .def("deductStatWound", &Creature::DeductStatWound, "deducts from the given wound :class:`.STATS`") + .def("getStatWound", &Creature::GetStatWound, "gets the value of the current wound :class:`.STATS`") + .def("addStatEncumberance", &Creature::AddStatEncumberance, "adds to the given encumberance :class:`.STATS`") + .def("deductStatEncumberance", &Creature::DeductStatEncumberance, "deducts from the given encumberance :class:`.STATS`") + .def("getStatEncumberance", &Creature::GetStatEncumberance, "gets the value of the current encumberance :class:`.STATS`") + .def("setStatMax", &Creature::SetStatMax, "sets the given MAX :class:`.STATS`") + .def("addStatMax", &Creature::AddStatMax, "adds to the given MAX :class:`.STATS`") + .def("deductStatMax", &Creature::DeductStatMax, "deducts from the given MAX :class:`.STATS`") + .def("getStatMax", &Creature::GetStatMax, "gets the value of the current MAX :class:`.STATS`") // - .def("add_skill", &Creature::AddSkill, "adds skill to the creature") - .def("remove_skill", &Creature::RemoveSkill, "removes skill from the creature") - .def("has_skill", &Creature::HasSkill, "returns true if the creature has the skill") - .def("add_skill_mod", &Creature::AddSkillMod, "adds skill mod to the creature") - .def("remove_skill_mod", &Creature::RemoveSkillMod, "removes skill mod from the creature") - .def("get_skill_mod", &Creature::GetSkillMod, "gets the current value of the skill mod") + .def("addSkill", &Creature::AddSkill, "adds skill to the creature") + .def("removeSkill", &Creature::RemoveSkill, "removes skill from the creature") + .def("hasSkill", &Creature::HasSkill, "returns true if the creature has the skill") + .def("addSkillMod", &Creature::AddSkillMod, "adds skill mod to the creature") + .def("removeSkillMod", &Creature::RemoveSkillMod, "removes skill mod from the creature") + .def("getSkillMod", &Creature::GetSkillMod, "gets the current value of the skill mod") .add_property("bank_credits", &Creature::GetBankCredits, &Creature::SetBankCredits, "Gets and Sets the credits that a creature has in their bank") .add_property("cash_credits", &Creature::GetCashCredits, &Creature::SetCashCredits, "Gets and Sets the credits that a creature has on themselves") .add_property("posture", &Creature::GetPosture, &Creature::SetPosture, "Gets and Sets the posture of the creature, :class:`.POSTURE`") - .def("is_dead", &Creature::IsDead, "returns true if this creature is dead") - .def("is_incap", &Creature::IsIncapacitated, "returns true if this creature is incapacitated") + .def("isDead", &Creature::IsDead, "returns true if this creature is dead") + .def("isIncap", &Creature::IsIncapacitated, "returns true if this creature is incapacitated") .add_property("faction_rank", &Creature::GetFactionRank, &Creature::SetFactionRank, "Gets and Sets the faction rank for this creature") .add_property("owner_id", &Creature::GetOwnerId, &Creature::SetOwnerId, "Gets and Sets the owner id for the creature") .add_property("scale", &Creature::GetScale, &Creature::SetScale, "Gets and Sets the scale of the creature 1-10") .add_property("battle_fatigue", &Creature::GetBattleFatigue, &Creature::SetBattleFatigue, "Gets and Sets the battle fatigue of the creature") .add_property("state_bitmask", &Creature::GetStateBitmask, &Creature::SetStateBitmask, "Gets and Sets the state bitmask see :class:`.ACTION`") - .def("has_state", &Creature::HasState, "Checks to see if the state :class:`.ACTION` exists in the bitmask") - .def("toggle_state", &Creature::ToggleStateBitmask, "Toggles the provided :class:`.ACTION` State") - .def("toggle_state_on", &Creature::ToggleStateOn, "Toggles the provided :class:`.ACTION` State On") - .def("toggle_state_off", &Creature::ToggleStateOff, "Toggles the provided :class:`.ACTION` State Off") + .def("hasState", &Creature::HasState, "Checks to see if the state :class:`.ACTION` exists in the bitmask") + .def("toggleState", &Creature::ToggleStateBitmask, "Toggles the provided :class:`.ACTION` State") + .def("toggleStateOn", &Creature::ToggleStateOn, "Toggles the provided :class:`.ACTION` State On") + .def("toggleStateOff", &Creature::ToggleStateOff, "Toggles the provided :class:`.ACTION` State Off") .add_property("acceleration_multiplayer_base", &Creature::GetAccelerationMultiplierBase, &Creature::SetAccelerationMultiplierBase, "Gets and Sets the base acceleration multiplier") .add_property("acceleration_multiplayer_modifier", &Creature::GetAccelerationMultiplierModifier, &Creature::SetAccelerationMultiplierModifier, "Gets and Sets the acceleration multiplier modifier") .add_property("listen_to_id", &Creature::GetListenToId, &Creature::SetListenToId, "Gets and Sets who this creature is listening to, see Entertainer") @@ -170,9 +170,9 @@ void exportCreature() .add_property("disguise", &Creature::GetDisguise, &Creature::SetDisguise, "Gets and Sets the disguise of the current creature, this makes the creature look like the given iff file") .add_property("stationary", &Creature::SetStationary, &Creature::SetStationary, "Gets and Sets if the creature can move or not") .add_property("pvp_status", &Creature::GetPvpStatus, &Creature::SetPvPStatus, "Gets and Sets the :class:`.PVPSTATUS` of the creature") - .def("in_duel_list", &Creature::InDuelList, "Returns a boolean based on if the creature is currently dueling the target") - .def("add_duel_list", &Creature::AddToDuelList, "Adds the creature id to the duel list") - .def("remove_duel_list", &Creature::RemoveFromDuelList, "Removes the creature from the duel list") + .def("inDuelList", &Creature::InDuelList, "Returns a boolean based on if the creature is currently dueling the target") + .def("addDuelList", &Creature::AddToDuelList, "Adds the creature id to the duel list") + .def("removeDuelList", &Creature::RemoveFromDuelList, "Removes the creature from the duel list") ; implicitly_convertible, std::shared_ptr>(); diff --git a/src/swganh/object/guild/guild_binding.h b/src/swganh/object/guild/guild_binding.h index c1452a363..4f97782ac 100644 --- a/src/swganh/object/guild/guild_binding.h +++ b/src/swganh/object/guild/guild_binding.h @@ -18,7 +18,7 @@ struct GuildWrapper : Guild, wrapper void exportGuild() { class_, boost::noncopyable>("Guild") - .def("add_guild_tag", &GuildWrapper::AddGuildTag, "adds guild tag to the specified guild_id") - .def("remove_guild_tag", &GuildWrapper::RemoveGuildTag, "remove guild tag") + .def("addGuildTag", &GuildWrapper::AddGuildTag, "adds guild tag to the specified guild_id") + .def("removeGuildTag", &GuildWrapper::RemoveGuildTag, "remove guild tag") ; } diff --git a/src/swganh/object/object_binding.h b/src/swganh/object/object_binding.h index 770e80a65..0d5fe23bd 100644 --- a/src/swganh/object/object_binding.h +++ b/src/swganh/object/object_binding.h @@ -89,11 +89,11 @@ void exportObject() void (ContainerInterface::*RemoveObject)(shared_ptr, shared_ptr) = &ContainerInterface::RemoveObject; class_, boost::noncopyable>("ContainerInterface", "Container interface", no_init) - .def("Add", &ContainerInterface::AddObject, addObjectOverload(args("requester", "newObject", "arrangement_id"), "Adds an object to the current object")) - .def("Remove", RemoveObject, "Removes an object fomr the current object") - .def("Transfer", &ContainerInterface::TransferObject, transferObjectOverload(args("object", "newContainer", "arrangement_id"), "Transfer an object to a different object")) - .def("SwapSlots", &Object::SwapSlots, "Change an objects current arrangement") - .def("Container", &Object::GetContainer, "Gets the :class:`ContainerInterface` object of the current object") + .def("add", &ContainerInterface::AddObject, addObjectOverload(args("requester", "newObject", "arrangement_id"), "Adds an object to the current object")) + .def("remove", RemoveObject, "Removes an object fomr the current object") + .def("transfer", &ContainerInterface::TransferObject, transferObjectOverload(args("object", "newContainer", "arrangement_id"), "Transfer an object to a different object")) + .def("swapSlots", &Object::SwapSlots, "Change an objects current arrangement") + .def("container", &Object::GetContainer, "Gets the :class:`ContainerInterface` object of the current object") ; class_, std::shared_ptr, boost::noncopyable>("Object", "The Base SWG Object that all Objects inherit from") @@ -107,26 +107,26 @@ void exportObject() .add_property("volume", &Object::GetVolume, &Object::SetVolume, "Property to get or set the volume of the object (how much it can store)") .add_property("stf_name_file", &Object::GetStfNameFile, "gets the stf name file of the object") .add_property("stf_name_string", &Object::GetStfNameString, "gets the stf name file of the object") - .def("stf_name", &Object::SetStfName, "sets the full stf name, takes stf_name_file and stf_name_string as parameters") + .def("stfName", &Object::SetStfName, "sets the full stf name, takes stf_name_file and stf_name_string as parameters") .add_property("custom_name", &Object::GetCustomName, &Object::SetCustomName, "Property to get and set the custom name") - .def("Controller", &Object::GetController, "Get the :class:`.ObjectController` of the object") - .def("HasFlag", &Object::HasFlag, "Checks if the object has a specific flag set on it") - .def("SetFlag", &Object::SetFlag, "Sets a flag on the object") - .def("RemoveFlag", &Object::RemoveFlag, "Removes a flag from the object") - .def("SetMenuResponse", &Object::SetMenuResponse, "Sets the radial menu response from a python list") - .def("get_float_attribute", &Object::GetAttribute, "Gets the float attribute value") - .def("set_float_attribute", &Object::SetAttribute, "Sets the float attribute value") - .def("get_int_attribute", &Object::GetAttribute, "Gets the int attribute value") - .def("set_int_attribute", &Object::SetAttribute, "Sets the int attribute value") - .def("get_string_attribute", &Object::GetAttribute, "Gets the string attribute value") - .def("set_string_attribute", &Object::SetAttribute, "sets the string attribute value") + .def("controller", &Object::GetController, "Get the :class:`.ObjectController` of the object") + .def("hasFlag", &Object::HasFlag, "Checks if the object has a specific flag set on it") + .def("setFlag", &Object::SetFlag, "Sets a flag on the object") + .def("removeFlag", &Object::RemoveFlag, "Removes a flag from the object") + .def("setMenuResponse", &Object::SetMenuResponse, "Sets the radial menu response from a python list") + .def("getFloatAttribute", &Object::GetAttribute, "Gets the float attribute value") + .def("setFloatAttribute", &Object::SetAttribute, "Sets the float attribute value") + .def("getIntAttribute", &Object::GetAttribute, "Gets the int attribute value") + .def("setIntAttribute", &Object::SetAttribute, "Sets the int attribute value") + .def("getStringAttribute", &Object::GetAttribute, "Gets the string attribute value") + .def("setStringAttribute", &Object::SetAttribute, "sets the string attribute value") .add_property("attribute_template_id", &Object::GetAttributeTemplateId, &Object::SetAttributeTemplateId, "Gets and Sets the attribute template_id") - .def("event_dispatcher", &Object::SetEventDispatcher, "Sets the event dispatcher pointer") - .def("SendSystemMessage", SendSystemMessage1, "Send a system message to the requester, see :class:`") - .def("SendSystemMessage", SendSystemMessage2, "Send a system message to the requester") - .def("SendSystemMessage", SendSystemMessage3, "Send a system message to the requester") - .def("SendSystemMessage", SendSystemMessage4, "Send a system message to the requester") - .def("SendFlyText", SendFlyText, "Sends Fly Text to the player, see :class:`.FlyTextColor`") + .def("eventDispatcher", &Object::SetEventDispatcher, "Sets the event dispatcher pointer") + .def("sendSystemMessage", SendSystemMessage1, "Send a system message to the requester, see :class:`") + .def("sendSystemMessage", SendSystemMessage2, "Send a system message to the requester") + .def("sendSystemMessage", SendSystemMessage3, "Send a system message to the requester") + .def("sendSystemMessage", SendSystemMessage4, "Send a system message to the requester") + .def("sendFlyText", SendFlyText, "Sends Fly Text to the player, see :class:`.FlyTextColor`") ; diff --git a/src/swganh/object/object_controller_binding.h b/src/swganh/object/object_controller_binding.h index d13b4e30b..80e7a0f42 100644 --- a/src/swganh/object/object_controller_binding.h +++ b/src/swganh/object/object_controller_binding.h @@ -26,6 +26,6 @@ void exportObjectController() { typedef void (ObserverInterface::*NotifyFunc)(const swganh::ByteBuffer& message); class_, boost::noncopyable>("ObserverInterface", "Object that describes the observer of an object", no_init) - .def("Notify", NotifyFunc(&ObserverInterface::Notify), "Notifies the controller whent he object has been updated") + .def("notify", NotifyFunc(&ObserverInterface::Notify), "Notifies the controller whent he object has been updated") ; } diff --git a/src/swganh/object/player/player_binding.h b/src/swganh/object/player/player_binding.h index 804bc35e5..94b866919 100644 --- a/src/swganh/object/player/player_binding.h +++ b/src/swganh/object/player/player_binding.h @@ -65,67 +65,67 @@ void exportPlayer() ; class_, std::shared_ptr, boost::noncopyable>("Player", "The :class:`.Player` is a child of :class:`.Object` and describes actions specific to a Player Character.") - .def("add_status_flag", &PlayerWrapper::AddStatusFlag, "adds a status flag to the existing :class:`.STATUS_FLAGS`") - .def("remove_status_flag", &PlayerWrapper::RemoveStatusFlag, "remove status flag from existing :class:`.STATUS_FLAGS`") - .def("clear_status_flags", &PlayerWrapper::ClearStatusFlags, "clears all status :class:`.STATUS_FLAGS`") - .def("add_profile_flag", &PlayerWrapper::AddProfileFlag, "adds a profile flag to the existing :class:`.PROFILE_FLAGS`") - .def("remove_profile_flag", &PlayerWrapper::RemoveProfileFlag, "remove profile flag from existing :class:`.PROFILE_FLAGS`") - .def("clear_profile_flags", &PlayerWrapper::ClearProfileFlags, "clears all :class:`.PROFILE_FLAGS`") + .def("addStatusFlag", &PlayerWrapper::AddStatusFlag, "adds a status flag to the existing :class:`.STATUS_FLAGS`") + .def("removeStatusFlag", &PlayerWrapper::RemoveStatusFlag, "remove status flag from existing :class:`.STATUS_FLAGS`") + .def("clearStatusFlags", &PlayerWrapper::ClearStatusFlags, "clears all status :class:`.STATUS_FLAGS`") + .def("addProfileFlag", &PlayerWrapper::AddProfileFlag, "adds a profile flag to the existing :class:`.PROFILE_FLAGS`") + .def("removeProfileFlag", &PlayerWrapper::RemoveProfileFlag, "remove profile flag from existing :class:`.PROFILE_FLAGS`") + .def("clearProfileFlags", &PlayerWrapper::ClearProfileFlags, "clears all :class:`.PROFILE_FLAGS`") .add_property("profession_tag", &PlayerWrapper::GetProfessionTag, &PlayerWrapper::SetProfessionTag, "Gets and Sets the profession tag") .add_property("born_date", &PlayerWrapper::GetBornDate, &PlayerWrapper::SetBornDate, "Gets and Sets the born date") .add_property("play_time", &PlayerWrapper::GetTotalPlayTime, &PlayerWrapper::SetTotalPlayTime, "Gets and Sets Total Play Time") .add_property("admin_flag", &PlayerWrapper::GetAdminTag, &PlayerWrapper::SetAdminTag, "Gets and Sets the admin tag of the player") - .def("add_xp", &PlayerWrapper::AddExperience, "adds experience via :class:`.XpData`") - .def("deduct_xp", &PlayerWrapper::DeductXp, "deducts experience via :class:`.XpData`") - .def("clear_xp", &PlayerWrapper::ClearXpType, "clears all experience of the type given") - .def("clear_all_xp", &PlayerWrapper::ClearAllXp, "clears all experience of all types") - .def("add_waypoint", &PlayerWrapper::AddWaypoint, "adds a :class:`.Waypoint` to the player") - .def("remove_waypoint", &PlayerWrapper::RemoveWaypoint, "removes a :class:`.Waypoint` from the player") - .def("modify_waypoint", &PlayerWrapper::ModifyWaypoint, "modifys an existing :class:`.Waypoint`") - .def("clear_all_waypoints", &PlayerWrapper::ClearAllWaypoints, "clears all :class:`.Waypoint`") - .add_property("force_power", &PlayerWrapper::GetCurrentForcePower, &PlayerWrapper::SetCurrentForcePower, "Gets and Sets the current force power") - .def("add_force_power", &PlayerWrapper::IncrementForcePower, "increments the current force power by x amount") - .add_property("max_force_power", &PlayerWrapper::GetMaxForcePower, &PlayerWrapper::SetMaxForcePower, "Gets and set the max force power") - .def("get_current_fs_quests", &PlayerWrapper::GetCurrentForceSensitiveQuests, "Gets the players current force sensitive quests in crc form") - .def("add_fs_quest", &PlayerWrapper::AddCurrentForceSensitiveQuest, "Adds a fs quest to the players current force sensitive quests") - .def("clear_fs_quests", &PlayerWrapper::ClearCurrentForceSensitiveQuests, "Clear current force sensitive quests") - .def("get_completed_fs_quests", &PlayerWrapper::GetCompletedForceSensitiveQuests, "Gets the players completed force sensitive quests in crc form") - .def("complete_fs_quest", &PlayerWrapper::AddCompletedForceSensitiveQuest, "Adds a fs quest to the players completed force sensitive quests") - .def("clear_completed_fs_quests", &PlayerWrapper::ClearCompletedForceSensitiveQuests, "Clear completed force sensitive quests") - .def("add_quest", &PlayerWrapper::AddQuest, "Adds a quest to the players :class:`.QuestJournal`") - .def("remove_quest", &PlayerWrapper::RemoveQuest, "Removes quest from the players :class:`.QuestJournal`") - .def("update_quest", &PlayerWrapper::UpdateQuest, "Updates an existing quest in the players :class:`.QuestJournal`") - .def("clear_quests", &PlayerWrapper::ClearAllQuests, "Clears all quests from a players :class:`.QuestJournal`") + .def("addXp", &PlayerWrapper::AddExperience, "adds experience via :class:`.XpData`") + .def("deductXp", &PlayerWrapper::DeductXp, "deducts experience via :class:`.XpData`") + .def("clearXp", &PlayerWrapper::ClearXpType, "clears all experience of the type given") + .def("clearAllXp", &PlayerWrapper::ClearAllXp, "clears all experience of all types") + .def("addWaypoint", &PlayerWrapper::AddWaypoint, "adds a :class:`.Waypoint` to the player") + .def("removeWaypoint", &PlayerWrapper::RemoveWaypoint, "removes a :class:`.Waypoint` from the player") + .def("modifyWaypoint", &PlayerWrapper::ModifyWaypoint, "modifys an existing :class:`.Waypoint`") + .def("clearAllWaypoints", &PlayerWrapper::ClearAllWaypoints, "clears all :class:`.Waypoint`") + .add_property("forcePower", &PlayerWrapper::GetCurrentForcePower, &PlayerWrapper::SetCurrentForcePower, "Gets and Sets the current force power") + .def("addForcePower", &PlayerWrapper::IncrementForcePower, "increments the current force power by x amount") + .add_property("maxForcePower", &PlayerWrapper::GetMaxForcePower, &PlayerWrapper::SetMaxForcePower, "Gets and set the max force power") + .def("getCurrentFsQuests", &PlayerWrapper::GetCurrentForceSensitiveQuests, "Gets the players current force sensitive quests in crc form") + .def("addFsQuest", &PlayerWrapper::AddCurrentForceSensitiveQuest, "Adds a fs quest to the players current force sensitive quests") + .def("clearFsQuests", &PlayerWrapper::ClearCurrentForceSensitiveQuests, "Clear current force sensitive quests") + .def("getCompletedFsQuests", &PlayerWrapper::GetCompletedForceSensitiveQuests, "Gets the players completed force sensitive quests in crc form") + .def("completeFsQuest", &PlayerWrapper::AddCompletedForceSensitiveQuest, "Adds a fs quest to the players completed force sensitive quests") + .def("clearCompletedFsQuests", &PlayerWrapper::ClearCompletedForceSensitiveQuests, "Clear completed force sensitive quests") + .def("addQuest", &PlayerWrapper::AddQuest, "Adds a quest to the players :class:`.QuestJournal`") + .def("removeQuest", &PlayerWrapper::RemoveQuest, "Removes quest from the players :class:`.QuestJournal`") + .def("updateQuest", &PlayerWrapper::UpdateQuest, "Updates an existing quest in the players :class:`.QuestJournal`") + .def("clearQuests", &PlayerWrapper::ClearAllQuests, "Clears all quests from a players :class:`.QuestJournal`") /*.def("add_ability", &PlayerWrapper::AddAbility, "Adds an ability to the player") .def("remove_ability", &PlayerWrapper::RemoveAbility, "Removes an ability from the player") .def("clear_abilities", &PlayerWrapper::ClearAllAbilities, "Clears all abilities from the player")*/ .add_property("experimentation_flag", &PlayerWrapper::GetExperimentationFlag, &PlayerWrapper::SetExperimentationFlag, "Gets and Sets the player experimentation flag") .add_property("crafting_stage", &PlayerWrapper::GetCraftingStage, &PlayerWrapper::SetCraftingStage, "Gets and Sets the players current crafting stage") .add_property("nearest_crafting_station", &PlayerWrapper::GetNearestCraftingStation, &PlayerWrapper::SetNearestCraftingStation, "Gets and Sets the nearest crafting station for the player") - .def("add_draft_schematic", &PlayerWrapper::AddDraftSchematic, "Adds a :class:`.DraftSchematicData` to the player") - .def("remove_draft_schematic", &PlayerWrapper::RemoveDraftSchematic, "Removes a :class:`.DraftSchematicData` from the player") - .def("clear_draft_schematics", &PlayerWrapper::ClearDraftSchematics, "Clears all :class:`.DraftSchematicData` from player") + .def("addDraftSchematic", &PlayerWrapper::AddDraftSchematic, "Adds a :class:`.DraftSchematicData` to the player") + .def("removeDraftSchematic", &PlayerWrapper::RemoveDraftSchematic, "Removes a :class:`.DraftSchematicData` from the player") + .def("clearDraftSchematics", &PlayerWrapper::ClearDraftSchematics, "Clears all :class:`.DraftSchematicData` from player") .add_property("experimentation_points", &PlayerWrapper::GetExperimentationPoints, &PlayerWrapper::ResetExperimentationPoints, "Gets and Resets the experimentation points of the player") - .def("add_experimentation_points", &PlayerWrapper::AddExperimentationPoints, "Adds experimentations points to the player") - .def("remove_experimentation_points", &PlayerWrapper::RemoveExperimentationPoints, "Removes experimentation points from the player") - .def("increment_accomplishments", &PlayerWrapper::IncrementAccomplishmentCounter, "increments the accomplishment counter of the player") + .def("addExperimentationPoints", &PlayerWrapper::AddExperimentationPoints, "Adds experimentations points to the player") + .def("removeExperimentationPoints", &PlayerWrapper::RemoveExperimentationPoints, "Removes experimentation points from the player") + .def("incrementAccomplishments", &PlayerWrapper::IncrementAccomplishmentCounter, "increments the accomplishment counter of the player") .add_property("accomplishment_counter", &PlayerWrapper::GetAccomplishmentCounter, &PlayerWrapper::ResetAccomplishmentCounter, "Gets and Resets the accomplishment counter of the player") - .def("add_friend", &PlayerWrapper::AddFriend, "Adds a friend to the players friends list") - .def("remove_friend", &PlayerWrapper::RemoveFriend, "Removes a friend from the players friends list") - .def("clear_friends", &PlayerWrapper::ClearFriends, "Clears all friends from the players friends list") - .def("is_friend", &PlayerWrapper::IsFriend, "Checks to see if the name is currently a friend of the player") - .def("is_ignored", &PlayerWrapper::IsIgnored, "Checks to see if the name is currently being ignored by the player") - .def("ignore_player", &PlayerWrapper::IgnorePlayer, "Adds a player to the ignore list") - .def("remove_ignore", &PlayerWrapper::StopIgnoringPlayer, "Stops ignoring a player, removes them from the ignore list") - .def("clear_ignore_players", &PlayerWrapper::ClearIgnored, "Clears the ignore player list") + .def("addFriend", &PlayerWrapper::AddFriend, "Adds a friend to the players friends list") + .def("removeFriend", &PlayerWrapper::RemoveFriend, "Removes a friend from the players friends list") + .def("clearFriends", &PlayerWrapper::ClearFriends, "Clears all friends from the players friends list") + .def("isFriend", &PlayerWrapper::IsFriend, "Checks to see if the name is currently a friend of the player") + .def("isIgnored", &PlayerWrapper::IsIgnored, "Checks to see if the name is currently being ignored by the player") + .def("ignorePlayer", &PlayerWrapper::IgnorePlayer, "Adds a player to the ignore list") + .def("removeIgnore", &PlayerWrapper::StopIgnoringPlayer, "Stops ignoring a player, removes them from the ignore list") + .def("clearIgnorePlayers", &PlayerWrapper::ClearIgnored, "Clears the ignore player list") .add_property("language", &PlayerWrapper::GetLanguage, &PlayerWrapper::SetLanguage, "Gets and Sets the players spoken language") .add_property("stomach", &PlayerWrapper::GetCurrentStomach, &PlayerWrapper::ResetCurrentStomach, "Gets and resets the players stomach level") - .def("increase_stomach", &PlayerWrapper::IncreaseCurrentStomach, "adds to the players current stomach level") - .def("decrease_stomach", &PlayerWrapper::DecreaseCurrentStomach, "decreases from the players current stomach level") + .def("increaseStomach", &PlayerWrapper::IncreaseCurrentStomach, "adds to the players current stomach level") + .def("decreaseStomach", &PlayerWrapper::DecreaseCurrentStomach, "decreases from the players current stomach level") .add_property("max_stomach", &PlayerWrapper::GetMaxStomach, &PlayerWrapper::ResetMaxStomach, "Gets and resets the players MAX stomach level") .add_property("drink", &PlayerWrapper::GetCurrentDrink, &PlayerWrapper::ResetCurrentDrink, "Gets and resets the players drink level") - .def("increase_drink", &PlayerWrapper::IncreaseCurrentDrink, "adds to the players current drink level") - .def("decrease_drink", &PlayerWrapper::DecreaseCurrentDrink, "decreases from the players current drink level") + .def("increaseDrink", &PlayerWrapper::IncreaseCurrentDrink, "adds to the players current drink level") + .def("decreaseDrink", &PlayerWrapper::DecreaseCurrentDrink, "decreases from the players current drink level") .add_property("max_drink", &PlayerWrapper::GetMaxDrink, &PlayerWrapper::ResetMaxDrink, "Gets and resets the players MAX drink level") .add_property("jedi_state", &PlayerWrapper::GetJediState, &PlayerWrapper::SetJediState, "Gets and set the jedi state") .add_property("gender", &PlayerWrapper::GetGender, &PlayerWrapper::SetGender, "Gets and Sets the players :class:`.GENDER` ") diff --git a/src/swganh/object/tangible/tangible_binding.h b/src/swganh/object/tangible/tangible_binding.h index 4f14bd844..6d5822593 100644 --- a/src/swganh/object/tangible/tangible_binding.h +++ b/src/swganh/object/tangible/tangible_binding.h @@ -18,26 +18,26 @@ void exportTangible() class_, std::shared_ptr, boost::noncopyable>("Tangible") .add_property("customization", &Tangible::GetCustomization, &Tangible::SetCustomization, "Gets and Sets the tangible customization") //.def("customization.__add__", &Tangible::AddCustomization, "Adds a string to the existing customization") - .def("component_customization", &Tangible::GetComponentCustomization, "Gets the current component_customization") - .def("add_component_customization", &Tangible::AddComponentCustomization, "Adds a string to the component_customization") - .def("remove_component_customization", &Tangible::RemoveComponentCustomization, "Removes the specified component_customization") + .def("componentCustomization", &Tangible::GetComponentCustomization, "Gets the current component_customization") + .def("addComponentCustomization", &Tangible::AddComponentCustomization, "Adds a string to the component_customization") + .def("removeComponentCustomization", &Tangible::RemoveComponentCustomization, "Removes the specified component_customization") //.def("component_customization.__add__", &Tangible::AddComponentCustomization, "Adds a crc to the component customization list") //.def("component_customization.__sub__", &Tangible::RemoveComponentCustomization, "Removes crc from the component customization list") - .def("clear_component_customization", &Tangible::ClearComponentCustomization, "Clears all crc's from the component customization list") + .def("clearComponentCustomization", &Tangible::ClearComponentCustomization, "Clears all crc's from the component customization list") .add_property("options_mask", &Tangible::GetOptionsMask, &Tangible::SetOptionsMask, "Gets and Sets the options mask") - .def("toggle_option", &Tangible::ToggleOption, "Toggles the specified option") + .def("toggleOption", &Tangible::ToggleOption, "Toggles the specified option") .add_property("incap_timer", &Tangible::GetIncapTimer, &Tangible::SetIncapTimer, "Gets and Sets the incapacitation timer of the tangible object") .add_property("condition_damage", &Tangible::GetCondition, &Tangible::SetConditionDamage, "Gets and Sets the current condition of the tangible") .add_property("max_condition", &Tangible::GetMaxCondition, &Tangible::SetMaxCondition, "Gets and Sets the max condition of the tangible") .add_property("static", &Tangible::IsStatic, &Tangible::SetStatic, "Gets and Sets the static property") - .def("add_defender", &Tangible::AddDefender, "Adds a defender to the list") - .def("remove_defender", &Tangible::RemoveDefender, "Removes a defender from the list") + .def("addDefender", &Tangible::AddDefender, "Adds a defender to the list") + .def("removeDefender", &Tangible::RemoveDefender, "Removes a defender from the list") .def("defended", &Tangible::IsDefending, "Checks if the object is being defended") - .def("reset_defenders", &Tangible::ResetDefenders, "Resets the defenders to the specified tangible") - .def("clear_defenders", &Tangible::ClearDefenders, "Clears all defenders from the tangible object") - .def("activate_auto_attack", &Tangible::ActivateAutoAttack, "Activates auto attack for the tangible object") - .def("clear_auto_attack", &Tangible::ClearAutoAttack, "Clears the auto attack flag") - .def("is_auto_attacking", &Tangible::IsAutoAttacking, "returns true if currently auto attacking") + .def("resetDefenders", &Tangible::ResetDefenders, "Resets the defenders to the specified tangible") + .def("clearDefenders", &Tangible::ClearDefenders, "Clears all defenders from the tangible object") + .def("activateAutoAttack", &Tangible::ActivateAutoAttack, "Activates auto attack for the tangible object") + .def("clearAutoAttack", &Tangible::ClearAutoAttack, "Clears the auto attack flag") + .def("isAutoAttacking", &Tangible::IsAutoAttacking, "returns true if currently auto attacking") ; implicitly_convertible, std::shared_ptr>(); diff --git a/src/swganh/simulation/simulation_service_binding.h b/src/swganh/simulation/simulation_service_binding.h index 0497afa45..5298a05d7 100644 --- a/src/swganh/simulation/simulation_service_binding.h +++ b/src/swganh/simulation/simulation_service_binding.h @@ -34,13 +34,13 @@ void exportSimulationService() typedef void (SimulationServiceInterface::*TransferObjectToSceneObjectAndPositionBinding)(shared_ptr, const std::string&, float, float, float); enum_("ContainerPermission") - .value("Default", DEFAULT_PERMISSION) - .value("World", WORLD_PERMISSION) - .value("StaticContainer", STATIC_CONTAINER_PERMISSION) - .value("WorldCell", WORLD_CELL_PERMISSION) - .value("Creature", CREATURE_PERMISSION) - .value("CreatureContainer", CREATURE_CONTAINER_PERMISSION) - .value("Rideable", RIDEABLE_PERMISSION); + .value("DEFAULT", DEFAULT_PERMISSION) + .value("WORLD", WORLD_PERMISSION) + .value("STATIC_CONTAINER", STATIC_CONTAINER_PERMISSION) + .value("WORLD_CELL", WORLD_CELL_PERMISSION) + .value("CREATURE", CREATURE_PERMISSION) + .value("CREATURE_CONTAINER", CREATURE_CONTAINER_PERMISSION) + .value("RIDEABLE", RIDEABLE_PERMISSION); class_, boost::noncopyable>("SimulationService", "The simulation service handles the current scenes aka planets", no_init) .def("persist", &SimulationServiceInterface::PersistObject, "persists the specified object and it's containing objects") diff --git a/src/swganh/social/social_service_binding.h b/src/swganh/social/social_service_binding.h index f675027b6..059eab0ae 100644 --- a/src/swganh/social/social_service_binding.h +++ b/src/swganh/social/social_service_binding.h @@ -18,7 +18,7 @@ using namespace std; void exportSocialService() { class_, boost::noncopyable>("SocialService", "The social service handles services that involve social actions", no_init) - .def("add_friend", &SocialServiceInterface::AddFriend, "Checks the database to see if the character name exists and then adds the friend to the player") - .def("add_ignore", &SocialServiceInterface::AddIgnore, "Checks the database to see if the character name exists and then adds to the ignore list") + .def("addFriend", &SocialServiceInterface::AddFriend, "Checks the database to see if the character name exists and then adds the friend to the player") + .def("addIgnore", &SocialServiceInterface::AddIgnore, "Checks the database to see if the character name exists and then adds to the ignore list") ; } diff --git a/src/swganh/sui/sui_service_binding.h b/src/swganh/sui/sui_service_binding.h index db7d62c68..5bff56273 100644 --- a/src/swganh/sui/sui_service_binding.h +++ b/src/swganh/sui/sui_service_binding.h @@ -105,48 +105,48 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(CreateInputOverload, CreateInputBox, 5, 7 void exportSuiService() { bp::enum_("InputTrigger") - .value("update", InputTrigger::TRIGGER_UPDATE) - .value("ok", InputTrigger::TRIGGER_OK) - .value("cancel", InputTrigger::TRIGGER_CANCEL); + .value("UPDATE", InputTrigger::TRIGGER_UPDATE) + .value("OK", InputTrigger::TRIGGER_OK) + .value("CANCEL", InputTrigger::TRIGGER_CANCEL); bp::enum_("MessageBoxType") - .value("ok", MessageBoxType::MESSAGE_BOX_OK) - .value("okcancel", MessageBoxType::MESSAGE_BOX_OK_CANCEL) - .value("yesno", MessageBoxType::MESSAGE_BOX_YES_NO); + .value("OK", MessageBoxType::MESSAGE_BOX_OK) + .value("OK_CANCEL", MessageBoxType::MESSAGE_BOX_OK_CANCEL) + .value("YES_NO", MessageBoxType::MESSAGE_BOX_YES_NO); bp::enum_("InputBoxType") - .value("ok", InputBoxType::INPUT_BOX_OK) - .value("okcancel", InputBoxType::INPUT_BOX_OKCANCEL); + .value("OK", InputBoxType::INPUT_BOX_OK) + .value("OK_CANCEL", InputBoxType::INPUT_BOX_OKCANCEL); bp::enum_("ListBoxType") - .value("ok", ListBoxType::LIST_BOX_OK) - .value("okcancel", ListBoxType::LIST_BOX_OKCANCEL); + .value("OK", ListBoxType::LIST_BOX_OK) + .value("OK_CANCEL", ListBoxType::LIST_BOX_OKCANCEL); bp::class_, boost::noncopyable>("SUIWindow", "A SUI window class.", bp::no_init) - .def("ClearDataSource", &SUIWindowInterface::ClearDataSource, "Instructs the client to clear a data source. Takes a location string (ie. FullPath:Name), and a new value") - .def("SetProperty", &SUIWindowInterface::SetProperty, "Instructs the client to set a particular ui property. Takes a location string (ie. FullPath:Name), and a new value") - .def("AddProperty", &SUIWindowInterface::AddProperty, "Instructs the client to add a particular ui property. Takes a location string (ie. FullPath:Name), and a new value") - .def("SubscribeToEventCallback", SubcribeWrapper, "Subscribes the SUI system to a particular client ui event. This can be used to return values of properties when the client clicks a button or exits a window.") - .def("AddDataSourceContainer", &SUIWindowInterface::AddDataSourceContainer, "Adds a data source container to the UI.") - .def("ClearComponents", &SUIWindowInterface::ClearComponents, "Clears the components of this UI. This is typically for internal use only.") - .def("GetOwner", &SUIWindowInterface::GetOwner, "Returns the owner of this window.") - .def("GetRangedObject", &SUIWindowInterface::GetRangedObject, "Returns the ranged object this window is attached to.") - .def("SetRangedObject", &SUIWindowInterface::SetRangedObject, "Sets the ranged object for this window.") - .def("GetMaxDistance", &SUIWindowInterface::GetMaxDistance, "Returns the distance from the ranged object at which to automatically destroy this window.") - .def("SetMaxDistance", &SUIWindowInterface::SetMaxDistance, "Sets the distance from the ranged object at which to automatically destroy this window.") - .def("GetWindowId", &SUIWindowInterface::GetWindowId, "Returns this window's unique id."); + .def("clearDataSource", &SUIWindowInterface::ClearDataSource, "Instructs the client to clear a data source. Takes a location string (ie. FullPath:Name), and a new value") + .def("setProperty", &SUIWindowInterface::SetProperty, "Instructs the client to set a particular ui property. Takes a location string (ie. FullPath:Name), and a new value") + .def("addProperty", &SUIWindowInterface::AddProperty, "Instructs the client to add a particular ui property. Takes a location string (ie. FullPath:Name), and a new value") + .def("subscribeToEventCallback", SubcribeWrapper, "Subscribes the SUI system to a particular client ui event. This can be used to return values of properties when the client clicks a button or exits a window.") + .def("addDataSourceContainer", &SUIWindowInterface::AddDataSourceContainer, "Adds a data source container to the UI.") + .def("clearComponents", &SUIWindowInterface::ClearComponents, "Clears the components of this UI. This is typically for internal use only.") + .def("getOwner", &SUIWindowInterface::GetOwner, "Returns the owner of this window.") + .def("getRangedObject", &SUIWindowInterface::GetRangedObject, "Returns the ranged object this window is attached to.") + .def("setRangedObject", &SUIWindowInterface::SetRangedObject, "Sets the ranged object for this window.") + .def("getMaxDistance", &SUIWindowInterface::GetMaxDistance, "Returns the distance from the ranged object at which to automatically destroy this window.") + .def("setMaxDistance", &SUIWindowInterface::SetMaxDistance, "Sets the distance from the ranged object at which to automatically destroy this window.") + .def("getWindowId", &SUIWindowInterface::GetWindowId, "Returns this window's unique id."); bp::class_, boost::noncopyable>("SUIService", "The SUI service can be used to display custom interfaces on connected clients. It is used for several core game systems.", bp::no_init) - .def("CreateSUIWindow", &SUIServiceInterface::CreateSUIWindow, CreateOverload(bp::args("script_name", "owner", "ranged_object", "max_distance"), "Creates a new SUIWindow.")) - .def("CreateMessageBox", &SUIServiceInterface::CreateMessageBox, CreateMessageOverload(bp::args("msgBox_type", "title", "caption", "owner", "ranged_object", "max_distance"),"Creates a SUIWindow and fills in properties for a basic message box.")) - .def("CreateListBox", CreateListBoxWrapper, ListBoxOverloads(bp::args("self", "lstBox_type", "title", "prompt", "dataList", "owner", "ranged_object", "range"),"Creates a SUIWindow and fills in properties for a basic list box.")) - .def("CreateInputBox", &SUIServiceInterface::CreateInputBox, CreateInputOverload(bp::args("iptBox_type", "title", "caption", "max_input_length", "owner", "ranged_object", "max_distance"), "Creates a SUIWindow and fills in properties for a basic input box.")) + .def("createSUIWindow", &SUIServiceInterface::CreateSUIWindow, CreateOverload(bp::args("script_name", "owner", "ranged_object", "max_distance"), "Creates a new SUIWindow.")) + .def("createMessageBox", &SUIServiceInterface::CreateMessageBox, CreateMessageOverload(bp::args("msgBox_type", "title", "caption", "owner", "ranged_object", "max_distance"),"Creates a SUIWindow and fills in properties for a basic message box.")) + .def("createListBox", CreateListBoxWrapper, ListBoxOverloads(bp::args("self", "lstBox_type", "title", "prompt", "dataList", "owner", "ranged_object", "range"),"Creates a SUIWindow and fills in properties for a basic list box.")) + .def("createInputBox", &SUIServiceInterface::CreateInputBox, CreateInputOverload(bp::args("iptBox_type", "title", "caption", "max_input_length", "owner", "ranged_object", "max_distance"), "Creates a SUIWindow and fills in properties for a basic input box.")) - .def("OpenSUIWindow", &SUIServiceInterface::OpenSUIWindow, "Creates the given window for the window's current owner.") - .def("UpdateSUIWindow", &SUIServiceInterface::UpdateSUIWindow, "Updates the given window for the window's current owner.") - .def("GetSUIWindowById", &SUIServiceInterface::GetSUIWindowById, "Gets the SUI window associated with the given id from the given owner.") - .def("CloseSUIWindow", &SUIServiceInterface::CloseSUIWindow, "Forcefully closes the SUI window with the given id for the given owner"); + .def("openSUIWindow", &SUIServiceInterface::OpenSUIWindow, "Creates the given window for the window's current owner.") + .def("updateSUIWindow", &SUIServiceInterface::UpdateSUIWindow, "Updates the given window for the window's current owner.") + .def("getSUIWindowById", &SUIServiceInterface::GetSUIWindowById, "Gets the SUI window associated with the given id from the given owner.") + .def("closeSUIWindow", &SUIServiceInterface::CloseSUIWindow, "Forcefully closes the SUI window with the given id for the given owner"); bp::class_>("ResultList", "list for results of a SUI window") .def(bp::vector_indexing_suite, true>()); diff --git a/src/swganh/terrain/terrain_service_binding.h b/src/swganh/terrain/terrain_service_binding.h index 5dfbb8307..3553abd24 100644 --- a/src/swganh/terrain/terrain_service_binding.h +++ b/src/swganh/terrain/terrain_service_binding.h @@ -39,7 +39,7 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(IsWaterOverload, IsWater, 3, 4) void exportTerrainService() { class_, boost::noncopyable>("TerrainService", "The terrain service allows fetching of terrain height and water at x z coordinates.", no_init) - .def("GetHeight", &TerrainServiceInterface::GetHeight, GetHeightOverload(args("scene_id", "x", "z", "raw"), "Returns the height of a particular x, z coordinate")) - .def("GetWaterHeight", &TerrainServiceInterface::GetWaterHeight, GetWaterHeightOverload(args("scene_id", "x", "z", "raw"), "Returns the water height at a particular x, z coordinate. This is probably not necessary for external code.")) - .def("IsWater", &TerrainServiceInterface::IsWater, IsWaterOverload(args("scene_id", "x", "z", "raw"), "Returns true iff the x, z is water.")); + .def("getHeight", &TerrainServiceInterface::GetHeight, GetHeightOverload(args("scene_id", "x", "z", "raw"), "Returns the height of a particular x, z coordinate")) + .def("getWaterHeight", &TerrainServiceInterface::GetWaterHeight, GetWaterHeightOverload(args("scene_id", "x", "z", "raw"), "Returns the water height at a particular x, z coordinate. This is probably not necessary for external code.")) + .def("isWater", &TerrainServiceInterface::IsWater, IsWaterOverload(args("scene_id", "x", "z", "raw"), "Returns true iff the x, z is water.")); } diff --git a/src/swganh/weather/weather_service_binding.h b/src/swganh/weather/weather_service_binding.h index 50e8c4e6b..ef3cfb6cf 100644 --- a/src/swganh/weather/weather_service_binding.h +++ b/src/swganh/weather/weather_service_binding.h @@ -44,15 +44,15 @@ void exportSocialService() ; class_, boost::noncopyable>("WeatherService", "The weather service processes in-game weather features.", no_init) - .def("get_scene_weather", &WeatherServiceInterface::GetSceneWeather, "Returns the current weather ID from a specified scene.") - .def("set_scene_weather", &WeatherServiceInterface::SetSceneWeather, "Sets the weather ID on a specified scene and broadcasts a ServerWeatherMessage to all players on that scene.") + .def("getSceneWeather", &WeatherServiceInterface::GetSceneWeather, "Returns the current weather ID from a specified scene.") + .def("setSceneWeather", &WeatherServiceInterface::SetSceneWeather, "Sets the weather ID on a specified scene and broadcasts a ServerWeatherMessage to all players on that scene.") ; - class_ >("weather_sequence", "A vector for WeatherEvent objects which contain duration, weather type, and cloud vector.") + class_ >("WeatherSequence", "A vector for WeatherEvent objects which contain duration, weather type, and cloud vector.") .def(vector_indexing_suite, true>()) ; - class_("weather_event", "Contains the duration, weather type, and cloud vector for a weaather event.", init()) + class_("WeatherEvent", "Contains the duration, weather type, and cloud vector for a weaather event.", init()) .def("getDuration", &WeatherEvent::GetDuration, "Gets the duration.") .def("setDuration", &WeatherEvent::SetDuration, "Sets the duration.") .def("getWeatherType", &WeatherEvent::GetWeatherType, "Gets the weather type.") @@ -60,8 +60,8 @@ void exportSocialService() .def("getCloudVector", &WeatherEvent::GetCloudVector, "Gets the cloud vector.") .def("setCloudVector", &WeatherEvent::SetCloudVector, "Sets the cloud vector.") .add_property("duration", &WeatherEvent::GetDuration, &WeatherEvent::SetDuration, "Gets and sets the duration.") - .add_property("weather_type", &WeatherEvent::GetWeatherType, &WeatherEvent::SetWeatherType, "Gets and sets the weather type.") - .add_property("cloud_vector", &WeatherEvent::GetCloudVector, &WeatherEvent::SetCloudVector, "Gets and sets the cloud vector.") + .add_property("weatherType", &WeatherEvent::GetWeatherType, &WeatherEvent::SetWeatherType, "Gets and sets the weather type.") + .add_property("cloudVector", &WeatherEvent::GetCloudVector, &WeatherEvent::SetCloudVector, "Gets and sets the cloud vector.") ; } diff --git a/src/swganh_core/attributes/armor_attribute_template.h b/src/swganh_core/attributes/armor_attribute_template.h index 5dc63e3a1..6daac0716 100644 --- a/src/swganh_core/attributes/armor_attribute_template.h +++ b/src/swganh_core/attributes/armor_attribute_template.h @@ -8,10 +8,25 @@ namespace swganh { namespace attributes { + + /*! + * The attribute template for armor related items. + */ class ArmorAttributeTemplate : public BaseAttributeTemplate { public: + + /*! + * Creates a the armor attribute template + * @param dispatcher the dispatcher to associate this template with + */ ArmorAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/attributes_get_batch_command.cc b/src/swganh_core/attributes/attributes_get_batch_command.cc index 8cb065a98..0b0c00815 100644 --- a/src/swganh_core/attributes/attributes_get_batch_command.cc +++ b/src/swganh_core/attributes/attributes_get_batch_command.cc @@ -51,7 +51,7 @@ boost::optional> GetAttributesBatchCommand::Run auto found = simulation_service_->GetObjectById(boost::lexical_cast(object)); if (found) { - attributes_service_->HandleGetAttributesBatch(found, actor); + attributes_service_->SendAttributesMessage(found, actor); } } diff --git a/src/swganh_core/attributes/attributes_get_batch_command.h b/src/swganh_core/attributes/attributes_get_batch_command.h index fc6fbbe3f..5a9191ce7 100644 --- a/src/swganh_core/attributes/attributes_get_batch_command.h +++ b/src/swganh_core/attributes/attributes_get_batch_command.h @@ -16,15 +16,31 @@ namespace attributes { class AttributesService; + /*! + * An implementation of a base swg command handler + * that handles the GetAttributesBatch message. + */ class GetAttributesBatchCommand : public swganh::command::BaseSwgCommand { public: + + /*! + * Creates a new instance using the kernel + * and the given properties + */ GetAttributesBatchCommand( swganh::app::SwganhKernel* kernel, const swganh::command::CommandProperties& properties); + /*! + * Custom Destructor + */ virtual ~GetAttributesBatchCommand(); + /*! + * Method that is called when the command is processed. + * @Override + */ virtual boost::optional> Run(); private: diff --git a/src/swganh_core/attributes/attributes_helper.h b/src/swganh_core/attributes/attributes_helper.h index 5f35f5bee..9f2af570d 100644 --- a/src/swganh_core/attributes/attributes_helper.h +++ b/src/swganh_core/attributes/attributes_helper.h @@ -18,6 +18,16 @@ namespace attributes { class AttributesHelper { public: + + /*! + * Adds the attribute to the given attributes list + * iff it exists in the object. + * @param attributes the attribute list to add to + * @param attribute_label the label of the attribute + * @param the name of the attribute to add + * @param the object to check + * @param recursive true iff the attribute should be populated recursively + */ static void SetOptionalAttribute( std::vector& attributes, const std::string& attribute_label, diff --git a/src/swganh_core/attributes/attributes_service.cc b/src/swganh_core/attributes/attributes_service.cc index 67440b5bb..779a65a1f 100644 --- a/src/swganh_core/attributes/attributes_service.cc +++ b/src/swganh_core/attributes/attributes_service.cc @@ -76,11 +76,6 @@ void AttributesService::Startup() LoadAttributeTemplates_(); } -AttributesService::~AttributesService() -{ - attribute_templates_.clear(); -} - bool AttributesService::HasAttributeTemplate(AttributeTemplateId template_id) { auto found = find_if(begin(attribute_templates_), end(attribute_templates_), [&template_id](AttributeTemplates::value_type entry) @@ -138,9 +133,3 @@ void AttributesService::LoadAttributeTemplates_() SetAttributeTemplate(make_shared(kernel_->GetEventDispatcher()), WEAPON); SetAttributeTemplate(make_shared(kernel_->GetEventDispatcher()), WEARABLE); } - -void AttributesService::HandleGetAttributesBatch(const std::shared_ptr object, const std::shared_ptr actor) -{ - SendAttributesMessage(object, actor); -} - diff --git a/src/swganh_core/attributes/attributes_service.h b/src/swganh_core/attributes/attributes_service.h index 8de37fc90..f3bba52f3 100644 --- a/src/swganh_core/attributes/attributes_service.h +++ b/src/swganh_core/attributes/attributes_service.h @@ -37,20 +37,60 @@ namespace attributes { std::shared_ptr > AttributeTemplates; + /*! + * Service that pushes attribute listings to the clients + * when requested. + */ class AttributesService: public swganh::attributes::AttributesServiceInterface { public: + + /*! + * Creates a new instance + */ explicit AttributesService(swganh::app::SwganhKernel* kernel); - virtual ~AttributesService(); - swganh::service::ServiceDescription GetServiceDescription(); + + /*! + * Returns the service description for this service + */ + swganh::service::ServiceDescription GetServiceDescription(); + /*! + * @param template_id the attribute to fetch + * @return the attribute template associated with a particular id + */ std::shared_ptr GetAttributeTemplate(swganh::attributes::AttributeTemplateId template_id); - void SetAttributeTemplate(const std::shared_ptr template_, swganh::attributes::AttributeTemplateId template_id); + + /*! + * Adds an attribute to the lookup with the given id + * @param template_ the new template + * @param template_id_ the new template's id + */ + void SetAttributeTemplate(const std::shared_ptr template_, swganh::attributes::AttributeTemplateId template_id); + + /*! + * Returns true if the given template id is bound to a template + * @param template_id the id to check + */ bool HasAttributeTemplate(swganh::attributes::AttributeTemplateId template_id); - void SendAttributesMessage(const std::shared_ptr object, const std::shared_ptr actor); + + /*! + * Send the attributes list message for object to actor + * @param object the object to build the attribute list from + * @param actor the object to send the attribute list to + */ + void SendAttributesMessage(const std::shared_ptr object, const std::shared_ptr actor); + + /*! + * Method called on the service at start up. + */ void Startup(); - void HandleGetAttributesBatch(const std::shared_ptr object, const std::shared_ptr actor); + private: + + /*! + * Loads a static list of attribute templates + */ void LoadAttributeTemplates_(); AttributeTemplates attribute_templates_; diff --git a/src/swganh_core/attributes/base_attribute_template.h b/src/swganh_core/attributes/base_attribute_template.h index 5c8632dac..c033d7f05 100644 --- a/src/swganh_core/attributes/base_attribute_template.h +++ b/src/swganh_core/attributes/base_attribute_template.h @@ -9,17 +9,40 @@ namespace swganh { namespace attributes { - typedef std::map ObjectMapAttributeListMessages; + typedef std::map ObjectMapAttributeListMessages; + + /** + * This is the base implementation of the AttributeTemplateInterface. + */ class BaseAttributeTemplate : public swganh::attributes::AttributeTemplateInterface { public: + /* + * Create a new instance of this base template + * @param dispatcher the dispatcher to use for this attribute template. + */ BaseAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Registers event handlers required by this template + * @Override + */ virtual void RegisterEventHandlers(); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ virtual swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); + /** + * @param object_id the object_id to check + * @return true if the attribute list message for the given object_id is cached + * @Override + */ virtual bool HasAttributeListMessage(uint64_t object_id); + protected: ObjectMapAttributeListMessages object_attribute_list_messages_; }; diff --git a/src/swganh_core/attributes/crafting_tool_attribute_template.h b/src/swganh_core/attributes/crafting_tool_attribute_template.h index c57885940..522f0e6a0 100644 --- a/src/swganh_core/attributes/crafting_tool_attribute_template.h +++ b/src/swganh_core/attributes/crafting_tool_attribute_template.h @@ -6,10 +6,24 @@ namespace swganh { namespace attributes { + + /** + * Attributes template used for crafting tools + */ class CraftingToolAttributeTemplate : public BaseAttributeTemplate { public: + + /* + * Creates a new instance + */ CraftingToolAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/deed_attribute_template.h b/src/swganh_core/attributes/deed_attribute_template.h index 85cab11a0..bcd1ff62d 100644 --- a/src/swganh_core/attributes/deed_attribute_template.h +++ b/src/swganh_core/attributes/deed_attribute_template.h @@ -6,10 +6,23 @@ namespace swganh { namespace attributes { + + /** + * Attributes template used for deeds + */ class DeedAttributeTemplate : public BaseAttributeTemplate { public: + /** + * Creates a new instance + */ DeedAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; }} diff --git a/src/swganh_core/attributes/droid_attribute_template.h b/src/swganh_core/attributes/droid_attribute_template.h index 35eedf13b..0b8d0b794 100644 --- a/src/swganh_core/attributes/droid_attribute_template.h +++ b/src/swganh_core/attributes/droid_attribute_template.h @@ -6,10 +6,23 @@ namespace swganh { namespace attributes { + + /** + * The attributes template used for droids + */ class DroidAttributeTemplate : public BaseAttributeTemplate { public: + /** + * Creates a new instance + */ DroidAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/factory_crate_attribute_template.h b/src/swganh_core/attributes/factory_crate_attribute_template.h index fef7601cb..98cb468f3 100644 --- a/src/swganh_core/attributes/factory_crate_attribute_template.h +++ b/src/swganh_core/attributes/factory_crate_attribute_template.h @@ -6,10 +6,20 @@ namespace swganh { namespace attributes { + + /** + * The attribute template used for factory crates + */ class FactoryCrateAttributeTemplate : public BaseAttributeTemplate { public: - FactoryCrateAttributeTemplate(swganh::EventDispatcher* dispatcher); + FactoryCrateAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/food_attribute_template.h b/src/swganh_core/attributes/food_attribute_template.h index d9fdba3fe..0f8d0f335 100644 --- a/src/swganh_core/attributes/food_attribute_template.h +++ b/src/swganh_core/attributes/food_attribute_template.h @@ -6,10 +6,24 @@ namespace swganh { namespace attributes { + + /** + * The attribute template used for food objects + */ class FoodAttributeTemplate : public BaseAttributeTemplate { public: + + /** + * Creates a new instance + */ FoodAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/furniture_attribute_template.h b/src/swganh_core/attributes/furniture_attribute_template.h index 857bc71e8..d3810b4f2 100644 --- a/src/swganh_core/attributes/furniture_attribute_template.h +++ b/src/swganh_core/attributes/furniture_attribute_template.h @@ -7,10 +7,24 @@ namespace swganh { namespace attributes { + + /** + * The attribute template used for furniture + */ class FurnitureAttributeTemplate : public BaseAttributeTemplate { public: + + /** + * Creates a new instance + */ FurnitureAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/meds_attribute_template.h b/src/swganh_core/attributes/meds_attribute_template.h index cfcd9c1be..8eb057093 100644 --- a/src/swganh_core/attributes/meds_attribute_template.h +++ b/src/swganh_core/attributes/meds_attribute_template.h @@ -6,10 +6,24 @@ namespace swganh { namespace attributes { + + /** + * The attribute template used for meds + */ class MedsAttributeTemplate : public BaseAttributeTemplate { public: + + /** + * Creates new instance + */ MedsAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/ship_attribute_template.h b/src/swganh_core/attributes/ship_attribute_template.h index 38fa53d1a..04365be5e 100644 --- a/src/swganh_core/attributes/ship_attribute_template.h +++ b/src/swganh_core/attributes/ship_attribute_template.h @@ -6,10 +6,23 @@ namespace swganh { namespace attributes { + + /** + * The attribute template used for ships. + */ class ShipAttributeTemplate : public BaseAttributeTemplate { public: + /** + * Creates a new instance + */ ShipAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/weapon_attribute_template.h b/src/swganh_core/attributes/weapon_attribute_template.h index 0733f14f1..e8186b857 100644 --- a/src/swganh_core/attributes/weapon_attribute_template.h +++ b/src/swganh_core/attributes/weapon_attribute_template.h @@ -6,10 +6,24 @@ namespace swganh { namespace attributes { + + /** + * The attribute template used for weapons + */ class WeaponAttributeTemplate : public BaseAttributeTemplate { public: - WeaponAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Creates a new instance + */ + WeaponAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/attributes/wearable_attribute_template.h b/src/swganh_core/attributes/wearable_attribute_template.h index c54fe86f1..afd69bd12 100644 --- a/src/swganh_core/attributes/wearable_attribute_template.h +++ b/src/swganh_core/attributes/wearable_attribute_template.h @@ -6,10 +6,24 @@ namespace swganh { namespace attributes { + + /* + * The attribute template used for wearables. + */ class WearableAttributeTemplate : public BaseAttributeTemplate { public: - WearableAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Creates a new instance + */ + WearableAttributeTemplate(swganh::EventDispatcher* dispatcher); + + /** + * Builds an attribute list message using this template. + * @param object the object to buid the message for + * @Override + */ swganh::messages::AttributeListMessage BuildAttributeTemplate(std::shared_ptr object); }; diff --git a/src/swganh_core/character/character_service.cc b/src/swganh_core/character/character_service.cc index 42c633887..877f73455 100644 --- a/src/swganh_core/character/character_service.cc +++ b/src/swganh_core/character/character_service.cc @@ -54,8 +54,6 @@ CharacterService::CharacterService(SwganhKernel* kernel) character_provider_ = kernel->GetPluginManager()->CreateObject("Character::CharacterProvider"); } -CharacterService::~CharacterService() {} - service::ServiceDescription CharacterService::GetServiceDescription() { service::ServiceDescription service_description( "ANH Character Service", diff --git a/src/swganh_core/character/character_service.h b/src/swganh_core/character/character_service.h index 51f3564d4..d21eae61a 100644 --- a/src/swganh_core/character/character_service.h +++ b/src/swganh_core/character/character_service.h @@ -31,25 +31,51 @@ namespace character { }} namespace swganh { namespace character { - + +/** +* The character service is used to handle character creation, deletion and random +* name generation. +*/ class CharacterService : public swganh::character::CharacterServiceInterface { public: - explicit CharacterService(swganh::app::SwganhKernel* kernel); - ~CharacterService(); + + /** + * Creates a new instance + */ + explicit CharacterService(swganh::app::SwganhKernel* kernel); + /** + * @return the service description for this service + */ swganh::service::ServiceDescription GetServiceDescription(); + /** + * Called on startup of the server + */ void Startup(); private: + + /** + * Message handler for Random name requests. + * This will reply with a RandomNameResponse + */ void HandleClientRandomNameRequest_( const std::shared_ptr& client, swganh::messages::ClientRandomNameRequest* message); + /** + * Message handler for ClientCreateCharacter. + * This will respond with a CharacterCreateSuccess or CreateCharacterFailed + */ void HandleClientCreateCharacter_( const std::shared_ptr& client, swganh::messages::ClientCreateCharacter* message); + /** + * Message handler for character deletion. + * This will reply with DeleteCharacterReplyMessage + */ void HandleDeleteCharacterMessage_( const std::shared_ptr& login_client, swganh::messages::DeleteCharacterMessage* message); diff --git a/src/swganh_core/character/mysql_character_provider.cc b/src/swganh_core/character/mysql_character_provider.cc index d766a9e39..f4a3e3cd1 100644 --- a/src/swganh_core/character/mysql_character_provider.cc +++ b/src/swganh_core/character/mysql_character_provider.cc @@ -271,7 +271,7 @@ tuple MysqlCharacterProvider::CreateCharacter(const ClientCrea { // if we get a special character_id back it means there was an error. /// @TODO Change this to return a separate output value for the error code - return make_tuple(0, setCharacterCreateErrorCode_(static_cast(char_id))); + return make_tuple(0, getCharacterCreateErrorCode_(static_cast(char_id))); } return make_tuple(char_id, ""); } @@ -285,7 +285,7 @@ tuple MysqlCharacterProvider::CreateCharacter(const ClientCrea return make_tuple(0, "name_declined_internal_error"); } -std::string MysqlCharacterProvider::setCharacterCreateErrorCode_(uint32_t error_code) +std::string MysqlCharacterProvider::getCharacterCreateErrorCode_(uint32_t error_code) { std::string error_string; switch(error_code) diff --git a/src/swganh_core/character/mysql_character_provider.h b/src/swganh_core/character/mysql_character_provider.h index 86a303b79..d283da1ae 100644 --- a/src/swganh_core/character/mysql_character_provider.h +++ b/src/swganh_core/character/mysql_character_provider.h @@ -12,21 +12,71 @@ class KernelInterface; namespace swganh { namespace character { +/** +* A character provider that uses mysql to fetch characters +*/ class MysqlCharacterProvider : public swganh::character::CharacterProviderInterface{ public: explicit MysqlCharacterProvider(swganh::app::KernelInterface* kernel); ~MysqlCharacterProvider(){}; + /** + * @param account_id the account to return the data for + * @return all character data associated with this account. + */ virtual std::vector GetCharactersForAccount(uint64_t account_id); + + /** + * @param character_id the character to delete + * @param account_id the account to delete the character for + */ virtual bool DeleteCharacter(uint64_t character_id, uint64_t account_id); - virtual std::wstring GetRandomNameRequest(const std::string& base_model); - virtual uint16_t GetMaxCharacters(uint64_t player_id); + + /** + * Creates a name based on the model given + * @param base_model the model of the species to create the name for + * @return a random name + */ + virtual std::wstring GetRandomNameRequest(const std::string& base_model); + + /** + * @param player_id the account_id to get the max characters for + * @return the max number of characters + */ + virtual uint16_t GetMaxCharacters(uint64_t player_id); + + /** + * Creates a character based on the info provided + * @param character_info the info of the character to create + * @param account_id the id of the account to use + * @return a tuple that indicates success or failure. + * On success, it returns the object_id of the created character + * On failure, it returns the 0 and the string of the error that occurred + */ virtual std::tuple CreateCharacter(const swganh::messages::ClientCreateCharacter& character_info, uint32_t account_id); + + /** + * Checks if a particular name is allowed to be used + * @param name the name to check + * @return a tuple that indicates success or failure + * On success, it returns true + * On failure, it returns false and the reason why + */ virtual std::tuple IsNameAllowed(std::string name); + + /** + * Returns the object_id of the character with the given name + * @param name the name to search for + * @return the id of the character or 0 of not found + */ virtual uint64_t GetCharacterIdByName(const std::string& name); private: - std::string setCharacterCreateErrorCode_(uint32_t error_code); + + /** + * @returns the string for the given mysql implementation-specific bad name error code + */ + std::string getCharacterCreateErrorCode_(uint32_t error_code); swganh::app::KernelInterface* kernel_; std::vector reserved_names_; diff --git a/src/swganh_core/chat/chat_service.cc b/src/swganh_core/chat/chat_service.cc index 610b4de88..e6c0230f5 100644 --- a/src/swganh_core/chat/chat_service.cc +++ b/src/swganh_core/chat/chat_service.cc @@ -51,11 +51,6 @@ ChatService::ChatService(SwganhKernel* kernel) : kernel_(kernel) {} -ChatService::~ChatService() -{ -} - - ServiceDescription ChatService::GetServiceDescription() { ServiceDescription service_description( diff --git a/src/swganh_core/chat/chat_service.h b/src/swganh_core/chat/chat_service.h index 80be40f33..956f1a629 100644 --- a/src/swganh_core/chat/chat_service.h +++ b/src/swganh_core/chat/chat_service.h @@ -20,25 +20,46 @@ namespace object { namespace swganh { namespace chat { - class ChatService: public swganh::chat::ChatServiceInterface - { - public: - explicit ChatService(swganh::app::SwganhKernel* kernel); - virtual ~ChatService(); - swganh::service::ServiceDescription GetServiceDescription(); - - void SendSpatialChat( - const std::shared_ptr& actor, // creature object - const std::shared_ptr& target, // target object - std::wstring chat_message, - uint16_t chat_type, - uint16_t mood); - - void Startup(); - - private: - swganh::command::CommandServiceInterface* command_service_; - swganh::app::SwganhKernel* kernel_; - }; +/* +* The chat service handles chat related functions +*/ +class ChatService: public swganh::chat::ChatServiceInterface +{ +public: + + /** + * Creates a new instance + */ + explicit ChatService(swganh::app::SwganhKernel* kernel); + + /** + * @return the service description for this service + */ + swganh::service::ServiceDescription GetServiceDescription(); + + /** + * Sends a spatial chat message + * @param actor the speaker + * @param target the target + * @param chat_message the message + * @param chat_type the type of chat + * @param mood the mood used + */ + void SendSpatialChat( + const std::shared_ptr& actor, // creature object + const std::shared_ptr& target, // target object + std::wstring chat_message, + uint16_t chat_type, + uint16_t mood); + + /** + * Called on startup + */ + void Startup(); + +private: + swganh::command::CommandServiceInterface* command_service_; + swganh::app::SwganhKernel* kernel_; +}; }} // namespace swganh::chat diff --git a/src/swganh_core/chat/spatial_chat_internal_command.cc b/src/swganh_core/chat/spatial_chat_internal_command.cc index 38a3ebb6c..78c7ef299 100644 --- a/src/swganh_core/chat/spatial_chat_internal_command.cc +++ b/src/swganh_core/chat/spatial_chat_internal_command.cc @@ -46,9 +46,6 @@ SpatialChatInternalCommand::SpatialChatInternalCommand( chat_service_ = kernel->GetServiceManager()->GetService("ChatService"); } -SpatialChatInternalCommand::~SpatialChatInternalCommand() -{} - boost::optional> SpatialChatInternalCommand::Run() { // This regular expression searches for 5 numbers separated by spaces diff --git a/src/swganh_core/chat/spatial_chat_internal_command.h b/src/swganh_core/chat/spatial_chat_internal_command.h index 0d84eb9f2..1b4688504 100644 --- a/src/swganh_core/chat/spatial_chat_internal_command.h +++ b/src/swganh_core/chat/spatial_chat_internal_command.h @@ -11,15 +11,23 @@ namespace chat { class ChatService; + /** + * An command implementation for spatial chat + */ class SpatialChatInternalCommand : public swganh::command::BaseSwgCommand { public: + + /** + Creates a new instance + */ SpatialChatInternalCommand( swganh::app::SwganhKernel* kernel, const swganh::command::CommandProperties& properties); - virtual ~SpatialChatInternalCommand(); - + /** + * Runs this command + */ virtual boost::optional> Run(); private: diff --git a/src/swganh_core/combat/combat_data.h b/src/swganh_core/combat/combat_data.h index e2bca03d7..5ecd4864a 100644 --- a/src/swganh_core/combat/combat_data.h +++ b/src/swganh_core/combat/combat_data.h @@ -23,6 +23,9 @@ namespace command { namespace swganh { namespace combat { +/** +* Data used in combat +*/ struct CombatData : swganh::command::CommandProperties { // TEMP @@ -50,8 +53,15 @@ struct CombatData : swganh::command::CommandProperties { } + /** + * Create a combat data from a given command + */ explicit CombatData(swganh::command::BaseCombatCommand* command); - CombatData(boost::python::object p_object, swganh::command::CommandProperties& properties ); + + /** + * Create combat data from a python object + */ + CombatData(boost::python::object p_object, swganh::command::CommandProperties& properties ); int min_damage; int max_damage; @@ -88,6 +98,9 @@ struct CombatData : swganh::command::CommandProperties bool IsRandomPool(); int GetDamagingPool(); + /** + * Extracts combat data from a python object + */ template void ExtractData(boost::python::object& p_object, std::string key, T& extract_value) { diff --git a/src/swganh_core/combat/combat_service.h b/src/swganh_core/combat/combat_service.h index bf3a70fe6..4786e5515 100644 --- a/src/swganh_core/combat/combat_service.h +++ b/src/swganh_core/combat/combat_service.h @@ -54,34 +54,69 @@ namespace combat { MISS }; + /** + * The service used for combat + */ class CombatService: public swganh::combat::CombatServiceInterface { public: - explicit CombatService(swganh::app::SwganhKernel* kernel); + /** + * Creates a new instance + */ + explicit CombatService(swganh::app::SwganhKernel* kernel); + + /** + * @return the service description of this service + */ swganh::service::ServiceDescription GetServiceDescription(); + /** + * Attacker incapacitates target + * @param attacker the object that caused the incapacitation + * @param target the object that has become incapacitated + */ void SetIncapacitated(const std::shared_ptr& attacker, const std::shared_ptr& target); + /** + * Attacker kills target + * @param attacker the object that caused the kill + * @param target the object that has been killed + */ void SetDead(const std::shared_ptr& attacker, const std::shared_ptr& target); + /** + * Ends a duel + * @param attacker the object that has ended the duel + * @param target the object that has had it's duel ended + */ void EndDuel(const std::shared_ptr& attacker, const std::shared_ptr& target); - void EndCombat(const std::shared_ptr& attacker, const std::shared_ptr& target); + /** + * Ends combat + * @param attacker the object that has ended combat + * @param target the object that has had combat ended + */ + void EndCombat(const std::shared_ptr& attacker, const std::shared_ptr& target); + + /** + * Called on startup. + */ void Startup(); + /** + * Executes a combat action + * @param command the command of the combat action to execute + */ void SendCombatAction(swganh::command::BaseCombatCommand* command); private: - typedef Concurrency::concurrent_unordered_map< - uint32_t, - CombatHandler - > HandlerMap; - + typedef Concurrency::concurrent_unordered_map HandlerMap; + bool InitiateCombat(const std::shared_ptr& attacker, const std::shared_ptr & target, const swganh::HashString& command); - + bool InitiateCombat(const std::shared_ptr& attacker, const std::shared_ptr & target, const swganh::messages::controllers::CommandQueueEnqueue& command_message); - void SendCombatAction(const std::shared_ptr& attacker, const std::shared_ptr & target, const swganh::messages::controllers::CommandQueueEnqueue& command_message, boost::python::object p_object); + void SendCombatAction(const std::shared_ptr& attacker, const std::shared_ptr & target, const swganh::messages::controllers::CommandQueueEnqueue& command_message, boost::python::object p_object); void SendCombatActionMessage(const std::shared_ptr& attacker, const std::shared_ptr & target, CombatData& properties, std::string animation = std::string("")); int SingleTargetCombatAction(const std::shared_ptr& attacker, const std::shared_ptr & target, CombatData& properties); int SingleTargetCombatAction(const std::shared_ptr& attacker, const std::shared_ptr & target, CombatData& properties); diff --git a/src/swganh_core/command/command_factory.cc b/src/swganh_core/command/command_factory.cc index 17045e5db..db2d25f86 100644 --- a/src/swganh_core/command/command_factory.cc +++ b/src/swganh_core/command/command_factory.cc @@ -26,9 +26,6 @@ CommandFactory::CommandFactory(SwganhKernel* kernel) , command_service_(nullptr) {} -CommandFactory::~CommandFactory() -{} - void CommandFactory::AddCommandCreator(swganh::HashString command, swganh::command::CommandCreator&& creator) { auto properties = GetCommandService()->FindPropertiesForCommand(command); diff --git a/src/swganh_core/command/command_factory.h b/src/swganh_core/command/command_factory.h index cd0abcded..16c2d5ba6 100644 --- a/src/swganh_core/command/command_factory.h +++ b/src/swganh_core/command/command_factory.h @@ -19,16 +19,33 @@ namespace command { namespace swganh { namespace command { + /** + * Implementation that associates a command name with creation of a command + */ class CommandFactory : public swganh::command::CommandFactoryInterface { public: + /** + * Creates a new instance + */ explicit CommandFactory(swganh::app::SwganhKernel* kernel); - ~CommandFactory(); + /** + * Associates a particular command name with a creator + * @param command the name + * @param creator the creator + */ virtual void AddCommandCreator(swganh::HashString command, swganh::command::CommandCreator&& creator); + /** + * Disassociates a particular command name with a creator + * @param command the command name to disassociate + */ virtual void RemoveCommandCreator(swganh::HashString command); + /** + * Create a command by name + */ virtual std::shared_ptr CreateCommand(swganh::HashString command); private: @@ -46,9 +63,7 @@ namespace command { const swganh::command::CommandProperties& properties; }; - typedef std::map< - swganh::HashString, CreatorData - > CreatorMap; + typedef std::map CreatorMap; swganh::app::SwganhKernel* kernel_; swganh::command::CommandServiceInterface* command_service_; diff --git a/src/swganh_core/command/command_filter.h b/src/swganh_core/command/command_filter.h index f130d99b6..97c807c7d 100644 --- a/src/swganh_core/command/command_filter.h +++ b/src/swganh_core/command/command_filter.h @@ -25,16 +25,34 @@ enum ERROR GOD_LEVEL = 6 }; +/** +* Defines a set of filters that can be run on a command +*/ struct CommandFilters { + /** + * Checks the target of a command matches what is expected + */ static std::tuple TargetCheckFilter(swganh::command::CommandInterface* command); + /** + * Checks that the actor of a command is in the proper posture to execute that command + */ static std::tuple PostureCheckFilter(swganh::command::CommandInterface* command); + /** + * Checks that the actor of a command is in the proper state to execute that command + */ static std::tuple StateCheckFilter(swganh::command::CommandInterface* command); + /** + * Checks that the actor of a command has necessary abilities to execute that command + */ static std::tuple AbilityCheckFilter(swganh::command::CommandInterface* command); + /** + * Checks that the target of a combat command can be attacked + */ static std::tuple CombatTargetCheckFilter(swganh::command::CommandInterface* command); /** diff --git a/src/swganh_core/command/command_queue.h b/src/swganh_core/command/command_queue.h index 7053037bb..e8ed8c51b 100644 --- a/src/swganh_core/command/command_queue.h +++ b/src/swganh_core/command/command_queue.h @@ -27,15 +27,43 @@ namespace command { namespace swganh { namespace command { + /** + * Represents the queue of commands for a particular client + * This class wraps a simple queue and adds proper client updating functionality + */ class CommandQueue : public swganh::command::CommandQueueInterface { public: + /** + * Create a new instance + */ CommandQueue(swganh::app::SwganhKernel* kernel); - ~CommandQueue(); + /** + * Custom destructor + */ + ~CommandQueue(); + + /** + * Adds a command to this queue + * @param command the command to add + */ virtual void EnqueueCommand(const std::shared_ptr& command); - virtual void SetDefaultCommand(const std::shared_ptr& command); - virtual void ClearDefaultCommand(); + + /** + * Sets the default command for this queue. + * @param command the default + */ + virtual void SetDefaultCommand(const std::shared_ptr& command); + + /** + * Clears the default command for this queue + */ + virtual void ClearDefaultCommand(); + + /* + * @return true if this queue has a default command + */ virtual bool HasDefaultCommand(); private: diff --git a/src/swganh_core/command/command_queue_manager.cc b/src/swganh_core/command/command_queue_manager.cc index 7ceb8ae7b..e25f6549a 100644 --- a/src/swganh_core/command/command_queue_manager.cc +++ b/src/swganh_core/command/command_queue_manager.cc @@ -12,9 +12,6 @@ using swganh::command::CommandQueueManager; using swganh::command::CommandInterface; using swganh::command::CommandQueueInterface; -CommandQueueManager::~CommandQueueManager() -{} - void CommandQueueManager::EnqueueCommand(const std::shared_ptr& command) { CommandQueueInterface* queue = nullptr; diff --git a/src/swganh_core/command/command_queue_manager.h b/src/swganh_core/command/command_queue_manager.h index ac6e687ec..41e67247b 100644 --- a/src/swganh_core/command/command_queue_manager.h +++ b/src/swganh_core/command/command_queue_manager.h @@ -13,30 +13,57 @@ namespace swganh { namespace command { + /** + * Manages command queues for all objects that require them. + */ class CommandQueueManager : public swganh::command::CommandQueueManagerInterface { public: - virtual ~CommandQueueManager(); + /** + * Enqueues a command for the proper object + * @param command the command to enqueue + */ virtual void EnqueueCommand(const std::shared_ptr& command); + /** + * Sets an an object's queue. + * @param queue_owner_id the id of the queue's owner + * @param command_queue the command queue to add + */ virtual void AddQueue(uint64_t queue_owner_id, const std::shared_ptr& command_queue); + /** + * Removes an object's queue. + * @param queue_owner_id the id of the owner to disassociate + */ virtual void RemoveQueue(uint64_t queue_owner_id); + /** + * Clears all queues for all owners + */ virtual void ClearQueues(); + /** + * Sets the default command for a particular owner + * @param the queue owner to set the default command for. + */ virtual void SetDefaultCommand(uint64_t queue_owner_id, const std::shared_ptr& command); + /** + * Clears the default command for a particular owner + * @param queue_owner_id the object to clear the default command for + */ virtual void ClearDefaultCommand(uint64_t queue_owner_id); + /* + * @param queue_owner_id the object to check + * @return true if the given object has a default command + */ virtual bool HasDefaultCommand(uint64_t queue_owner_id); private: - typedef std::map< - uint64_t, - std::shared_ptr - > CommandQueueMap; + typedef std::map> CommandQueueMap; boost::mutex queue_map_mutex_; CommandQueueMap queue_map_; diff --git a/src/swganh_core/command/command_service.cc b/src/swganh_core/command/command_service.cc index cb982687b..adf50e763 100644 --- a/src/swganh_core/command/command_service.cc +++ b/src/swganh_core/command/command_service.cc @@ -49,14 +49,6 @@ CommandService::CommandService(SwganhKernel* kernel) command_validator_impl_ = kernel->GetPluginManager()->CreateObject("Command::CommandValidator"); } -CommandService::~CommandService() -{ - auto event_dispatcher = kernel_->GetEventDispatcher(); - - event_dispatcher->Unsubscribe("ObjectReadyEvent", obj_ready_id_); - event_dispatcher->Unsubscribe("ObjectRemovedEvent", obj_removed_id_); -} - ServiceDescription CommandService::GetServiceDescription() { ServiceDescription service_description( diff --git a/src/swganh_core/command/command_service.h b/src/swganh_core/command/command_service.h index 0f025288a..c5aab40bf 100644 --- a/src/swganh_core/command/command_service.h +++ b/src/swganh_core/command/command_service.h @@ -22,26 +22,68 @@ namespace observer { namespace swganh { namespace command { + /** + * The command service builds, checks, queues, and runs commands. + */ class CommandService: public swganh::command::CommandServiceInterface { public: + + /** + * Creates a new instance + */ explicit CommandService(swganh::app::SwganhKernel* kernel); - ~CommandService(); + /** + * @return the service description for this service + */ swganh::service::ServiceDescription GetServiceDescription(); + /** + * Adds a new filter that is checked before enqueue + * @param filter the filter to add + */ void AddCommandEnqueueFilter(swganh::command::CommandFilter&& filter); + /** + * Adds a new filter that is checked before processing + * @param filter the filter to add + */ void AddCommandProcessFilter(swganh::command::CommandFilter&& filter); + /** + * Adds a new command creation source + * @param command the name of the command + * @param creator the object that will create the command. + */ void AddCommandCreator(swganh::HashString command, swganh::command::CommandCreator&& creator); + /** + * Removes a command creator by name + * @param command the name of the command to remove. + */ void RemoveCommandCreator(swganh::HashString command); + /** + * Creates a new command by name. + * @param command the name of the command to create + */ std::shared_ptr CreateCommand(swganh::HashString command); + /** + * Enqueues a command + * @param command the command to enqueue + */ void EnqueueCommand(const std::shared_ptr& command); + /** + * Sends the command queue removal message + * @param object object receiving the message + * @param action_counter the counter for the action. +1 each time + * @param default_time_sec the number of seconds the action takes to execute + * @param error the error to send + * @param action sets either state or locomotion depending on the error + */ void SendCommandQueueRemove( const std::shared_ptr& object, uint32_t action_counter, @@ -49,25 +91,61 @@ namespace command { uint32_t error, uint32_t action); + /** + * Runs the command through a series of filters in prep for enqueue + * @param command the command to validate + * @return a tuple representing success or failure. + */ std::tuple ValidateForEnqueue(swganh::command::CommandInterface* command); + /** + * Runs the command through a series of filters in prep for processing + * @param command the command to validate + * @return a tuple representing success or failure. + */ std::tuple ValidateForProcessing(swganh::command::CommandInterface* command); + /** + * Loads the command properties map and returns it + */ swganh::command::CommandPropertiesMap LoadCommandPropertiesMap(); + /** + * Tries to find properities for a particular command. + */ boost::optional FindPropertiesForCommand(swganh::HashString command); + /** + * Called on startup + */ void Startup(); + /** + * Handler for the EnqueueCommand message. + * @param controller the object that requested the enqueue + * @param message the command queue enqueue message received + */ void EnqueueCommandRequest( const std::shared_ptr& controller, swganh::messages::controllers::CommandQueueEnqueue* message); - + /** + * Sets the default command for an object_id + * @param queue_owner_id the id of the object to set the default command for + * @param command the new default command + */ void SetDefaultCommand(uint64_t queue_owner_id, const std::shared_ptr& command); + /** + * Clears the default command for an object by id + * @param queue_owner_id the id of the object to clear + */ void ClearDefaultCommand(uint64_t queue_owner_id); + /** + * Checks the default command for an object by id + * @param queue_owner_id the id of the object to check + */ bool HasDefaultCommand(uint64_t queue_owner_id); private: diff --git a/src/swganh_core/command/command_validator.cc b/src/swganh_core/command/command_validator.cc index cd8c73ed2..044fe301c 100644 --- a/src/swganh_core/command/command_validator.cc +++ b/src/swganh_core/command/command_validator.cc @@ -12,9 +12,6 @@ using swganh::command::BaseSwgCommand; using swganh::command::CommandFilter; using swganh::command::CommandInterface; -CommandValidator::~CommandValidator() -{} - void CommandValidator::AddCommandEnqueueFilter(swganh::command::CommandFilter&& filter) { enqueue_filters_.push_back(std::move(filter)); diff --git a/src/swganh_core/command/command_validator.h b/src/swganh_core/command/command_validator.h index d626a3159..f9a638938 100644 --- a/src/swganh_core/command/command_validator.h +++ b/src/swganh_core/command/command_validator.h @@ -14,17 +14,37 @@ namespace command { namespace swganh { namespace command { + /** + * Validates commands based on a series of filters + */ class CommandValidator : public swganh::command::CommandValidatorInterface { public: - virtual ~CommandValidator(); + /** + * Adds a new pre-enqueue filter + * @param filter the filter to add + */ virtual void AddCommandEnqueueFilter(swganh::command::CommandFilter&& filter); + /** + * Adds a new process filter + * @param filter the filter to add + */ virtual void AddCommandProcessFilter(swganh::command::CommandFilter&& filter); + /** + * Runs the command through a series of filters in prep for enqueue + * @param command the command to validate + * @return a tuple representing success or failure. + */ virtual std::tuple ValidateForEnqueue(swganh::command::CommandInterface* command); + /** + * Runs the command through a series of filters in prep for processing + * @param command the command to validate + * @return a tuple representing success or failure. + */ virtual std::tuple ValidateForProcessing(swganh::command::CommandInterface* command); private: diff --git a/src/swganh_core/connection/connection_client.h b/src/swganh_core/connection/connection_client.h index cc18ea261..89d509d90 100644 --- a/src/swganh_core/connection/connection_client.h +++ b/src/swganh_core/connection/connection_client.h @@ -9,22 +9,48 @@ namespace swganh { namespace connection { +/* +* Represents a remote client. +*/ class ConnectionClient : public swganh::connection::ConnectionClientInterface { public: + /** + * Creates a new instance + */ ConnectionClient(swganh::network::soe::ServerInterface* server, boost::asio::io_service& io_service, boost::asio::ip::udp::endpoint remote_endpoint); + /** + * @return the current state of this remote client + */ State GetState() const; + /** + * @return the account id of this remote client + */ uint32_t GetAccountId() const; + /** + * @return the player id of this remote client + */ uint64_t GetPlayerId() const; + /** + * Saves the account and player data and sets the state of this client + * @param account_id the account to set + * @param player_id the player id to set + */ void Connect(uint32_t account_id, uint64_t player_id); + /** + * @return the observer (ie. session) associated with this connection client. + */ const std::shared_ptr& GetController() const; + /** + * @return the observer (ie. session) associated with this connection client + */ void SetController(const std::shared_ptr& controller); private: diff --git a/src/swganh_core/connection/connection_service.h b/src/swganh_core/connection/connection_service.h index 32357c123..6c621262c 100644 --- a/src/swganh_core/connection/connection_service.h +++ b/src/swganh_core/connection/connection_service.h @@ -16,30 +16,67 @@ namespace connection { class PingServer; +/** +* Manages remote connections +*/ class ConnectionService : public swganh::connection::ConnectionServiceInterface { public: + /** + * Create a new instance + */ ConnectionService( std::string listen_address, uint16_t listen_port, uint16_t ping_port, swganh::app::SwganhKernel* kernel); + /** + * Custom destructor + */ ~ConnectionService(); + /** + * @return the service description for this service + */ swganh::service::ServiceDescription GetServiceDescription(); + /** + * Removes a session (ie. ends) + */ bool RemoveSession(std::shared_ptr session); + /** + * Returns the session by endpoint (ie. ip address) + * @param endpoint the ip address to find + * @return the session associated with the ip or nullptr + */ std::shared_ptr GetSession(const boost::asio::ip::udp::endpoint& endpoint); + /** + * Finds a connection client based on player id + * @param player_id the id of the player to find the connection for + */ std::shared_ptr FindConnectionByPlayerId(uint64_t player_id); + /** + * Called on startup + */ void Startup(); + + /** + * Called on shutdown + */ void Shutdown(); + /** + * @return the string name of the address this connection service is using + */ const std::string& listen_address(); + /** + * @return the port this connection service is using + */ uint16_t listen_port(); private: diff --git a/src/swganh_core/equipment/equipment_service.cc b/src/swganh_core/equipment/equipment_service.cc index 4ab6ce9d9..099355ed1 100644 --- a/src/swganh_core/equipment/equipment_service.cc +++ b/src/swganh_core/equipment/equipment_service.cc @@ -1,3 +1,6 @@ +// This file is part of SWGANH which is released under the MIT license. +// See file LICENSE or go to http://swganh.com/LICENSE + #include "equipment_service.h" #include diff --git a/src/swganh_core/equipment/equipment_service.h b/src/swganh_core/equipment/equipment_service.h index 0397f932e..2b7404e3d 100644 --- a/src/swganh_core/equipment/equipment_service.h +++ b/src/swganh_core/equipment/equipment_service.h @@ -1,3 +1,5 @@ +// This file is part of SWGANH which is released under the MIT license. +// See file LICENSE or go to http://swganh.com/LICENSE #pragma once #include @@ -15,23 +17,50 @@ namespace swganh { namespace equipment { - class EquipmentService : public swganh::equipment::EquipmentServiceInterface - { - public: - EquipmentService(swganh::tre::ResourceManager* resourceManager); +/** +* A service that provides wrapping functionality for the container system +* Methods on this interface basically convert slot name to slot id +*/ +class EquipmentService : public swganh::equipment::EquipmentServiceInterface +{ +public: + /** + * Creates a new instance + */ + EquipmentService(swganh::tre::ResourceManager* resourceManager); - swganh::service::ServiceDescription GetServiceDescription(); + /** + * @return the service description for this service + */ + swganh::service::ServiceDescription GetServiceDescription(); - virtual int32_t GetSlotIdByName(std::string slot_name); - virtual std::string GetSlotNameById(int32_t slot_id); + /** + * @return the id of a slot by name + */ + virtual int32_t GetSlotIdByName(std::string slot_name); + + /** + * @return the name of a slot by id + */ + virtual std::string GetSlotNameById(int32_t slot_id); - virtual void ClearSlot(std::shared_ptr object, std::string slot_name); - - virtual std::shared_ptr GetEquippedObject( - std::shared_ptr object, std::string slot_name); + /** + * Clears a slot for an object by name + * @param object the object to manipulate + * @param slot_name the name of the slot to clear + */ + virtual void ClearSlot(std::shared_ptr object, std::string slot_name); + + /** + * @param object the object to search + * @param slot_name the name of the slot to return + * @returns a sub object of object by slot name + */ + virtual std::shared_ptr GetEquippedObject( + std::shared_ptr object, std::string slot_name); - private: - std::shared_ptr slot_definitions_; - }; +private: + std::shared_ptr slot_definitions_; +}; } } \ No newline at end of file diff --git a/src/swganh_core/galaxy/galaxy_service.h b/src/swganh_core/galaxy/galaxy_service.h index c38e3d391..118feadb9 100644 --- a/src/swganh_core/galaxy/galaxy_service.h +++ b/src/swganh_core/galaxy/galaxy_service.h @@ -7,31 +7,54 @@ namespace swganh { namespace galaxy { - class GalaxyService : public swganh::galaxy::GalaxyServiceInterface - { - public: - explicit GalaxyService(swganh::app::SwganhKernel* kernel); - ~GalaxyService(); - - uint32_t GetPopulation(); +/** +* Manages statistics on a galaxy and provides galaxy time +*/ +class GalaxyService : public swganh::galaxy::GalaxyServiceInterface +{ +public: + + /** + * Creates a new instance + */ + explicit GalaxyService(swganh::app::SwganhKernel* kernel); + + /** + * Custom destructor + */ + ~GalaxyService(); + + /** + * @return the population of the galaxy + */ + uint32_t GetPopulation(); - uint64_t GetGalaxyTimeInMilliseconds(); - - swganh::service::ServiceDescription GetServiceDescription(); + /** + * @return the current time of the galaxy since galaxy birth + */ + uint64_t GetGalaxyTimeInMilliseconds(); + + /** + * @return the description of the service + */ + swganh::service::ServiceDescription GetServiceDescription(); - void Startup(); + /** + * Called on server startup + */ + void Startup(); - private: - GalaxyService(); +private: + GalaxyService(); - void GalaxyStatusTimerHandler_(const boost::system::error_code& e, int delay_in_secs); - - std::shared_ptr galaxy_provider_; - swganh::app::SwganhKernel* kernel_; - swganh::service::ServiceDirectoryInterface* service_directory_; - swganh::EventDispatcherInterface* event_dispatcher_; - std::shared_ptr galaxy_timer_; - }; + void GalaxyStatusTimerHandler_(const boost::system::error_code& e, int delay_in_secs); + + std::shared_ptr galaxy_provider_; + swganh::app::SwganhKernel* kernel_; + swganh::service::ServiceDirectoryInterface* service_directory_; + swganh::EventDispatcherInterface* event_dispatcher_; + std::shared_ptr galaxy_timer_; +}; }} // swganh::galaxy diff --git a/src/swganh_core/galaxy/mysql_galaxy_provider.cc b/src/swganh_core/galaxy/mysql_galaxy_provider.cc index fb305e582..a3927bb0c 100644 --- a/src/swganh_core/galaxy/mysql_galaxy_provider.cc +++ b/src/swganh_core/galaxy/mysql_galaxy_provider.cc @@ -21,8 +21,6 @@ MysqlGalaxyProvider::MysqlGalaxyProvider(swganh::database::DatabaseManagerInterf : GalaxyProviderInterface() , db_manager_(db_manager) {} -MysqlGalaxyProvider::~MysqlGalaxyProvider() {} - uint32_t MysqlGalaxyProvider::GetPopulation() { uint32_t population = 0; diff --git a/src/swganh_core/galaxy/mysql_galaxy_provider.h b/src/swganh_core/galaxy/mysql_galaxy_provider.h index d6c182366..73cc9b0f5 100644 --- a/src/swganh_core/galaxy/mysql_galaxy_provider.h +++ b/src/swganh_core/galaxy/mysql_galaxy_provider.h @@ -11,11 +11,19 @@ namespace swganh { namespace database { class DatabaseManagerInterface; namespace swganh { namespace galaxy { +/** +* Provides basic galaxy functionality via mysql +*/ class MysqlGalaxyProvider : public swganh::galaxy::providers::GalaxyProviderInterface { public: + /** + * Creates a new instance + */ explicit MysqlGalaxyProvider(swganh::database::DatabaseManagerInterface* db_manager); - ~MysqlGalaxyProvider(); + /** + * @return the population of the galaxy + */ virtual uint32_t GetPopulation(); private: diff --git a/src/swganh_core/login/authentication_manager.h b/src/swganh_core/login/authentication_manager.h index f18d3f2d7..502c80adb 100644 --- a/src/swganh_core/login/authentication_manager.h +++ b/src/swganh_core/login/authentication_manager.h @@ -7,12 +7,24 @@ namespace swganh { namespace login { +/** +* Provides authentication via an encoder +*/ class AuthenticationManager : public swganh::login::AuthenticationManagerInterface { public: + /** + * Creates a new instance + */ explicit AuthenticationManager(std::shared_ptr encoder); + /** + * @return the encoder used + */ std::shared_ptr encoder(); + /** + * @return true if authenticated, false otherwise + */ bool Authenticate( std::shared_ptr client, std::shared_ptr account); diff --git a/src/swganh_core/login/login_service.h b/src/swganh_core/login/login_service.h index dac907088..d03c3caca 100644 --- a/src/swganh_core/login/login_service.h +++ b/src/swganh_core/login/login_service.h @@ -7,35 +7,92 @@ namespace swganh { namespace login { +/** +* Provides the functionality of the login service. +*/ class LoginService : public swganh::login::LoginServiceInterface { public: + + /** + * Creates a new instance + */ LoginService( std::string listen_address, uint16_t listen_port, swganh::app::SwganhKernel* kernel); - ~LoginService(); + /** + * Custom destructor + */ + ~LoginService(); + + /** + * @return the service description for this service + */ swganh::service::ServiceDescription GetServiceDescription(); + /** + * Removes a session from this service. + * @param session the session to remove + * @return true if success + */ bool RemoveSession(std::shared_ptr session); + /** + * @param endpoint the ip of the session to fetch + * @return the session for a given ip + */ std::shared_ptr GetSession(const boost::asio::ip::udp::endpoint& endpoint); + /** + * @param session_key the key of the session to fetch the account id for + * @return the account_id of the session found + */ uint32_t GetAccountBySessionKey(const std::string& session_key); - + + /** + * @return the number of seconds between galaxy status updates + */ int galaxy_status_check_duration_secs() const; + + /** + * Sets the number of seconds between galaxy status updates + * @param the new duration + */ void galaxy_status_check_duration_secs(int new_duration); + /** + * @return true if auto account creation is enabled + */ bool login_auto_registration() const; + + /** + * Sets the status of account auto creation + * @param auto_registration true if the enabled + */ void login_auto_registration(bool auto_registeration); + /** + * @return the timeout of the login server in seconds + */ int login_error_timeout_secs() const; + + /** + * Sets the login timeout + * @param new_timeout the new login timeout in seconds + */ void login_error_timeout_secs(int new_timeout); + /** + * Called on startup + */ void Startup(); + /** + * Called on shutdown + */ void Shutdown(); private: diff --git a/src/swganh_core/login/mysql_account_provider.cc b/src/swganh_core/login/mysql_account_provider.cc index ed23568a3..a7a1f75af 100644 --- a/src/swganh_core/login/mysql_account_provider.cc +++ b/src/swganh_core/login/mysql_account_provider.cc @@ -26,8 +26,6 @@ MysqlAccountProvider::MysqlAccountProvider(swganh::database::DatabaseManagerInte : AccountProviderInterface() , db_manager_(db_manager) {} -MysqlAccountProvider::~MysqlAccountProvider() {} - shared_ptr MysqlAccountProvider::FindByUsername(string username) { shared_ptr account = nullptr; diff --git a/src/swganh_core/login/mysql_account_provider.h b/src/swganh_core/login/mysql_account_provider.h index 2327c6f72..f5eeca30f 100644 --- a/src/swganh_core/login/mysql_account_provider.h +++ b/src/swganh_core/login/mysql_account_provider.h @@ -10,16 +10,45 @@ namespace swganh { namespace database { class DatabaseManagerInterface; namespace swganh { namespace login { +/** +* Provides account handling via mysql +*/ class MysqlAccountProvider : public swganh::login::providers::AccountProviderInterface { public: + + /** + * Create new instance + */ explicit MysqlAccountProvider(swganh::database::DatabaseManagerInterface* db_manager); - ~MysqlAccountProvider(); + /** + * Finds and populates an account by username + */ virtual std::shared_ptr FindByUsername(std::string username); - virtual uint32_t FindBySessionKey(const std::string& session_key); - virtual void EndSessions(); + + /** + * Finds an populates an account by session key + */ + virtual uint32_t FindBySessionKey(const std::string& session_key); + + /** + * Ends all active sessions + */ + virtual void EndSessions(); + + /** + * Creates a new session for an account with the given key + */ virtual bool CreateAccountSession(uint32_t account_id, const std::string& session_key); - virtual bool AutoRegisterAccount(std::string username, std::string password); + + /** + * Creates a new account with the given username and password + */ + virtual bool AutoRegisterAccount(std::string username, std::string password); + + /** + * Creates a new player account for the given id + */ virtual bool CreatePlayerAccount(uint64_t account_id); private: diff --git a/src/swganh_core/login/mysql_session_provider.cc b/src/swganh_core/login/mysql_session_provider.cc index 3b3b09417..d44c218cb 100644 --- a/src/swganh_core/login/mysql_session_provider.cc +++ b/src/swganh_core/login/mysql_session_provider.cc @@ -24,8 +24,6 @@ MysqlSessionProvider::MysqlSessionProvider(swganh::database::DatabaseManagerInte : SessionProviderInterface() , db_manager_(db_manager) {} -MysqlSessionProvider::~MysqlSessionProvider() {} - uint64_t MysqlSessionProvider::GetPlayerId(uint32_t account_id) { uint64_t player_id = 0; diff --git a/src/swganh_core/login/mysql_session_provider.h b/src/swganh_core/login/mysql_session_provider.h index 3a3e0fca3..fb13d7845 100644 --- a/src/swganh_core/login/mysql_session_provider.h +++ b/src/swganh_core/login/mysql_session_provider.h @@ -11,14 +11,34 @@ namespace swganh { namespace database { class DatabaseManagerInterface; namespace swganh { namespace login { +/** +* Provides sessions via Mysql +*/ class MysqlSessionProvider : public swganh::connection::providers::SessionProviderInterface { public: + /** + * Creates a new instance + */ explicit MysqlSessionProvider(swganh::database::DatabaseManagerInterface* db_manager); - ~MysqlSessionProvider(); + /** + * Returns the id of a player based on account_id + */ virtual uint64_t GetPlayerId(uint32_t account_id); - virtual uint32_t GetAccountId(uint64_t player_id); + + /** + * Returns the id of an account based on player_id + */ + virtual uint32_t GetAccountId(uint64_t player_id); + + /** + * Creates a new game session with the given id + */ virtual bool CreateGameSession(uint64_t player_id, uint32_t session_id); + + /** + * Ends a game session by player_id + */ virtual void EndGameSession(uint64_t player_id); private: swganh::database::DatabaseManagerInterface* db_manager_; diff --git a/src/swganh_core/login/sha512_encoder.cc b/src/swganh_core/login/sha512_encoder.cc index ceb5bbc4b..1e49ea0cb 100644 --- a/src/swganh_core/login/sha512_encoder.cc +++ b/src/swganh_core/login/sha512_encoder.cc @@ -18,7 +18,6 @@ using namespace std; Sha512Encoder::Sha512Encoder(DatabaseManagerInterface* db_manager) : db_manager_(db_manager) {} -Sha512Encoder::~Sha512Encoder() {} string Sha512Encoder::EncodePassword(string raw, string salt) { string result; diff --git a/src/swganh_core/login/sha512_encoder.h b/src/swganh_core/login/sha512_encoder.h index c33f0b106..9c57cd27a 100644 --- a/src/swganh_core/login/sha512_encoder.h +++ b/src/swganh_core/login/sha512_encoder.h @@ -11,12 +11,25 @@ namespace swganh { namespace database { class DatabaseManagerInterface; namespace swganh { namespace login { +/** +* Provides Sha512 encoding for password checking via MYSQL +*/ class Sha512Encoder : public swganh::login::encoders::EncoderInterface { public: + + /** + * Creates a new instance + */ explicit Sha512Encoder(swganh::database::DatabaseManagerInterface* db_manager); - ~Sha512Encoder(); + /** + * Encodes a password with the given salt and returns the value + */ std::string EncodePassword(std::string raw, std::string salt); + + /** + * Compares the encoded string to the raw when encoded with the salt + */ bool IsPasswordValid(std::string encoded, std::string raw, std::string salt); private: swganh::database::DatabaseManagerInterface* db_manager_; From 7ec3c15fbb9d340f9aeb61f27a9b6480a9406ffd Mon Sep 17 00:00:00 2001 From: Richard Laughlin Date: Thu, 4 Oct 2012 09:13:54 -0300 Subject: [PATCH 2/5] Update src/swganh/app/swganh_app.cc Added db error messages when db connection errors occur. --- src/swganh/app/swganh_app.cc | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/swganh/app/swganh_app.cc b/src/swganh/app/swganh_app.cc index 0bbe6621b..4dca152ea 100644 --- a/src/swganh/app/swganh_app.cc +++ b/src/swganh/app/swganh_app.cc @@ -169,20 +169,28 @@ void SwganhApp::Initialize(int argc, char* argv[]) { auto app_config = kernel_->GetAppConfig(); - // Initialize kernel resources - kernel_->GetDatabaseManager()->registerStorageType( - "galaxy_manager", - app_config.galaxy_manager_db.schema, - app_config.galaxy_manager_db.host, - app_config.galaxy_manager_db.username, - app_config.galaxy_manager_db.password); - - kernel_->GetDatabaseManager()->registerStorageType( - "galaxy", - app_config.galaxy_db.schema, - app_config.galaxy_db.host, - app_config.galaxy_db.username, - app_config.galaxy_db.password); + try { + + // Initialize kernel resources + kernel_->GetDatabaseManager()->registerStorageType( + "galaxy_manager", + app_config.galaxy_manager_db.schema, + app_config.galaxy_manager_db.host, + app_config.galaxy_manager_db.username, + app_config.galaxy_manager_db.password); + + kernel_->GetDatabaseManager()->registerStorageType( + "galaxy", + app_config.galaxy_db.schema, + app_config.galaxy_db.host, + app_config.galaxy_db.username, + app_config.galaxy_db.password); + + } + catch(...) + { + LOG(fatal) << "Database connection errors occurred. Did you forget to populate the db?"; + } CleanupServices_(); From 7c32de672a30bdc7ef1589d83d883b442a7ceece Mon Sep 17 00:00:00 2001 From: Richard Laughlin Date: Thu, 4 Oct 2012 09:32:36 -0300 Subject: [PATCH 3/5] Update src/swganh/app/swganh_app.cc Added ascii art and db error exception rethrow --- src/swganh/app/swganh_app.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/swganh/app/swganh_app.cc b/src/swganh/app/swganh_app.cc index 4dca152ea..4d9c1dc4b 100644 --- a/src/swganh/app/swganh_app.cc +++ b/src/swganh/app/swganh_app.cc @@ -164,6 +164,18 @@ void SwganhApp::Initialize(int argc, char* argv[]) { // Init Logging SetupLogging_(); + std::cout << "Ben Kenobi : That team is our last hope." << std::endl; + std::cout << " Yoda : NO! There is another..." << std::endl << std::endl; + std::cout << " .d8888b. 888 888 .d8888b. d8888 888b 888 888 888 " << std::endl; + std::cout << "d88P Y88b 888 o 888 d88P Y88b d88888 8888b 888 888 888 " << std::endl; + std::cout << "Y88b. 888 d8b 888 888 888 d88P888 88888b 888 888 888 " << std::endl; + std::cout << " \"Y888b. 888 d888b 888 888 d88P 888 888Y88b 888 8888888888 " << std::endl; + std::cout << " \"Y88b. 888d88888b888 888 88888 d88P 888 888 Y88b888 888 888 " << std::endl; + std::cout << " \"888 88888P Y88888 888 888 d88P 888 888 Y88888 888 888 " << std::endl; + std::cout << "Y88b d88P 8888P Y8888 Y88b d88P d8888888888 888 Y8888 888 888 " << std::endl; + std::cout << " \"Y8888P\" 888P Y888 \"Y8888P88 d88P 888 888 Y888 888 888 " << std::endl << std::endl; + + // Load the configuration LoadAppConfig_(argc, argv); @@ -187,9 +199,10 @@ void SwganhApp::Initialize(int argc, char* argv[]) { app_config.galaxy_db.password); } - catch(...) + catch(std::exception& e) { LOG(fatal) << "Database connection errors occurred. Did you forget to populate the db?"; + throw e; } CleanupServices_(); From 521a63050f8a21846dc14dc4de52721d3e9b21f7 Mon Sep 17 00:00:00 2001 From: Richard Laughlin Date: Thu, 4 Oct 2012 18:05:55 -0400 Subject: [PATCH 4/5] Used exit to fix shutdown errors. (Bad practice, but shouldn't effect our use because services are given time to shutdown properly) --- src/swganh/app/swganh_app.cc | 22 +++---- src/swganh/app/swganh_kernel.cc | 10 +++- src/swganh/app/swganh_kernel.h | 2 + src/swganh/main.cc | 4 +- src/swganh/player/player_service_interface.h | 2 - src/swganh/service/service_manager.cc | 3 +- .../character/character_service.cc | 2 +- .../connection/connection_service.cc | 2 +- src/swganh_core/galaxy/galaxy_service.cc | 2 +- src/swganh_core/login/login_service.cc | 2 +- src/swganh_core/player/player_service.cc | 5 -- src/swganh_core/player/player_service.h | 58 ++++++++++++------- src/swganh_core/spawn/spawn_service.cc | 4 +- src/swganh_core/weather/weather_service.cc | 4 +- 14 files changed, 69 insertions(+), 53 deletions(-) diff --git a/src/swganh/app/swganh_app.cc b/src/swganh/app/swganh_app.cc index 4d9c1dc4b..20032d68d 100644 --- a/src/swganh/app/swganh_app.cc +++ b/src/swganh/app/swganh_app.cc @@ -151,21 +151,22 @@ SwganhApp::~SwganhApp() { Stop(); // Shutdown Event Dispatcher - kernel_->GetEventDispatcher()->Shutdown(); + kernel_->Shutdown(); - kernel_.reset(); - io_work_.reset(); - - // join the threadpool threads until each one has exited. - for_each(io_threads_.begin(), io_threads_.end(), std::mem_fn(&boost::thread::join)); + io_work_.reset(); + + // join the threadpool threads until each one has exited. + for_each(io_threads_.begin(), io_threads_.end(), std::mem_fn(&boost::thread::join)); + + kernel_.reset(); } void SwganhApp::Initialize(int argc, char* argv[]) { // Init Logging SetupLogging_(); - std::cout << "Ben Kenobi : That team is our last hope." << std::endl; - std::cout << " Yoda : NO! There is another..." << std::endl << std::endl; + std::cout << "Ben Kenobi : That boy was our last hope." << std::endl; + std::cout << " Yoda : No! There is another..." << std::endl << std::endl; std::cout << " .d8888b. 888 888 .d8888b. d8888 888b 888 888 888 " << std::endl; std::cout << "d88P Y88b 888 o 888 d88P Y88b d88888 8888b 888 888 888 " << std::endl; std::cout << "Y88b. 888 d8b 888 888 888 d88P888 88888b 888 888 888 " << std::endl; @@ -316,8 +317,6 @@ void SwganhApp::LoadAppConfig_(int argc, char* argv[]) { } void SwganhApp::LoadPlugins_(vector plugins) { - LOG(info) << "Loading plugins..."; - if (!plugins.empty()) { auto plugin_manager = kernel_->GetPluginManager(); auto plugin_directory = kernel_->GetAppConfig().plugin_directory; @@ -327,7 +326,6 @@ void SwganhApp::LoadPlugins_(vector plugins) { plugin_manager->LoadPlugin(plugin, plugin_directory); }); } - LOG(info) << "Finished Loading plugins..."; } void SwganhApp::CleanupServices_() { @@ -361,9 +359,7 @@ void SwganhApp::LoadCoreServices_() if (entry.first.length() > 7 && regex_match(name, m, rx)) { auto service_name = m[1].str(); - LOG(info) << "Loading Service " << name << "..."; auto service = kernel_->GetPluginManager()->CreateObject(name); - kernel_->GetServiceManager()->AddService(service_name, service); LOG(info) << "Loaded Service " << name; } diff --git a/src/swganh/app/swganh_kernel.cc b/src/swganh/app/swganh_kernel.cc index b621e7594..810f14a9c 100644 --- a/src/swganh/app/swganh_kernel.cc +++ b/src/swganh/app/swganh_kernel.cc @@ -42,7 +42,15 @@ SwganhKernel::SwganhKernel(boost::asio::io_service& io_service) SwganhKernel::~SwganhKernel() { - service_manager_->Stop(); + +} + +void SwganhKernel::Shutdown() +{ + service_manager_->Stop(); + exit(0); + + event_dispatcher_->Shutdown(); resource_manager_.reset(); event_dispatcher_.reset(); diff --git a/src/swganh/app/swganh_kernel.h b/src/swganh/app/swganh_kernel.h index 6a87dfc32..73f7712c7 100644 --- a/src/swganh/app/swganh_kernel.h +++ b/src/swganh/app/swganh_kernel.h @@ -70,6 +70,8 @@ class SwganhKernel : public swganh::app::KernelInterface { explicit SwganhKernel(boost::asio::io_service& io_service); virtual ~SwganhKernel(); + void Shutdown(); + const swganh::app::Version& GetVersion(); AppConfig& GetAppConfig(); diff --git a/src/swganh/main.cc b/src/swganh/main.cc index a3bc77fb5..4eecbafff 100644 --- a/src/swganh/main.cc +++ b/src/swganh/main.cc @@ -49,8 +49,8 @@ int main(int argc, char* argv[]) if (cmd.compare("exit") == 0 || cmd.compare("quit") == 0 || cmd.compare("q") == 0) { LOG(info) << "Exit command received from command line. Shutting down."; - - break; + + break; } else { LOG(warning) << "Invalid command received: " << cmd; std::cout << "Type exit or (q)uit to quit" << std::endl; diff --git a/src/swganh/player/player_service_interface.h b/src/swganh/player/player_service_interface.h index 7e15b2fcc..bc5ad7aea 100644 --- a/src/swganh/player/player_service_interface.h +++ b/src/swganh/player/player_service_interface.h @@ -15,8 +15,6 @@ namespace player { class PlayerServiceInterface : swganh::service::ServiceInterface { public: - virtual void CleanupPlayerState(std::shared_ptr player) = 0; - virtual void OnPlayerEnter(std::shared_ptr player) = 0; virtual void OnPlayerExit(std::shared_ptr player) = 0; diff --git a/src/swganh/service/service_manager.cc b/src/swganh/service/service_manager.cc index aefad06d8..81ad6f88d 100644 --- a/src/swganh/service/service_manager.cc +++ b/src/swganh/service/service_manager.cc @@ -73,9 +73,8 @@ void ServiceManager::AddService(string name, shared_ptr servic void ServiceManager::Start() { for_each(services_.begin(), services_.end(), [this] (ServiceMap::value_type& entry) { if (entry.second.second) { - LOG(warning) << "Starting " << entry.second.first->name(); entry.second.second->Startup(); - LOG(warning) << "Started..."; + LOG(info) << "Started " << entry.second.first->name(); entry.second.first->status(swganh::service::Galaxy::ONLINE); service_directory_->updateService(*entry.second.first); } diff --git a/src/swganh_core/character/character_service.cc b/src/swganh_core/character/character_service.cc index 877f73455..0a05b9757 100644 --- a/src/swganh_core/character/character_service.cc +++ b/src/swganh_core/character/character_service.cc @@ -56,7 +56,7 @@ CharacterService::CharacterService(SwganhKernel* kernel) service::ServiceDescription CharacterService::GetServiceDescription() { service::ServiceDescription service_description( - "ANH Character Service", + "Character Service", "character", "0.1", "127.0.0.1", diff --git a/src/swganh_core/connection/connection_service.cc b/src/swganh_core/connection/connection_service.cc index ae49aba3c..bd4a27c53 100644 --- a/src/swganh_core/connection/connection_service.cc +++ b/src/swganh_core/connection/connection_service.cc @@ -73,7 +73,7 @@ ServiceDescription ConnectionService::GetServiceDescription() { auto listen_address = Resolve(listen_address_); ServiceDescription service_description( - "ANH Connection Service", + "Connection Service", "connection", "0.1", listen_address, diff --git a/src/swganh_core/galaxy/galaxy_service.cc b/src/swganh_core/galaxy/galaxy_service.cc index 120715f3d..46090e416 100644 --- a/src/swganh_core/galaxy/galaxy_service.cc +++ b/src/swganh_core/galaxy/galaxy_service.cc @@ -34,7 +34,7 @@ GalaxyService::~GalaxyService() ServiceDescription GalaxyService::GetServiceDescription() { ServiceDescription service_description( - "ANH Galaxy Service", + "Galaxy Service", "galaxy", "0.1", "127.0.0.1", diff --git a/src/swganh_core/login/login_service.cc b/src/swganh_core/login/login_service.cc index 2a54261db..c9f621c26 100644 --- a/src/swganh_core/login/login_service.cc +++ b/src/swganh_core/login/login_service.cc @@ -74,7 +74,7 @@ service::ServiceDescription LoginService::GetServiceDescription() { auto listen_address = Resolve(listen_address_); service::ServiceDescription service_description( - "ANH Login Service", + "Login Service", "login", "0.1", listen_address, diff --git a/src/swganh_core/player/player_service.cc b/src/swganh_core/player/player_service.cc index 28f3340c5..634af8c1a 100644 --- a/src/swganh_core/player/player_service.cc +++ b/src/swganh_core/player/player_service.cc @@ -60,11 +60,6 @@ void PlayerService::Startup() GetService("SimulationService"); } -void PlayerService::CleanupPlayerState(shared_ptr player) -{ - -} - void PlayerService::OnPlayerEnter(shared_ptr player) { if (player) diff --git a/src/swganh_core/player/player_service.h b/src/swganh_core/player/player_service.h index d028f19e8..a3433df5a 100644 --- a/src/swganh_core/player/player_service.h +++ b/src/swganh_core/player/player_service.h @@ -20,31 +20,47 @@ namespace simulation { namespace swganh { namespace player { - class PlayerService : public swganh::player::PlayerServiceInterface - { - public: - PlayerService(swganh::app::SwganhKernel* kernel); +/** +* Provides basic functionality of player logout +*/ +class PlayerService : public swganh::player::PlayerServiceInterface +{ +public: + /** + * Creates a new instance + */ + PlayerService(swganh::app::SwganhKernel* kernel); - void Startup(); + /** + * Called on startup + */ + void Startup(); - swganh::service::ServiceDescription GetServiceDescription(); + /** + * @return the service description for this service + */ + swganh::service::ServiceDescription GetServiceDescription(); - void CleanupPlayerState(std::shared_ptr player); + /** + * Called when a player enters the game + */ + void OnPlayerEnter(std::shared_ptr player); - void OnPlayerEnter(std::shared_ptr player); + /** + * Called when a player exits the game + */ + void OnPlayerExit(std::shared_ptr player); +private: + void RemoveClientTimerHandler_( + const boost::system::error_code& e, + std::shared_ptr timer, + int delay_in_secs, + std::shared_ptr controller); - void OnPlayerExit(std::shared_ptr player); - private: - void RemoveClientTimerHandler_( - const boost::system::error_code& e, - std::shared_ptr timer, - int delay_in_secs, - std::shared_ptr controller); - - swganh::app::SwganhKernel* kernel_; - swganh::simulation::SimulationServiceInterface* simulation_service_; - swganh::CallbackId player_selected_callback_; - swganh::CallbackId player_removed_; - }; + swganh::app::SwganhKernel* kernel_; + swganh::simulation::SimulationServiceInterface* simulation_service_; + swganh::CallbackId player_selected_callback_; + swganh::CallbackId player_removed_; +}; }} // swganh::player diff --git a/src/swganh_core/spawn/spawn_service.cc b/src/swganh_core/spawn/spawn_service.cc index 1fc91b789..825f26622 100644 --- a/src/swganh_core/spawn/spawn_service.cc +++ b/src/swganh_core/spawn/spawn_service.cc @@ -29,7 +29,7 @@ using namespace swganh::simulation; SpawnService::SpawnService(SwganhKernel* kernel) : kernel_(kernel) { - kernel_->GetEventDispatcher()->Subscribe("SceneManager:NewScene", [&] (const std::shared_ptr& newEvent) + /*kernel_->GetEventDispatcher()->Subscribe("SceneManager:NewScene", [&] (const std::shared_ptr& newEvent) { auto real_event = std::static_pointer_cast(newEvent); @@ -76,7 +76,7 @@ SpawnService::SpawnService(SwganhKernel* kernel) : kernel_(kernel) } } }); - + */ /* Dont need this now, but we might later. kernel_->GetEventDispatcher()->Subscribe("SceneManager:DestroyScene", [&] (const std::shared_ptr& newEvent) diff --git a/src/swganh_core/weather/weather_service.cc b/src/swganh_core/weather/weather_service.cc index 1fac0902a..b18c47128 100644 --- a/src/swganh_core/weather/weather_service.cc +++ b/src/swganh_core/weather/weather_service.cc @@ -50,7 +50,9 @@ WeatherService::WeatherService(SwganhKernel* kernel) }); } -WeatherService::~WeatherService(){ +WeatherService::~WeatherService() +{ + weather_timer_->cancel(); } void WeatherService::OnPlayerEnter(shared_ptr player_obj) From c258d0b6657f3ecfced1fd415ed70c26b1c19717 Mon Sep 17 00:00:00 2001 From: Richard Laughlin Date: Thu, 4 Oct 2012 21:21:59 -0400 Subject: [PATCH 5/5] Fixed non-combat commands to execute immediately. --- data/scripts/commands/burstrun.py | 12 ++-- data/scripts/commands/kneel.py | 2 +- data/scripts/commands/stand.py | 3 +- data/scripts/commands/transferItemMisc.py | 4 +- data/scripts/radials/elevator.py | 3 +- examples/add objects to player.txt | 16 ++--- examples/create composite set.py | 64 +++++++++---------- .../command/base_combat_command_binding.cc | 2 +- src/swganh/command/command_binding.cc | 4 +- src/swganh_core/command/command_queue.cc | 3 +- 10 files changed, 58 insertions(+), 55 deletions(-) diff --git a/data/scripts/commands/burstrun.py b/data/scripts/commands/burstrun.py index d1c26549c..ddb06a55d 100644 --- a/data/scripts/commands/burstrun.py +++ b/data/scripts/commands/burstrun.py @@ -5,7 +5,7 @@ class BurstRunCommand(BaseSwgCommand): base_run_duration_ms = 15000 base_cooldate_timer_ms = 60000 - def Validate(self): + def validate(self): actor = self.getActor() if actor == None: @@ -23,7 +23,7 @@ def Validate(self): return True - def Run(self): + def run(self): actor = self.getActor() actor.setFlag("BurstRunning") @@ -34,9 +34,9 @@ def Run(self): actor.sendSystemMessage('cbt_spam', 'burstrun_start_single') - return Callback(self.EndBurstRun, self.base_run_duration_ms) + return Callback(self.endBurstRun, self.base_run_duration_ms) - def EndBurstRun(self): + def endBurstRun(self): actor = self.getActor() actor.removeFlag("BurstRunning") @@ -47,9 +47,9 @@ def EndBurstRun(self): actor.sendSystemMessage('cbt_spam', 'burstrun_stop_single') actor.sendSystemMessage('combat_effects', 'burst_run_tired') - return Callback(self.EndBurstRunCooldown, self.base_cooldate_timer_ms - self.base_run_duration_ms) + return Callback(self.endBurstRunCooldown, self.base_cooldate_timer_ms - self.base_run_duration_ms) - def EndBurstRunCooldown(self): + def endBurstRunCooldown(self): actor = self.getActor() actor.removeFlag("BurstRunCooldown") diff --git a/data/scripts/commands/kneel.py b/data/scripts/commands/kneel.py index 5d1120b10..5c79594bb 100644 --- a/data/scripts/commands/kneel.py +++ b/data/scripts/commands/kneel.py @@ -2,7 +2,7 @@ from swgpy import POSTURE class KneelCommand(BaseSwgCommand): - def Run(self): + def run(self): actor = self.getActor() actor.posture = POSTURE.CROUCHED diff --git a/data/scripts/commands/stand.py b/data/scripts/commands/stand.py index 1533de844..639b69bba 100644 --- a/data/scripts/commands/stand.py +++ b/data/scripts/commands/stand.py @@ -5,7 +5,8 @@ class StandCommand(BaseSwgCommand): base_run_speed = 5.75 def run(self): + print("test") actor = self.getActor() - + print("test") actor.posture = POSTURE.UPRIGHT actor.run_speed = self.base_run_speed diff --git a/data/scripts/commands/transferItemMisc.py b/data/scripts/commands/transferItemMisc.py index 07b064ceb..85350305f 100644 --- a/data/scripts/commands/transferItemMisc.py +++ b/data/scripts/commands/transferItemMisc.py @@ -6,5 +6,5 @@ class TransferItem(BaseSwgCommand): def run(self): split = re.split('\W+', self.getCommandString()) container_id = split[1] - container = self.getKernel().serviceManager().simulationService().findObjectById(int(container_id)) - self.getTarget().container().transfer(self.getActor(), self.getTarget(), container) \ No newline at end of file + c = self.getKernel().serviceManager().simulationService().findObjectById(int(container_id)) + self.getTarget().container().transfer(self.getActor(), self.getTarget(), c) \ No newline at end of file diff --git a/data/scripts/radials/elevator.py b/data/scripts/radials/elevator.py index 41320e0af..745dba4ac 100644 --- a/data/scripts/radials/elevator.py +++ b/data/scripts/radials/elevator.py @@ -37,6 +37,7 @@ def handleElevatorAction(self, target, owner, expected_elevator_action): if data.going_down == expected_elevator_action: #Move the player destination_cell = simulation_service.findObjectById(data.dst_cell) - owner.updatePosition(destination_cell, data.dst_position, data.dst_orientation) + new_position = vector3(owner.getPosition().x, data.dst_position.y, owner.getPosition().z) + owner.updatePosition(destination_cell, new_position, owner.getOrientation()) #Perform Effect \ No newline at end of file diff --git a/examples/add objects to player.txt b/examples/add objects to player.txt index b942fb3c7..b852a5fa5 100644 --- a/examples/add objects to player.txt +++ b/examples/add objects to player.txt @@ -1,15 +1,15 @@ from swgpy import * -simulation = kernel.service_manager().simulation_service() -armor = simulation.createObject('object/tangible/wearables/armor/composite/shared_armor_composite_helmet.iff', ContainerPermission.Default, False, False) +simulation = kernel.serviceManager().simulationService() +armor = simulation.createObject('object/tangible/wearables/armor/composite/shared_armor_composite_helmet.iff', ContainerPermission.DEFAULT, False, False) armor.condition = 0 armor.max_condition = 1000 -actor = simulation.findObject('Kayope Seemec') -equipment = kernel.service_manager().equipment_service() -inventory = equipment.GetEquippedObject(actor, "inventory") -inventory.Add(actor, armor) +actor = simulation.findObject('Skivossk Iskorx') +equipment = kernel.serviceManager().equipmentService() +inventory = equipment.getEquippedObject(actor, "inventory") +inventory.add(actor, armor) -boots = simulation.createObject('object/tangible/wearables/boots/shared_boots_s15.iff', ContainerPermission.Default, False, False) -inventory.Add(actor, boots) +boots = simulation.createObject('object/tangible/wearables/boots/shared_boots_s15.iff', ContainerPermission.DEFAULT, False, False) +inventory.add(actor, boots) boots.condition = 0 boots.max_condition = 1000 diff --git a/examples/create composite set.py b/examples/create composite set.py index 2ea3e9260..a1ffaf2bd 100644 --- a/examples/create composite set.py +++ b/examples/create composite set.py @@ -1,62 +1,62 @@ -bicep_l = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bicep_l.iff', ContainerPermission.Default, False, False) -bicep_r = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bicep_r.iff', ContainerPermission.Default, False, False) -belt = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_belt.iff', ContainerPermission.Default, False, False) -boots = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_shoes.iff', ContainerPermission.Default, False, False) -bicep_l = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bracer_l.iff', ContainerPermission.Default, False, False) -bracer_r = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bracer_r.iff', ContainerPermission.Default, False, False) -bracer_l = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bicep_l.iff', ContainerPermission.Default, False, False) -chest = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_chest_plate.iff', ContainerPermission.Default, False, False) -gloves = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_gloves.iff', ContainerPermission.Default, False, False) -leggings = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_leggings.iff', ContainerPermission.Default, False, False) -helmet = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_helmet.iff', ContainerPermission.Default, False, False) - -helmet.stf_name('wearables_name', 'armor_mandalorian_helmet') +bicep_l = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bicep_l.iff', ContainerPermission.DEFAULT, False, False) +bicep_r = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bicep_r.iff', ContainerPermission.DEFAULT, False, False) +belt = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_belt.iff', ContainerPermission.DEFAULT, False, False) +boots = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_shoes.iff', ContainerPermission.DEFAULT, False, False) +bicep_l = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bracer_l.iff', ContainerPermission.DEFAULT, False, False) +bracer_r = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bracer_r.iff', ContainerPermission.DEFAULT, False, False) +bracer_l = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_bicep_l.iff', ContainerPermission.DEFAULT, False, False) +chest = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_chest_plate.iff', ContainerPermission.DEFAULT, False, False) +gloves = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_gloves.iff', ContainerPermission.DEFAULT, False, False) +leggings = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_leggings.iff', ContainerPermission.DEFAULT, False, False) +helmet = simulation.createObject('object/tangible/wearables/armor/mandalorian/shared_armor_mandalorian_helmet.iff', ContainerPermission.DEFAULT, False, False) + +helmet.stfName('wearables_name', 'armor_mandalorian_helmet') helmet.condition = 0 helmet.max_condition = 1000 -inventory.Add(actor, helmet) +inventory.add(actor, helmet) -belt.stf_name('wearables_name', 'armor_mandalorian_helmet') +belt.stfName('wearables_name', 'armor_mandalorian_helmet') belt.condition = 0 belt.max_condition = 1000 -inventory.Add(actor, belt) +inventory.add(actor, belt) -bicep_l.stf_name('wearables_name', 'armor_mandalorian_bicep_l') +bicep_l.stfName('wearables_name', 'armor_mandalorian_bicep_l') bicep_l.condition = 0 bicep_l.max_condition = 1000 -inventory.Add(actor, bicep_l) +inventory.add(actor, bicep_l) -bicep_r.stf_name('wearables_name', 'armor_mandalorian_bicep_r') +bicep_r.stfName('wearables_name', 'armor_mandalorian_bicep_r') bicep_r.condition = 0 bicep_r.max_condition = 1000 -inventory.Add(actor, bicep_r) +inventory.add(actor, bicep_r) -boots.stf_name('wearables_name', 'armor_mandalorian_shoes') +boots.stfName('wearables_name', 'armor_mandalorian_shoes') boots.condition = 0 boots.max_condition = 1000 -inventory.Add(actor, boots) +inventory.add(actor, boots) -bracer_l.stf_name('wearables_name', 'armor_mandalorian_bracer_l') +bracer_l.stfName('wearables_name', 'armor_mandalorian_bracer_l') bracer_l.condition = 0 bracer_l.max_condition = 1000 -inventory.Add(actor, bracer_l) +inventory.add(actor, bracer_l) -bracer_r.stf_name('wearables_name', 'armor_mandalorian_bracer_r') +bracer_r.stfName('wearables_name', 'armor_mandalorian_bracer_r') bracer_r.condition = 0 bracer_r.max_condition = 1000 -inventory.Add(actor, bracer_r) +inventory.add(actor, bracer_r) -chest.stf_name('wearables_name', 'armor_mandalorian_chest_plate') +chest.stfName('wearables_name', 'armor_mandalorian_chest_plate') chest.condition = 0 chest.max_condition = 1000 -inventory.Add(actor, chest) +inventory.add(actor, chest) -gloves.stf_name('wearables_name', 'armor_mandalorian_gloves') +gloves.stfName('wearables_name', 'armor_mandalorian_gloves') gloves.condition = 0 gloves.max_condition = 1000 -inventory.Add(actor, gloves) +inventory.add(actor, gloves) -leggings.stf_name('wearables_name', 'armor_mandalorian_pants') +leggings.stfName('wearables_name', 'armor_mandalorian_pants') leggings.condition = 0 leggings.max_condition = 1000 -inventory.Add(actor, leggings) +inventory.add(actor, leggings) diff --git a/src/swganh/command/base_combat_command_binding.cc b/src/swganh/command/base_combat_command_binding.cc index cb56fb6a2..bc161cca7 100644 --- a/src/swganh/command/base_combat_command_binding.cc +++ b/src/swganh/command/base_combat_command_binding.cc @@ -41,7 +41,7 @@ struct BaseCombatCommandWrapper : BaseCombatCommand, bp::wrapperget_override("Run")) + if (bp::override run = this->get_override("run")) { bp::object result = run(); diff --git a/src/swganh/command/command_binding.cc b/src/swganh/command/command_binding.cc index 91d3ea7de..af0d15ea4 100644 --- a/src/swganh/command/command_binding.cc +++ b/src/swganh/command/command_binding.cc @@ -40,7 +40,7 @@ struct BaseSwgCommandWrapper : BaseSwgCommand, bp::wrapper ScopedGilLock lock; try { - auto validate = this->get_override("Validate"); + auto validate = this->get_override("validate"); if (validate) { validated = validate(); @@ -66,7 +66,7 @@ struct BaseSwgCommandWrapper : BaseSwgCommand, bp::wrapper ScopedGilLock lock; try { - bp::object result = this->get_override("Run")(); + bp::object result = this->get_override("run")(); if (!result.is_none()) { diff --git a/src/swganh_core/command/command_queue.cc b/src/swganh_core/command/command_queue.cc index 79bc2a7ee..598c5b3ff 100644 --- a/src/swganh_core/command/command_queue.cc +++ b/src/swganh_core/command/command_queue.cc @@ -135,7 +135,8 @@ void CommandQueue::Notify() { ProcessCommand(command); - timer_.expires_from_now(boost::posix_time::milliseconds(static_cast(command->GetDefaultTime() * 1000))); + std::shared_ptr actor = std::static_pointer_cast(command->GetActor()); + timer_.expires_from_now(boost::posix_time::milliseconds(static_cast((actor->HasState(swganh::object::COMBAT)) ? command->GetDefaultTime() * 1000 : 0))); timer_.async_wait([this] (const boost::system::error_code& ec) { if (!ec && this)