|
You last visited: Today at 15:40
Advertisement
Source Teile SonsofErenia
Discussion on Source Teile SonsofErenia within the Nostale forum part of the MMORPGs category.
05/02/2014, 14:56
|
#1
|
elite*gold: 5
Join Date: Dec 2013
Posts: 683
Received Thanks: 56
|
Source Teile SonsofErenia
#Entfernt weil hier eh jeder nur C&P macht *:
|
|
|
05/02/2014, 15:21
|
#2
|
elite*gold: 0
Join Date: Aug 2011
Posts: 1,190
Received Thanks: 549
|
Für die Leute die es etwas sauberer haben wollen. ^^
PS: Kenne mich mit dem Source nicht aus.
Code:
void wtf::changeClass ( int classId )
{
Char->user_class = classId;
Map::MapIOPool->RemoveFromMap(Char);
Char->MapPoint.map = 1;
Char->MapPoint.x = 80;
Char->MapPoint.y = 120;
Map::MapIOPool->AddToMap(Char);
}
if(packet[0] == "$schwertkämpfer")
changeClass ( 1 );
else if(packet[0] == "$bogenschütze")
changeClass ( 2 );
else if(packet[0] == "$magier")
changeClass ( 3 );
|
|
|
05/02/2014, 16:08
|
#3
|
elite*gold: 5
Join Date: Dec 2013
Posts: 683
Received Thanks: 56
|
naja das hier ist eig. das "Herzstück" des source
Code:
if(packet[0] == "select" && packet.size()==2)
{
if(toInt(packet[1]) >= 0 && toInt(packet[1]) <= 2)
{
ss << "SELECT * FROM tbl_chars WHERE Account_ID=" << this->Acount->Id << " AND Pos=" << packet[1] << ";";
MySql::ResultSet *res = MySql::db->executeQuery(ss.str());
if(res->RowCount() != 0)
{
res->Next();
this->Char->id = res->getInt(0);
this->Char->name = res->getString(3);
this->Char->sex = res->getInt(4);
this->Char->Hair.style = res->getInt(5);
this->Char->Hair.color = res->getInt(6);
this->Char->user_class = res->getInt(7);
this->Char->Level.Level = res->getInt(8);
this->Char->Level.jobLevel = res->getInt(9);
this->Char->MapPoint.map = res->getInt(10);
this->Char->MapPoint.x = res->getInt(11);
this->Char->MapPoint.y = res->getInt(12);
this->Char->Sp.inUsing = false;
this->Char->Reputation = res->getInt(34);
this->Char->miniland = res->getInt(36);
this->Char->Reputation_Icon = ReputationIconLoad(Char->Reputation);
this->Char->isGm = this->Acount->isGm;
this->Char->Equip.Fee = res->getInt(17);
this->Char->Equip.Fee1 = res->getInt(18);
this->Char->Equip.Weapon.id = res->getInt(19);
this->Char->Equip.Armor.id = res->getInt(20);
this->Char->Equip.Head = res->getInt(21);
this->Char->Equip.Hand = res->getInt(22);
this->Char->Equip.Shoe = res->getInt(23);
this->Char->Equip.Weapon2.id = res->getInt(24);
this->Char->Equip.Neck = res->getInt(25);
this->Char->Equip.Ring1 = res->getInt(26);
this->Char->Equip.Ring2 = res->getInt(27);
this->Char->Equip.Mask = res->getInt(28);
this->Char->Equip.Fairy = res->getInt(29);
this->Char->Equip.Amu = res->getInt(30);
this->Char->Sp.sprite = res->getInt(31);
this->Char->Equip.Event_Dress = res->getInt(32);
this->Char->Equip.Event_Hat = res->getInt(33);
this->Char->speed = 11;
this->Char->LastPortal = 0;
this->Char->Stat.CurrentHp = res->getInt(15);
this->Char->Stat.CurrentMp = res->getInt(16);
this->Char->Stat.MaxHp = Player::StatHandler->GetHp(Char);
this->Char->Stat.MaxMp = Player::StatHandler->GetMp(Char);
this->Char->inGroup = false;
this->Char->LastPulse = clock() / (double)CLOCKS_PER_SEC;
this->Char->PulseNum = 0;
this->Char->inv0 = HCrypto::split(res->getString(13),' ')[0];
this->Char->inv1 = HCrypto::split(res->getString(13),' ')[1];
this->Char->inv2 = HCrypto::split(res->getString(13),' ')[2];
this->Char->gold = res->getInt(14);
this->Char->dir = 0;
this->Char->Partner.vnum = res->getInt(36);
this->Char->Partner.id = res->getInt(37);
this->Char->Partner.name = res->getInt(38);
this->Char->Familie.name = res->getInt(40);
this->Char->Familie.position = res->getInt(41);
this->inGame = true;
this->Char->Sp.wings_arena = Char->rested = false;
this->LoadGame();
res->Free();
}
else
{
res->Free();
this->Kill();
}
}
else
this->Kill();
}
weiß nicht ob deins so auch funktioniert~
|
|
|
05/02/2014, 16:42
|
#4
|
elite*gold: 0
Join Date: Mar 2013
Posts: 478
Received Thanks: 235
|
Quote:
naja das hier ist eig. das "Herzstück" des source
Spoiler
weiß nicht ob deins so auch funktioniert~
|
Was du kannst sachen aus der Datenbank laden lassen alter komm mal skype und zeig es mir ....
|
|
|
05/02/2014, 17:04
|
#5
|
elite*gold: 5
Join Date: Dec 2013
Posts: 683
Received Thanks: 56
|
Deledt nö D: ok doch <_< add du mich:
*klick*
ps: ja ich weiß das es spaß es und ja es ist mein richtiges skype xD
edit: deledt dieser teil war schon im source ich habe einfach nur was hinzugefügt weil mir in der schule lw war :P
|
|
|
05/02/2014, 18:26
|
#6
|
elite*gold: 0
Join Date: Mar 2013
Posts: 478
Received Thanks: 235
|
Code:
if (Packet[0] == "$Changed" && toInt(Packet[1]) >= 0 && toInt(Packet[1]) <= 3){
Char->user_class = toInt(Packet[1]);
Map::MapIOPool->RemoveFromMap(Char);
Map::MapIOPool->AddToMap(Char);
}
|
|
|
05/02/2014, 18:49
|
#7
|
elite*gold: 5
Join Date: Dec 2013
Posts: 683
Received Thanks: 56
|
Er brauch die koordinaten wohin mit den spieler.
also waere
Code:
if (packet[0] == "$Class_change" && packet.size() == 2)
{
this->Char->user_class = toInt(packet[1]);
Map::MapIOPool->RemoveFromMap(Char);
Char->MapPoint.map = this-Char->MapPoint.map;
Char->MapPoint.x = this-Char->MapPoint.x;
Char->MapPoint.y = this-Char->MapPoint.y;
Map::MapIOPool->AddToMap(Char);
}
Richtig und besser ^^
|
|
|
05/02/2014, 19:50
|
#8
|
elite*gold: 0
Join Date: Aug 2011
Posts: 1,190
Received Thanks: 549
|
Soll das eig. irgendein Sinn ergeben das du manchmal "this" benutzt und dann mal wieder nicht?
Bzw. würde dein Code nicht mal laufen.
|
|
|
05/02/2014, 19:53
|
#9
|
elite*gold: 5
Join Date: Dec 2013
Posts: 683
Received Thanks: 56
|
***~ TChar = Anderer Char
this->Char/Char dein Char~
natürlich kann man auch nur Char schreiben aber mit this->Char ist es etwas sicherer o:
TChar beispiel: pet/Partner von ein anderen Spieler
Code:
ss << "in 2 " << TChar->Partner.vnum << " " << TChar->Partner.id << " 11 7 2 100 100 0 0 3 " << TChar->id << " 1 0 -1 Partner 1 1 0 0 0 0 0 0 0 0";
Char->Send(ss.str());
ss.str("");
|
|
|
05/02/2014, 20:05
|
#10
|
elite*gold: 0
Join Date: Aug 2011
Posts: 1,190
Received Thanks: 549
|
Keine Ahnung warum du jetzt mit TChar kommst. ^^
Ich rede von dem hier:
Code:
this->Char->user_class = toInt(packet[1]);
Char->MapPoint.map = this-Char->MapPoint.map;
Einmal benutzt du this und einmal nicht, was soll dort der Sinn sein?
Sicherer?
Heißt einer der Parameter der Funktion "Char" ( oder außerhalb der Klasse ) und in der Klasse auch, dann könnte es Sinn ergeben, ansonsten naja. ^^
#Edit
Lol, hab deinen Text jetzt erst verstanden... Du solltest mal deine ganzen Zeichen fummelreien weglassen, bringt mich immer durcheinander beim Lesen deiner Texte.
|
|
|
05/02/2014, 20:20
|
#11
|
elite*gold: 5
Join Date: Dec 2013
Posts: 683
Received Thanks: 56
|
Naja bei den was du kopiert hast hab ich nur ein ">" vergessen~
Richtig:
this->Char->user_class = toInt(packet[1]);
Char->MapPoint.map = this->Char->MapPoint.map;
und so wie es ist läuft dieser Source teil bei Sons of Erenia~
bei
this->Char->user_class = toInt(packet[1]);
ändert er den char seine klasse auf das packet und wird in der db und im spiel gespeichert das heißt er kann map wechsel machen und er bleibt z.b. mager ö_ö
hier wird einfach abgefragt wohin er teleportiert wird
Char->MapPoint.map = this->Char->MapPoint.map;
"this->Char->MapPoint.map;" = momentane position des Chars~
Natürlich könnte man nun in den teil noch reinhauen falls wer schon ein job hat das sieht dann ca. so aus
Code:
if (packet[0] == "$Class_change" && packet.size() == 2)
{
if(packet[1] == "0")
{
ss << "say 0 0 11 Du kannst nicht wieder Abenteurer werden!";
ss.str("");
Char->Send(ss.str());
}
else if(this->Char->user_class > 0)
{
ss << "say 0 0 11 Du hast bereits dein Job gewechselt";
ss.str("");
Char->Send(ss.str());
}
else if(packet[1] == "1")
{
this->Char->user_class = toInt(packet[1]);
Map::MapIOPool->RemoveFromMap(Char);
Char->MapPoint.map = this->Char->MapPoint.map;
Char->MapPoint.x = this->Char->MapPoint.x;
Char->MapPoint.y = this->Char->MapPoint.y;
Map::MapIOPool->AddToMap(Char);
ss << "say 0 0 11 Du bist nun Schwertkämpfer";
Char->Send(ss.str());
ss.str("");
ss << "tit " << (this->Char->user_class==0?"Abenteurer":(this->Char->user_class==1?"Schwertkämpfer":(this->Char->user_class==2?"Bogenschütze":"Magier"))) << " " <<this->Char->name;
this->Send(ss.str());
ss.str("");
ss << "UPDATE tbl_chars SET Class = "<< this->Char->user_class << " WHERE Char_ID = " << this->Char->id;
MySql::db->doQuery(ss.str());
ss.str("");
ss << "in 1 " << Char->name << " - " << Char->id << " " << Char->MapPoint.x << " " << Char->MapPoint.y << " " << Char->dir<< " " << (Char->isGm?2:0)<< " " << Char->sex << " " << Char->Hair.style << " " << Char->Hair.color << " " << Char->user_class << " " << Char->Equip.Head << "." << Char->Equip.Armor.id << "." << Char->Equip.Weapon.id << "." << Char->Equip.Weapon2.id << "." << Char->Equip.Mask << ".-1 " << HMath::percent(Char->Stat.CurrentHp, Char->Stat.MaxHp) <<" "<< HMath::percent(Char->Stat.CurrentMp, Char->Stat.CurrentMp) <<" 0 -1 4 4 " << Char->Equip.Fee1 << " " << Char->Equip.Fee << " 0 " << (Char->Sp.inUsing?Char->Sp.sprite:0) << " 0 0 -1 - " << Char->Reputation_Icon << " 0 " << (Char->Sp.inUsing?Char->Sp.upgrade:0) << " 0 " << (Char->Sp.inUsing?Char->Sp.wings:0) << " " << Char->Level.Level << " 0 " << (Char->Sp.wings_arena?1:0);
Map::MapIOPool->SendMap(this->Char,ss.str(),false);
ss.str("");
}
else if(packet[1] == "2")
{
this->Char->user_class = toInt(packet[1]);
Map::MapIOPool->RemoveFromMap(Char);
Char->MapPoint.map = this->Char->MapPoint.map;
Char->MapPoint.x = this->Char->MapPoint.x;
Char->MapPoint.y = this->Char->MapPoint.y;
Map::MapIOPool->AddToMap(Char);
ss << "say 0 0 11 Du bist nun Bogenschütze";
Char->Send(ss.str());
ss.str("");
ss << "tit " << (this->Char->user_class==0?"Abenteurer":(this->Char->user_class==1?"Schwertkämpfer":(this->Char->user_class==2?"Bogenschütze":"Magier"))) << " " <<this->Char->name;
this->Send(ss.str());
ss.str("");
ss << "UPDATE tbl_chars SET Class = "<< this->Char->user_class << " WHERE Char_ID = " << this->Char->id;
MySql::db->doQuery(ss.str());
ss.str("");
ss << "in 1 " << Char->name << " - " << Char->id << " " << Char->MapPoint.x << " " << Char->MapPoint.y << " " << Char->dir<< " " << (Char->isGm?2:0)<< " " << Char->sex << " " << Char->Hair.style << " " << Char->Hair.color << " " << Char->user_class << " " << Char->Equip.Head << "." << Char->Equip.Armor.id << "." << Char->Equip.Weapon.id << "." << Char->Equip.Weapon2.id << "." << Char->Equip.Mask << ".-1 " << HMath::percent(Char->Stat.CurrentHp, Char->Stat.MaxHp) <<" "<< HMath::percent(Char->Stat.CurrentMp, Char->Stat.CurrentMp) <<" 0 -1 4 4 " << Char->Equip.Fee1 << " " << Char->Equip.Fee << " 0 " << (Char->Sp.inUsing?Char->Sp.sprite:0) << " 0 0 -1 - " << Char->Reputation_Icon << " 0 " << (Char->Sp.inUsing?Char->Sp.upgrade:0) << " 0 " << (Char->Sp.inUsing?Char->Sp.wings:0) << " " << Char->Level.Level << " 0 " << (Char->Sp.wings_arena?1:0);
Map::MapIOPool->SendMap(this->Char,ss.str(),false);
ss.str("");
}
else if(packet[1] == "3")
{
this->Char->user_class = toInt(packet[1]);
ss << "say 0 0 11 Du bist nun Magier";
Char->Send(ss.str());
ss.str("");
ss << "tit " << (this->Char->user_class==0?"Abenteurer":(this->Char->user_class==1?"Schwertkämpfer":(this->Char->user_class==2?"Bogenschütze":"Magier"))) << " " <<this->Char->name;
this->Send(ss.str());
ss.str("");
ss << "UPDATE tbl_chars SET Class = "<< this->Char->user_class << " WHERE Char_ID = " << this->Char->id;
MySql::db->doQuery(ss.str());
ss.str("");
ss << "in 1 " << Char->name << " - " << Char->id << " " << Char->MapPoint.x << " " << Char->MapPoint.y << " " << Char->dir<< " " << (Char->isGm?2:0)<< " " << Char->sex << " " << Char->Hair.style << " " << Char->Hair.color << " " << Char->user_class << " " << Char->Equip.Head << "." << Char->Equip.Armor.id << "." << Char->Equip.Weapon.id << "." << Char->Equip.Weapon2.id << "." << Char->Equip.Mask << ".-1 " << HMath::percent(Char->Stat.CurrentHp, Char->Stat.MaxHp) <<" "<< HMath::percent(Char->Stat.CurrentMp, Char->Stat.CurrentMp) <<" 0 -1 4 4 " << Char->Equip.Fee1 << " " << Char->Equip.Fee << " 0 " << (Char->Sp.inUsing?Char->Sp.sprite:0) << " 0 0 -1 - " << Char->Reputation_Icon << " 0 " << (Char->Sp.inUsing?Char->Sp.upgrade:0) << " 0 " << (Char->Sp.inUsing?Char->Sp.wings:0) << " " << Char->Level.Level << " 0 " << (Char->Sp.wings_arena?1:0);
Map::MapIOPool->SendMap(this->Char,ss.str(),false);
ss.str("");
}
}
edit: hier her kommt "Char"
Code:
if(packet[0] == "select" && packet.size()==2)
{
if(toInt(packet[1]) >= 0 && toInt(packet[1]) <= 2)
{
ss << "SELECT * FROM tbl_chars WHERE Account_ID=" << this->Acount->Id << " AND Pos=" << packet[1] << ";";
MySql::ResultSet *res = MySql::db->executeQuery(ss.str());
if(res->RowCount() != 0)
{
res->Next();
this->Char->id = res->getInt(0);
this->Char->name = res->getString(3);
this->Char->sex = res->getInt(4);
this->Char->Hair.style = res->getInt(5);
this->Char->Hair.color = res->getInt(6);
this->Char->user_class = res->getInt(7);
this->Char->Level.Level = res->getInt(8);
this->Char->Level.jobLevel = res->getInt(9);
this->Char->MapPoint.map = res->getInt(10);
this->Char->MapPoint.x = res->getInt(11);
this->Char->MapPoint.y = res->getInt(12);
this->Char->Sp.inUsing = false;
this->Char->Reputation = res->getInt(34);
this->Char->miniland = res->getInt(36);
this->Char->Reputation_Icon = ReputationIconLoad(Char->Reputation);
this->Char->isGm = this->Acount->isGm;
this->Char->Equip.Fee = res->getInt(17);
this->Char->Equip.Fee1 = res->getInt(18);
this->Char->Equip.Weapon.id = res->getInt(19);
this->Char->Equip.Armor.id = res->getInt(20);
this->Char->Equip.Head = res->getInt(21);
this->Char->Equip.Hand = res->getInt(22);
this->Char->Equip.Shoe = res->getInt(23);
this->Char->Equip.Weapon2.id = res->getInt(24);
this->Char->Equip.Neck = res->getInt(25);
this->Char->Equip.Ring1 = res->getInt(26);
this->Char->Equip.Ring2 = res->getInt(27);
this->Char->Equip.Mask = res->getInt(28);
this->Char->Equip.Fairy = res->getInt(29);
this->Char->Equip.Amu = res->getInt(30);
this->Char->Sp.sprite = res->getInt(31);
this->Char->Equip.Event_Dress = res->getInt(32);
this->Char->Equip.Event_Hat = res->getInt(33);
this->Char->speed = 11;
this->Char->LastPortal = 0;
this->Char->Stat.CurrentHp = res->getInt(15);
this->Char->Stat.CurrentMp = res->getInt(16);
this->Char->Stat.MaxHp = Player::StatHandler->GetHp(Char);
this->Char->Stat.MaxMp = Player::StatHandler->GetMp(Char);
this->Char->inGroup = false;
this->Char->LastPulse = clock() / (double)CLOCKS_PER_SEC;
this->Char->PulseNum = 0;
this->Char->inv0 = HCrypto::split(res->getString(13),' ')[0];
this->Char->inv1 = HCrypto::split(res->getString(13),' ')[1];
this->Char->inv2 = HCrypto::split(res->getString(13),' ')[2];
this->Char->gold = res->getInt(14);
this->Char->dir = 0;
this->Char->Partner.vnum = res->getInt(36);
this->Char->Partner.id = res->getInt(37);
this->Char->Partner.name = res->getInt(38);
this->Char->Familie.name = res->getInt(40);
this->Char->Familie.position = res->getInt(41);
this->inGame = true;
this->Char->Sp.wings_arena = Char->rested = false;
this->LoadGame();
res->Free();
}
else
{
res->Free();
this->Kill();
}
}
else
this->Kill();
}
Edit: Class Change Update~
|
|
|
05/03/2014, 00:24
|
#12
|
elite*gold: 0
Join Date: Apr 2010
Posts: 2,832
Received Thanks: 4,152
|
Wow, direkter DB Zugriff... Top Source man
|
|
|
05/03/2014, 00:34
|
#13
|
elite*gold: 150
Join Date: Sep 2010
Posts: 2,070
Received Thanks: 821
|
Quote:
Originally Posted by Elektrochemie
Wow, direkter DB Zugriff... Top Source man 
|
Wie hast du drauf zugegriffen?
|
|
|
05/03/2014, 00:42
|
#14
|
elite*gold: 0
Join Date: Apr 2010
Posts: 2,832
Received Thanks: 4,152
|
Hatte mich eventuell falsch Ausgedrückt, es geht nicht darum wie man Zugreift, sondern "wann".
Noch nie gewundert warum / wie es Rollbacks gibt?
|
|
|
05/03/2014, 11:25
|
#15
|
elite*gold: 5
Join Date: Dec 2013
Posts: 683
Received Thanks: 56
|
Quote:
Originally Posted by Elektrochemie
Noch nie gewundert warum / wie es Rollbacks gibt?
|
Rollbacks werden gemacht wenn es Fehler in der Datenbank gibt und diese Rollbacks werden mit älteren Datenbank Einträgen gemacht :P
Bei den Source ist es aber so das er sonst nie Speichert nicht mal beim ausloggen somit muss er den Kack irgendwann auch speichern und da ich den Teil noch nicht Veröffentlicht habe muss man er muss man den Teil selbst schreiben oder Warten bis ich es halt veröffentliche (:
|
|
|
Similar Threads
|
[Release]Teile von Offi V19 Source
06/27/2013 - Flyff PServer Guides & Releases - 6 Replies
Ich release hier mal ein paar Teile vom Offi V19 Source
zum recoden von Features kann man es so näher an offi halten ;)
soetwas wie VersionCommon
enum ContentType {
CT_OPTION_17 = 0x0,
CT_SHOP_CART_17 = 0x1,
CT_CANCELLATION = 0x2,
|
[B] Steam-Account: Black Ops, CS:S, DoD:Source, GTA IV + Extension, 3 Hitman-Teile ..
10/07/2011 - Steam Trading - 81 Replies
Unschlagbares Angebot: Nurnoch 30€, wenn man mit PayPal oder Überweisung zahlt!!!
Hallo,
da ich momentan etwas Geld brauche, möchte ich meinen Steam Account verkaufen.
Spiele:
- Call of Duty: Black Ops
- Counter-Strike: Source
- Day of Defeat: Source
- Grand Theft Auto IV
|
All times are GMT +1. The time now is 15:41.
|
|