From: <lpa...@us...> - 2022-01-01 20:41:03
|
Revision: 10012 http://sourceforge.net/p/planeshift/code/10012 Author: lpancallo Date: 2022-01-01 20:41:01 +0000 (Sat, 01 Jan 2022) Log Message: ----------- Fixed bug in npcoperations.cpp and adminmanager.cpp Added comments to clarify code Modified Paths: -------------- trunk/src/npcclient/npcbehave.cpp trunk/src/npcclient/npcoperations.cpp trunk/src/server/actionmanager.cpp trunk/src/server/actionmanager.h trunk/src/server/adminmanager.cpp trunk/src/server/gem.cpp trunk/src/server/usermanager.cpp trunk/src/server/usermanager.h Modified: trunk/src/npcclient/npcbehave.cpp =================================================================== --- trunk/src/npcclient/npcbehave.cpp 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/npcclient/npcbehave.cpp 2022-01-01 20:41:01 UTC (rev 10012) @@ -652,7 +652,7 @@ void BehaviorSet::Advance(csTicks delta, NPC* npc) { - float d = .001 * delta; + float d = .001 * delta; // transforms milliseconds in seconds UpdateNeeds(d, npc); Modified: trunk/src/npcclient/npcoperations.cpp =================================================================== --- trunk/src/npcclient/npcoperations.cpp 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/npcclient/npcoperations.cpp 2022-01-01 20:41:01 UTC (rev 10012) @@ -3372,6 +3372,7 @@ bool outsideRegion = psGameObject::ReplaceNPCVariablesBool(npc, attackOutsideRegion); bool tribe = psGameObject::ReplaceNPCVariablesBool(npc, attackMostHatedTribeTarget); + // search enemy in melee_range if(tribe && npc->GetTribe()) { ent = npc->GetTribe()->GetMostHated(npc, melee_range, outsideRegion, attackInvisible, attackInvincible); @@ -3381,6 +3382,7 @@ ent = npc->GetMostHated(melee_range, outsideRegion, attackInvisible, attackInvincible); } + // search enemy in seek_range if(!ent) { NPCDebug(npc, 8, "No Melee target in range (%2.2f), going to chase!", melee_range); @@ -3820,7 +3822,7 @@ Error2("Invalid argument passed to operation in xml file: %s", value); return false; } - memoryCheck == split[2]; + memoryCheck = split[2]; return true; } else Modified: trunk/src/server/actionmanager.cpp =================================================================== --- trunk/src/server/actionmanager.cpp 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/server/actionmanager.cpp 2022-01-01 20:41:01 UTC (rev 10012) @@ -181,6 +181,8 @@ handled = HandleSelectQuery(topNode, client); } + // If our query didnt find any action locations in database, send the info anyway to the client so + // it can create a new one (must be GM and have GM window open), see ActionHandler::HandleMessage() client side if(!handled) { // evk: Sending to clients with security level 30+ only. @@ -549,6 +551,7 @@ } } + // send back to the client the updated list of action locations for this sector csString xmlMsg; csString escpxml = EscpXML(sectorName); xmlMsg.Format("<location><sector>%s</sector></location>", escpxml.GetData()); @@ -569,7 +572,7 @@ return; } - // Search for matching locations + // Search for matching location by ID csRef<iDocument> doc; csRef<iDocumentNode> root, topNode, node; @@ -611,6 +614,7 @@ delete actionLocation; } + // send back to the client the updated list of action locations for this sector csString xmlMsg; csString escpxml = EscpXML(sectorName); xmlMsg.Format("<location><sector>%s</sector></location>", escpxml.GetData()); Modified: trunk/src/server/actionmanager.h =================================================================== --- trunk/src/server/actionmanager.h 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/server/actionmanager.h 2022-01-01 20:41:01 UTC (rev 10012) @@ -157,7 +157,7 @@ /** * Check if there is an active action location for this client/actionLocation pair. * - * @param actorEID The EID of the actor to remove from the given action location. + * @param actorEID The EID of the actor to check for active action location. * @param actionLocation The location that is triggered for the given actor. */ bool HasActiveTrigger(EID actorEID, const psActionLocation* actionLocation); @@ -165,7 +165,7 @@ /** * Add a new active actionLocation for this client. * - * @param actorEID The EID of the actor to remove from the given action location. + * @param actorEID The EID of the actor to add the given action location. * @param actionLocation The location that is triggered for the given actor. */ void AddActiveTrigger(EID actorEID, const psActionLocation* actionLocation); @@ -201,15 +201,22 @@ // Message Handlers /** - * Handles Query messages from client. + * Handles Query messages from client (QUERY). * * @param xml xml containing query parameters. + * Example: + * + * * @param client The client that sent the message. */ void HandleQueryMessage(csString xml, Client* client); void LoadXML(iDocumentNode* topNode); + + // Find the best action location matching the input parameters like: sector, mesh , poly , point w/in radius , instance bool HandleSelectQuery(iDocumentNode* topNode, Client* client); + + // Launch Examine UI client side or execute script for identified Action Locations bool ProcessMatches(csArray<psActionLocation*> matches, Client* client); /** @@ -216,14 +223,27 @@ * Handles Save messages from client. * * @param xml xml containing query parameters. + * Example: + * <location><id>167</id><masterid>0</masterid><name>torch2</name><sector>hydlaa_plaza</sector> + * <mesh>_s_laanx_fireplaces</mesh><polygon>0</polygon><position><x>-6.170000</x><y>1.150000</y><z>-54.880001</z></position> + * <pos_instance>4294967295</pos_instance><radius>1.000000</radius><triggertype>PROXIMITY</triggertype><responsetype>SCRIPT</responsetype> + * <response>flame_damage</response><active>Y</active></location> + * * @param client The client that sent the message. */ void HandleSaveMessage(csString xml, Client* client); /** - * Handles List messages from client. + * Handles List messages from client (LIST_QUERY) * - * @param xml xml containing query parameters. + * @param xml xml containing sector name for which we want the list of all action locations. + * Example: + * <location><sector>hydlaa_plaza</sector></location> + * + * As a response it will then send to the client an XML with the following format: + * <locations><location>...</location><location>...</location></locations> + * see HandleSaveMessage() desc for content of <location> + * * @param client The client that sent the message. */ void HandleListMessage(csString xml, Client* client); @@ -232,6 +252,9 @@ * Handles Delete messages from client. * * @param xml xml containing query parameters. + * Example: + * <location><id>5030</id></location> + * * @param client The client that sent the message. */ void HandleDeleteMessage(csString xml, Client* client); Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/server/adminmanager.cpp 2022-01-01 20:41:01 UTC (rev 10012) @@ -3885,7 +3885,7 @@ // gets a list of quests of the target if(words.GetCount() == index) { - subCmd == "list"; + subCmd = "list"; } // check for other subcommands else if(subCommandList.IsSubCommand(words[index])) Modified: trunk/src/server/gem.cpp =================================================================== --- trunk/src/server/gem.cpp 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/server/gem.cpp 2022-01-01 20:41:01 UTC (rev 10012) @@ -3893,7 +3893,7 @@ } else // Moving { - // unwork stuff + // If we are moving, we stop any crafting if(GetMode() == PSCHARACTER_MODE_WORK) { SetMode(PSCHARACTER_MODE_PEACE); Modified: trunk/src/server/usermanager.cpp =================================================================== --- trunk/src/server/usermanager.cpp 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/server/usermanager.cpp 2022-01-01 20:41:01 UTC (rev 10012) @@ -1241,9 +1241,11 @@ if(client->GetBuddyListHide() && buddy->GetSecurityLevel() < GM_LEVEL) // Don't tell none GM+ that a GM+ came online continue; + // send to the client UI the information of buddy status psBuddyStatus status(buddy->GetClientNum(), name , logged_in); status.SendMessage(); + // send also text message if(logged_in) { psserver->SendSystemInfo(buddy->GetClientNum(),"%s just joined PlaneShift",name.GetData()); @@ -1269,9 +1271,11 @@ if(buddy->GetSecurityLevel() >= GM_LEVEL) // Don't tell GM+ as they already know continue; + // send to the client UI the information of buddy status psBuddyStatus status(buddy->GetClientNum(), name , logged_in); status.SendMessage(); + // send also text message if(logged_in) { psserver->SendSystemInfo(buddy->GetClientNum(),"%s just joined PlaneShift",name.GetData()); @@ -2361,6 +2365,7 @@ return; } + // check if the second parameters is an EID csString eid_str = msg.target.Slice(4); EID targetEID = EID(strtoul(eid_str.GetDataSafe(), NULL, 10)); Modified: trunk/src/server/usermanager.h =================================================================== --- trunk/src/server/usermanager.h 2022-01-01 20:38:22 UTC (rev 10011) +++ trunk/src/server/usermanager.h 2022-01-01 20:41:01 UTC (rev 10012) @@ -599,7 +599,7 @@ void HandleTargetEvent(MsgEntry* me,Client* client); /** - * + * Called when the player clicks on "Enter" from an action location Interact Menu */ void HandleEntranceMessage(MsgEntry* me, Client* client); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |