Package transientlibs.bindedobjects.gamecontent

Source Code of transientlibs.bindedobjects.gamecontent.Job

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package transientlibs.bindedobjects.gamecontent;

import transientlibs.objects.general.Node;
import transientlibs.tex.ReqList;
import transientlibs.tex.StringAnalyst;
import java.util.ArrayList;
import transientlibs.slick2d.util.Log;
import transientlibs.bindedobjects.core.Binding;
import transientlibs.bindedobjects.core.Req;

/**
*
* @author kibertoad
*/
public class Job extends Node {

    public String LName;
    public String femLName;
    public String desc;
    public ReqList reqs = new ReqList();
    public int glamour;
    public int prestige;
    public int salary;
    public int frequency;

public static ArrayList<Job> jobs = new ArrayList<Job>();

    public static Job lastJob;

public static void loadJobs (){

     if (StringAnalyst.isFileExist("jobs.dat")) {
        StringAnalyst reader = new StringAnalyst();


        reader.openFile("jobs.dat");

        while (!reader.eof) {


        reader.readRow();
        analyzeStringForJobs (reader);
        }

        reader.closeFile();
     }
    }

          public static void analyzeStringForJobs (StringAnalyst analyst) {
        analyzeStringForJobs ("-NO-", analyst);
    }

public static void analyzeStringForJobs (String getString, StringAnalyst analyst) {

   if (!"-NO-".equals(getString)) {analyst.fullStr = getString;}

   analyst.checkForAliases();

        analyst.getNextString();
        String nowStr = analyst.lastStr;

        boolean withResult = false;

        if (nowStr.equals("job")) {

            jobs.add (new Job ());
            lastJob = jobs.get(jobs.size()-1);
            lastJob.ID = analyst.getBinding (Binding.jobBinding);
            lastJob.frequency = 10;

            ReqList.lastReqList = lastJob.reqs;

            withResult = true;

        }

    if (nowStr.equals("name")) {
            lastJob.LName = analyst.restOfRow();
            lastJob.femLName = lastJob.LName;
            withResult = true;
        }

    if (nowStr.equals("femname")) {
            lastJob.femLName = analyst.restOfRow();
            withResult = true;
        }

        if (nowStr.equals("desc")) {
            lastJob.desc = analyst.restOfRow();
            withResult = true;
        }

        if (nowStr.equals("salary")) {
            lastJob.salary = analyst.getNextNumber();
            withResult = true;
        }

        if (nowStr.equals("glamour")) {
            lastJob.glamour = analyst.getNextNumber();
            withResult = true;
        }

        if (nowStr.equals("prestige")) {
            lastJob.prestige = analyst.getNextNumber();
            withResult = true;
        }

        if (nowStr.equals("freq")) {
            lastJob.frequency = analyst.getNextNumber();
            withResult = true;
        }



        if (withResult == false) {withResult = Req.analyzeStringForReqs(analyst.fullStr, analyst);}

        if ((withResult == false) && (nowStr.length()>2) && (!nowStr.startsWith("//"))) {
            Log.error("Unknown string: "+nowStr);}

}

  @Override
    public String name (){
        return LName;
    }

}
TOP

Related Classes of transientlibs.bindedobjects.gamecontent.Job

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.