Re: [R63] Part of (valentine) quests.
Someone on KekoMundo already coded the valentine / snowflake page for UberEMU,
Check it out here ( This isn't ment as advertising )
Re: [R63] Part of (valentine) quests.
thanks pejump, it helped me out:)
Re: [R63] Part of (valentine) quests.
Cant wait until you get fireworks fully working toperwin :)
Re: [R63] Part of (valentine) quests.
Quote:
Originally Posted by
PEjump2
Someone on KekoMundo already coded the valentine / snowflake page for UberEMU,
Check it out
here ( This isn't ment as advertising )
Will someone beable to translate that and post it on ragezone?
Re: [R63] Part of (valentine) quests.
Cata stuff for Valentines. - From Keko requested translation by HabsHotel
Execute this SQL;
Code:
ALTER TABLE `catalog_items` ADD `quest_active` INT( 255 ) NOT NULL ,
ADD `quest_cost` INT( 255 ) NOT NULL ,
ADD `quest_type` VARCHAR( 500 ) NOT NULL DEFAULT 'val' COMMENT 'val = valentyne quest; snow = snowflakes quest'
In CatalogItem.cs,
Find
public int Amount;
Add under it:
PHP Code:
public int Quest_IsValid;
public int QuestCoinCost;
public string QuestType;
find
PHP Code:
public CatalogItem(uint Id, string Name, string ItemIds, int CreditsCost, int PixelsCost, int Amount)
Replace with
PHP Code:
public CatalogItem(uint Id, string Name, string ItemIds, int CreditsCost, int PixelsCost, int Amount, int Quest_IsValid, int QuestCoinCost, string QuestType)
And at the end of the function bit, Add:
PHP Code:
this.Quest_IsValid = Quest_IsValid;
this.QuestCoinCost = QuestCoinCost;
this.QuestType = QuestType;
Find
PHP Code:
Message.AppendInt32(PixelsCost);
Message.AppendInt32(0);
Replace witb
PHP Code:
if (Quest_IsValid != 1)
{
Message.AppendInt32(PixelsCost);
Message.AppendInt32(0); //snowflakes enable/disable (coming soon)
}
else
{
Message.AppendInt32(QuestCoinCost);
if (QuestType == "val")
{
Message.AppendInt32(2);
}
else if(QuestType == "snow")
{
Message.AppendInt32(1);
}
}
Now go to CatalogPage.cs
FIND:
PHP Code:
Data = dbClient.ReadDataTable("SELECT id,item_ids,catalog_name,cost_credits,cost_pixels,amount
Replace with
Data = dbClient.ReadDataTable("SELECT id,item_ids,catalog_name,cost_credits,cost_pixels,amount,quest_active,quest_cost,quest_type FROM catalog_items WHERE page_id = '" + Id + "' ORDER BY item_ids ASC");
Find
PHP Code:
Items.Add(new CatalogItem(
Replace with
Items.Add(new CatalogItem((uint)Row["id"], (string)Row["catalog_name"], (string)Row["item_ids"], (int)Row["cost_credits"], (int)Row["cost_pixels"], (int)Row["amount"], (int)Row["quest_active"], (int)Row["quest_cost"], (string)Row["quest_type"]));
Now go to Habbo.CS
PHP Code:
FIND
public Int32 ActivityPoints;
ADD UNDER
public Int32 QuestPoints;
FIND:
PHP Code:
public Habbo(UInt32 Id, string Username, string RealName, string AuthTicket,
uint Rank, string Motto, string Look, string Gender, Int32 Credits,
Int32 ActivityPoints, Double LastActivityPointsUpdate, bool Muted,
UInt32 HomeRoom, Int32 Respect, Int32 DailyRespectPoints, Int32 DailyPetRespectPoints,
int NewbieStatus, bool MutantPenalty, bool BlockNewFriends, GameClient pClient)
REPLACE WITH:
PHP Code:
public Habbo(UInt32 Id, string Username, string RealName, string AuthTicket,
uint Rank, string Motto, string Look, string Gender, Int32 Credits,
Int32 ActivityPoints, Double LastActivityPointsUpdate, bool Muted,
UInt32 HomeRoom, Int32 Respect, Int32 DailyRespectPoints, Int32 DailyPetRespectPoints,
int NewbieStatus, bool MutantPenalty, bool BlockNewFriends, GameClient pClient, Int32 QuestCoins)
PHP Code:
FIND
this.AuthTicket = AuthTicket,
Add under
this.QuestCoins = QuestCoins;
Now go to Authenticator.cs
Replace
PHP Code:
private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client)
{
return new Habbo((UInt32)Data["id"], (string)Data["username"], (string)Data["real_name"], AuthTicket, (uint)Data["rank"], (string)Data["motto"], (string)Data["look"], (string)Data["gender"], (int)Data["credits"], (int)Data["activity_points"], (Double)Data["activity_points_lastupdate"], UberEnvironment.EnumToBool(Data["is_muted"].ToString()), (UInt32)Data["home_room"], (Int32)Data["respect"], (int)Data["daily_respect_points"], (int)Data["daily_pet_respect_points"], (int)Data["newbie_status"], (Data["mutant_penalty"].ToString() != "0"), UberEnvironment.EnumToBool(Data["block_newfriends"].ToString()), Client);
}
With
PHP Code:
private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client)
{
return new Habbo((UInt32)Data["id"], (string)Data["username"], (string)Data["real_name"], AuthTicket, (uint)Data["rank"], (string)Data["motto"], (string)Data["look"], (string)Data["gender"], (int)Data["credits"], (int)Data["activity_points"], (Double)Data["activity_points_lastupdate"], UberEnvironment.EnumToBool(Data["is_muted"].ToString()), (UInt32)Data["home_room"], (Int32)Data["respect"], (int)Data["daily_respect_points"], (int)Data["daily_pet_respect_points"], (int)Data["newbie_status"], (Data["mutant_penalty"].ToString() != "0"), UberEnvironment.EnumToBool(Data["block_newfriends"].ToString()), Client, (int)Data["hearts"]);
}
Replace the UpdateCreditsBalance with
PHP Code:
public void UpdateCreditsBalance(Boolean InDatabase)
{
mClient.GetMessageHandler().GetResponse().Init(6);
mClient.GetMessageHandler().GetResponse().AppendStringWithBreak(Credits + ".0");
mClient.GetMessageHandler().SendResponse();
mClient.GetMessageHandler().GetResponse().Init(438);
mClient.GetMessageHandler().GetResponse().AppendInt32(QuestCoins);
mClient.GetMessageHandler().GetResponse().AppendInt32(0);
mClient.GetMessageHandler().GetResponse().AppendInt32(2);
if (InDatabase)
{
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE users SET credits = '" + Credits + "' WHERE id = '" + Id + "' LIMIT 1;");
dbClient.ExecuteQuery("UPDATE users SET hearts = '" + QuestCoins + "' WHERE id = '" + Id + "' LIMIT 1;");
}
}
}
In Catalog.cs
Replace the HandlePurchase function with
PHP Code:
public void HandlePurchase(GameClient Session, int PageId, uint ItemId, string ExtraData, Boolean IsGift, string GiftUser, string GiftMessage)
{
CatalogPage Page = GetPage(PageId);
if (Page.MinRank > Session.GetHabbo().Rank || Page.Visible == false)
{
Session.SendNotif("No estás autorizado para ver esta página.", 0);
return;
}
if (Page == null || Page.ComingSoon || !Page.Enabled || !Page.Visible)
{
return;
}
if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") || Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
{
return;
}
CatalogItem Item = Page.GetItem(ItemId);
if (Item == null)
{
return;
}
uint GiftUserId = 0;
if (IsGift)
{
if (!Item.GetBaseItem().AllowGift)
{
return;
}
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("gift_user", GiftUser);
try
{
GiftUserId = (uint)dbClient.ReadDataRow("SELECT id FROM users WHERE username = @gift_user LIMIT 1")[0];
}
catch (Exception) { }
}
if (GiftUserId == 0)
{
Session.GetMessageHandler().GetResponse().Init(76);
Session.GetMessageHandler().GetResponse().AppendBoolean(true);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(GiftUser);
Session.GetMessageHandler().SendResponse();
return;
}
}
Boolean CreditsError = false;
Boolean PixelError = false;
Boolean QuestError = false;
if (Session.GetHabbo().Credits < Item.CreditsCost)
{
CreditsError = true;
}
if (Session.GetHabbo().ActivityPoints < Item.PixelsCost)
{
PixelError = true;
}
if (Session.GetHabbo().QuestCoins < Item.QuestCoinCost)
{
QuestError = true;
}
if (CreditsError || PixelError || QuestError)
{
Session.GetMessageHandler().GetResponse().Init(68);
Session.GetMessageHandler().GetResponse().AppendBoolean(CreditsError);
if (Item.Quest_IsValid != 1)
{
Session.GetMessageHandler().GetResponse().AppendBoolean(PixelError);
}
else
{
Session.GetMessageHandler().GetResponse().AppendBoolean(QuestError);
}
Session.GetMessageHandler().SendResponse();
return;
}
if (IsGift && Item.GetBaseItem().Type.ToLower() == "e")
{
Session.SendNotif("No puedes enviar este objeto como regalo.", 0);
return;
}
// Extra Data is _NOT_ filtered at this point and MUST BE VERIFIED BELOW:
switch (Item.GetBaseItem().InteractionType.ToLower())
{
case "pet":
try
{
string[] Bits = ExtraData.Split('\n');
string PetName = Bits[0];
string Race = Bits[1];
string Color = Bits[2];
int.Parse(Race); // to trigger any possible errors
if (!CheckPetName(PetName))
{
return;
}
if (Race.Length != 3)
{
return;
}
if (Color.Length != 6)
{
return;
}
}
catch (Exception) { return; }
break;
case "roomeffect":
Double Number = 0;
try
{
Number = Double.Parse(ExtraData);
}
catch (Exception) { }
ExtraData = Number.ToString().Replace(',', '.');
break; // maintain extra data // todo: validate
case "postit":
ExtraData = "FFFF33";
break;
case "dimmer":
ExtraData = "1,1,1,#000000,255";
break;
case "trophy":
ExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + UberEnvironment.FilterInjectionChars(ExtraData, true);
break;
default:
ExtraData = "";
break;
}
if (Item.CreditsCost > 0)
{
Session.GetHabbo().Credits -= Item.CreditsCost;
Session.GetHabbo().UpdateCreditsBalance(true);
}
if (Item.PixelsCost > 0)
{
Session.GetHabbo().ActivityPoints -= Item.PixelsCost;
Session.GetHabbo().UpdateActivityPointsBalance(true);
}
if (Item.QuestCoinCost > 0)
{
Session.GetHabbo().QuestCoins -= Item.QuestCoinCost;
Session.GetHabbo().UpdateCreditsBalance(true);
}
Session.GetMessageHandler().GetResponse().Init(67);
Session.GetMessageHandler().GetResponse().AppendUInt(Item.GetBaseItem().ItemId);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Name);
Session.GetMessageHandler().GetResponse().AppendInt32(Item.CreditsCost);
if (Item.Quest_IsValid != 1)
{
Session.GetMessageHandler().GetResponse().AppendInt32(Item.PixelsCost);
}
else
{
Session.GetMessageHandler().GetResponse().AppendInt32(Item.QuestCoinCost);
}
Session.GetMessageHandler().GetResponse().AppendInt32(0);
Session.GetMessageHandler().GetResponse().AppendInt32(1);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Type.ToLower());
Session.GetMessageHandler().GetResponse().AppendInt32(Item.GetBaseItem().SpriteId);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak("");
Session.GetMessageHandler().GetResponse().AppendInt32(1);
Session.GetMessageHandler().GetResponse().AppendInt32(-1);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak("");
Session.GetMessageHandler().SendResponse();
if (IsGift)
{
uint GenId = GenerateItemId();
Item Present = GeneratePresent();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("gift_message", "!" + GiftMessage);
dbClient.AddParamWithValue("extra_data", ExtraData);
dbClient.ExecuteQuery("INSERT INTO user_items (id,user_id,base_item,extra_data) VALUES ('" + GenId + "','" + GiftUserId + "','" + Present.ItemId + "',@gift_message)");
dbClient.ExecuteQuery("INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('" + GenId + "','" + Item.GetBaseItem().ItemId + "','" + Item.Amount + "',@extra_data)");
}
GameClient Receiver = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(GiftUserId);
if (Receiver != null)
{
Receiver.SendNotif("Has recibido un regalo! Revisa tu inventario.", 0);
Receiver.GetHabbo().GetInventoryComponent().UpdateItems(true);
}
Session.SendNotif("Regalo enviado!", 0);
}
else
{
DeliverItems(Session, Item.GetBaseItem(), Item.Amount, ExtraData);
}
}
Maybe 1 or 2 mistakes with my Translating
SORRY
Re: [R63] Part of (valentine) quests.
Thanks Tweeney for translating this, Im trying is out right away =D
Re: [R63] Part of (valentine) quests.
/\
That doesn't work, or, for me it doesn't.
Re: [R63] Part of (valentine) quests.
Quote:
Originally Posted by
tweeney
Cata stuff for Valentines. - From Keko requested translation by HabsHotel
Execute this SQL;
Code:
ALTER TABLE `catalog_items` ADD `quest_active` INT( 255 ) NOT NULL ,
ADD `quest_cost` INT( 255 ) NOT NULL ,
ADD `quest_type` VARCHAR( 500 ) NOT NULL DEFAULT 'val' COMMENT 'val = valentyne quest; snow = snowflakes quest'
In CatalogItem.cs,
Find
public int Amount;
Add under it:
PHP Code:
public int Quest_IsValid;
public int QuestCoinCost;
public string QuestType;
find
PHP Code:
public CatalogItem(uint Id, string Name, string ItemIds, int CreditsCost, int PixelsCost, int Amount)
Replace with
PHP Code:
public CatalogItem(uint Id, string Name, string ItemIds, int CreditsCost, int PixelsCost, int Amount, int Quest_IsValid, int QuestCoinCost, string QuestType)
And at the end of the function bit, Add:
PHP Code:
this.Quest_IsValid = Quest_IsValid;
this.QuestCoinCost = QuestCoinCost;
this.QuestType = QuestType;
Find
PHP Code:
Message.AppendInt32(PixelsCost);
Message.AppendInt32(0);
Replace witb
PHP Code:
if (Quest_IsValid != 1)
{
Message.AppendInt32(PixelsCost);
Message.AppendInt32(0); //snowflakes enable/disable (coming soon)
}
else
{
Message.AppendInt32(QuestCoinCost);
if (QuestType == "val")
{
Message.AppendInt32(2);
}
else if(QuestType == "snow")
{
Message.AppendInt32(1);
}
}
Now go to CatalogPage.cs
FIND:
PHP Code:
Data = dbClient.ReadDataTable("SELECT id,item_ids,catalog_name,cost_credits,cost_pixels,amount
Replace with
Data = dbClient.ReadDataTable("SELECT id,item_ids,catalog_name,cost_credits,cost_pixels,amount,quest_active,quest_cost,quest_type FROM catalog_items WHERE page_id = '" + Id + "' ORDER BY item_ids ASC");
Find
PHP Code:
Items.Add(new CatalogItem(
Replace with
Items.Add(new CatalogItem((uint)Row["id"], (string)Row["catalog_name"], (string)Row["item_ids"], (int)Row["cost_credits"], (int)Row["cost_pixels"], (int)Row["amount"], (int)Row["quest_active"], (int)Row["quest_cost"], (string)Row["quest_type"]));
Now go to Habbo.CS
PHP Code:
FIND
public Int32 ActivityPoints;
ADD UNDER
public Int32 QuestPoints;
FIND:
PHP Code:
public Habbo(UInt32 Id, string Username, string RealName, string AuthTicket,
uint Rank, string Motto, string Look, string Gender, Int32 Credits,
Int32 ActivityPoints, Double LastActivityPointsUpdate, bool Muted,
UInt32 HomeRoom, Int32 Respect, Int32 DailyRespectPoints, Int32 DailyPetRespectPoints,
int NewbieStatus, bool MutantPenalty, bool BlockNewFriends, GameClient pClient)
REPLACE WITH:
PHP Code:
public Habbo(UInt32 Id, string Username, string RealName, string AuthTicket,
uint Rank, string Motto, string Look, string Gender, Int32 Credits,
Int32 ActivityPoints, Double LastActivityPointsUpdate, bool Muted,
UInt32 HomeRoom, Int32 Respect, Int32 DailyRespectPoints, Int32 DailyPetRespectPoints,
int NewbieStatus, bool MutantPenalty, bool BlockNewFriends, GameClient pClient, Int32 QuestCoins)
PHP Code:
FIND
this.AuthTicket = AuthTicket,
Add under
this.QuestCoins = QuestCoins;
Now go to Authenticator.cs
Replace
PHP Code:
private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client)
{
return new Habbo((UInt32)Data["id"], (string)Data["username"], (string)Data["real_name"], AuthTicket, (uint)Data["rank"], (string)Data["motto"], (string)Data["look"], (string)Data["gender"], (int)Data["credits"], (int)Data["activity_points"], (Double)Data["activity_points_lastupdate"], UberEnvironment.EnumToBool(Data["is_muted"].ToString()), (UInt32)Data["home_room"], (Int32)Data["respect"], (int)Data["daily_respect_points"], (int)Data["daily_pet_respect_points"], (int)Data["newbie_status"], (Data["mutant_penalty"].ToString() != "0"), UberEnvironment.EnumToBool(Data["block_newfriends"].ToString()), Client);
}
With
PHP Code:
private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client)
{
return new Habbo((UInt32)Data["id"], (string)Data["username"], (string)Data["real_name"], AuthTicket, (uint)Data["rank"], (string)Data["motto"], (string)Data["look"], (string)Data["gender"], (int)Data["credits"], (int)Data["activity_points"], (Double)Data["activity_points_lastupdate"], UberEnvironment.EnumToBool(Data["is_muted"].ToString()), (UInt32)Data["home_room"], (Int32)Data["respect"], (int)Data["daily_respect_points"], (int)Data["daily_pet_respect_points"], (int)Data["newbie_status"], (Data["mutant_penalty"].ToString() != "0"), UberEnvironment.EnumToBool(Data["block_newfriends"].ToString()), Client, (int)Data["hearts"]);
}
Replace the UpdateCreditsBalance with
PHP Code:
public void UpdateCreditsBalance(Boolean InDatabase)
{
mClient.GetMessageHandler().GetResponse().Init(6);
mClient.GetMessageHandler().GetResponse().AppendStringWithBreak(Credits + ".0");
mClient.GetMessageHandler().SendResponse();
mClient.GetMessageHandler().GetResponse().Init(438);
mClient.GetMessageHandler().GetResponse().AppendInt32(QuestCoins);
mClient.GetMessageHandler().GetResponse().AppendInt32(0);
mClient.GetMessageHandler().GetResponse().AppendInt32(2);
if (InDatabase)
{
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE users SET credits = '" + Credits + "' WHERE id = '" + Id + "' LIMIT 1;");
dbClient.ExecuteQuery("UPDATE users SET hearts = '" + QuestCoins + "' WHERE id = '" + Id + "' LIMIT 1;");
}
}
}
In Catalog.cs
Replace the HandlePurchase function with
PHP Code:
public void HandlePurchase(GameClient Session, int PageId, uint ItemId, string ExtraData, Boolean IsGift, string GiftUser, string GiftMessage)
{
CatalogPage Page = GetPage(PageId);
if (Page.MinRank > Session.GetHabbo().Rank || Page.Visible == false)
{
Session.SendNotif("No estás autorizado para ver esta página.", 0);
return;
}
if (Page == null || Page.ComingSoon || !Page.Enabled || !Page.Visible)
{
return;
}
if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") || Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
{
return;
}
CatalogItem Item = Page.GetItem(ItemId);
if (Item == null)
{
return;
}
uint GiftUserId = 0;
if (IsGift)
{
if (!Item.GetBaseItem().AllowGift)
{
return;
}
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("gift_user", GiftUser);
try
{
GiftUserId = (uint)dbClient.ReadDataRow("SELECT id FROM users WHERE username = @gift_user LIMIT 1")[0];
}
catch (Exception) { }
}
if (GiftUserId == 0)
{
Session.GetMessageHandler().GetResponse().Init(76);
Session.GetMessageHandler().GetResponse().AppendBoolean(true);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(GiftUser);
Session.GetMessageHandler().SendResponse();
return;
}
}
Boolean CreditsError = false;
Boolean PixelError = false;
Boolean QuestError = false;
if (Session.GetHabbo().Credits < Item.CreditsCost)
{
CreditsError = true;
}
if (Session.GetHabbo().ActivityPoints < Item.PixelsCost)
{
PixelError = true;
}
if (Session.GetHabbo().QuestCoins < Item.QuestCoinCost)
{
QuestError = true;
}
if (CreditsError || PixelError || QuestError)
{
Session.GetMessageHandler().GetResponse().Init(68);
Session.GetMessageHandler().GetResponse().AppendBoolean(CreditsError);
if (Item.Quest_IsValid != 1)
{
Session.GetMessageHandler().GetResponse().AppendBoolean(PixelError);
}
else
{
Session.GetMessageHandler().GetResponse().AppendBoolean(QuestError);
}
Session.GetMessageHandler().SendResponse();
return;
}
if (IsGift && Item.GetBaseItem().Type.ToLower() == "e")
{
Session.SendNotif("No puedes enviar este objeto como regalo.", 0);
return;
}
// Extra Data is _NOT_ filtered at this point and MUST BE VERIFIED BELOW:
switch (Item.GetBaseItem().InteractionType.ToLower())
{
case "pet":
try
{
string[] Bits = ExtraData.Split('\n');
string PetName = Bits[0];
string Race = Bits[1];
string Color = Bits[2];
int.Parse(Race); // to trigger any possible errors
if (!CheckPetName(PetName))
{
return;
}
if (Race.Length != 3)
{
return;
}
if (Color.Length != 6)
{
return;
}
}
catch (Exception) { return; }
break;
case "roomeffect":
Double Number = 0;
try
{
Number = Double.Parse(ExtraData);
}
catch (Exception) { }
ExtraData = Number.ToString().Replace(',', '.');
break; // maintain extra data // todo: validate
case "postit":
ExtraData = "FFFF33";
break;
case "dimmer":
ExtraData = "1,1,1,#000000,255";
break;
case "trophy":
ExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + UberEnvironment.FilterInjectionChars(ExtraData, true);
break;
default:
ExtraData = "";
break;
}
if (Item.CreditsCost > 0)
{
Session.GetHabbo().Credits -= Item.CreditsCost;
Session.GetHabbo().UpdateCreditsBalance(true);
}
if (Item.PixelsCost > 0)
{
Session.GetHabbo().ActivityPoints -= Item.PixelsCost;
Session.GetHabbo().UpdateActivityPointsBalance(true);
}
if (Item.QuestCoinCost > 0)
{
Session.GetHabbo().QuestCoins -= Item.QuestCoinCost;
Session.GetHabbo().UpdateCreditsBalance(true);
}
Session.GetMessageHandler().GetResponse().Init(67);
Session.GetMessageHandler().GetResponse().AppendUInt(Item.GetBaseItem().ItemId);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Name);
Session.GetMessageHandler().GetResponse().AppendInt32(Item.CreditsCost);
if (Item.Quest_IsValid != 1)
{
Session.GetMessageHandler().GetResponse().AppendInt32(Item.PixelsCost);
}
else
{
Session.GetMessageHandler().GetResponse().AppendInt32(Item.QuestCoinCost);
}
Session.GetMessageHandler().GetResponse().AppendInt32(0);
Session.GetMessageHandler().GetResponse().AppendInt32(1);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Type.ToLower());
Session.GetMessageHandler().GetResponse().AppendInt32(Item.GetBaseItem().SpriteId);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak("");
Session.GetMessageHandler().GetResponse().AppendInt32(1);
Session.GetMessageHandler().GetResponse().AppendInt32(-1);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak("");
Session.GetMessageHandler().SendResponse();
if (IsGift)
{
uint GenId = GenerateItemId();
Item Present = GeneratePresent();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("gift_message", "!" + GiftMessage);
dbClient.AddParamWithValue("extra_data", ExtraData);
dbClient.ExecuteQuery("INSERT INTO user_items (id,user_id,base_item,extra_data) VALUES ('" + GenId + "','" + GiftUserId + "','" + Present.ItemId + "',@gift_message)");
dbClient.ExecuteQuery("INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('" + GenId + "','" + Item.GetBaseItem().ItemId + "','" + Item.Amount + "',@extra_data)");
}
GameClient Receiver = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(GiftUserId);
if (Receiver != null)
{
Receiver.SendNotif("Has recibido un regalo! Revisa tu inventario.", 0);
Receiver.GetHabbo().GetInventoryComponent().UpdateItems(true);
}
Session.SendNotif("Regalo enviado!", 0);
}
else
{
DeliverItems(Session, Item.GetBaseItem(), Item.Amount, ExtraData);
}
}
Maybe 1 or 2 mistakes with my Translating
SORRY
This code doesn't work for me...
Re: [R63] Part of (valentine) quests.
mClient is only for Blah emu.
Re: [R63] Part of (valentine) quests.
Puh I have the real BlahEmu, open source, thanks it works ;D
Re: [R63] Part of (valentine) quests.
can you give me that blahEmu?
Re: [R63] Part of (valentine) quests.
Quote:
Originally Posted by
jordynegen11
can you give me that blahEmu?
i have it too, and belive me, blahemu=shit at most places!
Re: [R63] Part of (valentine) quests.
Quote:
Originally Posted by
toperwin
i have it too, and belive me, blahemu=shit at most places!
Yeah ;D
Re: [R63] Part of (valentine) quests.
Quote:
Originally Posted by
tweeney
Cata stuff for Valentines. - From Keko requested translation by HabsHotel
Execute this SQL;
Code:
ALTER TABLE `catalog_items` ADD `quest_active` INT( 255 ) NOT NULL ,
ADD `quest_cost` INT( 255 ) NOT NULL ,
ADD `quest_type` VARCHAR( 500 ) NOT NULL DEFAULT 'val' COMMENT 'val = valentyne quest; snow = snowflakes quest'
In CatalogItem.cs,
Find
public int Amount;
Add under it:
PHP Code:
public int Quest_IsValid;
public int QuestCoinCost;
public string QuestType;
find
PHP Code:
public CatalogItem(uint Id, string Name, string ItemIds, int CreditsCost, int PixelsCost, int Amount)
Replace with
PHP Code:
public CatalogItem(uint Id, string Name, string ItemIds, int CreditsCost, int PixelsCost, int Amount, int Quest_IsValid, int QuestCoinCost, string QuestType)
And at the end of the function bit, Add:
PHP Code:
this.Quest_IsValid = Quest_IsValid;
this.QuestCoinCost = QuestCoinCost;
this.QuestType = QuestType;
Find
PHP Code:
Message.AppendInt32(PixelsCost);
Message.AppendInt32(0);
Replace witb
PHP Code:
if (Quest_IsValid != 1)
{
Message.AppendInt32(PixelsCost);
Message.AppendInt32(0); //snowflakes enable/disable (coming soon)
}
else
{
Message.AppendInt32(QuestCoinCost);
if (QuestType == "val")
{
Message.AppendInt32(2);
}
else if(QuestType == "snow")
{
Message.AppendInt32(1);
}
}
Now go to CatalogPage.cs
FIND:
PHP Code:
Data = dbClient.ReadDataTable("SELECT id,item_ids,catalog_name,cost_credits,cost_pixels,amount
Replace with
Data = dbClient.ReadDataTable("SELECT id,item_ids,catalog_name,cost_credits,cost_pixels,amount,quest_active,quest_cost,quest_type FROM catalog_items WHERE page_id = '" + Id + "' ORDER BY item_ids ASC");
Find
PHP Code:
Items.Add(new CatalogItem(
Replace with
Items.Add(new CatalogItem((uint)Row["id"], (string)Row["catalog_name"], (string)Row["item_ids"], (int)Row["cost_credits"], (int)Row["cost_pixels"], (int)Row["amount"], (int)Row["quest_active"], (int)Row["quest_cost"], (string)Row["quest_type"]));
Now go to Habbo.CS
PHP Code:
FIND
public Int32 ActivityPoints;
ADD UNDER
public Int32 QuestPoints;
FIND:
PHP Code:
public Habbo(UInt32 Id, string Username, string RealName, string AuthTicket,
uint Rank, string Motto, string Look, string Gender, Int32 Credits,
Int32 ActivityPoints, Double LastActivityPointsUpdate, bool Muted,
UInt32 HomeRoom, Int32 Respect, Int32 DailyRespectPoints, Int32 DailyPetRespectPoints,
int NewbieStatus, bool MutantPenalty, bool BlockNewFriends, GameClient pClient)
REPLACE WITH:
PHP Code:
public Habbo(UInt32 Id, string Username, string RealName, string AuthTicket,
uint Rank, string Motto, string Look, string Gender, Int32 Credits,
Int32 ActivityPoints, Double LastActivityPointsUpdate, bool Muted,
UInt32 HomeRoom, Int32 Respect, Int32 DailyRespectPoints, Int32 DailyPetRespectPoints,
int NewbieStatus, bool MutantPenalty, bool BlockNewFriends, GameClient pClient, Int32 QuestCoins)
PHP Code:
FIND
this.AuthTicket = AuthTicket,
Add under
this.QuestCoins = QuestCoins;
Now go to Authenticator.cs
Replace
PHP Code:
private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client)
{
return new Habbo((UInt32)Data["id"], (string)Data["username"], (string)Data["real_name"], AuthTicket, (uint)Data["rank"], (string)Data["motto"], (string)Data["look"], (string)Data["gender"], (int)Data["credits"], (int)Data["activity_points"], (Double)Data["activity_points_lastupdate"], UberEnvironment.EnumToBool(Data["is_muted"].ToString()), (UInt32)Data["home_room"], (Int32)Data["respect"], (int)Data["daily_respect_points"], (int)Data["daily_pet_respect_points"], (int)Data["newbie_status"], (Data["mutant_penalty"].ToString() != "0"), UberEnvironment.EnumToBool(Data["block_newfriends"].ToString()), Client);
}
With
PHP Code:
private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client)
{
return new Habbo((UInt32)Data["id"], (string)Data["username"], (string)Data["real_name"], AuthTicket, (uint)Data["rank"], (string)Data["motto"], (string)Data["look"], (string)Data["gender"], (int)Data["credits"], (int)Data["activity_points"], (Double)Data["activity_points_lastupdate"], UberEnvironment.EnumToBool(Data["is_muted"].ToString()), (UInt32)Data["home_room"], (Int32)Data["respect"], (int)Data["daily_respect_points"], (int)Data["daily_pet_respect_points"], (int)Data["newbie_status"], (Data["mutant_penalty"].ToString() != "0"), UberEnvironment.EnumToBool(Data["block_newfriends"].ToString()), Client, (int)Data["hearts"]);
}
Replace the UpdateCreditsBalance with
PHP Code:
public void UpdateCreditsBalance(Boolean InDatabase)
{
mClient.GetMessageHandler().GetResponse().Init(6);
mClient.GetMessageHandler().GetResponse().AppendStringWithBreak(Credits + ".0");
mClient.GetMessageHandler().SendResponse();
mClient.GetMessageHandler().GetResponse().Init(438);
mClient.GetMessageHandler().GetResponse().AppendInt32(QuestCoins);
mClient.GetMessageHandler().GetResponse().AppendInt32(0);
mClient.GetMessageHandler().GetResponse().AppendInt32(2);
if (InDatabase)
{
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.ExecuteQuery("UPDATE users SET credits = '" + Credits + "' WHERE id = '" + Id + "' LIMIT 1;");
dbClient.ExecuteQuery("UPDATE users SET hearts = '" + QuestCoins + "' WHERE id = '" + Id + "' LIMIT 1;");
}
}
}
In Catalog.cs
Replace the HandlePurchase function with
PHP Code:
public void HandlePurchase(GameClient Session, int PageId, uint ItemId, string ExtraData, Boolean IsGift, string GiftUser, string GiftMessage)
{
CatalogPage Page = GetPage(PageId);
if (Page.MinRank > Session.GetHabbo().Rank || Page.Visible == false)
{
Session.SendNotif("No estás autorizado para ver esta página.", 0);
return;
}
if (Page == null || Page.ComingSoon || !Page.Enabled || !Page.Visible)
{
return;
}
if (Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") || Page.ClubOnly && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
{
return;
}
CatalogItem Item = Page.GetItem(ItemId);
if (Item == null)
{
return;
}
uint GiftUserId = 0;
if (IsGift)
{
if (!Item.GetBaseItem().AllowGift)
{
return;
}
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("gift_user", GiftUser);
try
{
GiftUserId = (uint)dbClient.ReadDataRow("SELECT id FROM users WHERE username = @gift_user LIMIT 1")[0];
}
catch (Exception) { }
}
if (GiftUserId == 0)
{
Session.GetMessageHandler().GetResponse().Init(76);
Session.GetMessageHandler().GetResponse().AppendBoolean(true);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(GiftUser);
Session.GetMessageHandler().SendResponse();
return;
}
}
Boolean CreditsError = false;
Boolean PixelError = false;
Boolean QuestError = false;
if (Session.GetHabbo().Credits < Item.CreditsCost)
{
CreditsError = true;
}
if (Session.GetHabbo().ActivityPoints < Item.PixelsCost)
{
PixelError = true;
}
if (Session.GetHabbo().QuestCoins < Item.QuestCoinCost)
{
QuestError = true;
}
if (CreditsError || PixelError || QuestError)
{
Session.GetMessageHandler().GetResponse().Init(68);
Session.GetMessageHandler().GetResponse().AppendBoolean(CreditsError);
if (Item.Quest_IsValid != 1)
{
Session.GetMessageHandler().GetResponse().AppendBoolean(PixelError);
}
else
{
Session.GetMessageHandler().GetResponse().AppendBoolean(QuestError);
}
Session.GetMessageHandler().SendResponse();
return;
}
if (IsGift && Item.GetBaseItem().Type.ToLower() == "e")
{
Session.SendNotif("No puedes enviar este objeto como regalo.", 0);
return;
}
// Extra Data is _NOT_ filtered at this point and MUST BE VERIFIED BELOW:
switch (Item.GetBaseItem().InteractionType.ToLower())
{
case "pet":
try
{
string[] Bits = ExtraData.Split('\n');
string PetName = Bits[0];
string Race = Bits[1];
string Color = Bits[2];
int.Parse(Race); // to trigger any possible errors
if (!CheckPetName(PetName))
{
return;
}
if (Race.Length != 3)
{
return;
}
if (Color.Length != 6)
{
return;
}
}
catch (Exception) { return; }
break;
case "roomeffect":
Double Number = 0;
try
{
Number = Double.Parse(ExtraData);
}
catch (Exception) { }
ExtraData = Number.ToString().Replace(',', '.');
break; // maintain extra data // todo: validate
case "postit":
ExtraData = "FFFF33";
break;
case "dimmer":
ExtraData = "1,1,1,#000000,255";
break;
case "trophy":
ExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + UberEnvironment.FilterInjectionChars(ExtraData, true);
break;
default:
ExtraData = "";
break;
}
if (Item.CreditsCost > 0)
{
Session.GetHabbo().Credits -= Item.CreditsCost;
Session.GetHabbo().UpdateCreditsBalance(true);
}
if (Item.PixelsCost > 0)
{
Session.GetHabbo().ActivityPoints -= Item.PixelsCost;
Session.GetHabbo().UpdateActivityPointsBalance(true);
}
if (Item.QuestCoinCost > 0)
{
Session.GetHabbo().QuestCoins -= Item.QuestCoinCost;
Session.GetHabbo().UpdateCreditsBalance(true);
}
Session.GetMessageHandler().GetResponse().Init(67);
Session.GetMessageHandler().GetResponse().AppendUInt(Item.GetBaseItem().ItemId);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Name);
Session.GetMessageHandler().GetResponse().AppendInt32(Item.CreditsCost);
if (Item.Quest_IsValid != 1)
{
Session.GetMessageHandler().GetResponse().AppendInt32(Item.PixelsCost);
}
else
{
Session.GetMessageHandler().GetResponse().AppendInt32(Item.QuestCoinCost);
}
Session.GetMessageHandler().GetResponse().AppendInt32(0);
Session.GetMessageHandler().GetResponse().AppendInt32(1);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Item.GetBaseItem().Type.ToLower());
Session.GetMessageHandler().GetResponse().AppendInt32(Item.GetBaseItem().SpriteId);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak("");
Session.GetMessageHandler().GetResponse().AppendInt32(1);
Session.GetMessageHandler().GetResponse().AppendInt32(-1);
Session.GetMessageHandler().GetResponse().AppendStringWithBreak("");
Session.GetMessageHandler().SendResponse();
if (IsGift)
{
uint GenId = GenerateItemId();
Item Present = GeneratePresent();
using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("gift_message", "!" + GiftMessage);
dbClient.AddParamWithValue("extra_data", ExtraData);
dbClient.ExecuteQuery("INSERT INTO user_items (id,user_id,base_item,extra_data) VALUES ('" + GenId + "','" + GiftUserId + "','" + Present.ItemId + "',@gift_message)");
dbClient.ExecuteQuery("INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('" + GenId + "','" + Item.GetBaseItem().ItemId + "','" + Item.Amount + "',@extra_data)");
}
GameClient Receiver = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(GiftUserId);
if (Receiver != null)
{
Receiver.SendNotif("Has recibido un regalo! Revisa tu inventario.", 0);
Receiver.GetHabbo().GetInventoryComponent().UpdateItems(true);
}
Session.SendNotif("Regalo enviado!", 0);
}
else
{
DeliverItems(Session, Item.GetBaseItem(), Item.Amount, ExtraData);
}
}
Maybe 1 or 2 mistakes with my Translating
SORRY
DAMNIT :grr: :grr: - MAKE FOR UBEREMU!, BLAHEMU IS A SHIT.
THE CODE DON'T WORKS HERE ON MY EMULATOR
Re: [R63] Part of (valentine) quests.
Nice Release.
But now comes a piece of furniture if you fill the screen. Habbo, they also without image, how do you do that?