Code: Show/Hide 8:BOT>Mavbot> +123
8:BOT>Mavbot> +138 8:BOT>Mavbot> +142 8:BOT>Mavbot> +150 |
Code: Show/Hide BOT>Mavbot Object number 123 enabled
BOT>Mavbot Object number 19917 disabled BOT>Mavbot Object number 138 enabled BOT>Mavbot Object number 19917 disabled |
Code: Show/Hide queue_enable(id);
toggle_objects(); |
Code: Show/Hide objectInfo oi;
oi.id = objid; oi.disabled = 0; tell(makeToggleObjects(UNASSIGNED,(Uint16 *)&oi,1)); |
Code: Show/Hide void botInfo::updateLVZ(String jackpot) { //First turn off old lvz String oldjp = String(jp),tmp; int len = 8-oldjp.len; int i =0; if(jp>0) { for(i=0;i<oldjp.len;i++) { //sendPublic("*objoff 1"+String(i+1+len)+String(oldjp[i]-48)); tmp = "1"+String(i+1+len)+String(oldjp[i]-48); queue_disable(atoi(tmp)); sendChannel("-1"+String(i+1+len)+String(oldjp[i]-48)); } } //Then turn on new lvz len = 8-jackpot.len; for(i=0;i<jackpot.len;i++) { //sendPublic("*objon 1"+String(i+1+len)+String(jackpot[i]-48)); tmp = "1"+String(i+1+len)+String(jackpot[i]-48); queue_enable(atoi(tmp)); sendChannel("+1"+String(i+1+len)+String(jackpot[i]-48)); } //Apply the lvz changes toggle_objects(); } |
Code: Show/Hide updateLVZ("3820"); |
Code: Show/Hide clientMessage *generateObjectToggle (Uint16 player, objectInfo *objects, Uint16 num_objects)
{ clientMessage *ret = new clientMessage(4 + 2 * num_objects); if (ret == NULL) return NULL; char *msg = ret->msg; /* Field Length Description 0 1 Type byte: 0x0a 1 2 Player ident (-1 = all players) 3 1 LVZ type byte: 0x35 The following are repeated until the end of the message 4 2 LVZ bitfield */ msg[0] = 0x0a; *(Uint16*)&msg[1] = player; msg[3] = 0x35; memcpy(msg + 4, objects, 2 * num_objects); return ret; } |
Code: Show/Hide void botInfo::toggle_objects()
{ Player *p = object_dest; if (!p) tell(makeToggleObjects(UNASSIGNED, (Uint16 *)object_array, num_objects)); else tell(makeToggleObjects(p->ident, (Uint16 *)object_array, num_objects)); num_objects = 0; } void botInfo::queue_enable(int id) { if (num_objects == MAX_OBJECTS) toggle_objects(); object_array[num_objects].id = id; object_array[num_objects].disabled = false; ++num_objects; } |
Code: Show/Hide union objectInfo { struct { Uint16 id : 15; // Object ident Uint16 disabled : 1; // 1=off, 0=on }; Uint16 n; }; #define MAX_OBJECTS 20 |