|
@ -270,7 +270,6 @@ where |
|
|
{
|
|
|
{
|
|
|
Ok(trades
|
|
|
Ok(trades
|
|
|
.with(&id, |this, other| -> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, anyhow::Error> {
|
|
|
.with(&id, |this, other| -> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, anyhow::Error> {
|
|
|
println!("statuses {:?} {:?}", this.status, other.status);
|
|
|
|
|
|
if status_is_not(&this.status, &[TradeStatus::FinalConfirm]) || status_is_not(&other.status, &[TradeStatus::FinalConfirm, TradeStatus::ItemsChecked]) {
|
|
|
if status_is_not(&this.status, &[TradeStatus::FinalConfirm]) || status_is_not(&other.status, &[TradeStatus::FinalConfirm, TradeStatus::ItemsChecked]) {
|
|
|
//if this.status != TradeStatus::FinalConfirm || (other.status != TradeStatus::FinalConfirm || other.status != TradeStatus::ItemsChecked) {
|
|
|
//if this.status != TradeStatus::FinalConfirm || (other.status != TradeStatus::FinalConfirm || other.status != TradeStatus::ItemsChecked) {
|
|
|
return Err(TradeError::MismatchedStatus.into())
|
|
|
return Err(TradeError::MismatchedStatus.into())
|
|
@ -292,7 +291,6 @@ where |
|
|
.unwrap();
|
|
|
.unwrap();
|
|
|
match real_item {
|
|
|
match real_item {
|
|
|
InventoryItem::Individual(individual_inventory_item) => {
|
|
|
InventoryItem::Individual(individual_inventory_item) => {
|
|
|
println!("real indiv item: {:?} {:?} ==? {:?}", real_item, real_item.as_client_bytes(), trade_item_bytes);
|
|
|
|
|
|
if real_item.as_client_bytes() == trade_item_bytes {
|
|
|
if real_item.as_client_bytes() == trade_item_bytes {
|
|
|
Ok(TradeItem::Individual(individual_inventory_item.item_id))
|
|
|
Ok(TradeItem::Individual(individual_inventory_item.item_id))
|
|
|
}
|
|
|
}
|
|
@ -301,7 +299,6 @@ where |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
InventoryItem::Stacked(stacked_inventory_item) => {
|
|
|
InventoryItem::Stacked(stacked_inventory_item) => {
|
|
|
println!("real stack item: {:?} {:?} ==? {:?}", real_item, real_item.as_client_bytes(), trade_item_bytes);
|
|
|
|
|
|
if real_item.as_client_bytes()[0..4] == trade_item_bytes[0..4] {
|
|
|
if real_item.as_client_bytes()[0..4] == trade_item_bytes[0..4] {
|
|
|
let amount = trade_item_bytes[5] as usize;
|
|
|
let amount = trade_item_bytes[5] as usize;
|
|
|
if amount <= stacked_inventory_item.entity_ids.len() {
|
|
|
if amount <= stacked_inventory_item.entity_ids.len() {
|
|
@ -323,7 +320,6 @@ where |
|
|
Ok(Box::new(std::iter::once((other.client(), SendShipPacket::AcknowledgeTrade(AcknowledgeTrade {})))))
|
|
|
Ok(Box::new(std::iter::once((other.client(), SendShipPacket::AcknowledgeTrade(AcknowledgeTrade {})))))
|
|
|
})?
|
|
|
})?
|
|
|
.unwrap_or_else(|err| {
|
|
|
.unwrap_or_else(|err| {
|
|
|
println!("asdf {:?}", err);
|
|
|
|
|
|
log::warn!("trade error: {:?}", err);
|
|
|
log::warn!("trade error: {:?}", err);
|
|
|
let (this, other) = trades.remove_trade(&id);
|
|
|
let (this, other) = trades.remove_trade(&id);
|
|
|
Box::new(client_location.get_all_clients_by_client(id).unwrap().into_iter()
|
|
|
Box::new(client_location.get_all_clients_by_client(id).unwrap().into_iter()
|
|
@ -351,7 +347,6 @@ where |
|
|
Ok(p) => Ok(p),
|
|
|
Ok(p) => Ok(p),
|
|
|
Err(err) => {
|
|
|
Err(err) => {
|
|
|
log::warn!("atrade error: {:?}", err);
|
|
|
log::warn!("atrade error: {:?}", err);
|
|
|
println!("qwer");
|
|
|
|
|
|
let (this, other) = trades.remove_trade(&id);
|
|
|
let (this, other) = trades.remove_trade(&id);
|
|
|
Ok(Box::new(client_location.get_all_clients_by_client(id)?.into_iter()
|
|
|
Ok(Box::new(client_location.get_all_clients_by_client(id)?.into_iter()
|
|
|
.filter(move |client| other.as_ref().map(|other| client.client == other.client()).unwrap_or_else(|| false))
|
|
|
.filter(move |client| other.as_ref().map(|other| client.client == other.client()).unwrap_or_else(|| false))
|
|
|