Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bounty/Request: Adding Resource Stats to Survey Droid Mails (CLAIMED!)
#1
Lightbulb 
Hi guys,

Me again, if anyone is interested we have another bounty up:

We hereby offer a bounty of $25 $75, to the first person that posts here (and we can successfuly replicate it) the code/file changes required to excecute this modification.

We are attempting to add stats to the email the survey droids send when deployed, ive already done most of the research and ive narrowed it to one file, i tried editing it but the original coder used a very complex (but efficient) virtual table array system, and that is way beyond my skills, my "decent" attempt failed miserably, but at least i know its a skill restriction not an actual imposibility

If anyone is willing to give it a go (or if you already did this on ur server and you wish to earn some easy cash) heres what ive got so far, im attaching the current modified file as much as i could figure it out, im also attaching the error log the server throws when trying to compile/build it.

Im sure one of you will take a quick look at it and figure it out in 2 seconds.

Thanks again!

Debug Log:
Code:
In file included from ../../../src/server/zone/managers/resource/InterplanetarySurveyImplementation.cpp:7:0:
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h: In member function ‘virtual void InterplanetarySurveyTask::run()’:
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:40:56: error: no matching function for call to ‘server::zone::objects::resource::ResourceSpawn::getAttributeAndValue()’
   String attrib = resourceSpawn->getAttributeAndValue();
                                                       ^
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:40:56: note: candidate is:
In file included from ../../../src/server/zone/managers/resource/resourcespawner/resourcemap/ResourceMap.h:14:0,
                from ../../../src/server/zone/managers/resource/resourcespawner/ResourceSpawner.h:19,
                from ../../../src/autogen/server/zone/managers/resource/ResourceManager.h:89,
                from ../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:12,
                from ../../../src/server/zone/managers/resource/InterplanetarySurveyImplementation.cpp:7:
../../../src/autogen/server/zone/objects/resource/ResourceSpawn.h:175:6: note: int server::zone::objects::resource::ResourceSpawn::getAttributeAndValue(sys::lang::String&, int)
 int getAttributeAndValue(String& attribute, int index);
     ^
../../../src/autogen/server/zone/objects/resource/ResourceSpawn.h:175:6: note:   candidate expects 2 arguments, 0 provided
In file included from ../../../src/server/zone/managers/resource/InterplanetarySurveyImplementation.cpp:7:0:
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:64:35: error: ‘class sys::lang::String’ has no member named ‘get’
   Vector<String>* alist = attrib.get(attrib);
                                  ^
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:71:12: error: ‘class sys::lang::String’ has no member named ‘put’
    attrib.put(attrib,alist);
           ^
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:120:35: error: ‘attrib’ was not declared in this scope
     Vector<String>* attriblist = attrib.get(ResName);
                                  ^
In file included from ../../../src/server/zone/objects/player/sessions/InterplanetarySurveyDroidSessionImplementation.cpp:11:0:
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h: In member function ‘virtual void InterplanetarySurveyTask::run()’:
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:40:56: error: no matching function for call to ‘server::zone::objects::resource::ResourceSpawn::getAttributeAndValue()’
   String attrib = resourceSpawn->getAttributeAndValue();
                                                       ^
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:40:56: note: candidate is:
In file included from ../../../src/server/zone/managers/resource/resourcespawner/resourcemap/ResourceMap.h:14:0,
                from ../../../src/server/zone/managers/resource/resourcespawner/ResourceSpawner.h:19,
                from ../../../src/autogen/server/zone/managers/resource/ResourceManager.h:89,
                from ../../../src/server/zone/objects/player/sessions/InterplanetarySurveyDroidSessionImplementation.cpp:2:
../../../src/autogen/server/zone/objects/resource/ResourceSpawn.h:175:6: note: int server::zone::objects::resource::ResourceSpawn::getAttributeAndValue(sys::lang::String&, int)
 int getAttributeAndValue(String& attribute, int index);
     ^
../../../src/autogen/server/zone/objects/resource/ResourceSpawn.h:175:6: note:   candidate expects 2 arguments, 0 provided
In file included from ../../../src/server/zone/objects/player/sessions/InterplanetarySurveyDroidSessionImplementation.cpp:11:0:
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:64:35: error: ‘class sys::lang::String’ has no member named ‘get’
   Vector<String>* alist = attrib.get(attrib);
                                  ^
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:71:12: error: ‘class sys::lang::String’ has no member named ‘put’
    attrib.put(attrib,alist);
           ^
../../../src/server/zone/managers/resource/InterplanetarySurveyTask.h:120:35: error: ‘attrib’ was not declared in this scope
     Vector<String>* attriblist = attrib.get(ResName);
                                  ^
Makefile:7988: recipe for target 'server/zone/managers/resource/InterplanetarySurveyImplementation.o' failed
make[3]: *** [server/zone/managers/resource/InterplanetarySurveyImplementation.o] Error 1
Makefile:7988: recipe for target 'server/zone/objects/player/sessions/InterplanetarySurveyDroidSessionImplementation.o' failed
make[3]: *** [server/zone/objects/player/sessions/InterplanetarySurveyDroidSessionImplementation.o] Error 1
make[3]: Target 'all' not remade because of errors.
make[3]: Leaving directory '/home/swgemu/workspace/Core3/MMOCoreORB/build/unix/src'
make[3]: Entering directory '/home/swgemu/workspace/Core3/MMOCoreORB/build/unix'
make[3]: Leaving directory '/home/swgemu/workspace/Core3/MMOCoreORB/build/unix'
Makefile:417: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/swgemu/workspace/Core3/MMOCoreORB/build/unix'
Makefile:357: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/swgemu/workspace/Core3/MMOCoreORB/build/unix'
Makefile:57: recipe for target 'build' failed
make: *** [build] Error 2
** BUILD FAILED **





InterplanetarySurveyTask.h
Code:
/*
* InterplanetrySurveyTask.h
*
*  Created on: 6/8/2014
*      Author: washu
*/

#ifndef INTERPLANETARYSURVERYTASK_H_
#define INTERPLANETARYSURVERYTASK_H_

#include "server/ServerCore.h"
#include "server/zone/managers/resource/ResourceManager.h"
#include "server/chat/ChatManager.h"
#include "server/zone/managers/stringid/StringIdManager.h"

class InterplanetarySurveyTask : public Task {
    ManagedReference<InterplanetarySurvey*> surveyData;

public:

    InterplanetarySurveyTask(InterplanetarySurvey* survey) {
        surveyData = survey;
    }

    void run() {
        // Determine what planet and type, and pull results
        ManagedReference<ResourceManager*> rmanager = ServerCore::getZoneServer()->getResourceManager();
        Vector<ManagedReference<ResourceSpawn*> > resources;
        rmanager->getResourceListByType(resources, surveyData->getSurveyToolType(), surveyData->getPlanet());
        // format email and send
        ManagedReference<ResourceSpawn*> resourceSpawn;
        // We need to sort this by family name
        HashTable<String, Vector<String>* > mapped;
        HashTable<String, Vector<String>* > typeMap;
        for(int i=0;i<resources.size();i++) {
            resourceSpawn = resources.get(i);
            String family = resourceSpawn->getFamilyName();
            String type = resourceSpawn->getFinalClass();
            String name = resourceSpawn->getName();
            String attrib = resourceSpawn->getAttributeAndValue();
            // map type to family
            Vector<String>* list = typeMap.get(family);
            if (list != NULL) {
                if (!list->contains(type))
                    list->add(type);
            } else {
                list = new Vector<String>();
                list->add(type);
                typeMap.put(family,list);
            }

            // map type to spawn name
            Vector<String>* mlist = mapped.get(type);
            if (mlist != NULL) {
                if (!mlist->contains(name))
                    mlist->add(name);
            } else {
                mlist = new Vector<String>();
                mlist->add(name);
                mapped.put(type,mlist);
            }
            
            // map attributes to spawn name
            Vector<String>* alist = attrib.get(attrib);
            if (alist != NULL) {
                if (!alist->contains(name))
                    alist->add(name);
            } else {
                alist = new Vector<String>();
                alist->add(name);
                attrib.put(attrib,alist);
            }
        }
        // Create Email:
        StringBuffer body;

        String sender = "interplanetary survey droid";
        Reference<StringIdManager* > stringIdManager = StringIdManager::instance();

        String planetName = surveyData->getPlanet();
        planetName[0] = toupper(planetName[0]);

        String sType = surveyData->getSurveyType();
        // Some override for untranslated names
        if (sType == "floral_resources") {
            sType = "Floral";
        }
        if (sType == "energy_renewable_unlimited_solar") {
            sType = "Solar";
        }
        if (sType == "energy_renewable_unlimited_wind") {
            sType = "Wind";
        }
        StringBuffer tBuff;
        char tmp = sType.charAt(0);
        tmp = toupper(tmp);
        tBuff.append(tmp);
        tBuff.append(sType.subString(1));
        String surveyType = tBuff.toString();
        UnicodeString subject(String("Interplanetary Survey: " + planetName  + " - " + surveyType));
        body << "Incoming planetary survey report...\n\n";
        body << "\\#pcontrast3 Planet: \\#pcontrast1 " << planetName <<"\n";
        body << "\\#pcontrast3 Resource Class: \\#pcontrast1 " << surveyType << "\n\n";
        body << "\\#pcontrast3 Resources located...\\#.\n\n";
        HashTableIterator<String, Vector<String>* > familyit = typeMap.iterator();
        // Get Family
        while(familyit.hasNext()) {
            String family = familyit.getNextKey();
            Vector<String>* tValues = typeMap.get(family);
            body << family << "\n";
            // Get Type
            for(int i=0;i<tValues->size();i++) {
                String sType = tValues->get(i);
                body << "\t" << sType << "\n";
                Vector<String>* namelist = mapped.get(sType);
                // Get Name
                for(int j=0;j<namelist->size();j++) {
                    String ResName = namelist->get(j);
                    body << "\t\t\\#pcontrast1 " << ResName << "\\#.\n";
                    Vector<String>* attriblist = attrib.get(ResName);
                    // Get Attributes
                    for(int k=0;k<attriblist->size();k++) {
                        String attribs = attriblist->get(j);
                        body << "\t\t\\#pcontrast4 " << attribs << "\\#.\n";
                    }
                }
            }
        }
        UnicodeString bodyString(body.toString());
        ManagedReference<ChatManager*> chat = ServerCore::getZoneServer()->getChatManager();
        chat->sendMail(sender, subject, bodyString, surveyData->getRequestor());
        // mark it as run and delete from the database
        surveyData->setExecuted(true);
        if (surveyData->isPersistent())
            ObjectManager::instance()->destroyObjectFromDatabase(surveyData->_getObjectID());
    }

};

#endif /* INTERPLANETARYSURVERYTASK_H_ */


Attached Files
.txt   InterplanetarySurveyTask.h.txt (Size: 4.53 KB / Downloads: 1)
 
Reply
#2
Ook! so bumping this to a more handsome reward seems in order lol
 
Reply
#3
We have that working on our server. Let me check with our other admin who created it to see if he wants to release it Smile
 
Reply
#4
This bounty has been claimed!, will post details of it along with relevant files and credit in a few moments!

Thanks everyone for looking!
 
Reply
#5
Attached is the code to reproduce the mod

All credit for access to this mod goes to Sidious and Savage from SWG Rogue One http://www.swgrogueone.com/

We post it here in the spirit of sharing so that others may benefit from this mod as well


Attached Files
.txt   InterplanetarySurveyTask.h.txt (Size: 5.87 KB / Downloads: 10)
 
Reply
  



Forum Jump:


Browsing: 1 Guest(s)