Need some Help form a Dev
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
Need some Help form a Dev
I am working on lw/ww and i was wondering how you guys fixed the architect bug. where it shows names of the scripted item name again??
i need pretty much detail because i have tryed about everything in my know how to fix it.
i need pretty much detail because i have tryed about everything in my know how to fix it.
-
Maarc
- Developer
- Posts: 576
- Joined: Sat Mar 27, 2004 6:22 am
- Location: Fleet, UK
- Has thanked: 0
- Been thanked: 0
- Contact:
Not quite sure what you mean. It, if I understand correctly, single click at issue. Notably CPISingleClick::Handle() in cPlayerAction.cpp. The code you want, I think, is his:
Basically, if it has a script given name (not '#'), then use it instead of looking it up.
Let me know if that doesn't cover it. If not, if you can describe better I'll help as best as I can.
Code: Select all
if( i->GetName()[0] != '#' )
{
if( i->GetID() == 0x0ED5 )//guildstone
realname = UString::sprintf( Dictionary->GetEntry( 101, tSock->Language() ).c_str(), i->GetName().c_str() );
if( !i->isPileable() || getAmount == 1 )
{
if( mChar->IsGM() && !i->isCorpse() && getAmount > 1 )
realname = UString::sprintf( "%s (%u)", i->GetName().c_str(), getAmount );
else
realname = i->GetName();
}
else
realname = UString::sprintf( "%u %ss", getAmount, i->GetName().c_str() );
}
else
{
getTileName( (*i), realname );
if( i->GetAmount() > 1 )
realname = UString::number( getAmount ) + " " + realname;
}
Let me know if that doesn't cover it. If not, if you can describe better I'll help as best as I can.
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
-
Maarc
- Developer
- Posts: 576
- Joined: Sat Mar 27, 2004 6:22 am
- Location: Fleet, UK
- Has thanked: 0
- Been thanked: 0
- Contact:
Nope, thats a different ball of wax. That is the buy window. Similar concept though. CPacketSend.cpp, CPOpenBuyWindow class. This code is what you want I think. Similar idea of '#' vs named.
Code: Select all
void CPOpenBuyWindow::AddItem( CItem *toAdd, CTownRegion *tReg, UI16 &baseOffset )
{
UI32 value = toAdd->GetBuyValue();
if( cwmWorldState->ServerData()->RankSystemStatus() )
value = calcValue( toAdd, value );
if( cwmWorldState->ServerData()->TradeSystemStatus() )
value = calcGoodValue( tReg, toAdd, value, false );
std::string itemname;
itemname.reserve( MAX_NAME );
UI08 sLen = 0;
UString temp = toAdd->GetName() ;
temp = temp.simplifyWhiteSpace();
if( temp.substr( 0, 1 ) == "#" )
{
itemname = UString::number( 1020000 + toAdd->GetID() );
sLen = static_cast<UI08>(itemname.size() + 1);
}
else
sLen = static_cast<UI08>(getTileName( (*toAdd), itemname )); // Item name length, don't strip the NULL (3D client doesn't like it)
pStream.ReserveSize( baseOffset + 5 + sLen );
pStream.WriteLong( baseOffset, value );
pStream.WriteByte( baseOffset += 4, sLen );
pStream.WriteString( baseOffset += 1, itemname, sLen );
baseOffset += sLen;
}
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
Okay here is what i came up with I'm not to much of a coder my brother does most of it but he is stumped about this code as well.
Any help fixing this bug I'm sure lw users and ww users will be so gracefull
Any help fixing this bug I'm sure lw users and ww users will be so gracefull
Code: Select all
bool sendshopinfo(int s, P_CHAR Vendor, P_ITEM pi)
{
unsigned char m1[6096];
unsigned char m2[6096];
char itemname[256];
char cFoundItems=0;
memset(m1,0,6096);
memset(m2,0,6096);
memset(itemname,0,256);
int k, m1t=0, m2t=0, value;
unsigned char slen;
m1[0]=0x3C; // Container content message
m1[1]=0;// Size of message
m1[2]=0;// Size of message
m1[3]=0;// Count of items
m1[4]=0;// Count of items
m2[0]=0x74;// Buy window details message
m2[1]=0;// Size of message
m2[2]=0;// Size of message
LongToCharPtr(pi->serial,m2+3); //container serial number
m2[7]=0; // Count of items;
m1t=5;
m2t=8;
#define ARCHIBUG 0
#if ARCHIBUG
int num = pi->CountItems();
#endif
int ci=0,loopexit=0;
P_ITEM pj;
while ( ((pj=pi->Search(&ci)) != NULL) && (++loopexit <MAXLOOPS>amount>0) // don't count items with 0 amount
// (0x1a container items should never be deleted, hence they get a 0 if item out of stock
{
if (m2t>6000 || m1t>6000) break;
LongToCharPtr(pj->serial,m1+m1t+0); //Item serial number
ShortToCharPtr(pj->id(),m1+m1t+4); //ID
//m1[m1t+6]=0; // Always zero (but already 0'ed out)
ShortToCharPtr(pj->amount,m1+m1t+7); // amount
#if ARCHIBUG
ShortToCharPtr(num--,m1+m1t+9);
#else
ShortToCharPtr(m1t,m1+m1t+9);
#endif
ShortToCharPtr(m1t,m1+m1t+11);
/// note, that's actually kind of a client bug resp. oddity
/// normally, those two are for x/y of item
/// but client sorts the items in 0x3c's by x/y after 0x74 being send, not like it had been added
/// it does NOT sort 0x74. so we get a mismatch of ID+description if we add real x/y's
/// to get them synched (both lists in same order) we need to add dummy x/y's that have same order like being added
/// eg m1t, itemcount would work as well. just has to be monotonic increasing with itemcount
LongToCharPtr(pi->serial,m1+m1t+13); // container serial
ShortToCharPtr(pj->color(),m1+m1t+17); // Item color
m1[4]++; // Increase item count.
m1t += 19;
value=pj->calcBuyPrice(Vendor->region);
LongToCharPtr(value,m2+m2t+0); // item value
if (!"#")
{
slen=m2[m2t+4]=pj->getName(itemname); // Item name length
for(k=0;k<slen;k++)
{
m2[m2t+5+k]=itemname[k]; // item name
}
}
//slen = 7;
//m2[m2t+4]=slen;
//m2[m2t+5+0]='5';
//m2[m2t+5+1]='0';
//m2[m2t+5+2]='0';
//m2[m2t+5+3]='0';
//m2[m2t+5+4]='5';
//m2[m2t+5+5]='5';
//m2[m2t+5+6]=0;
//m2[m2t+5+7]=0;
m2[7]++;
m2t += slen+5;
cFoundItems=1; //we found items so send message
}
}
if (cFoundItems==1)
{
ShortToCharPtr(m1t,m1+1);
ShortToCharPtr(m2t,m2+1);
XStartPkt(0x3c, m1t);
XAddPkt(&m1[0+3], m1t-3);
XFinishPkt(s);
XStartPkt(0x74, m2t);
XAddPkt(&m2[0+3], m2t-3);
XFinishPkt(s);
return true;
}-
Maarc
- Developer
- Posts: 576
- Joined: Sat Mar 27, 2004 6:22 am
- Location: Fleet, UK
- Has thanked: 0
- Been thanked: 0
- Contact:
That if condition is a tad funky. Could be the board though. Not sure on the behaviour of getName either. But I'd see it more likedragon slayer wrote:Okay here is what i came up with I'm not to much of a coder my brother does most of it but he is stumped about this code as well.
Any help fixing this bug I'm sure lw users and ww users will be so gracefull
<snip>
Code: Select all
if (!"#") { slen=m2[m2t+4]=pj->getName(itemname); // Item name length for(k=0;k<slen;k++) { m2[m2t+5+k]=itemname[k]; // item name } }
Code: Select all
slen = pj->getName(itemname);
if( itemname != '#' )
{
m2[m2t+4] = slen; // Item name length
for(k=0;k<slen;k++)
{
m2[m2t+5+k]=itemname[k]; // item name
}
}
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
Okay i tryed that but had to [0] for first letter but still
well this didnt change the effect of the name still see deed.
I'm just so stumped on this
Code: Select all
if( itemname[0]!= '#' )
{
m2[m2t+4] = slen; // Item name length
for(k=0;k<slen;k++)
{
m2[m2t+5+k]=itemname[k]; // item name
}
}I'm just so stumped on this
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
Think I found the problem.
The OpenBuyWindow (0x74) packet also uses the ItemsInContainer (0x3C) packet. However along with each item sent for the ItesmInContainer packet we also send 0xD6, which is the ToolTip packet introduced in AOS. You can find the full detail of how we implemented that packet around line 4615 of CPacketSend.cpp, but what is most important for the vendor buy window is the chunk around 4803 inside the block if( playerVendor )
Once you include that packet it should correctly display the custom names in the buy window again.
The OpenBuyWindow (0x74) packet also uses the ItemsInContainer (0x3C) packet. However along with each item sent for the ItesmInContainer packet we also send 0xD6, which is the ToolTip packet introduced in AOS. You can find the full detail of how we implemented that packet around line 4615 of CPacketSend.cpp, but what is most important for the vendor buy window is the chunk around 4803 inside the block if( playerVendor )
Once you include that packet it should correctly display the custom names in the buy window again.
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
-
dragon slayer
- UOX3 Guru
- Posts: 776
- Joined: Thu Dec 21, 2006 7:37 am
- Has thanked: 4 times
- Been thanked: 26 times
I may not use uox as my emu but I do think all the work you have done here is very great and its agreat community. Even Fraz would tell you about how good uox has been to him.
Thinking about fraz and me was talking about uox the other night how it was are first emu. Oh i remember boats still beable to move across land the great days. I remember users asking and begging for a fix for that LOL because boats being parked at britain bank. LOL I remember when fix was added how many thank you. You all got.
I remember Xuri shard for uox was in dev for years. was a great world map. I can't beleive its gone now tho. the great days of uo can still be alive if we all make it.
Thinking about fraz and me was talking about uox the other night how it was are first emu. Oh i remember boats still beable to move across land the great days. I remember users asking and begging for a fix for that LOL because boats being parked at britain bank. LOL I remember when fix was added how many thank you. You all got.
I remember Xuri shard for uox was in dev for years. was a great world map. I can't beleive its gone now tho. the great days of uo can still be alive if we all make it.