/// <summary> /// Converts this virtual room pet to a string to make it appear for game clients. /// </summary> public override string ToString() { fuseStringBuilder FSB = new fuseStringBuilder(); if (this.Information != null) { FSB.appendKeyValueParameter("i", this.ID); FSB.appendKeyValueParameter("n", this.Information.ID.ToString() + Convert.ToChar(4).ToString() + this.Information.Name); FSB.appendKeyValueParameter("f", this.Information.Figure); FSB.appendKeyValueParameter("l", this.X + " " + this.Y + " " + stringFunctions.formatFloatForClient(this.Z)); return(FSB.ToString()); } return(FSB.ToString()); }
/// <summary> /// Returns the favorite rooms of a given user as a string. /// </summary> /// <param name="User">The userInformation object of the user to retrieve the favorite rooms for.</param> public string getFavoriteRooms(userInformation User) { int guestRoomCount = 0; StringBuilder Rooms = new StringBuilder(); Database Database = new Database(false, true); Database.addParameterWithValue("userid", User.ID); Database.Open(); DataTable dTable = Database.getTable("SELECT rooms.*,users.username AS owner FROM rooms LEFT JOIN users ON rooms.ownerid = users.id WHERE rooms.id IN (SELECT roomid FROM rooms_favorites WHERE userid = @userid) ORDER BY rooms.id DESC LIMIT 30"); // User flats first foreach (DataRow dRow in dTable.Rows) { roomInformation Room = roomInformation.Parse(dRow, true); if (Room.isUserFlat) { guestRoomCount++; } Rooms.Append(Room.ToString(User)); } fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendWired(guestRoomCount); FSB.Append(Rooms.ToString()); return(FSB.ToString()); }
/// <summary> /// Converts this room user to a room user details string and returns it. /// </summary> public override string ToString() { if (this.Session != null && this.Session.User != null) { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendKeyValueParameter("i", this.ID); FSB.appendKeyValueParameter("a", Session.User.ID); FSB.appendKeyValueParameter("n", Session.User.Username); FSB.appendKeyValueParameter("f", Session.User.Figure); FSB.appendKeyValueParameter("s", Session.User.Sex); FSB.appendKeyValueParameter("l", this.X + " " + this.Y + " " + this.Z); if (Session.User.Motto.Length > 0) { FSB.appendKeyValueParameter("c", Session.User.Motto); } if (Session.User.Badge.Length > 0) { FSB.appendKeyValueParameter("b", Session.User.Badge); } // TODO: Swimoutfit return(FSB.ToString()); } else { return(""); } }
/// <summary> /// Returns the item list of all the items in the hand ordered by ID. /// </summary> public string getHandItemCasts() { fuseStringBuilder Items = new fuseStringBuilder(); int startID = 0; int endID = this.handItems.Count; if (this.handStripPageIndex == 255) { this.handStripPageIndex = (byte)((endID - 1) / 9); } calculateStripOffset: if (endID > 0) { startID = this.handStripPageIndex * 9; if (endID > (startID + 9)) { endID = startID + 9; } if (startID >= endID) { this.handStripPageIndex--; goto calculateStripOffset; } for (int stripSlotID = startID; stripSlotID < endID; stripSlotID++) { Items.Append(this.handItems[stripSlotID].ToStripString(stripSlotID)); } } return(Items.ToString()); }
/// <summary> /// Returns a string with all the statuses of all active room units. /// </summary> public string getRoomUnitStatuses() { fuseStringBuilder FSB = new fuseStringBuilder(); if (this.roomPets != null) { lock (this.roomPets) { foreach (roomPet lPet in this.roomPets) { FSB.Append(lPet.ToStatusString()); } } } lock (this.roomUsers) { foreach (roomUser lUser in this.roomUsers.Values) { FSB.Append(lUser.ToStatusString()); } } return(FSB.ToString()); }
/// <summary> /// Creates the messenger textmessage message of this string and returns it. /// </summary> public override string ToString() { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendWired(this.ID); FSB.appendWired(this.senderID); FSB.appendClosedValue(this.sentString); FSB.appendClosedValue(this.Body); return(FSB.ToString()); }
/// <summary> /// Generates the trade box for a given session and returns it as as string. /// </summary> /// <param name="Session">The Woodpecker.Sessions.Session object to generate the trade box string for.</param> public string generateTradeBox(Session Session) { fuseStringBuilder Box = new fuseStringBuilder(); if (Session.itemStripHandler.isTrading) { Box.appendTabbedValue(Session.User.Username); Box.appendTabbedValue(Session.itemStripHandler.tradeAccept.ToString().ToLower()); Box.Append(Session.itemStripHandler.getTradeOfferItems()); Box.appendChar(13); } return(Box.ToString()); }
/// <summary> /// Converts this floor item to a string representation and returns it. /// </summary> public override string ToString() { /* Format example: public space object * 2732 invisichair 27 32 1 2 */ /* Format example: furniture * 802610 * chair_polyfon * PB PA I I H 0.0 * 0,0,0 * * H data */ fuseStringBuilder FSB = new fuseStringBuilder(); if (!this.Definition.Behaviour.isPublicSpaceObject) { FSB.appendClosedValue(this.ID.ToString()); FSB.appendClosedValue(this.Definition.Sprite); FSB.appendWired(this.X); FSB.appendWired(this.Y); FSB.appendWired(this.Definition.Length); FSB.appendWired(this.Definition.Width); FSB.appendWired(this.Rotation); FSB.appendClosedValue(stringFunctions.formatFloatForClient(this.Z)); FSB.appendClosedValue(this.Definition.Color); FSB.appendClosedValue(null); FSB.appendWired(this.teleporterID); FSB.appendClosedValue(this.customData); } else { //FSB.appendWhiteSpacedValue(this.ID.ToString()); FSB.appendWhiteSpacedValue(this.customData); FSB.appendWhiteSpacedValue(this.Definition.Sprite); FSB.appendWhiteSpacedValue(this.X.ToString()); FSB.appendWhiteSpacedValue(this.Y.ToString()); FSB.appendWhiteSpacedValue(this.Z.ToString()); FSB.Append(this.Rotation.ToString()); FSB.appendChar(13); } return(FSB.ToString()); }
/// <summary> /// Creates the user details string for use with message 5. ('@E') /// </summary> public override string ToString() { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendClosedValue(this.sessionID.ToString()); FSB.appendClosedValue(this.Username); FSB.appendClosedValue(this.Figure); FSB.appendClosedValue(this.Sex.ToString()); FSB.appendClosedValue(this.Motto); FSB.appendWired(this.Tickets); FSB.appendClosedValue(null); // Pool figure FSB.appendWired(this.Film); return(FSB.ToString()); }
/// <summary> /// Converts this wall item to a string representation and returns it. /// </summary> public override string ToString() { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendTabbedValue(this.ID.ToString()); FSB.appendTabbedValue(this.Definition.Sprite); FSB.appendTabbedValue(" "); FSB.appendTabbedValue(this.wallPosition); if (this.customData != null) { FSB.Append(this.customData); } return(FSB.ToString()); }
/// <summary> /// Creates the messenger buddy string of this user information and returns it. /// </summary> public override string ToString() { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendWired(this.ID); FSB.appendClosedValue(this.Username); FSB.appendWired(this.Sex == 'M'); FSB.appendClosedValue(messengerMotto); bool isOnline = Engine.Game.Users.userIsLoggedIn(this.ID); FSB.appendWired(isOnline); if (isOnline) // User is online { Session userSession = Engine.Game.Users.getUserSession(this.ID); if (userSession == null) { FSB.Append("Hotel View"); } else { if (userSession.inRoom) { if (userSession.roomInstance.Information.isUserFlat) { FSB.Append("Floor1a"); } else { FSB.Append(userSession.roomInstance.Information.Name); } } this.lastActivity = DateTime.Now; } } else { FSB.Append("Hotel View"); } FSB.appendChar(2); FSB.appendClosedValue(messengerLastActivity); FSB.appendClosedValue(this.Figure); return(FSB.ToString()); }
/// <summary> /// Returns a string with all the offered trade items represented as a string. /// </summary> public string getTradeOfferItems() { fuseStringBuilder FSB = new fuseStringBuilder(); if (this.isTrading) { for (int slotID = 0; slotID < this.tradeOfferItemIDs.Count; slotID++) { stripItem pItem = this.getHandItem(this.tradeOfferItemIDs[slotID]); if (pItem != null) { FSB.Append(pItem.ToStripString(slotID)); } } } return(FSB.ToString()); }
/// <summary> /// Parses the generic roomInformation object to a room information string. /// </summary> /// <param name="viewingUser">The userInformation object of the user that requests the flat information string.</param> public string ToString(userInformation viewingUser) { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendWired(this.ID); // Room ID if (!this.isUserFlat) // Public space flag { FSB.appendWired(true); } FSB.appendClosedValue(this.Name); // Room name if (this.isUserFlat) // User flat { if (this.showOwner || this.ownerID == viewingUser.ID || viewingUser.hasFuseRight("fuse_see_all_roomowners")) { FSB.appendClosedValue(this.Owner); } else { FSB.Append("-"); } FSB.appendClosedValue(this.accessType.ToString()); } FSB.appendWired(this.currentVisitors); FSB.appendWired(this.maxVisitors); if (!this.isUserFlat) { FSB.appendWired(this.categoryID); } FSB.appendClosedValue(this.Description); if (!this.isUserFlat) { FSB.appendWired(this.ID); FSB.appendWired(false); FSB.appendClosedValue(this.CCTs); FSB.appendWired(false); FSB.appendWired(true); } return(FSB.ToString()); }
/// <summary> /// Converts this room user to a room user details string and returns it. /// </summary> public override string ToString() { if (this.Session != null && this.Session.User != null) { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendKeyValueParameter("i", this.ID); FSB.appendKeyValueParameter("a", Session.User.ID); FSB.appendKeyValueParameter("n", Session.User.Username); FSB.appendKeyValueParameter("f", Session.User.Figure); FSB.appendKeyValueParameter("s", Session.User.Sex); FSB.appendKeyValueParameter("l", this.X + " " + this.Y + " " + this.Z); if (Session.User.Motto.Length > 0) { FSB.appendKeyValueParameter("c", Session.User.Motto); } if (Session.User.Badge.Length > 0) { FSB.appendKeyValueParameter("b", Session.User.Badge); } // TODO: Swimoutfit return(FSB.ToString()); } else if (this.bInfo != null) { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendKeyValueParameter("i", this.ID); FSB.appendKeyValueParameter("a", -1); FSB.appendKeyValueParameter("n", bInfo.Name); FSB.appendKeyValueParameter("f", bInfo.Figure); //FSB.appendKeyValueParameter("s", "M"); FSB.appendKeyValueParameter("l", this.X + " " + this.Y + " " + this.Z); //if (Session.User.Motto.Length > 0) FSB.appendKeyValueParameter("c", "I'm a Bot!"); //if (Session.User.Badge.Length > 0) FSB.appendKeyValueParameter("b", "ADM"); FSB.appendNewLineValue("[bot]"); return(FSB.ToString()); } else { return(""); } }
/// <summary> /// Returns a string with all the string representations of all the wall items in this room instance. /// </summary> /// <returns></returns> public string getWallItems() { if (this.Information.isUserFlat) { fuseStringBuilder FSB = new fuseStringBuilder(); lock (this.wallItems) { foreach (wallItem lItem in this.wallItems) { FSB.Append(lItem.ToString()); FSB.appendChar(13); } } return FSB.ToString(); } else return ""; }
/// <summary> /// Returns a string with the usernames of the users in this room. /// </summary> public string getUserList() { fuseStringBuilder FSB = new fuseStringBuilder(); if (!this.Information.isUserFlat) { FSB.appendWired(this.roomID); lock (this.roomUsers) { FSB.appendWired(this.roomUsers.Count); foreach (roomUser lRoomUser in this.roomUsers.Values) { FSB.appendClosedValue(lRoomUser.Session.User.Username); } } } return(FSB.ToString()); }
/// <summary> /// Returns a string with all the string representations of all the floor items in this room instance. /// </summary> /// <param name="publicSpaceItems">Supply true to return the public space items, false for user items.</param> public string getFloorItems(bool publicSpaceItems) { fuseStringBuilder FSB = new fuseStringBuilder(); if (!(publicSpaceItems && this.Information.isUserFlat)) { if (!publicSpaceItems) FSB.appendWired(this.floorItems.Count); lock (this.floorItems) { foreach (floorItem lItem in this.floorItems) { FSB.Append(lItem.ToString()); } } } return FSB.ToString(); }
/// <summary> /// Converts the required fields from this object to a user flat information string. The 'show owner username' property is handled here as well, by checking the permissions of the given user. /// </summary> /// <param name="viewingUser">The userInformation object of the user that requests the flat information string.</param> /// <returns></returns> public string ToUserFlatString() { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendTabbedValue(this.ID.ToString()); FSB.appendTabbedValue(this.Name); FSB.appendTabbedValue(this.Owner); FSB.appendTabbedValue(this.accessType.ToString()); FSB.appendTabbedValue("x"); FSB.appendTabbedValue(this.currentVisitors.ToString()); FSB.appendTabbedValue(this.maxVisitors.ToString()); FSB.appendTabbedValue("null"); FSB.appendTabbedValue(this.Description); FSB.appendTabbedValue(this.Description); FSB.appendChar(13); return(FSB.ToString()); }
/// <summary> /// Converts this store page representation to a string and returns it. /// </summary> public override string ToString() { if (this._szObj == null) // Not made yet! { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendKeyValueParameter("i", base.getStringAttribute("name_index")); // Index name of page FSB.appendKeyValueParameter("n", base.getStringAttribute("name")); // Display name of page FSB.appendKeyValueParameter("l", base.getStringAttribute("layout")); // Layout type of page FSB.appendKeyValueParameter("g", base.getStringAttribute("img_headline")); // Name of headline image in c_images/catalogue/ directory OR internal cast files of client FSB.appendKeyValueParameter("e", base.getStringAttribute("img_teasers")); // List of teaser image names, separated by commas FSB.appendKeyValueParameter("h", base.getStringAttribute("body")); // Body text of page if (base.hasSetAttribute("label_pick")) // 'Click for more information' label { FSB.appendKeyValueParameter("w", base.getStringAttribute("label_pick")); } if (base.hasSetAttribute("label_extra_s")) // Extra information { FSB.appendKeyValueParameter("s", base.getStringAttribute("label_extra_s")); } // Custom data (t1:, t2: etc) for (int attID = 1; attID < 11; attID++) { string szExtraAttribute = "label_extra_t_" + attID; if (!base.hasSetAttribute(szExtraAttribute)) { break; } FSB.appendKeyValueParameter("t" + attID, base.getStringAttribute(szExtraAttribute)); } foreach (storeCatalogueSale lSale in this.getSales()) { FSB.appendKeyValueParameter("p", lSale.ToString()); } this._szObj = FSB.ToString(); } return(this._szObj); }
/// <summary> /// Converts this catalogue page sale representation to a string and returns it. /// </summary> public override string ToString() { try { fuseStringBuilder szSaleDetails = new fuseStringBuilder(); szSaleDetails.appendTabbedValue(this.Name); szSaleDetails.appendTabbedValue(this.Description); szSaleDetails.appendTabbedValue(this.Price.ToString()); szSaleDetails.appendTabbedValue(null); szSaleDetails.appendTabbedValue(this.saleItemType); // 'i', 's', 'd' etc szSaleDetails.appendTabbedValue(this.itemIcon); szSaleDetails.appendTabbedValue(this.itemSize); szSaleDetails.appendTabbedValue(this.itemDimensions); szSaleDetails.appendTabbedValue(this.saleCode); if (this.isPackage || this.pItem.Sprite == "poster") { szSaleDetails.appendTabbedValue(null); } if (this.isPackage) { szSaleDetails.appendTabbedValue(this.pPackageItems.Count.ToString()); foreach (storeCataloguePackageItem lPackageItem in this.pPackageItems) { szSaleDetails.appendTabbedValue(Engine.Game.Items.generateSpecialSprite(ref lPackageItem.pItem.Sprite, lPackageItem.specialSpriteID)); szSaleDetails.appendTabbedValue(lPackageItem.pAmount.ToString()); szSaleDetails.appendTabbedValue(lPackageItem.pItem.Color); } } else { if (!this.pItem.Behaviour.isWallItem) // Wall items do not have colors { szSaleDetails.appendTabbedValue(this.pItem.Color); } } return(szSaleDetails.ToString()); } catch { return(""); } }
/// <summary> /// Returns a string with all the string representations of all the wall items in this room instance. /// </summary> /// <returns></returns> public string getWallItems() { if (this.Information.isUserFlat) { fuseStringBuilder FSB = new fuseStringBuilder(); lock (this.wallItems) { foreach (wallItem lItem in this.wallItems) { FSB.Append(lItem.ToString()); FSB.appendChar(13); } } return(FSB.ToString()); } else { return(""); } }
/// <summary> /// Returns a string with all the string representations of all the floor items in this room instance. /// </summary> /// <param name="publicSpaceItems">Supply true to return the public space items, false for user items.</param> public string getFloorItems(bool publicSpaceItems) { fuseStringBuilder FSB = new fuseStringBuilder(); if (!(publicSpaceItems && this.Information.isUserFlat)) { if (!publicSpaceItems) { FSB.appendWired(this.floorItems.Count); } lock (this.floorItems) { foreach (floorItem lItem in this.floorItems) { FSB.Append(lItem.ToString()); } } } return(FSB.ToString()); }
/// <summary> /// Loads all the item definitions from the database and stores them in the definition collection. /// </summary> public void loadDefinitions() { _Definitions.Clear(); // Clear old definitions from collection fuseStringBuilder spriteIndex = new fuseStringBuilder(); Logging.Log("Loading item definitions..."); Database dbClient = new Database(true, true); if (dbClient.Ready) { List <string> includedSprites = new List <string>(); DataRowCollection Definitions = dbClient.getTable("SELECT * FROM items_definitions ORDER BY id ASC").Rows; spriteIndex.appendWired(Definitions.Count); foreach (DataRow dRow in Definitions) { int ID = (int)dRow["id"]; itemDefinition Definition = itemDefinition.Parse(dRow); Definition.directoryID = (int)dRow["cast_directory"]; _Definitions.Add(ID, Definition); if (!includedSprites.Contains(Definition.Sprite)) { spriteIndex.appendClosedValue(Definition.Sprite); spriteIndex.appendWired(Definition.directoryID); includedSprites.Add(Definition.Sprite); } } _spriteIndex = spriteIndex.ToString(); Logging.Log("Loaded " + Definitions.Count + " item definitions."); } else { Logging.Log("Failed to load the item definitions, database was not contactable!", Logging.logType.commonError); } }
/// <summary> /// Creates the messenger buddy status string of this user information and returns it. /// </summary> public string ToStatusString() { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendWired(this.ID); FSB.appendClosedValue(messengerMotto); bool isOnline = Engine.Game.Users.userIsLoggedIn(this.ID); FSB.appendWired(isOnline); if (isOnline) // User is online { Session userSession = Engine.Game.Users.getUserSession(this.ID); if (userSession.inRoom) { if (userSession.roomInstance.Information.isUserFlat) { FSB.Append("Floor1a"); } else { FSB.Append(userSession.roomInstance.Information.Name); } } else { FSB.Append("on Hotel View"); } } else { FSB.Append(messengerLastActivity); } FSB.appendChar(2); return(FSB.ToString()); }
/// <summary> /// Returns a string with all the statuses of all active room units. /// </summary> public string getRoomUnitStatuses() { fuseStringBuilder FSB = new fuseStringBuilder(); if (this.roomPets != null) { lock (this.roomPets) { foreach (roomPet lPet in this.roomPets) { FSB.Append(lPet.ToStatusString()); } } } if (this.roomBots != null) { lock (this.roomBots) { foreach (roomUser lBot in this.roomBots) { lBot.rotationHead = lBot.bInfo.rotation; lBot.rotationBody = lBot.bInfo.rotation; FSB.Append(lBot.ToStatusString()); } } } lock (this.roomUsers) { foreach (roomUser lUser in this.roomUsers.Values) { FSB.Append(lUser.ToStatusString()); } } return(FSB.ToString()); }
/// <summary> /// Builds the string for the client that displays the index of games and their details. /// </summary> public string buildGameIndex() { int[] gameAmounts = new int[3]; fuseStringBuilder ptxtGames = new fuseStringBuilder(); foreach (arcadeGame lGame in mGames) { ptxtGames.Append(lGame.ToSummaryString()); gameAmounts[(int)lGame.State]++; } fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendWired(gameAmounts[0]); // Amount of 'waiting' games if (gameAmounts[1] > 0 || gameAmounts[2] > 0) { FSB.appendWired(gameAmounts[1]); // Amount of started games FSB.appendWired(gameAmounts[2]); // Amount of ended games } FSB.Append(ptxtGames.ToString()); return(FSB.ToString()); }
/// <summary> /// Returns the string representation of this arcade game for display in the game list. /// </summary> public string ToSummaryString() { fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendWired(this.ID); FSB.appendClosedValue(this.Title); arcadeGamePlayer pOwner = this.getOwnerPlayer(); if (pOwner != null) { FSB.appendWired(pOwner.roomUnitID); FSB.appendClosedValue(pOwner.Username); } else { FSB.appendWired(-1); FSB.appendClosedValue("???"); } FSB.appendWired(this.mapID); return(FSB.ToString()); }
/// <summary> /// Converts this item instance representation to a string that displays this item on a strip (hand or trading box) and returns it. /// </summary> /// <param name="slotID">The current slot ID of this item on the strip.</param> public string ToStripString(int stripSlotID) { /* * Wallitem: * + "SI" * + itemID * + slotID * + stripItemType 'I' * + itemID * + sprite * + color (incase of decoration or post.it pad: customdata) * + recycleable 1/0 * + "/" * * Flooritem: * + "SI" * + itemID (negative) * + slotID * + stripItemType 'S' * + itemID * + sprite * + length * + width * + customdata * + color * + recycleable 1/0 * + sprite * + "/" */ fuseStringBuilder FSB = new fuseStringBuilder(); FSB.appendStripValue("SI"); //if (!this.Definition.isWallItem) // Floor item ID = negative, so prefix with '-' // FSB.Append("-"); FSB.appendStripValue(this.ID.ToString()); FSB.appendStripValue(stripSlotID.ToString()); if (this.Definition.Behaviour.isWallItem) { FSB.appendStripValue("I"); } else { FSB.appendStripValue("S"); } FSB.appendStripValue(this.ID.ToString()); FSB.appendStripValue(this.Definition.Sprite); if (this.Definition.Behaviour.isWallItem) { FSB.appendStripValue(this.customData); FSB.appendStripValue("0"); // Not-recycleable } else { FSB.appendStripValue(this.Definition.Length.ToString()); FSB.appendStripValue(this.Definition.Width.ToString()); FSB.appendStripValue(this.customData); FSB.appendStripValue(this.Definition.Color); FSB.appendStripValue("0"); // Not-recycleable FSB.appendStripValue(this.Definition.Sprite); } FSB.Append("/"); return(FSB.ToString()); }
/// <summary> /// 100 - "Ad" /// </summary> public void GRPC() { for (int i = 0; i < this.Session.User.Multiplier; i++) { string[] purchaseArguments = Request.Content.Split(Convert.ToChar(13)); storeCataloguePage pPage = Engine.Game.Store.getCataloguePage(purchaseArguments[1]); if (pPage == null) { return; } if (!pPage.roleHasAccess(Session.User.Role)) // No access { return; } storeCatalogueSale pSale = pPage.getSale(purchaseArguments[3]); #region Credits balance + valid item check if (pSale == null || pSale.Price > Session.User.Credits) // Sale not found/not able to purchase { Response.Initialize(68); // "AD" sendResponse(); return; } #endregion int receivingUserID = Session.User.ID; string customData = null; string presentBoxNote = null; if (!pSale.isPackage) { #region Handle custom data if (pSale.pItem.Behaviour.isDecoration) { int decorationValue = 0; if (int.TryParse(purchaseArguments[4], out decorationValue) && decorationValue > 0) { customData = decorationValue.ToString(); } else { return; } } else if (pSale.pItem.Behaviour.isPrizeTrophy) { stringFunctions.filterVulnerableStuff(ref purchaseArguments[4], true); fuseStringBuilder sb = new fuseStringBuilder(); sb.appendTabbedValue(Session.User.Username); sb.appendTabbedValue(DateTime.Today.ToShortDateString()); sb.Append(purchaseArguments[4]); // Inscription customData = sb.ToString(); } if (pSale.saleCode.Length == 4 && pSale.saleCode.IndexOf("pet") == 0) // Pet sale { // Verify petname string[] petData = purchaseArguments[4].Split(Convert.ToChar(2)); if (petData[0].Length > 15) // Name too long, truncate name { petData[0] = petData[0].Substring(0, 15); } stringFunctions.filterVulnerableStuff(ref petData[0], true); // Verify pet type int petType = int.Parse(pSale.saleCode.Substring(3)); // Verify race byte Race = 0; try { Race = byte.Parse(petData[1]); } catch { } petData[1] = Race.ToString(); // Verify color try { ColorTranslator.FromHtml("#" + petData[2]); } catch { return; } // Hax! customData = petData[0] // Name + Convert.ToChar(2) + petType.ToString() // Type + Convert.ToChar(2) + petData[1] // Race + Convert.ToChar(2) + petData[2]; // Color } #endregion } #region Handle presents if (purchaseArguments[5] == "1") { if (purchaseArguments[6].ToLower() != Session.User.Username.ToLower()) // Receiving user is different than buyer { receivingUserID = Engine.Game.Users.getUserID(purchaseArguments[6]); if (receivingUserID == 0) // Receiving user was not found { Response.Initialize(76); // "AL" Response.Append(purchaseArguments[6]); sendResponse(); return; } } presentBoxNote = purchaseArguments[7]; stringFunctions.filterVulnerableStuff(ref presentBoxNote, true); } #endregion // Charge buyer Session.User.Credits -= pSale.Price; Session.refreshCredits(); // Create items and deliver Engine.Game.Store.requestSaleShipping(receivingUserID, pSale.saleCode, true, purchaseArguments[5] == "1", presentBoxNote, customData ?? ""); // Update user valueables and log transaction Session.User.updateValueables(); Engine.Game.Store.logTransaction(Session.User.ID, "stuff_store", -pSale.Price); } }