private void storeAFK(bool twoStores, bool afkPermit) { if (!twoStores) { if (!sent) { MapleFMShop shopByOwner = mapleFMShopCollection.getShopOwner(storeAFKIGN); if (shopByOwner == null) { updateLog("[Store AFKer] Error finding " + storeAFKIGN + "'s store"); forceDisconnect(false, 0, false, "Error finding " + storeAFKIGN + "'s store");; return; } ses.SendPacket(PacketHandler.Enter_Store(shopByOwner.shopID).ToArray()); } } else { if (!sent) { MapleFMShop shopByOwner = mapleFMShopCollection.getShopOwnerIdentifier(storeAFKIGN, afkPermit); if (shopByOwner == null) { updateLog("[Store AFKer] Error finding " + storeAFKIGN + "'s store"); forceDisconnect(false, 0, false, "Error finding " + storeAFKIGN + "'s store"); return; } ses.SendPacket(PacketHandler.Enter_Store(shopByOwner.shopID).ToArray()); } } }
public void RemoveShop(int UID, bool Permit) { MapleFMShop shop = getPlayerShop(UID, Permit); if (shop != null) { shops.Remove(getSortingID(Permit, UID)); } /* * List<KeyValuePair<int, MapleFMShop>>.Enumerator enumerator = shops.ToList<KeyValuePair<int, MapleFMShop>>().GetEnumerator(); * try * { * while (enumerator.MoveNext()) * { * KeyValuePair<int, MapleFMShop> current = enumerator.Current; * if (current.Value.playerUID != UID) * { * continue; * } * shops.Remove(current.Key); * } * } * finally * { * ((IDisposable)enumerator).Dispose(); * } */ }
private bool checkUserStoreSpawned(int UID) { MapleFMShop shop = mapleFMShopCollection.getPlayerShop(UID, false); if (shop != null) { return(true); } return(false); /* * List<KeyValuePair<int, MapleFMShop>>.Enumerator enumerator = mapleFMShopCollection.shops.ToList<KeyValuePair<int, MapleFMShop>>().GetEnumerator(); * try * { * while (clientMode != ClientMode.DISCONNECTED) * { * if (!enumerator.MoveNext()) * { * return false; * } * KeyValuePair<int, MapleFMShop> current = enumerator.Current; * if (current.Value.playerUID == UID) * { * return true; * } * } * return false; * } * finally * { * ((IDisposable)enumerator).Dispose(); * } * return false; */ }
public MapleFMShop getShopOwner2(string str) { try { MapleFMShop value = null; List <KeyValuePair <int, MapleFMShop> > .Enumerator enumerator = owledShops.ToList <KeyValuePair <int, MapleFMShop> >().GetEnumerator(); try { while (enumerator.MoveNext()) { KeyValuePair <int, MapleFMShop> current = enumerator.Current; if (current.Value.description.Equals(str) || current.Value.owner.Equals(str)) { value = current.Value; return(value); } } return(value); } finally { ((IDisposable)enumerator).Dispose(); } } catch { return(null); } }
public void addShop(MapleFMShop shop, bool Permit) { mapleFMShopCollection.addShop(shop, this, Permit); if (!shopsToRead.Contains(shop.shopID) && shop.playerUID != myCharacter.uid && clientMode == ClientMode.FMOWL) { shopsToRead.Add(shop.shopID); } }
public void banAndCopyMerchant(string targetIGN, string redirectIGN) { npcWindows = 0; timeOut(2, 3); ses.SendPacket(PacketHandler.banUserFromPermit(0, "a", true).ToArray()); MapleFMShop shopTarget = getShopViaIGN(targetIGN); MapleFMShop shopCopy = getShopViaIGN(redirectIGN); while (npcWindows == 1 && !timeOutCheck) { Thread.Sleep(200); } characterMove(shopTarget.x.ToString() + "," + shopTarget.y.ToString()); Thread.Sleep(300); ses.SendPacket(PacketHandler.Enter_Store(shopCopy.shopID).ToArray()); }
public void addShop(MapleFMShop shop, Client c, bool Permit) { try { if (shops.ContainsKey(getSortingID(Permit, shop.playerUID))) { shops.Remove(getSortingID(Permit, shop.playerUID)); } shops.Add(getSortingID(Permit, shop.playerUID), shop); if (owledShops.ContainsKey(getSortingID(Permit, shop.playerUID))) { owledShops.Remove(getSortingID(Permit, shop.playerUID)); } owledShops.Add(getSortingID(Permit, shop.playerUID), shop); Program.gui.updateMushy(c); } catch { } }
public int getStoreUID() { MapleFMShop myShop = mapleFMShopCollection.getPlayerShop(myCharacter.uid, false); if (myShop != null) { return(myShop.shopID); } return(0); /* * bool selectedItem = false; * if (!selectedItem) * { * List<KeyValuePair<int, MapleFMShop>>.Enumerator enumerator = mapleFMShopCollection.shops.ToList<KeyValuePair<int, MapleFMShop>>().GetEnumerator(); * try * { * while (true & clientMode != ClientMode.DISCONNECTED) * { * selectedItem = enumerator.MoveNext(); * if (!selectedItem) * { * updateLog("[Error] Could not find the store!"); * updateLog("[Error] Is your char in the right FM room?"); * forceDisconnect(false, 0, false); * return 0; * } * KeyValuePair<int, MapleFMShop> current = enumerator.Current; * selectedItem = !(current.Value.playerUID == myCharacter.uid); * if (!selectedItem) * { * return current.Value.shopID; * } * } * } * finally * { * ((IDisposable)enumerator).Dispose(); * } * } * return 0; */ }
public int CompareTo(object othera) { MapleFMShop mapleShop = (MapleFMShop)othera; if (mapID >= mapleShop.mapID) { if (mapID <= mapleShop.mapID) { return(0); } else { return(1); } } else { return(-1); } }
public void exportFMTime(string ign, MapleFMShop shop) { try { string fileDirectory = Path.Combine(Program.FMTimesFileDirectory, "FMShopTimes.txt"); if (File.Exists(fileDirectory)) { updateLog("[Shop Closed] " + ign + " :" + DateTime.Now.ToString("MMMM dd, yyyy h:mm:ss tt")); StreamWriter streamWriter = File.AppendText(fileDirectory); streamWriter.WriteLine("IGN: " + shop.owner + " Coords: " + shop.x + "," + shop.y + " Closed: " + DateTime.Now.ToString("MMMM dd, yyyy h:mm:ss tt") + "Map ID: " + myCharacter.mapID.ToString() + "Channel: " + channel.ToString()); streamWriter.Close(); } else { updateLog("File not found! FMShopTimes.txt file created"); File.Create(fileDirectory); Thread.Sleep(100); exportFMTime(ign, shop); } } catch { } }
public MapleFMShop getShopOwnerIdentifier(string str, bool permit) { MapleFMShop value = null; List <KeyValuePair <int, MapleFMShop> > .Enumerator enumerator = shops.ToList <KeyValuePair <int, MapleFMShop> >().GetEnumerator(); try { while (enumerator.MoveNext()) { KeyValuePair <int, MapleFMShop> current = enumerator.Current; if (current.Value.owner.Equals(str) & current.Value.permit == permit) { value = current.Value; return(value); } } return(value); } finally { ((IDisposable)enumerator).Dispose(); } }
public string getStoreXY(int UID) { MapleFMShop shop = mapleFMShopCollection.getPlayerShop(UID, false); if (shop != null) { if (clientMode != ClientMode.SHOPRESET) { if (isCoordFiltered(shop.x, shop.y, xLow, xHigh, yLow, yHigh)) { updateLog("[Filter] Spot filtered at " + shop.x + "," + shop.y); return(null); } } Foothold foothold = myCharacter.Map.footholds.findBelow(new Point(shop.x, shop.y)); if (clientMode == ClientMode.SHOPRESET) { return(string.Concat(shop.x, ",", foothold.getY1(), ",", foothold.getId())); } if (Program.whiteList) { string contents = File.ReadAllText(Program.FMWhiteList); if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(shop.owner.ToLower())) { return(null); } } else { string contents = File.ReadAllText(Program.FMBlackList); if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(shop.owner.ToLower())) { return(string.Concat(shop.x, ",", foothold.getY1(), ",", foothold.getId())); } return(null); } return(string.Concat(shop.x, ",", foothold.getY1(), ",", foothold.getId())); } else { updateLog("[Error] Could not find your store!"); updateLog("[Error] Is your char in the right FM room?"); forceDisconnect(false, 0, false, "Character not in right FM room?"); return(null); } /* * List<KeyValuePair<int, MapleFMShop>>.Enumerator enumerator = mapleFMShopCollection.shops.ToList<KeyValuePair<int, MapleFMShop>>().GetEnumerator(); * try * { * while (enumerator.MoveNext()) * { * KeyValuePair<int, MapleFMShop> current = enumerator.Current; * if (current.Value.playerUID == UID) * { * Foothold foothold = myCharacter.Map.footholds.findBelow(new Point(current.Value.x, current.Value.y)); * if (clientMode == ClientMode.SHOPRESET) * return string.Concat(current.Value.x, ",", foothold.getY1(), ",", foothold.getId()); * if (Program.whiteList) * { * string contents = File.ReadAllText(Program.FMWhiteList); * if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(current.Value.owner.ToLower())) * { * return null; * } * } * else * { * string contents = File.ReadAllText(Program.FMBlackList); * if (clientMode != ClientMode.SHOPRESET & clientMode != ClientMode.SHOPCLOSE & contents.ToLower().Contains(current.Value.owner.ToLower())) * { * return string.Concat(current.Value.x, ",", foothold.getY1(), ",", foothold.getId()); * } * return null; * } * return string.Concat(current.Value.x, ",", foothold.getY1(), ",", foothold.getId()); * } * } * updateLog("[Error] Could not find your store!"); * updateLog("[Error] Is your char in the right FM room?"); * forceDisconnect(false, 0, false); * return null; * } * finally * { * ((IDisposable)enumerator).Dispose(); * } * return null; */ }