void NiDefaultAVObjectPalette::ReplaceObj( const Ref<NiAVObject> newobj, const Ref<NiAVObject> oldobj ) {
  for (vector<AVObject>::iterator itr = objs.begin(); itr != objs.end(); ++itr) {
    if ( (*itr).avObject == oldobj ) {
      (*itr).name = newobj->GetName();
      (*itr).avObject = newobj;
    }
  }
}
bool NiDefaultAVObjectPalette::AddObj( Ref<NiAVObject > obj ) {
  for (vector<AVObject>::iterator itr = objs.begin(); itr != objs.end(); ++itr) {
    if ( (*itr).avObject == obj ) {
      return false;
    }
  }

  struct AVObject avo;
  avo.name = obj->GetName();
  avo.avObject = obj;

  objs.push_back(avo);
  numObjs++;

  return false;
}
Example #3
0
void User::CreatePlayer(){
	if (this->player != NULL){
		delete this->player;
		this->player = NULL;
		cout << "[WARN] WARNING: Player Object was not destroyed";
	}
	
	ZoneId cZone = this->getWorld();
	//cout << "USER: "******":" << cZone << std::endl;
	
	std::wstring name;
	COMPONENT1_POSITION pos = getZoneSpawnPoint(this->getWorld());
	Ref<Character> chr = this->GetCurrentCharacter();
	if (chr != NULL){
		name = StringToWString(chr->GetName());
		if (!chr->pos.isNull()) pos = chr->pos;
	}
	else{
		name = StringToWString(this->username);
	}
	//1152921507004579166
	//1152921504606846976
	this->player = new PlayerObject(this->GetCurrentCharacter()->charobjid, name);
	Component1 *c1 = this->player->getComponent1();
	c1->setPosition(pos);
	Component4 *c4 = this->player->getComponent4();
	c4->setLevel(this->current->level);
	PLAYER_INFO pi;
	pi.accountID = this->GetID();
	pi.isFreeToPlay = false;
	pi.legoScore = 600;
	c4->setInfo(pi);

	if (chr != NULL){
		CharacterData cd = chr->Data;
		PLAYER_STYLE style;
		style.eyebrowsStyle = cd.minifig.eyebrows;
		style.eyesStyle = cd.minifig.eyes;
		style.hairColor = cd.minifig.haircolor;
		style.hairStyle = cd.minifig.hairstyle;
		style.mouthStyle = cd.minifig.mouth;
		style.pantsColor = cd.minifig.pants;
		style.shirtColor = cd.minifig.shirtcolor;
		this->player->getComponent4()->setStyle(style);
	}
}
void write_breakpoint(BinaryNinja::BinaryView *view, uint64_t start, uint64_t length)
{
  // Sample function to show registering a plugin menu item for a range of bytes.
  // Also possible:
  //   register
  //   register_for_address
  //   register_for_function

  Ref<Architecture> arch = view->GetDefaultArchitecture();
  string arch_name = arch->GetName();

  if (arch_name.compare(0, 3, "x86") == 0) {
    string int3s = string(length, '\xcc');
    view->Write(start, int3s.c_str(), length);
  } else {
    LogError("No support for breakpoint on %s", arch_name.c_str());
  }
}
Example #5
0
void User::getChardata(long long objid, RakNet::BitStream *packet){
	packet->Write((uchar)83);
	packet->Write((ushort)5);
	packet->Write((ulong)4);
	packet->Write((uchar)0);

	LDF *ldf = new LDF();
	ldf->writeS64(L"accountID", this->id);
	ldf->writeS32(L"chatmode", 0); //0 - Normal, 1 - Super
	ldf->writeBOOL(L"editor_enabled", false);
	ldf->writeS32(L"editor_level", 0);
	ldf->writeBOOL(L"freetrial", false);
	ldf->writeS32(L"gmlevel", 0); //0 - Normal, 1 - Mythran
	ldf->writeBOOL(L"legoclub", true);
	ldf->writeS64(L"levelid", 0); //Try e3 04 f4 74 95 51 08 20 if this breaks

	std::wstring name;
	Ref<Character> chr = this->GetCurrentCharacter();
	if (chr != NULL){
		name = StringToWString(chr->GetName());
	}
	else{
		name = StringToWString(this->GetUsername());
	}

	ldf->writeWSTRING(L"name", name);
	ldf->writeID(L"objid", objid);
	ldf->writeFLOAT(L"position.x", this->current->pos.x);
	ldf->writeFLOAT(L"position.y", this->current->pos.y);
	ldf->writeFLOAT(L"position.z", this->current->pos.z);
	ldf->writeS64(L"reputation", 100); //Set reputation here
	ldf->writeS32(L"template", 1);

	RakNet::BitStream *xml = new RakNet::BitStream();
	writeXML(xml, "<?xml version=\"1.0\"?>");
	writeXML(xml, "<obj v=\"1\">");
	writeXML(xml, "<buff/>");
	writeXML(xml, "<skil/>");
	writeXML(xml, "<inv>");
	writeXML(xml, "<bag>");
	writeXML(xml, "<b t=\"0\" m=\"24\"/>"); //Items, Default size: 20
	writeXML(xml, "</bag>");
	writeXML(xml, "<items>");
	writeXML(xml, "<in>");
	//Adding items to the inventory:
	//l: LOT, template, type of item
	//id: objid, unique, this object
	//s: slot in inventory
	//b: present and set to "1" if object is linked to the player
	//c: amout of this item
	std::vector<InventoryItem> items = InventoryTable::getItems(objid);
	for (uint k = 0; k < items.size(); k++){
		//long lot = ObjectsTable::getTemplateOfItem(items.at(k).objid);
		ObjectInfo oinfo = ObjectsTable::getItemInfo(items.at(k).objid);
		Logger::log("USER", "CHARDATA", "Adding item " + std::to_string(oinfo.lot) + "[" + std::to_string(oinfo.objid) + "] " + std::to_string(oinfo.spawnerid));

		if (oinfo.lot > -1){
			stringstream adddata;
			adddata << "<i l=\"" << oinfo.lot << "\" id=\"" << items.at(k).objid << "\" s=\"" << items.at(k).slot << "\"";
			if (items.at(k).qnt > 1){
				adddata << " c=\"" << items.at(k).qnt << "\"";
			}
			if (oinfo.spawnerid > -1){
				adddata << " sk=\"" << oinfo.spawnerid << "\"";
			}
			if (items.at(k).linked){
				adddata << " b=\"1\"";
			}
			if (oinfo.spawnerid > -1){
				adddata << ">";

				ObjectInfo sinfo = ObjectsTable::getItemInfo(oinfo.spawnerid);
				if (sinfo.spawnerid == -1){
					//Not an item for an object itself
					if (sinfo.lot == 6416){
						//This is a custom Rocket
						RocketInfo rinfo = ObjectsTable::getRocketInfo(sinfo.objid);
						if (rinfo.cockpit_template > 0 && rinfo.engine_template > 0 && rinfo.nose_cone_template > 0){
							//adddata << "<x ma=\"0:1:" << rinfo.nose_cone_template << "+1:" << rinfo.cockpit_template << "+1:" << rinfo.engine_template << "\"/>";
							Logger::log("USER", "CHARDATA", "Adding Rocket");
						}
					}
				}

				adddata << "</i>";
			}else{
				adddata << "/>";
			}
			writeXML(xml, adddata.str());
		}
	}
	writeXML(xml, "</in>");
	writeXML(xml, "</items>");
	writeXML(xml, "</inv>");
	writeXML(xml, "<mf/>");
	writeXML(xml, "<char cc=\"");
	writeXML(xml, std::to_string(100).c_str());
	writeXML(xml, "\"></char>");
	std::stringstream adddata;
	adddata << "<lvl";
	adddata << " l=\"" << std::to_string(this->current->level) << "\"";
	adddata << "/>";
	writeXML(xml, adddata.str());
	writeXML(xml, "<flag/>");
	writeXML(xml, "<pet/>");
	
	std::vector<MISSION_DATA> missions = MissionsTable::getMissions(objid);
	if (missions.size() > 0){
		writeXML(xml, "<mis>");
		writeXML(xml, "<done>");
		for (unsigned int k = 0; k < missions.size(); k++){
			stringstream adddata;
			adddata << "<m";
			adddata << " id=\"" << std::to_string(missions.at(k).missionid) << "\"";
			adddata << " cts=\"" << std::to_string(missions.at(k).timestamp) << "\"";
			adddata << " cct=\"" << std::to_string(missions.at(k).missioncount) << "\"";
			adddata << "/>";
			writeXML(xml, adddata.str());
		}
		writeXML(xml, "</done>");
		writeXML(xml, "</mis>");
	}
	else{
		writeXML(xml, "<mis/>");
	}
	writeXML(xml, "<mnt/>");
	writeXML(xml, "<dest/>");
	writeXML(xml, "</obj>");

	ldf->writeBYTES(L"xmlData", xml);

	packet->Write((ulong)(ldf->getSize() + 1));
	packet->Write((uchar)0);
	ldf->writeToPacket(packet);
}