You last visited: Today at 15:11
Advertisement
[C#] DarkOrbit - Packets Handler
Discussion on [C#] DarkOrbit - Packets Handler within the .NET Languages forum part of the Coders Den category.
05/06/2012, 09:24
#1
elite*gold: 0
Join Date: Dec 2011
Posts: 141
Received Thanks: 104
[C#] DarkOrbit - Packets Handler
Hi community!
I play on UridiumWars (old Darkorbit - old packets etc.)
I write bot in C#. I write login(work), but I analyze UDOBOT and i have a problem.
I found function:
She takes the arguments:
Code:
Socket ^hSocket, String ^packet
I have socket, but i don't what's going on with packet.
When you call the function:
Code:
PacketHandler(hSocket,p);
Where:
Code:
String ^p = gcnew String(L"");
And i don't understand that.
String p isn't never declared(without up).
Func use "Split(|)" but string is empty o.0.
UDOBot source:
Code:
http://www.2shared.com/file/Fdf7s-uK/UDOBot_v51.html
from
All func:
Code:
void PacketHandler(Socket ^hSocket, String ^packet) {
array<Byte> ^Bytes = Encoding::UTF8->GetBytes(packet); // this is for debugging only...
array<String^> ^args = packet->Split('|');
array<String^> ^NearbyPlayers;
if(args->Length >= 2) {
if(args[0]->Equals(ERROR)) {
int err_code = Convert::ToInt32(args[1]);
String ^err_info = gcnew String(L"No Information available for this Error code.");
if(err_code == 1) {
err_info = gcnew String(L"Your ship has been destroyed.");
}
else if(err_code == 8) {
err_info = gcnew String(L"Your Server ID or Current Map is wrong.");
}
else if(err_code == 41) {
err_info = gcnew String(L"Invalid Session ID.");
}
String ^_Error_Message = String::Format(L"Received Error {0} from the Server!\nError Information: {1}",err_code,err_info);
MessageBox::Show(_Error_Message,L"Error",MessageBoxButtons::OK,MessageBoxIcon::Error);
Application::Exit();
return;
}
if(args[1]->Equals(NEW_MAP)) {
map.set(Convert::ToInt32(args[2]),Convert::ToInt32(args[3]),Convert::ToInt32(args[4]));
_LoadMap(map.getID());
String ^title = String::Format(L"UDOBot v.{0} - {1}",version,hero.getUsername());
setFormText(title);
StreamWriter ^sw = gcnew StreamWriter(L"temp.udbt");
String ^w = String::Format(L"{0};{1};{2};{3};{4}",version,UID,ServerID,SessionID,map.getID());
sw->Write(w);
sw->Flush();
sw->Close();
setIsUppers();
return;
}
if(args[1]->Equals(CREATE_STATION)) {
spacestation.set(Convert::ToInt32(args[5]),Convert::ToInt32(args[7]),Convert::ToInt32(args[8]),args[4],true);
return;
}
if(args[1]->Equals(CREATE_PORTAL)) {
portals.addPortal(Convert::ToInt32(args[2]),Convert::ToInt32(args[5]),Convert::ToInt32(args[6]));
return;
}
if(args[1]->Equals(HERO_INIT)) {
/*
args[2] == id;
args[3] == username;
args[4] == shipid;
args[5] == speed
args[6] == shield
args[7] == maxshield
args[8] == hp
args[9] == maxhp
args[10] == cargo
args[11] == maxcargo
args[12] == posx
args[13] == posy
args[14] == something to do with the last map
args[15] == faction/company
args[16] == clanid
args[17] == MaxLaserAmmo
args[18] == MaxRocketAmmo
args[19] == ExpansionTypeID
args[20] == Premium (true/false) in int
args[21] == experience points
args[22] == honor points
args[23] == level
args[24] == credits
args[25] == uridium
args[26] == jackpot (float)
args[27] == admin (21==admin)
args[28] == clan (string)
args[29] == galaxy gates done
args[30] == cloadked (int to bool)
*/
clearMainClasses();
hero.set(Convert::ToInt32(args[2]),args[3],Convert::ToInt32(args[4]),Convert::ToInt32(args[5]),Convert::ToInt32(args[6]),Convert::ToInt32(args[7]),Convert::ToInt32(args[8]),Convert::ToInt32(args[9]),Convert::ToInt32(args[10]),Convert::ToInt32(args[11]),Convert::ToDouble(args[12]),Convert::ToDouble(args[13]),Convert::ToInt32(args[15]),Convert::ToInt32(args[16]),Convert::ToInt32(args[17]),Convert::ToInt32(args[18]),Convert::ToBoolean(Convert::ToInt32(args[20])),Convert::ToInt32(args[21]),Convert::ToInt32(args[22]),Convert::ToInt32(args[23]),Convert::ToInt32(args[24]),Convert::ToInt32(args[25]),ConvertToDouble(args[26]),Convert::ToInt32(args[27]),args[28],Convert::ToInt32(args[29]),Convert::ToBoolean(Convert::ToInt32(args[30])));
SetProgressBarValue(progressBar1,hero.getHP(),hero.getMaxHP());
SetProgressBarValue(progressBar2,hero.getShield(),hero.getMaxShield());
SetProgressBarValue(progressBar3,hero.getMaxCargo()-hero.getCargo(),hero.getMaxCargo());
SetLabelText(label12,hero.getHP().ToString(L"N0"));
SetLabelText(label13,hero.getMaxHP().ToString(L"N0"));
SetLabelText(label14,hero.getShield().ToString(L"N0"));
SetLabelText(label15,hero.getMaxShield().ToString(L"N0"));
SetLabelText(label26,hero.getCredits().ToString(L"N0"));
SetLabelText(label27,hero.getUridium().ToString(L"N0"));
SetLabelText(label28,hero.getJackpot().ToString(L"N2"));
SetLabelText(label29,hero.getLevel().ToString(L"N0"));
SetLabelText(label30,hero.getExperience().ToString(L"N0"));
SetLabelText(label31,hero.getHonor().ToString(L"N0"));
SendPacket(hSocket,L"LAB|UPD|GET");
SendPacket(hSocket,L"ps|grp");
return;
}
if(args[1]->Equals(HERO_UPDATE_POSITION)) {
int updX = Convert::ToInt32(args[2]);
int updY = Convert::ToInt32(args[3]);
if(Math::Sqrt(Math::Pow(updX-hero.getPosX(),2)+Math::Pow(updY-hero.getPosY(),2)) > 500) {
hero.setPosX(updX);
hero.setPosY(updY);
hero.setMovementData(hero.getDesX(),hero.getDesY());
}
return;
}
if(args[1]->Equals(CREATE_SHIP)) {
/*
args[2] == id
args[3] == shipid
args[4] == expansiontype id
args[5] == clan
args[6] == username
args[7] == posx
args[8] == posy
args[9] == faction/company (if company > 3; company = 0)
args[10] == clan id
args[11] == daily rank... do we need this??? i dont think so...
args[12] == set warn icon on map (bool)
args[13] == clan diplomacy (0 == neutral, 1 == allied, 2 == no attack pact, 3 == at war)
args[14] == galaxy gates done
args[15] == ???
args[16] == set npc (bool)
args[17] == cloaked (bool)
*/
ships.addShip(Convert::ToInt32(args[2]),Convert::ToInt32(args[3]),args[5],args[6],Convert::ToDouble(args[7]),Convert::ToDouble(args[8]),Convert::ToInt32(args[9]),Convert::ToInt32(args[10]),Convert::ToInt32(args[13]),Convert::ToInt32(args[14]),Convert::ToBoolean(Convert::ToInt32(args[16])),Convert::ToBoolean(Convert::ToInt32(args[17])));
RemoveListboxItem(lstPlayers,args[2]);
if(Convert::ToInt32(args[16]) == 0) {
if(Convert::ToInt32(args[9]) == 1) {
//Company is MMO
String ^Combo1=System::String::Concat(args[2], " -- [MMO] -- ", args[6]);
AddListboxItem(lstPlayers,Combo1);
}
else if(Convert::ToInt32(args[9]) == 2) {
//Company is EIC
String ^Combo1=System::String::Concat(args[2], " -- [EIC] -- ", args[6]);
AddListboxItem(lstPlayers,Combo1);
}
else if(Convert::ToInt32(args[9]) == 3) {
//Company is VRU
String ^Combo1=System::String::Concat(args[2], " -- [VRU] -- ", args[6]);
AddListboxItem(lstPlayers,Combo1);
}
else {
//Unkown company
String ^Combo1=System::String::Concat(args[2], " -- ", args[6]);
AddListboxItem(lstPlayers,Combo1);
}
}
else if(Convert::ToInt32(args[16]) == 1) {
RemoveListboxItem(lstGGNPCLeft,args[2]);
String ^Combo1=System::String::Concat(args[2], " -- [NPC] -- ", args[6]);
AddListboxItem(lstGGNPCLeft,Combo1);
RemoveListboxItem(lstPlayers,args[2]);
String ^Combo2=System::String::Concat(args[2], " -- [NPC] -- ", args[6]);
AddListboxItem(lstPlayers,Combo2);
}
return;
}
if(args[1]->Equals(REMOVE_SHIP)||args[1]->Equals(DESTROY_SHIP)) {
int id = Convert::ToInt32(args[2]);
if(id == hero.getSelectedShipID()) {
LaserAttackingTimer = DateTime::Now;
hero.setLaserAttacking(false);
hero.setSelectedShipID(-1);
}
ships.removeShipWithID(id);
RemoveListboxItem(lstPlayers,args[2]);
if(chbGGActivate->Checked) {
RemoveListboxItem(lstGGNPCLeft,args[2]);
}
return;
}
if(args[1]->Equals(CREATE_BOX)) {
if(isHoneyBox(args[2])) { //check if it is a honeybox
return; //if its a honeybox then don't add it to the list!
}
int type = Convert::ToInt32(args[3]);
int posX = Convert::ToInt32(args[4]);
int posY = Convert::ToInt32(args[5]);
if(map.isOnMap(posX,posY)) {
if(type == BOX_TYPE_CARGO_BOX) {
objects.addCargoBox(args[2],posX,posY);
}
else if(type == BOX_TYPE_BONUS_BOX || type == 3 || type == 5 || type == 6 || type == 7 || type == 8 || type == 9 || type == 10 || type == 14 || type == 15 || type == 16) { //bonus boxes
objects.addBonusBox(args[2],posX,posY);
}
}
return;
}
if(args[1]->Equals(REMOVE_BOX)) {
objects.removeBonusBox(args[2]);
objects.removeCargoBox(args[2]);
return;
}
if(args[1]->Equals(CREATE_ORE)) {
if(isHoneyBox(args[2])) {
return;
}
int type = Convert::ToInt32(args[3]);
if(type < 10 && (type == 1 || type == 2 || type == 3)) {
objects.addResource(type,args[2],Convert::ToInt32(args[4]),Convert::ToInt32(args[5]));
return;
}
}
if(args[1]->Equals(REMOVE_ORE)) {
objects.removeResource(args[2]);
return;
}
if(args[1]->Equals(SET_ORE_COUNT)) {
hero.setCargo(Convert::ToInt32(args[2]),Convert::ToInt32(args[3]),Convert::ToInt32(args[4]),Convert::ToInt32(args[6]),Convert::ToInt32(args[7]),Convert::ToInt32(args[8]),Convert::ToInt32(args[9]),Convert::ToInt32(args[5]));
SetProgressBarValue(progressBar3,hero.getMaxCargo()-hero.getCargo(),hero.getMaxCargo());
return;
}
if(args[1]->Equals(SHIP_MOVEMENT)) {
Ship ^s = ships.getShipWithID(Convert::ToInt32(args[2]));
if(s != nullptr)
s->setMovementData(Convert::ToInt32(args[3]),Convert::ToInt32(args[4]),Convert::ToInt32(args[5]));
else
SendPacket(hSocket,String::Format(L"i|{0}",args[2]));
return;
}
if(args[1]->Equals(SET_STATUS)) {
if(args[2]->Equals(L"CFG")) {
hero.setConfig(Convert::ToInt32(args[3]));
SetLabelText(label95,hero.getCurrentConfig().ToString(L"N0"));
}
}
if(args[1]->Equals(PRIMARY_WEAPON_INFO)) {
hero.setLaserAmmo(Convert::ToInt32(args[2]),Convert::ToInt32(args[3]),Convert::ToInt32(args[4]),Convert::ToInt32(args[5]),Convert::ToInt32(args[6]),Convert::ToInt32(args[7]));
SetLabelText(label16,hero.getLaserAmmo1().ToString(L"N0"));
SetLabelText(label17,hero.getLaserAmmo2().ToString(L"N0"));
SetLabelText(label18,hero.getLaserAmmo3().ToString(L"N0"));
SetLabelText(label19,hero.getLaserAmmo4().ToString(L"N0"));
SetLabelText(label78,hero.getLaserAmmo5().ToString(L"N0"));
SetLabelText(label79,hero.getLaserAmmo6().ToString(L"N0"));
return;
}
if(args[1]->Equals(SECONDARY_WEAPON_INFO)) {
hero.setRocketAmmo(Convert::ToInt32(args[2]),Convert::ToInt32(args[3]),Convert::ToInt32(args[4]),Convert::ToInt32(args[5]),Convert::ToInt32(args[6]),Convert::ToInt32(args[8]),Convert::ToInt32(args[9]),Convert::ToInt32(args[10]),Convert::ToInt32(args[11]));
SetLabelText(label35,hero.getRocketAmmo1().ToString(L"N0"));
SetLabelText(label36,hero.getRocketAmmo2().ToString(L"N0"));
SetLabelText(label37,hero.getRocketAmmo3().ToString(L"N0"));
SetLabelText(label81,hero.getRocketAmmo4().ToString(L"N0"));
SetLabelText(label91,hero.getRocketAmmo5().ToString(L"N0"));
SetLabelText(label101,hero.getRocketAmmo6().ToString(L"N0"));
SetLabelText(label102,hero.getRocketAmmo7().ToString(L"N0"));
SetLabelText(label103,hero.getRocketAmmo8().ToString(L"N0"));
SetLabelText(label104,hero.getRocketAmmo9().ToString(L"N0"));
return;
}
if(args[1]->Equals(ROCKETLAUNCHER)) {
if(args[2]->Equals(SET_ROCKETLAUNCHER_ROCKETS)) {
hero.setRocketLauncherAmmo(Convert::ToInt32(args[3]),Convert::ToInt32(args[4]),Convert::ToInt32(args[5]));
SetLabelText(label108,hero.getRocketLauncherAmmo1().ToString(L"N0"));
SetLabelText(label109,hero.getRocketLauncherAmmo2().ToString(L"N0"));
SetLabelText(label110,hero.getRocketLauncherAmmo3().ToString(L"N0"));
}
return;
}
if(args[1]->Equals(LASER_ATTACK)) {
int id1 = Convert::ToInt32(args[2]);
int id2 = Convert::ToInt32(args[3]);
int heroid = hero.getID();
if(id2 == heroid) {
Ship ^s = ships.getShipWithID(id1);
if(s != nullptr) {
if(!s->getIsNPC()) {
//shit! were unter attack :S
EnemiesAttackingUs->Add(s->getID()); //add the motherfucker to the list so we can indentify if more than one motherfucker is attacking us ;) ad so we can attack back :D
String ^Combo1=System::String::Concat(DateTime::Now, " -- Under attack from: ", s->getUsername(), "...");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
__isUnderAttackbyEnemy = true;
}
}
}
else if(id1 == heroid) { //we are attacking :D
hero.setLaserAttacking(true);
}
return;
}
if(args[1]->Equals(ORE_COLLECTED_BY_HERO)) {
int type = Convert::ToInt32(args[2]);
switch(type) {
case 1:
__Collected_Prometium += 1;
SetLabelText(label59,__Collected_Prometium.ToString(L"N0"));
break;
case 2:
__Collected_Endurium += 1;
SetLabelText(label60,__Collected_Endurium.ToString(L"N0"));
break;
case 3:
__Collected_Terbium += 1;
SetLabelText(label61,__Collected_Terbium.ToString(L"N0"));
break;
}
return;
}
if(args[1]->Equals(SHIP_SELECTED)) {
/*
args[2] == id
args[3] == ??
args[4] == hp
args[5] == maxhp
args[6] == shield
args[7] == maxshield
*/
int id = Convert::ToInt32(args[2]);
Ship ^s = ships.getShipWithID(id);
if(s != nullptr) {
s->setShield(Convert::ToInt32(args[4]),Convert::ToInt32(args[5]));
s->setHP(Convert::ToInt32(args[6]),Convert::ToInt32(args[7]));
hero.setSelectedShipID(id);
}
return;
}
if(args[1]->Equals(ATTACKED_SHIP_INFO)) {
/*
args[2] == attack type L for laser and R for rocket
args[3] == hp
args[4] == shield
args[5] == damage done
args[6] == id
*/
int id = Convert::ToInt32(args[6]);
if(id != 0) {
Ship ^s = ships.getShipWithID(id);
if(s != nullptr) {
s->setHP(Convert::ToInt32(args[3]));
s->setShield(Convert::ToInt32(args[4]));
hero.setSelectedShipID(id);
__Damage_Given = Convert::ToInt32(args[5]);
}
}
return;
}
/* Log Messages */
if(args[1]->Equals(LOG_MESSAGE)) {
if(args[2]->Equals(L"ST")) {
if(args[3]->Equals(BOX_CONTENT_CREDITS)) {
__Earned_Credits += Convert::ToInt32(args[4]);
hero.setCredits(Convert::ToInt32(args[5]));
SetLabelText(label26,hero.getCredits().ToString(L"N0"));
SetLabelText(label44,__Earned_Credits.ToString(L"N0"));
incrementBBCollected();
String ^Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[4]), " Credits.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
return;
}
if(args[3]->Equals(BOX_CONTENT_URIDIUM)) {
__Earned_Uridium += Convert::ToInt32(args[4]);
hero.setUridium(Convert::ToInt32(args[5]));
SetLabelText(label27,hero.getUridium().ToString(L"N0"));
SetLabelText(label45,__Earned_Uridium.ToString(L"N0"));
incrementBBCollected();
String ^Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[4]), " Uridium.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
return;
}
if(args[3]->Equals(BOX_CONTENT_JACKPOT)) {
__Earned_Jackpot += ConvertToDouble(args[4]);
hero.setJackpot(ConvertToDouble(args[5]));
SetLabelText(label28,hero.getJackpot().ToString(L"N2"));
SetLabelText(label46,__Earned_Jackpot.ToString(L"N2"));
incrementBBCollected();
String ^Combo1=System::String::Concat(DateTime::Now, " -- Received ", ConvertToDouble(args[4]), " JBP.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
return;
}
if(args[3]->Equals(BOX_CONTENT_EXPERIENCE_POINTS)) {
__Earned_Experience += Convert::ToInt32(args[4]);
hero.setExperience(Convert::ToInt32(args[5]));
SetLabelText(label30,hero.getExperience().ToString(L"N0"));
SetLabelText(label48,__Earned_Experience.ToString(L"N0"));
String ^Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[4]), " Experience Points.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
if(chbStopEP->Checked) {
if(ConvertToDouble(txtStopEP->Text) < __Earned_Experience) {
tmrBotTimer->Enabled=false;
tmrExecuteScript->Enabled=false;
int x, y;
Thread::Sleep(100);
portals.getClosestPortal(hero,x,y);
SendMovementPacketRandomized(x,y,499);
if(hero.getLaserAttacking()) {
SendStopLaserAttack(hero.getSelectedShipID());
hero.setLaserAttacking(false);
}
String ^Combo1=System::String::Concat(DateTime::Now, " -- Logging out...");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
Application::Exit();
}
}
return;
}
if(args[3]->Equals(BOX_CONTENT_HONOR_POINTS)) {
__Earned_Honor += Convert::ToInt32(args[4]);
hero.setHonor(Convert::ToInt32(args[5]));
SetLabelText(label31,hero.getHonor().ToString(L"N0"));
SetLabelText(label49,__Earned_Honor.ToString(L"N0"));
String ^Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[4]), " Honour Points.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
return;
}
if(args[3]->Equals(BOX_CONTENT_EXTRA_ENERGY)) {
__Collected_GG_Energy += 1;
SetLabelText(label63,__Collected_GG_Energy.ToString(L"N0"));
incrementBBCollected();
String ^Combo1=System::String::Concat(DateTime::Now, " -- Received 1 Galaxy Gate Energy.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
return;
}
if(args[3]->Equals(LEVEL_UPDATE)) {
hero.setLevel(Convert::ToInt32(args[3]));
__Earned_Levels += 1;
SetLabelText(label29,hero.getLevel().ToString(L"N0"));
SetLabelText(label47,__Earned_Levels.ToString(L"N0"));
return;
}
if(args[3]->Equals(BOX_CONTENT_LASER_BATTERIES)) {
/*
Battery types
1 == "LCB-10";
2 == "MCB-25";
3 == "MCB-50";
4 == "UCB-100";
5 == "SAB";
6 == "RSB-75";
*/
int type = Convert::ToInt32(args[4]);
int amount = Convert::ToInt32(args[5]);
String ^Combo1;
switch(type) {
case 1:
__Collected_Laser_1 += amount;
SetLabelText(label67,__Collected_Laser_1.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " LCB-10 Ammo shots.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 2:
__Collected_Laser_2 += amount;
SetLabelText(label68,__Collected_Laser_2.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " MCB-25 Ammo shots.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 3:
__Collected_Laser_3 += amount;
SetLabelText(label69,__Collected_Laser_3.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " MCB-50 Ammo shots.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 4:
__Collected_Laser_4 += amount;
SetLabelText(label73,__Collected_Laser_4.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " USB-100 Ammo shots.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 5:
__Collected_Laser_5 += amount;
SetLabelText(label74,__Collected_Laser_5.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " SAB Ammo shots.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 6:
__Collected_Laser_6 += amount;
SetLabelText(label75,__Collected_Laser_6.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " RSB-75 Ammo shots.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
}
incrementBBCollected();
return;
}
if(args[3]->Equals(BOX_CONTENT_ROCKETS)) {
/*
1 == R310
2 == PLT-2026
3 == PLT-2021
4 == PLT-3030
*/
int type = Convert::ToInt32(args[4]);
int amount = Convert::ToInt32(args[5]);
String ^Combo1;
switch(type) {
case 1:
__Collected_Rocket_1 += amount;
SetLabelText(label86,__Collected_Rocket_1.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " R310 Rockets.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 2:
__Collected_Rocket_2 += amount;
SetLabelText(label87,__Collected_Rocket_2.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " PLT-2026 Rockets.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 3:
__Collected_Rocket_3 += amount;
SetLabelText(label88,__Collected_Rocket_3.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " PLT-2021 Rockets.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 4:
__Collected_Rocket_4 += amount;
SetLabelText(label89,__Collected_Rocket_4.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " PLT-3030 Rockets.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
case 5:
__Collected_Rocket_5 += amount;
SetLabelText(label93,__Collected_Rocket_5.ToString(L"N0"));
Combo1=System::String::Concat(DateTime::Now, " -- Received ", Convert::ToInt32(args[5]), " Rockets.");
AddListboxItem(lstLog,Combo1);
ScrollListbox(lstLog);
break;
}
incrementBBCollected();
return;
}
if(args[3]->Equals(BOX_CONTENT_HITPOINTS)) {
incrementBBCollected();
return;
}
if(args[3]->Equals(BOX_CONTENT_DEDUCTION_HITPOINTS)) {
incrementBBCollected();
return;
}
if(args[3]->Equals(BOX_CONTENT_ORE)) {
__Collected_Cargo_Boxes += 1;
SetLabelText(label54,__Collected_Cargo_Boxes.ToString(L"N0"));
return;
}
return;
}
return;
}
/* Log Messages End */
/* Set Attribute */
if(args[1]->Equals(SET_ATTRIBUTE)) {
/*
CPUS
cpuDict[3] = CPUItem.TYPE_DRONE_REPAIR;
cpuDict[4] = CPUItem.TYPE_RADAR;
cpuDict[5] = CPUItem.TYPE_JUMP;
cpuDict[6] = CPUItem.TYPE_AMMOBUY;
cpuDict[7] = CPUItem.TYPE_ROBOT;
cpuDict[8] = CPUItem.TYPE_HM7;
9 == ??
10 == smartbomb
11 == Instashield
12 == turbo mine cpu
cpuDict[13] = CPUItem.TYPE_AIM;
cpuDict[14] = CPUItem.TYPE_AROL;
cpuDict[15] = CPUItem.TYPE_CLOAK;
cpuDict[16] = CPUItem.TYPE_RLLB;
cpuDict[17] = CPUItem.TYPE_ROCKETBUY;
*/
if(args[2]->Equals(EXTRAS_INFO)) {
hero.setCPUs(Convert::ToInt32(args[3]),Convert::ToInt32(args[4]),Convert::ToInt32(args[5]),Convert::ToInt32(args[6]),Convert::ToInt32(args[7]),Convert::ToInt32(args[8]),Convert::ToInt32(args[9]),Convert::ToInt32(args[10]),Convert::ToInt32(args[11]),Convert::ToInt32(args[12]),Convert::ToInt32(args[13]),Convert::ToInt32(args[14]),Convert::ToInt32(args[15]),Convert::ToInt32(args[16]),Convert::ToInt32(args[17]));
}
if(args[2]->Equals(VELOCITY_UPDATE)) {
hero.setSpeed(Convert::ToInt32(args[3]));
return;
}
if(args[2]->Equals(HITPOINTS_INFO)) {
//args[4] == damage received
hero.setHP(Convert::ToInt32(args[3]),Convert::ToInt32(args[4]));
SetProgressBarValue(progressBar1,hero.getHP(),hero.getMaxHP());
SetLabelText(label12,hero.getHP().ToString(L"N0"));
SetLabelText(label13,hero.getMaxHP().ToString(L"N0"));
NextRepair = DateTime::Now.AddSeconds(10);
return;
}
if(args[2]->Equals(SHIELD_INFO)) {
hero.setShield(Convert::ToInt32(args[3]),Convert::ToInt32(args[4]));
SetProgressBarValue(progressBar2,hero.getShield(),hero.getMaxShield());
SetLabelText(label14,hero.getShield().ToString(L"N0"));
SetLabelText(label15,hero.getMaxShield().ToString(L"N0"));
return;
}
if(args[2]->Equals(CREDITS_UPDATE)) {
hero.setCurrency(Convert::ToInt32(args[3]),Convert::ToInt32(args[4]));
SetLabelText(label26,hero.getCredits().ToString(L"N0"));
SetLabelText(label27,hero.getUridium().ToString(L"N0"));
return;
}
if(args[2]->Equals(LOCALIZED_SERVER_MSG)) {
if(args[3]->Equals(L"no_attack")) {
int id = hero.getSelectedShipID();
if(id != -1) {
NPCsToExclude->Add(id);
hero.setSelectedShipID(-1);
}
return;
}
return;
}
if(args[2]->Equals(SET_COOLDOWN)) {
DateTime n = DateTime::Now;
if(args[3]->Equals(ROCKET_COOLDOWN)) {
RocketCooldown = n.AddSeconds(Convert::ToInt32(args[4]));
return;
}
if(args[3]->Equals(INSTASHIELD_COOLDOWN)) {
InstashieldCooldown = n.AddSeconds(Convert::ToInt32(args[4]));
return;
}
if(args[3]->Equals(EMP_COOLDOWN)) {
EMPCooldown = n.AddSeconds(Convert::ToInt32(args[4]));
return;
}
return;
}
return;
}
if(args[1]->Equals(IN_NO_ATTACK_ZONE)) {
int id = hero.getSelectedShipID();
if(id != -1) {
hero.setSelectedShipID(-1);
}
return;
}
if(args[1]->Equals(OUT_OF_RANGE)) {
hero.setTargetInRange(false);
return;
}
if(args[1]->Equals(TARGET_IN_RANGE)) {
hero.setTargetInRange(true);
return;
}
/* Set Attribute End */
if(args[1]->Equals(ATTACK_INFO)) {
int newhp = Convert::ToInt32(args[2]);
__Damage_Received = hero.getHP()-newhp;
hero.setHP(newhp,hero.getMaxHP());
hero.setShield(Convert::ToInt32(args[3]),hero.getMaxShield());
SetProgressBarValue(progressBar1,hero.getHP(),hero.getMaxHP());
SetProgressBarValue(progressBar2,hero.getShield(),hero.getMaxShield());
SetLabelText(label12,hero.getHP().ToString(L"N0"));
SetLabelText(label13,hero.getMaxHP().ToString(L"N0"));
SetLabelText(label14,hero.getShield().ToString(L"N0"));
SetLabelText(label15,hero.getMaxShield().ToString(L"N0"));
return;
}
/* Set Information */
if(args[1]->Equals(SET_INFORMATION)) {
if(args[2]->Equals(SET_PORTAL)) {
if(args[3]->Equals(SET_PORTAL_REMOVE)) {
if(args[4]->Equals(SET_PORTAL_REMOVE_ALL)) {
portals.Clear();
}
else {
portals.removePortal(Convert::ToInt32(args[4]));
}
}
return;
}
if(args[2]->Equals(TARGET_FADE_TO_GRAY)) {
int id1 = Convert::ToInt32(args[3]);
int id2 = Convert::ToInt32(args[4]);
if(id2 != hero.getID()) {
if(id1 != 0) {
Ship ^ship = ships.getShipWithID(id1);
if(ship != nullptr)
ship->setTaken(true);
}
}
return;
}
if(args[2]->Equals(TARGET_FADE_TO_GRAY_ABORT)) {
int id1 = Convert::ToInt32(args[3]);
Ship ^ship = ships.getShipWithID(id1);
if(ship != nullptr) {
ship->setTaken(false);
}
return;
}
return;
}
/* Set Information end */
/* this is unknown! Apparently stop laser attack... */
if(args[1]->Equals(LASER_STOP)) {
int id1;
if(args->Length == 3) {
id1 = Convert::ToInt32(args[2]);
if(id1 == hero.getID())
hero.setLaserAttacking(false);
}
}
/* ------------------------------------------------ */
if(args[1]->Equals(PORTAL_JUMP)) {
CurrentMap = Convert::ToInt32(args[2]);
return;
}
if(args[1]->Equals(JUMP_FAILED)) {
__JumpLoopExitVar = false;
return;
}
//update this later
if(args[1]->Equals(L"LAB") && args[2]->Equals(L"UPD") && args[3]->Equals(L"INFO"))
SendPacket(hSocket,L"9|g");
SendPacket(hSocket,L"i|108900975");
}
return;
}
Thanks
07/12/2012, 16:03
#2
elite*gold: 0
Join Date: Sep 2005
Posts: 427
Received Thanks: 87
Quote:
And i don't understand that.
String p isn't never declared(without up).
Func use "Split(|)" but string is empty o.0.
The caret ("^") indicates that the declared variable is a handle to a C++/CLI managed object, an object on the managed heap.
Similar Threads
Darkorbit and c++ or c# packets
06/23/2012 - DarkOrbit - 31 Replies
Hi
i programing in c++ and c#, but i don`t understand how we write DO bots. I can write tools, but with webbrowser control(it‘s very stupid). can we give me links to tutorials about this(sockets, packets in web games) or ezample codes(fe. login into darkorbit)
Thank ;)
Sorry for my English. I‘m Polish ;)
[Packets] Wie änder ich flyff packets?
07/16/2011 - Flyff Private Server - 19 Replies
HeyHo,
Ich würde sehr gerne wissen wie man die Flyff Packets ändert...
ich denke mal Zahlen ändern werden nicht ausreichen oder?
Exception Handler
07/12/2011 - CO2 Private Server - 1 Replies
So I'm trying to make my own source from scratch and I was thinking if an exception handler would be a good thing to have? Instead having to change every try/catch when catching exceptions.
Using this AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Handle); from Hybrids source thought.
What I have done is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
[Developing] Darkorbit Bot Packets
01/16/2011 - DarkOrbit - 11 Replies
Hallo,
ich bin gerade dabei einen DO Bot zu erstellen. allerdings hab ich ein problem bei den Packets:
Also als erstes muss ich ja wissen, an welche IP die Daten gesendet werden müssen. Nunja, die IP habe ich bisher nur von der Startseite rausbekommen, und diese hat sich auch schon geändert. Aber ist die von der Startseite überhaupt die richtige? Und Port ist doch 8080 oder? (Ich weiß das ich auch einfach in der eingabeaufforderung netstat -n eingeben kann. Aber bei der IP klappts auch net...
Creature Handler
10/23/2004 - General Gaming Discussion - 0 Replies
/ui action cycleTargetOutward;
/tellpet attack;
/pause 5;
/attack;
/tellpet attack;
/pause 20;
/ui action toolbarSlot00;
All times are GMT +2. The time now is 15:12 .