Jump to content
×
×
  • Create New...
  • 0

DD Camé ( implantation)


themantheman

Question

Salut

J'ai prit les source de Baskow pour voir comment il a implanter les DD camé ,pour pouvoir le mettre sur mon Ancestra remake rev41

 

J'ai vu qu'il a changer des truc dont voici les lignes :

 

-Dagodindes

package objects;

import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;

import common.Constants;
import common.SQLManager;
import common.World;

import objects.Personnage.Stats;

public class Dragodinde {

private int _id;
private int _color;
private int _sexe;
private int _amour;
private int _endurance;
private int _level;
private long _exp;
private String _nom;
private int _fatigue;
private int _energie;
private int _reprod;
private int _maturite;
private int _serenite;
private Stats _stats = new Stats();
private String _ancetres = ",,,,,,,,,,,,,";
private ArrayList _items = new ArrayList();
   /*Baskwo:Cameleone
   Mathias52: Modification */
private List capacite = new ArrayList(2);
String _ability = ",";


public Dragodinde(int color)
{
	_id = World.getNextIdForMount();
	_color = color;
	_level = 1;
	_exp = 0;
	_nom = "SansNom";
	_fatigue = 0;
	_energie = getMaxEnergie();
	_reprod = 0;
	_maturite = getMaxMatu();
	_serenite = 0;
	_stats = Constants.getMountStats(_color,_level);
	_ancetres = ",,,,,,,,,,,,,";
       //Baskwo:Cameleone
       _ability = "0";

	World.addDragodinde(this);
	SQLManager.CREATE_MOUNT(this);
}

public Dragodinde(int id, int color, int sexe, int amour, int endurance,
		int level, long exp, String nom, int fatigue,
		int energie, int reprod, int maturite, int serenite,String items,String anc,
           //Baskwo:Cameleone
           String ability)
{
	_id = id;
	_color = color;
	_sexe = sexe;
	_amour = amour;
	_endurance = endurance;
	_level = level;
	_exp = exp;
	_nom = nom;
	_fatigue = fatigue;
	_energie = energie;
	_reprod = reprod;
	_maturite = maturite;
	_serenite = serenite;
	_ancetres = anc;
	_stats = Constants.getMountStats(_color,_level);
       /*Baskwo:Cameleone
       Mathias52 : Modification*/
        _ability = ability;
        for (String s : ability.split(",",2)) {// 2 : Maximum 2 capa 
           if (s != null) {
           int a = Integer.parseInt(s);
       try{
           capacite.add(a);
       }catch(Exception e){}
   }
}
	for(String str : items.split(";"))
	{
		try
		{
			Objet obj = World.getObjet(Integer.parseInt(str));
			if(obj != null)_items.add(obj);
		}catch(Exception e){continue;}
	}
}

public int get_id() {
	return _id;
}

public int get_color() {
	return _color;
}

public int get_sexe() {
	return _sexe;
}

public int get_amour() {
	return _amour;
}

public String get_ancetres() {
	return _ancetres;
}

public int get_endurance() {
	return _endurance;
}
public int get_level() {
	return _level;
}

public long get_exp() {
	return _exp;
}

public String get_nom() {
	return _nom;
}

public int get_fatigue() {
	return _fatigue;
}

public int get_energie() {
	return _energie;
}

public int get_reprod() {
	return _reprod;
}

public int get_maturite() {
	return _maturite;
}

public int get_serenite() {
	return _serenite;
}

public Stats get_stats() {
	return _stats;
}

public ArrayList get_items() {
	return _items;
}

public String parse()
{
	String str = _id+":";
	str += _color+":";
	str += _ancetres+":";
	str += ",," + _ability + ":";//Baskwo:Cameleone
    	str += _nom+":";
	str += _sexe+":";
	str += parseXpString()+":";
	str += _level+":";
	str += "1"+":";//FIXME
	str += getTotalPod()+":";
	str += "0"+":";//FIXME podActuel?
	str += _endurance+",10000:";
	str += _maturite+","+getMaxMatu()+":";
	str += _energie+","+getMaxEnergie()+":";
	str += _serenite+",-10000,10000:";
	str += _amour+",10000:";
	str += "-1"+":";//FIXME
	str += "0"+":";//FIXME
	str += parseStats()+":";
	str += _fatigue+",240:";
	str += _reprod+",20:";
	return str;
}

private String parseStats()
{
	String stats = "";
	for(Entry entry : _stats.getMap().entrySet())
	{
		if(entry.getValue() <= 0)continue;
		if(stats.length() >0)stats += ",";
		stats += Integer.toHexString(entry.getKey())+"#"+Integer.toHexString(entry.getValue())+"#0#0";
	}
	return stats;
}

private int getMaxEnergie()
{
	int energie = 10000;
	return energie;
}

private int getMaxMatu()
{
	int matu = 1000;
	return matu;
}

private int getTotalPod()
{
	int pod = 1000;

	return pod;
}

private String parseXpString()
{
	return _exp+","+World.getExpLevel(_level).dinde+","+World.getExpLevel(_level+1).dinde;
}

public boolean isMountable()
{
	if(_energie <10
	|| _maturite < getMaxMatu()
	|| _fatigue == 240)return false;
	return true;
}

public String getItemsId()
{
	String str = "";
	for(Objet obj : _items)str += (str.length()>0?";":"")+obj.getGuid();
	return str;
}

public void setName(String packet)
{
	_nom = packet;
	SQLManager.UPDATE_MOUNT_INFOS(this);
}

public void addXp(long amount)
{
	_exp += amount;

	while(_exp >= World.getExpLevel(_level+1).dinde && _level<100)
		levelUp();

}

public void levelUp()
{
	_level++;
	_stats = Constants.getMountStats(_color,_level);
}
   //Baskwo:Cameleone
   public String get_color(String a)
   {
          String b = "";
          if (capacite.contains(9)) b = b + "," + a;
             return _color + b;
   }
   public boolean isCameleone() {
          return capacite.contains(9);
   }
   public String get_ability() {
          return _ability;
   }
   public boolean addCapacity(String capa) {
   int c = 0;
   for(String s : capa.split(",",2)) {
   	if(capacite.size() >= 2) return false;
   	try{
               c = Integer.parseInt(s);
   	}catch(Exception e){}
               if(c != 0) {
               capacite.add(c);
   	}
               if(capacite.size() == 1) {
   		this._ability = capacite.get(0) + ",";
               } else {
                   this._ability = capacite.get(0) + "," + capacite.get(1);
   		}
   	}
   	return true;
   }

}

 

-Action :

case 100://Donner x abileter
                     Dragodinde mount = perso.getMount();
                     World.addDragodinde(
                       new Dragodinde(
                      mount.get_id(),
                      mount.get_color(),
                      mount.get_sexe(),
                      mount.get_amour(),
                      mount.get_endurance(),
                      mount.get_level(),
                      mount.get_exp(),
                      mount.get_nom(),
                      mount.get_fatigue(),
                      mount.get_energie(),
                      mount.get_reprod(),
                      mount.get_maturite(),
                      mount.get_serenite(),
                      mount.getItemsId(),
                      mount.get_ancetres(),
                      args));
                     perso.setMount(World.getDragoByID(mount.get_id()));
                     SocketManager.GAME_SEND_Re_PACKET(perso, "+", World.getDragoByID(mount.get_id()));
                     SQLManager.UPDATE_MOUNT_INFOS(mount);
        break;	

 

-SQLManager :

new Dragodinde
				(
					RS.getInt("id"),
					RS.getInt("color"),
					RS.getInt("sexe"),
					RS.getInt("amour"),
					RS.getInt("endurance"),
					RS.getInt("level"),
					RS.getLong("xp"),
					RS.getString("name"),
					RS.getInt("fatigue"),
					RS.getInt("energie"),
					RS.getInt("reproductions"),
					RS.getInt("maturite"),
					RS.getInt("serenite"),
					RS.getString("items"),
					RS.getString("ancetres"),
					//Baskwo:Cameleone
					RS.getString("ability")
				)

 

Et dans ma BDD j'ai créé une colonnes ability a 0 d'origine.

 

Quand je lance mon serveur , que je chevauche une monture cela est normal.

Ensuite je parle au PNJ ActionID 100 et args 9

Ma monture devient bien Caméléone ( on le voit écrit )

Mais elle en prend pas les couleurs de mon perso ( couleur non par défaut )

 

Quelqu'un aurait une solution ?

 

Merci

 

Link to comment
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

2 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.